Thinkpad Retrofit: Keyboard Part 3 - Choosing a Controller

In the last couple of days I've talked to several friends well versed in both electronics and computers (Thanks to Scott, Chris, and Paul). We're all assuming that the 30 lines of the two ribbon cables shown here are the two sets of lines for the keyboard matrix. Scott suggested I should start by figuring out which rows and columns represented which keys with a continuity tester. I asked why bother when you could do it programmatically with the micro-controller you're going to end up using to control it anyway? He pointed out that if your tester is buggy, or the keyboard is bad, or any of a dozen other things go wrong ... you won't know where the error originates. So use the continuity tester and make sure the keyboard is good as a first step. Tomorrow I'll start by de-soldering the ribbon cable connectors from the original motherboard: they'll be easier to use for connecting the tester than the ends of the ribbon cables.

The next question is, what micro-controller and board should I use? The most obvious choice is the Arduino Teensy 2.0 (with the well known ATmega32u4 processor), which has been used in multiple keyboard projects (most notably the Ergodox). But ... the Teensy doesn't have anything like 30 I/O pins. Scott said this was easily solved with an I/O expander for a couple dollars, that would speak I2C or something back to the Teensy. I asked why bother using the Teensy/ATmega then? Because USB is a complex bitch of a protocol to implement - so let the Teensy do it. Paul's suggestion was to go for a board with more I/O pins in the first place: the well known and most-recommended-for-beginners Arduino Uno doesn't qualify (only 14 digital I/O pins), but the Arduino Mega (with 54 I/O pins) seems quite workable. The version of the Teensy++ 2.0 that Sparkfun sells has 46(!) I/O pins, but a chip that's an unknown quantity, the AT90USB1286. And here we run into another problem: Arduino boards may not all be able to act as USB HID devices. It appears that the official ones can with a firmware upgrade (and that source is so old that probably any new boards are already capable) ... but this source specifically says "The core libraries allow a 32u4 based boards or Due or Zero board to appear as a native Mouse and/or Keyboard to a connected computer." This would seem to specifically exclude the Mega and Teensy++. <sigh>

I'm also going to make sure that anything for this project runs on 5 volts, not 3.3 volts (such as the Arduino Zero) as 5 volts is what's provided by standard USB chargers and what's needed by the Raspberry Pi.

On the plus side it would appear that if I'm walking this road, supporting the keyboard's built-in trackpoint should only require a bit more code to interpret the six lines of I/O from that device.

Bibliography