About ten years before this guide was written, Ladyada wrote a fairly early guide for the Adafruit Learning System: "USB NeXT Keyboard with an Arduino Micro." The NeXT Computer and its keyboard remain iconic, and on the tenth anniversary of that older guide—more than 2000 guides later—I couldn't resist the challenge of updating the code from Arduino to CircuitPython.
The software in this guide is only for the original NeXT keyboard with 5-pin connector; the mouse is not supported. Later NeXT keyboards that use a 4-pin connector use a different protocol.
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, making it a breeze to meet the microsecond timing requirements while still writing the bulk of the code in high-level Python.
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.
The good about the NeXT Keyboard:
- Solid design
- Nice keyswitches
- How many times can I say "iconic" in this article?
The not so good:
- Limited to 2-key rollover (+ modifier keys)
- Layout of modifier keys may frustrate some
- Missing F-keys, page up/down, etc.
The next page is Ladyada's original research about the keyboard protocol, which I followed closely while implementing the CircuitPython version. That's why it refers to Arduino. Don't worry, this really is a CircuitPython project.