Sunday, March 26, 2017

Gas Guzzling Gherkin

Gherkin with aluminum plate base

Found a piece of aluminum plate just the right size for the Gherkin on eBay. First project with my Vanda-Lay drill press. Drilled the holes with a 5/64" bit. Just the right size for 2mm screws (1.984mm). Drilled out the bottom of the holes to 1/8" to hide the screw heads. The hex head nylon screws I had were slightly larger than 1/8" so I pounded them in with a mallet. They are very snug.

The aluminum pieces I bought were saw cut, they had very precise square edges. Sanded the edges and surface down with 220grit and then a scotchbrite pad to give a nice even finish.

Total weight with keycaps is 365grams.

Friday, March 24, 2017

Low effort Gherkin firmware

Using to create firmware for a Gherkin

Download the json file (click Raw and then save as file). Go to and upload the json file. The Wiring and Pins tabs are filled in and complete. You will need to complete the Keymap tab and anything else you want to edit.

I was going to create the same keymap as I have in TMK, but the clicking got tedious. Not my way of programming. This will however be useful for anyone who can't create a working dev environment to natively compile the TMK firmware.

Thursday, March 23, 2017

Gherkin in the wild

First real Gherkin I've seen

The Gherkin Pi by /u/willbill642.

I have seen a few boards built with the Gherkin PCBs, this is the first one that did something really different.

With this I consider releasing the gerber files as opensource a success. The PCB's are simple and cheap enough to try out new ideas.

I am looking forward to seeing what else the PCBs are made into. The cost to have your own PCBs made are relative low ($16 per set of plates shipped to just about anywhere) and you can sell the ones you don't use.

Thursday, March 16, 2017

Analog matrix keyboard

Keyboard using voltage dividers and analog inputs

This is a custom keyboard PCB that uses 12 analog channels on a Teensy LC. 4 switches are attached to each channel. Each switch when pressed connects to ground through a resistor. Each of the 4 switches has a different value resistor. Through parallel resistance the voltage divider produces a different voltage for each of the 16 possible combinations of the 4 keys being pressed. This voltage is sampled by the Teensy LC input pin and converted to a decimal value. These values are compared to an array and translated into keypresses.

The schematic shows the 12 channels and the resistors in the parallel resistor/voltage dividers. A Pro Micro was used to control the LEDs in the same way that the GNAP does.

An Arduino sketch was used to sample the analog inputs and output to serial monitor. The data was compiled and the values corresponding to the 16 different switch combinations identified. In the chart you can see the distribution of the 16 values. As more keys are pressed there is less separation of the values.

These are the 16 different analogread ranges for each of the 16 switch combinations. Resistor values must be selected so that the ranges never overlap.

The resistor values used were 1k, 2k, 3.9k, 8.1k. The pullup resistor is also 3.9k. Mathematically they should produce distinct voltages when combined in parallel in any combination in a voltage divider.

The matrix works, and my prototype can detect all 48 switches being pressed in any pattern. Currently there is no keyboard code, it is just a large board of switches that light up the corresponding LED when pressed.

There is a problem in that resistors are temperature sensitive, their resistance changes with temperature. The ones I used are metal film 1% tolerance with a 50ppm/C temperature coefficient. These were relatively inexpensive at 5 cents a piece. The problem is that there is sufficient drift with temperature that the readings on the lower end start to drift with temperature extremes. There are better resistors, 0.1% 15ppm/C, but they cost 7 times as much. Instead of $3 of resistors it would be $21.

Other possible solutions are to use a temperature sensor, switch to a Teensy 3.2, or add a better power supply. With a temperature sensor the readings can be adjusted to compensate for thermal drift. The Teensy 3.2 has an ADC with 1 more bit of resolution, which may or may not help. A better more stable power supply may remove some of the jitter in the readings. It is currently using the 3v regulator built into the Teensy LC.

I probably won't pursue this any further. Since I can't get 100% accurate output without modifications which may not help and it is cheaper and more reliable to use a conventional matrix. This uses 12 pins at 4 switches per pin for a total of 48 switches. A conventional matrix for the same number of switches can be made of a 8x6 grid, only 2 more pins.

Some pictures of the assembled prototype:

Keycaps are the X-Keys relegendable ones. I glued them shut since the tops pop off with the slightest pressure from the side. Probably fine when used with the X-Keys boards since they have very high bezels.

A second PCB was used as the bottom.

 You can see the Teensy LC and the Pro Micro between the two PCBs.

Wednesday, March 8, 2017

Ordering a PCB

How to order a PCB from from a gerber file

  • Download the zip file with the gerber files
The zip file contains multiple files each for a different layer of the PCB front/back. Do not edit these files. They have been tested as they are.
  • Go to and click "PCB Order"
  • Create an account or login
  • Upload the Zip file
  • Edit the length and width
  • Set the quantity, 5 piece minimum per board.
  • Set the color (anything other than green cost more, it's a flat fee regardless of quantity)
  • PCB should be 1.6mm. With only soldermask (no copper/silkscreen) the PCB will be 1.52mm thick.This matters if you are making a PCB switch plate for MX style switches.
  • Leave everything else at default
  • Add to cart
  • Repeat for additional boards
  • Checkout 
  • Select airmail or express (usually DHL). Airmail is only an option for lighter orders.
  • They take PayPal or credit card
  • The video below goes through all these steps.
The price of each individual board goes down dramatically with quantity. The cost of shipping also goes up dramatically, PCB's are heavy. Play with the quantities, you may be able to get many more boards for a few dollars more.

EasyEDA ships to most countries.
For an order of 5 sets of Gherkin PCB's it is $20 to most places via airmail. A total of $75.80 shipped ($55.80 for the 5 top/bottom/main PCBs)
5 mf68 PCB's are $28.60 plus $17.40 shipping, $46 total to most places.

Order PCB from gerber files from di0ib on Vimeo.

Gerber files I have released:
Gerber files released under
You do not have to contact me for permission, the license is comprehensive. You can link back to the github page as an attribution.