Close
0%
0%

The Smallest Keyboard

USB keyboard approximately the size of three pennies in a line

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

Hardware:

Code:

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

BOM_Pico Keyboard_2021-02-07.csv

Bill of Materials (JLCPCB)

ms-excel - 9.91 kB - 12/16/2021 at 00:54

Download

OBJ_Pico Keyboard PCB.obj

OBJ 3D representation ('as-is' from JLCPCB; a bit buggy in Blender)

obj - 1.44 MB - 12/16/2021 at 00:54

Download

PickAndPlace_Pico Keyboard PCB_2021-02-07.csv

Pick & Place file (JLCPCB; may need repositioning though the switch placement should be pretty clear from the Gerber file)

ms-excel - 10.89 kB - 12/16/2021 at 00:53

Download

View all 6 files

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

  • 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 2 project logs

Enjoy this project?

Share

Discussions

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