Keyboard number 4: a split on my own PCB, and the 36 diodes I soldered backwards
KiCad, an RP2040, QMK, and a one-line firmware fix for a hardware mistake
Contents
After three keyboards built from kits, I wanted to design one myself. Keyboard number 4 is a 36 key split (3 rows of 5 plus 3 thumb keys per half), on my own PCB, with an RP2040. It works now. The way it works is a little bit embarrassing, so I will tell you.
The design
- Schematic and PCB in KiCad 8. Two identical reversible halves, so I only order one design
- Controller: an RP2040 board in the Pro Micro footprint, one per half
- Halves connected with a TRRS cable, serial over one data wire
- Switches: Gazzew Boba U4T (tactile, of course), hot-swap sockets
- Case: 3D printed in PETG on my very loud printer, tented about 15 degrees
- Firmware: QMK
The matrix and the diodes
A keyboard does not wire every key to its own pin. The keys sit in a grid of rows and columns, and the controller scans: drive one column, read all rows, next column, and so on. Without a diode per key you get ghosting: press three keys in an L shape and the controller also "sees" the fourth corner. So every key gets a small diode (1N4148) and the diodes must all point the same way, matching what the firmware expects. QMK calls it COL2ROW or ROW2COL.
I designed for COL2ROW. In KiCad I placed the diode footprint for the first key, rotated it, and copied it to the other 17. Rotated it the wrong way. I did not notice on the PCB render, I did not notice when I soldered 18 diodes on the left half, and then I soldered the right half the same way, because it was the same PCB. 36 diodes, all backwards.
Plug it in. Nothing. Not one key.
The fix
I was ready to desolder 36 SMD diodes. Then I thought: the firmware does not care which direction, it only needs to know. So:
// keyboards/daan36/info.json
"diode_direction": "ROW2COL",
// keyboards/daan36/config.h
#define SERIAL_USART_TX_PIN GP1
// keyboards/daan36/rules.mk
SERIAL_DRIVER = vendor
One line changed (the first one), compile, flash. Every key works. Hardware bug, fixed in firmware, like every embedded engineer has done at least once in his life. The rev 2 PCB has the footprint rotated correctly, but I did not order it yet, because rev 1 works and I am Dutch.
Other things I learned
- Do not hot-plug the TRRS cable. When you plug it in with power on, the pins slide past each other and for a moment you can short VCC to a data pin. I killed one RP2040 board this way. Unplug USB first, always
- Put the reset button somewhere you can reach. Mine is under a keycap. I have to pull a keycap with a puller every time I want to flash. Use QMK's bootloader keycode on a layer instead, much nicer
- Print the PCB outline on paper first and put your hands on it. I moved the thumb cluster 4 mm after this test and it made a big difference
- Order the cheapest PCB option. 10 boards, standard green, around 20 euro with shipping. Colour does not make it type better
I would make a photo, but the light in my attic is terrible, so here is roughly the look I was going for:
Next: keyboard number 5, with a trackball. My wife has asked how many keyboards one person needs. I said "n plus one", like with bicycles. She is also Dutch, so she understood.
Written by
Daan Visser
Embedded/FPGA engineer in Eindhoven. VHDL by day, ESP32 nonsense by night. Building keyboard number 4. Prints parts on a very loud printer.
Get the best of #mechanical-and-loud weekly
One email each Monday with the most useful posts. No spam; unsubscribe in one click.
Comments
Sign in to join the conversation.
Sign in to comment