In this guide, you'll see how to convert an IBM PC keyboard for use on modern computers using Adafruit CircuitPython and an Adafruit QT Py RP2040 microcontroller board.
The software in this guide is only for original 83-key PC keyboard. There are also 101/102-key keyboards with the same connector, but they send multi-byte scancodes that aren't handled by the CircuitPython code.
The techniques in this guide may also be helpful in converting other classic keyboards that use a clocked serial protocol. The RP2040's "pio" peripheral is perfect for this kind of low level I/O task, and even provides a buffer for up to 8 key events so no keypresses get lost.
Since there are just a few pins used, the Adafruit QT Py RP2040 makes a solid choice of board for the project. However, there's no reason you couldn't adapt the code to the KB2040, Raspberry Pi Pico, or other board based on the same microcontroller.
Homework
When I saw this keyboard in a pile of stuff a friend was giving away, I recognized the classic IBM PC keyboard design with the function keys at the left hand side, and grabbed it with both hands. Good thing, too, because it weighs about 8lbs.
Being such a foundational piece of hardware, it is well documented and of course has an extensive Wikipedia article. This keyboard is commonly called the "Model F", though so is the later keyboard for the IBM PC/AT. The AT Model F has a much more conventional layout and seems to be more common, so double check which one you have.
Basics of the protocol (more detail in tmk_keyboard):
- keyboard drives clock and data lines
- unidirectional communication (keyboard to pc only)
- 2 start bits
- 8 data bits
- make/break bit (keydown/keyup)
- 1 stop bit
- keyboard reset via pin 3 to ground
Jeff's Verdict
I've always liked typing on buckling spring keyboards, and the feel and sound of this one are no exception. I'd have to work out alternatives for F11/F2 and the "Windows" modifier key to make it an everyday keyboard, though.
Pros:
- That classic buckling spring feel
- One of the heaviest keyboards I own
- Rare & expensive with fragile and unique keyswitches
- Seems to support full NKRO (limited to 6 keys + 3 modifiers by CircuitPython)
Cons:
- One of the heaviest keyboards I own
- Unusual location of some keys, especially F-keys and modifiers
- No caps lock / num lock indicators
- Rare & expensive with fragile and unique keyswitches
Text editor powered by tinymce.