-
*a smaller keyboard has entered the chat*
04/23/2023 at 12:04 • 0 commentsMy previous tiny keyboard was designed for direct soldering to a Raspberry Pi Pico, so what made sense at the time for ergonomics (lol) was to use the largest tactile switches that fit the given footprint. The PCB routing was relatively simple, considering the only components were the switches and the traces just had to form a matrix that lined up with the Pico's GPIO pads.
However, there are smaller switches available. I also took a few points of feedback from the DIY hardware community, among them: ditching the micro USB of the Pico in favor of USB Type-C, and adding back the right ALT modifier key, which is apparently critical for entering Polish characters.
Starting with a blank sheet design led me to a custom RP2040 circuit and a four-layer PCB stackup (to be fair the prior design was also four layers, two for the keyboard traces and two layers on the Pico board). The end result is a keyboard with a cross-section about the size of a quarter, wearing a USB Type-C port for a backpack. The PCB is reduced from the 51 x 21 mm of the prior design to 29 x 16.25 mm.
Design compromises include moving from a square ground pad for the RP2040 to a circular one to fit in additional traces under the RP2040 (which when it intersects with the solder mask paste layer, might be cropped back to a square anyway by the PCB assembler given that this layer is ostensibly what they use to cut the stencil), some very tightly placed vias occupying two input pins, and the four layer stackup itself. I wonder if it's possible to get back to a 2-layer PCB with a little bit better spacing, especially moving the RP2040 to a more central location on the board. I don't love where the right ALT key landed either, specifically it being to the right of enter -- it looked better positioned in the EDA software than in the render, but after seeing the 3D view, it is probably best rotated 90 degrees, placed just above the up arrow, and then enter can be shifted over a bit to the right. There are also a reduced number of decoupling capacitors (although an increased overall capacitence due to using much higher values), beginning to implement power integrity advice from Bogatin, et al., "The Myth of Three Capacitor Values" from Signal Integrity Journal [ free to read here: https://www.signalintegrityjournal.co... ], which boils down to: in the age of surface mount parts, for power circuits, you might as well use the largest capacitor value that is available in the component body size you have to work with (here 0204-sized components and sticking with the JLCPCB basic parts library, you might as well use the 10uF value in place of 1uF or 0.1uF/100nF -- although, considering 2-sided assembly at JLCPCB means you can't do economic PCBA, i.e. with standard PCBA 0201 parts are also on the table).
Given the two-sided assembly, cost is steep relative to the components at around $25 per PCB in small batches of 5.
The ubiquitous Pro Micro keyboard PCB or the Adafruit KB2040 [ https://www.adafruit.com/product/5302 ] could also be options for direct solder. The footprint of either, at around 1.3 inches, is just a little wider than this assembled version (but still smaller than the Pico footprint). Using one of these would reduce the assembly needed to just the keyswitch matrix, and the firmwares are already worked out, so this is probably the way to go for small stuff like wearables, so you can live out any residual calculator/PDA watch fantasies you might have.
The PCB design, BOM, and Pick and Place files are available. Pros and cons are as noted earlier. If anyone has this or something similar assembled, I'd recommend asking your PCB fabricator to have a look at the paste mask layer under the RP2040 to okay it, perhaps sprinkling a couple decoupling caps close to the RP2040 if you can, and double-checking each route as I have not built this intermediate version. Until next time...
-
Code Complete
01/05/2022 at 22:40 • 0 commentsThe code is complete! See code.py in the project attachments. There is also a video walkthrough of the code here:
-
The PCB
12/16/2021 at 01:02 • 0 commentsI received feedback on the Threadripper Laptop video that some would have liked to see a build video along the way. Well, here goes for the next project. The first component I'm nailing down is a very small keyboard, around the size of three pennies in a row.
There are BlackBerry keyboard-to-USB kits out there, though they require adapters and don't give you the full range of keys you might use with a PC.
There are small(-ish) key matrix decoder keyboards out there as well, though the tactile switches tend to be larger and spaced further apart.
What I settled on was a 59-key keyboard in the footprint of the Raspberry Pi Pico, with the microcontroller handling the key matrix decoding and USB interface.
The keyboard has a standard QWERTY layout with a full number row, symbol keys typical of a PC keyboard, Escape, CTRL, ALT, Shift, Backspace, Enter, Space, and directional arrows.
To fit it all in I found a very small tactile switch, the B3U-1000P, measuring just 3.0 x 2.5 x 1.6 mm. Making key matrix connections by hand in such a tight space would be miserable, so a PCB was the way to go. I went with JLCPCB because Easy EDA (their online PCB design tool) is, well, easy. There are top and bottom traces, as the matrix needs to crisscross.
The matrix is decoded by two nested loops: one through rows and one through columns. Each key has it's own unique row and column combination. The microcontroller loops through each possible combination and returns the value corresponding to the key pressed.
One potential downside to this approach is ambiguity when multiple keys are pressed at the same time, i.e. which key am I intending to hit and in which order. Some keyboard circuits use diodes to prevent this, but these are omitted here due to space considerations and because the ergonomics of this particular keyboard having to be carefully pressed often by fingernail, it is unlikely to run into multiple keys being pressed at the same time. Exceptions are any keys that can modify the meaning of another: CTRL, ALT, and Shift can all be read independently to see if the key being pressed is being modified in any way by these keys.
I originally named the keys according to their content, including special characters, so helpful labels would print on the PCB, but JLCPCB's systems ended up not playing nicely and left two switches out of the pick and place arrangement. I modified these names to remove the special characters that caused problems before uploading the project files.
Small batch PCB cost is around $10 per board, not awful considering there are 59 placed components and several large pads for direct soldering to a Raspberry Pi Pico (the black PCB and lead free options were nice as well). Adding the cost of a Pico and economy shipping, this can be replicated for around $20 per unit in batches of 5+ units.
Project files including the PCB and pick and place file are linked in the description.
In the second installment, we'll write the key matrix decoder.