Categories
goatee-stroking musing, or something

Teensy USB Keypad

in which I finally learn about Fritzing’s wire alignment facility …

I’ve had a couple of Teensy boards for a while, but a misunderstanding that they needed a load of of extra software installed (they need one thing, and it’s easy) had kept me away. They’ve got really impressive specs, and they’re especially easy to turn into USB devices like keyboards.

Super-heavy CEECO keypad

Here’s a little demo that turns a phone keypad — in my case, a ridiculously solid CEECO solid metal keypad designed for institutional use — into a simple USB keyboard. Plug it into any machine (including a Raspberry Pi) and it will be identified as a keyboard. No drivers are required.

The code is based on the standard Arduino Keypad library basic demo. That code was meant for a different keypad, so I eventually found a configuration that worked in the Sparkfun 12 button keypad datasheet. Rather than printing characters to the serial port, I used calls to Teensy’s USB Keyboard library instead.

The pinout is (from left to right, key side up):

  1. do not connect
  2. Column 2
  3. Row 1
  4. Column 1
  5. Row 4
  6. Column 3
  7. Row 3
  8. Row 2
  9. n/c

There’s no reason why this wouldn’t work with those very cheap 4×4 button matrix keypads for Arduino too with only minor modifications. Those keypads use 8 data lines, and they’re arranged (I think) as rows 1-4 on pins 1-4 and columns 1-4 are pins 5-8. columns 4-1 then rows 1-4 from the top of the pin connector down:

The Teensy USB keyboard isn’t limited to sending single characters: a single button press could trigger sending a whole string. I haven’t yet thought out any major uses for this (except “Crypto!”, which is my usual idea when I have no idea what I’m doing), but you might have better plans.

Update, 2020-04: These keypads don’t have diodes on every key to prevent key ghosting if you press multiple keys. Despite what the Arduino Playground Keypad section might tell you, you can’t do useful multi-key/rollover detection with them.

2 replies on “Teensy USB Keypad”

Hi. I don’t suppose you know where you found that keypad part for Fritzing? I can’t find it in my installation so I guess it’s not part of the default selection. Thanks.

Leave a Reply

Your email address will not be published. Required fields are marked *