Tiny USB keyboard with ATMEGA 32u4 - it works!

After a USB keyboard with an ATTINY85, a try at one with ATMEGA 32u4, I’m now at revision 2/3 for the ATMEGA 32u4 single key, USB keyboard.


Same as before:

  • a simple USB keyboard with 1 key
  • reprogrammable
  • tiny
  • mechanical keyboard key
  • cheap enough to give away
  • actually works
  • debuggable

The “cheap” aspect was mostly to justify making & buying some :).

Hardware design

Since the previous design mostly worked, I tweaked to make two versions. I suspected both would work, but perhaps one would be better than the other?

Changes I tried to implement:

  • Layout - move crystal closer
  • Make replaceable parts 0603 (though longer-term I suspect I can make them smaller if they end up not being replaced: the LED resistor, the crystal caps)
  • Increase resistor value for LED
  • Find/make key layout that works for Kailh low-profile switches too
  • Add a trace & via for CLK0 / PC7 – totally forgot about this one, oops. However, rev.2 uses PC7 so it’s broken out at least.

Rev 2 - crystal on bottom:

Rev 3 - crystal on top:

Both of these worked fine without any tweaking.


I use the Caterina bootloader was pretty straight-forward. Flashing it is pretty straightforward, once you’ve gotten it to work (like everything, sorry).

I use Arduino code to do the keyboard & LED blinking, nothing fancy, but also not cleaned up yet. It’s basically just calls to the Keyboard library.


Things that went well: IT WORKS, OMG, this was so cool.

  • Layout: Works
  • Key placement: works for both Cherry & Kailh
  • Stability: I’ve had one running for a month now.

Low-profile Kailh vs standard Cherry MX keys

(Kailh low-profile vs Cherry keys, background stitching from Lizzi)

The lower profile Kailh 1350 keys are really quite nice for this. Cherry keys have more options for keycaps though. It’s nice to have options for both kinds.

A capacitive touch device?

Rev 3 uses an ADC port – this allows us to use it as a capacitive touch sensor too, without any additional hardware. I could make a smaller board that doesn’t use a mechanical switch. It works too!

There are a handful of libraries that do this for you, I used ADCTouch, which worked right away. The theory is that you can put voltage on an ADC pin and measure how long it takes to discharge through an internal resistor. Any change in capacitance (by touching it) will be measurable.

Next steps

Not sure that these will happen, let’s see.

  • Make smaller version just for touch.
  • Add some RGB lights for more flash.
  • Make a board for the bottom to reduce wobble.
  • Make something heavier for the bottom to increase stability.
  • 3D print a case.
  • Actually finish the software and put it on Github. (Goal: reprogramability through web browser using WebUSB).
  • Try QMK firmware. Seems overkill for a single key, but overkill is my middle name.
  • Replace keycap with a bottle-cap epoxied on a cap (make a “Corona-button”? hah. Makes it hard to get to the hardware though.)

What else?

Comments / questions

There's currently no commenting functionality here. If you'd like to comment, please use Twitter and @me there. Thanks!

Tweet about this - and/or - search for latest comments / top comments

Related pages