Close
0%
0%

The Smallest Keyboard

v1 USB keyboard approximately the size of three pennies in a line; v2 around the size of a quarter

Similar projects worth following
I couldn't find a keyboard small enough for wearables and extremely small PCs, so I made one.

v2 'alpha'

Hardware:

Code:

PickAndPlace_Pico Keyboard PCB v2_2023-04-16.csv

v2 'alpha' pick and place

Comma-Separated Values - 21.38 kB - 04/23/2023 at 09:27

Download

BOM_Pico Keyboard PCB v2_2023-04-16.csv

v2 'alpha' bill of materials

Comma-Separated Values - 3.12 kB - 04/23/2023 at 09:27

Download

Gerber_Pico Keyboard PCB v2.zip

v2 'alpha' Gerber RP2040 circuit/4 layer

x-zip-compressed - 74.63 kB - 04/23/2023 at 09:27

Download

PCB_Pico Keyboard PCB_2022-01-13.json

Importable .json file for EasyEDA (File --> Open --> EasyEDA)

JavaScript Object Notation (JSON) - 497.13 kB - 01/13/2022 at 15:26

Download

code.py

CircuitPython / Pi Pico 'firmware' for the keyboard

py - 5.64 kB - 01/04/2022 at 22:24

Download

View all 9 files

  • 59 × B3U-1000P Microswitch
  • 1 × PCB (files attached)
  • 1 × Raspberry Pi Pico Microcontroller

  • *a smaller keyboard has entered the chat*

    TEC.IST04/23/2023 at 12:04 0 comments

    My 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

    TEC.IST01/05/2022 at 22:40 0 comments

    The code is complete!  See code.py in the project attachments.  There is also a video walkthrough of the code here: 

  • The PCB

    TEC.IST12/16/2021 at 01:02 0 comments

    I 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.

View all 3 project logs

Enjoy this project?

Share

Discussions

Colpr wrote 11/10/2023 at 12:58 point

I have small little hands but even for me this is too small. The good thing about small hands is their nice when soldering components.

  Are you sure? yes | no

Igor wrote 06/29/2022 at 21:34 point

Hi! Is it possible to use and edit your schematic and pcb  in public projects?

  Are you sure? yes | no

TEC.IST wrote 03/24/2023 at 16:14 point

Sorry, just seeing this now.  Yes, go for it.  This schematic, pcb, and supporting code  (the part I wrote, Circuit Python is from Adafruit) are in the public domain.

It would be great if you post a link to your project here, because whatever makes it different will make it a better fit to some use cases (and I'm curious how and where projects are eventually used!).

  Are you sure? yes | no

nrwest wrote 06/24/2022 at 02:12 point

Are you thinking of selling these? I'd buy one!

  Are you sure? yes | no

TEC.IST wrote 03/24/2023 at 15:52 point

Sorry, just seeing this now.  I have a couple extra due to PCB assembler minimums and can just mail you one.  Drop me a message here (hackady.io direct message).

  Are you sure? yes | no

Colpr wrote 12/28/2023 at 02:17 point

Would you let someone sell this keyboard?

  Are you sure? yes | no

asutrem wrote 01/12/2022 at 18:26 point

hi! is it possible for you to share the easyeda project? i would like to edit the silkscreen as the letters are covered by switch outlines. thank you!

  Are you sure? yes | no

TEC.IST wrote 01/13/2022 at 15:35 point

Yes, I attached the EasyEDA-native .json to the project page under 'Files' or directly download here: https://cdn.hackaday.io/files/1782047624279936/PCB_Pico%20Keyboard%20PCB_2022-01-13.json

  Are you sure? yes | no

tommy-hackaday.io wrote 01/12/2022 at 03:57 point

I’m a sucker for tiny full featured keyboards (have a lot of them) - I’d pay money for a battery power bluetooth version.

  Are you sure? yes | no

TEC.IST wrote 01/13/2022 at 15:39 point

I've seen some interesting microcontrollers with wireless options -- picking a battery, attachment method, etc. that wouldn't make it dramatically thicker could be tricky

  Are you sure? yes | no

tommy-hackaday.io wrote 01/13/2022 at 19:12 point

nf52840 and circuit python is one easy solution but batteries will add mass and volume.

  Are you sure? yes | no

esiako wrote 01/11/2022 at 18:03 point

please Add right alt for Polish language

  Are you sure? yes | no

TEC.IST wrote 01/13/2022 at 15:41 point

I don't think I'll be revisiting this version.  Here is the EasyEDA file: https://cdn.hackaday.io/files/1782047624279936/PCB_Pico%20Keyboard%20PCB_2022-01-13.json

See the code for the null row/column combinations and you could potentially work in a right alt key onto one of those spots.

  Are you sure? yes | no

bastetfurry wrote 12/18/2021 at 15:20 point

Somehow ordering with JLCPCB is broken with your board, the PCB itself gave a warning that it could be broken when manufactured and trying to add the BOM and Pick&Place file resulted in a bill of over 150€ and a preview that has the parts way over the edge of the board.
If i could add images i would, i hope links are OK on this site:
https://lionscade.de/zeugs/Screenshot_2021-12-18%20PCB%20Prototype%20PCB%20Fabrication%20Manufacturer%20-%20JLCPCB.png

  Are you sure? yes | no

TEC.IST wrote 12/19/2021 at 02:17 point

Hmm, I'll investigate.  Theoretically the Gerber should work at other PCB manufacturers if they can source switches with the same footprint.

  Are you sure? yes | no

TEC.IST wrote 01/13/2022 at 15:30 point

I have exported the EasyEDA-native .json format and verified that it imports correctly.  Find it attached to the project page under 'Files' or directly download here: https://cdn.hackaday.io/files/1782047624279936/PCB_Pico%20Keyboard%20PCB_2022-01-13.json

  Are you sure? yes | no

Shon wrote 01/15/2022 at 00:18 point

Amazing work @TEC.IST thank you for sharing!

@bastetfurry JLCPCB defaults to 5 pieces, which is why the quote is ~$150 I think. The main cost seems to be the switches which cost about $.50 ea.

Gerber file works well. There's something going on with the BOM/P&P CSVs. In my build there are 7 unused switches, it only detects 52 switches per board, not 59. Looking at the CSV there are some weird characters in there still. I'll monkey around with it and report progress if I make any.

I also had a preview with the parts skewed and off center / too big for the board, but the web app says they're engineers will correct that if the preview looks wrong.

  Are you sure? yes | no

Flore Alynne Verschelde wrote 11/09/2021 at 19:38 point

Any reason for the choice of micro usb instead of usb-c ?

  Are you sure? yes | no

TEC.IST wrote 12/16/2021 at 01:04 point

That's on the Raspberry Pi Pico.  I agree that it is a curious choice, given the Pico being released after USB-C became the norm.

  Are you sure? yes | no

TEC.IST wrote 01/13/2022 at 15:32 point

Seeed Studio has some 2040-based boards with USB-C (generally smaller than the Pico, so they wouldn't match the footprint here, but may be useful for other/future projects)

  Are you sure? yes | no

TheStumbler wrote 04/06/2021 at 20:31 point

This is an eerie coincidence. Just before bedtime last night, I watched a video ( https://www.youtube.com/watch?v=lfp8Kwm5zTA&t=545s ) on Clint Basinger's LGR Blerbs YouTube side-channel about a miniature reproduction of the NEC PC-8001 ( Pasocom mini: https://www.pcmini.jp). This is a quite detailed miniature of the original 1979 computer powered by a Raspberry Pi Zero under the hood. Clint noted in passing that the keyboard isn't functional, and I thought to myself, why not? It isn't a cheap trinket, this thing costs about $300, he said. Also, I thought, a real keyboard can be pricey, but it should be pretty cheap to make a novelty keyboard out of low-cost SMT microswitches, or "tacts" as my South Korean engineer friends call them. Lo and behold, I woke up this morning to see this project. Great work, Excursion Gear. I wonder what applications could come from this project? I'm reminded of a mentor who had a Casio(?) wristwatch with a tiny keyboard and a calculator mode. Could one use this keyboard to make a text-messaging wrist watch? You'd need to carry a toothpick around to enter your text, but still that would be cool.

  Are you sure? yes | no

Paul McClay wrote 04/08/2021 at 03:47 point

Some of those button-rich calc watches had a pointy key pick stashed in the clasp. Concave button tops captured the pick point. So - people have spent money on this before.

  Are you sure? yes | no

TEC.IST wrote 12/16/2021 at 01:27 point

Interesting, I hadn't seen the ones with concave buttons.  Makes sense and a stylus-type operation might be more ergonomic.  The form factor of this keyboard is such that you can use a fingernail to press the button, without accidental keypresses.

  Are you sure? yes | no

TEC.IST wrote 12/16/2021 at 01:23 point

Thanks, big fan of LGR, so I know the Pi case you mean.  The form factor looks doable (eyeballing the keyboard size vs the Pi Zero).  If it has to look good as well, any kind of keycap or printing would have to be really precision work.  The applications I have thought of so far are pocket terminals/remote work on things that don't need a keyboard often (e.g. servers), smartwatches, and as a HID attack vector.

  Are you sure? yes | no

kingo wrote 03/17/2021 at 10:29 point

I really want a blackberry keyboard, only that tiny bb keyboard, not the phone ...

  Are you sure? yes | no

TEC.IST wrote 12/16/2021 at 01:31 point

This exists, although it is a bit bulkier.  See the T-Watch adaptation of a Blackberry keyboard to USB here: https://www.ebay.com/itm/265446952158?var=565265651025&hash=item3dcddf0cde%3Ag%3AYo4AAOSw7MVhtCVg&amdata=enc%3AAQAGAAAAkFXOrYjroxciddSFshhfXGjxz0jiHmth8WkigCpwg9PVqIMKrRaltQzJ4u%2BK48IelAX7mkZNQ9On5Z3Q%2BfHTEsb3kA6pWvf13q2jfWIP5ZM4fBDEZrqAHWfc4TN7EhwKiRVtbd56W5xBNzxzvoC%2FPTYozDKPJcQEKMsXmsr44XWLqSanOPyyZ5zgMt%2BjVGjJ3g%3D%3D%7Ctkp%3ABFBMlJbhjbhf&mkcid=1&mkrid=711-53200-19255-0&siteid=0&campid=5338666937&customid=&toolid=10001&mkevt=1 [affiliate link]

  Are you sure? yes | no

Mike Szczys wrote 03/15/2021 at 16:47 point

That looks an awful lot like the Raspberry Pi Pico board. NIce job fitting the footprint and using the castellated edges. Do you have any updates on the progress of this one?

One trick I learned from @Voja Antonic is that angling the buttons might help back them in and looks really great. Not sure you need that here but it popped to mind: https://hackaday.io/project/80627-badge-for-hackaday-conference-2018-in-belgrade

  Are you sure? yes | no

TEC.IST wrote 12/16/2021 at 01:34 point

Someone was kind enough to have shared the Pico footprint on EasyEDA.  I just put together some build notes.  I still need to write the MicroPython matrix decoder.  I hadn't seen that trick with the buttons.. it looks like it buys more room for a legend, especially if you're using square switches.  I'll have to tinker with some layouts...

  Are you sure? yes | no

marazm wrote 03/14/2021 at 10:31 point

i prefer planck(chocolate) layout

  Are you sure? yes | no

TEC.IST wrote 12/16/2021 at 01:35 point

I thought about a grid layout (which you can decode however you like), but, alas, I'm just too used to QWERTY and where the keys are in that layout.

  Are you sure? yes | no

teraz wrote 01/14/2022 at 11:01 point

planck is querty too

  Are you sure? yes | no

TEC.IST wrote 01/14/2022 at 17:06 point

I was sort of lumping all the conventions of standard PC layout into "QWERTY" -- staggered alignment, esc/ctrl/alt/arrows/etc. being in the standard positions, having a number row.

  Are you sure? yes | no

esiako wrote 01/17/2022 at 12:58 point

https://ergodox-ez.com/pages/planck planck chocolate have keys up keys

  Are you sure? yes | no

MaudeKelleyuvw wrote 12/16/2021 at 02:51 point

Yes

  Are you sure? yes | no

Dan Maloney wrote 03/12/2021 at 19:39 point

That's quite a feat of layout. Looking forward to seeing it work.

  Are you sure? yes | no

TEC.IST wrote 12/16/2021 at 01:36 point

Thanks

  Are you sure? yes | no

TEC.IST wrote 01/05/2022 at 22:43 point

The code is complete, so now it's up and running.  There is a video walkthrough of the code at: https://youtu.be/V2ivH2PEoiA

  Are you sure? yes | no

Similar Projects

Does this project spark your interest?

Become a member to follow this project and never miss any updates