In this guide, you'll see how to adapt a Commodore 16 keyboard for use on modern computers using CircuitPython and an Adafruit KB2040 microcontroller board.

The techniques in this guide may also be helpful in converting other classic keyboards that use a key matrix. The keypad.KeyMatrix class in CircuitPython makes this task actually quite simple.

The code in this guide is made for the KB2040, which was designed for exactly this kind of project! With adaptation it would work on many other CircuitPython boards, provided they support the KeyMatrix class, USB HID, and (for the advanced version) asyncio.

Homework

I received this bare keyboard with no documentation. Some internet image searches confirmed it was a Commodore 16 keyboard (the 4 arrow keys on the top row are a dead giveaway). This keyboard is much rarer than the more common Commodore 64 keyboard, which is similar but not 100% compatible.

The keyboard has 60-odd keys (including a physically locking shift key) and a 20-pin connector. Without more documentation or a plan, there are a lot of possible combinations to try.

Luckily, classic computers of this age tended to have good documentation, including schematics. A search for a Commodore 16 schematic finds the following (screenshot from archive.org):

From this, you can intuit the following pin numbers on the keyboard connector

  • Rows: 6, 16, 1, 13, 11, 12, 8, 19
  • Columns: 5, 3, 10, 9, 7, 17, 14, 15, 18
  • Unused: 5, 20
  • Optional GND: 4
  • Orientation key: 2

From the source code of the Commodore 16's kernal (sic), I found the following table giving the key that corresponds to each row and column--noting that both "shift" keys as well as "shift lock" activate the same row & column:

del   return  £       help    f1      f2      f3      @
3     w       a       4       z       s       e       shift
5     r       d       6       c       f       t       x
7     y       g       8       b       h       u       v
9     i       j       0       m       k       o       n
down  p       l       up      .       :       -       ,
left  *       ;       right   escape  =       +       /
1     home    control 2       space   c=key   q       stop

Armed with this information, you can connect your keyboard to a microcontroller. You can use individual jumper wire connections, or build an adapter cable as detailed on the next page of the guide.

Parts

Angled shot of short pink microcontroller.
A wild Kee Boar appears! It’s a shiny KB2040! An Arduino Pro Micro-shaped board for Keebs with RP2040. (#keeblife 4 evah) A lot of folks like using Adafruit...
$8.95
In Stock
Collection of many Large Single Row Wire Housing Packs
Are you frustrated by the lack of customization options for your jumper wires? Look no further!Compatible with both male and female wires, these fully customizable wire housings...
$2.95
In Stock
Angled shot of Premium Male/Female Raw Jumper Wires - 40 x 6
Our Raw Male/Female Jumper Wires are perfect for making a custom jumper wire sets for wire harnesses or jumpering between headers on PCBs. These premium jumpers are a little...
$2.95
In 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
USB C to USB C cable. USB 3.1 gen 4 with E-Mark. 1 meter long
As technology changes and adapts, so does Adafruit! Rather than the regular USB A, this cable has USB C to USB C plugs!USB C is the latest...
$9.95
In Stock

This guide was first published on Sep 14, 2022. It was last updated on 2022-09-14 11:43:42 -0400.

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

Text editor powered by tinymce.