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

Parts

Video of hand holding a QT Py PCB in their hand. An LED glows rainbow colors.
What a cutie pie! Or is it... a QT Py? This diminutive dev board comes with one of our new favorite chip, the RP2040. It's been made famous in the new
$9.95
In Stock
Breadboard-friendly MIDI Jack
To celebrate the 30th Anniversary of the invention of MIDI we're carrying these handy 5-pin MIDI jacks. They're what you see on the back of nearly every synthesizer and drum...
$1.75
In Stock
Angled shot of half-size solderless breadboard with red and black power lines.
This is a cute, half-size breadboard with 400 tie points, good for small projects. It's 3.25" x 2.2" / 8.3cm x 5.5cm with a standard double-strip in the...
$4.95
In Stock
Angled shot of Premium Male/Male Jumper Wires - 40 x 6 (150mm)
Handy for making wire harnesses or jumpering between headers on PCB's. These premium jumper wires are 6" (150mm) long and come in a 'strip' of 40 (4 pieces of each of...
Out of Stock
USB Type A to Type C Cable - approx 1 meter / 3 ft long
As technology changes and adapts, so does Adafruit. This  USB Type A to Type C cable will help you with the transition to USB C, even if you're still...
$4.95
In Stock
Angled of shot 25 Through-Hole Resistors - 4.7K ohm 5% 1/4W.
ΩMG! You're not going to be able to resist these handy resistor packs! Well, axially, they do all of the resisting for you!This is a 25 Pack of 4.7K...
$0.75
In Stock

This guide was first published on Nov 02, 2022. It was last updated on Oct 29, 2022.

This page (Overview) was last updated on Oct 29, 2022.

Text editor powered by tinymce.