Category menu

The smallest USB mechanical keyboard in the world*

Sometimes it’s annoying when your favourite old school mechanical keyboard lacks some of the modern function keys that we’ve grown used to using in recent years. Or you might be re-purposing a keyboard for a use it wasn’t really designed for – I have a lovely chicklet keyboard with my Raspberry Pi Motorola Lapdock hack which lacks both left and right windows keys.

You can of course usually find a way round these limitations by hitting control and frantically hammering in the number of the function key (if you can remember it) – but sometimes that doesn’t work. For example the ArcEm emulator that runs on the Raspberry Pi RISC OS requires both left and right windows keys to be pressed simultaneously to exit.

Fortunately to the rescue is this – the smallest USB mechanical keyboard in the world (probably):

Smallest USB keyboard in the world

Now I just need a portal gun

The blue Cherry MX keys are illuminated, and for 10 seconds when you first plug it in you can remap them to almost anything (including words and short phrases). I did find a couple of programmable USB keystrips that offered similar functionality, but these were a bit expensive and lacked mechanical keys. If you shop around for the parts you can build this for less than £15.

Build guide:

First you need a few parts:

  • An Adafruit USB trinket (5v) In the UK available from Pimoroni
  • 2 x MX cherry keys (try ebay – e.g. this listing)
  • 2 x keycaps (lots on Amazon)
  • 2 x 3mm LEDs (and a 50 ohm resistor)
  • A mini (the older not micro) USB cable
  • Some wire
  • A suitable box (the one I used was a little on the small size – something 6cm x 3cm x 3cm might be better)
  • Craft knife, dremel, soldering iron, multimeter with continuity tester

This project does require a bit of soldering – I opted to solder the pins onto the the trinket, and then attach the wires using female jumper cables – for a neater build you could solder the wires directly between the cherry keys and Trinket. If you’re opting for total neatness you can also solder the USB wires directly to the underside of the Trinket as there are some surface mount tabs.

A costlier but wireless alternative to the Trinket is the Adafruit Bluefruit EZ HID keyboard controller again available from Pimoroni in the UK.

Putting it together

This is based on the Adafruit USB Trinket – a very cut down minimalist Arduino clone (it runs some simple Arduino code no problem, but needs it’s own version of the programmer tool). Adafruit have a tutorial which shows how to wire up a Trinket to act as a USB HID along with a couple of code examples.

First step is to try out the Adafruit tutorial on some breadboard – if you get stuck head over to the forums where Frank can help – to get this to work on my Mac I needed to plug the USB cable into a USB 2 port directly (not via a hub) and use the experimental library. Make sure you’re using Adafruit’s version of the Adruino IDE – all the info is on the Trinket page.

Adafruit Trinket as a USB keyboard

Trinket as a USB keyboard

Plug this in and try out uploading the sketch – when you first connect the Trinket the red LED will blink for 10 seconds – you have to hit the upload button on the Arduino IDE app in this time for it to work. Once the red LED has stopped blinking, your computer should recognise the keyboard.

We’re using exactly the same circuit, with the exception of adding 2 LEDs in series. The trinket has a 5v pin which supplies just about the right amount of power for the LEDs I used but check with an LED circuit calculator to see if you need to add a resistor. The Cherry switches have 2 small holes for the LED wires to sit in.

Next we need to prepare the keys and a box for them to sit in – here for some Dremel action!

Photo of USB keyboard before assembly

all the bits, prior to wiring

The Cherry keys are wedge shaped so cut a hole slightly too small and then widen using the Dremel – they are about 12mm square. I did find this a little messy and resorted to using a glue gun to tidy things up! for a neater build you could try a hot knife cutter, or for the über neat build 3d print a proper case. Fortunately once the keys are in place you don’t really see the holes.

Once the keys are fitted, solder on some wires. Note that the pins from the cherry keys are quite brittle (they’re designed to sit in a printed circuit board) so avoid bending them if possible.

The wiring arrangement I used was this:

Cherry keyboard wiring

Cherry keys viewed from the underside

Make sure the LEDs are wired in series (+ to – to + to -) – you can identify the positive (anode) lead on the LED as it’s the longer one. The LED and key circuit can all share the same ground connector. It doesn’t matter which way round you add the resistor.

Once you’ve got everything soldered together, plug it in and test – especially before putting the box together. I found cramming it all into the case a bit tricky but managed it just. I cut up a USB mini cable and re-soldered the wires to fit in the box. As I mentioned previously – soldering the wires directly to the Trinket would save a lot of space.

USB keyboard internal wiring

here it is, tight fit.

Finally enjoy your mechanical keyboard! – although this has only 2 keys, the action on the Cherry MX blues is so nice I’m now thinking I might need to invest in a proper full size one.

*probably – I’m not expecting a call from Guinness just yet.

Update – I’ve potentially been outdone with the single key keyboard which has been launched on Kickstarter.

, , ,

11 Responses to The smallest USB mechanical keyboard in the world*

  1. sarah February 10, 2014 at 10:31 pm #

    the happy hacking keyboard doesn’t have mx blues, btw, and different switches feel fairly different

    • Drew Baumann February 23, 2014 at 6:05 pm #

      Well yes. Do you know of a seller of topre switches and key caps?

      • admin February 24, 2014 at 11:30 am #

        lots of mechanical switches available on ebay / amazon – torpe switches are integrated into the printed circuit board of the keyboard so not usually available separately.

  2. Drew Baumann February 11, 2014 at 8:50 am #

    Have you found the code to fire a key press multiple times per click?

    • admin February 27, 2014 at 11:08 am #

      The code as is records multiple key fires – I was looking at hacking it a bit to stop it doing that, but as it stands it works as a quick fire button!

  3. jdcarpe February 18, 2014 at 3:10 pm #

    Nice job! We have a similar project over at Geekhack, the keyboard enthusiast forum.

    http://geekhack.org/index.php?topic=53234.0

  4. OMQ12 April 4, 2014 at 12:05 am #

    Noob @ keyboards here. So I know that you can probably modify the output of the letter like when you press a switch, But how do you change it and also what are the default keys.

    • admin April 4, 2014 at 9:28 am #

      you can change it by editing the code running on the trinket – the keys can work any letter or even a phrase

      • OMQ12 April 4, 2014 at 11:59 pm #

        Even Noobier question. Is there anyway specific you have to edit it. What exactly do you do? or can you just link me a video? Thanks in advance.

  5. jazzpirate May 3, 2014 at 5:36 am #

    Ohhhh man, would you ever consider selling these? I’d be SO down to buy this.

  6. Rin October 1, 2015 at 3:17 pm #

    can i use arduino nano? because i cant get the controller TT

Leave a Reply