The IBM PC keyboard male plug happens to be physically the same as the "MIDI DIN connector", so the female connectors are easy to come by.

With Adafruit's breadboard friendly DIN-5 connector, you can just wire it up on a breadboard! For advanced users who like to solder, it's possible to create a super compact adapter instead, in the style of this guide.

On the breadboard, make the following connections, noting the odd pin numbering of the DIN-5 connector:

  • QT Py 5V to DIN-5 pin 5
  • QT Py GND to DIN-5 pin 4
  • QT Py MISO (MI) to DIN-5 pin 2 (data)
  • QT Py SCK to DIN-5 PIN 1 (clock)
  • First resistor from DIN-5 pin 2 (data) to GND
  • Second resistor from DIN-5 pin 1 (clock) to GND

Use the blue supply rail as an additional GND bus to simplify the wiring.

Numbered DIN connector image from Wikipedia, rotated to match connector as shown in circuit diagram.

A note on voltages

The keyboard is powered at +5V. Its outputs are "open collector" pins meaning that they are never driven to +5V, but are instead allowed to float up to it through a nominal 2kΩ pull-up resistor. However, the RP2040's input pins are not 5V tolerant, but are limited to about 3.8V maximum. By adding a pull-down resistor we create a voltage divider which decreases the maximum voltage seen at the RP2040's input pin. The goldilocks resistor value of 3.3kΩ would give a high voltage of approximately 3.1V at the RP2040's input pin. But nearby standard values of 2.2kΩ (2.6V) and 4.7kΩ (3.5V) are within spec too. I used 2.2kΩ resistors because I had them on hand.

This guide was first published on Nov 02, 2022. It was last updated on May 24, 2024.

This page (Wiring the Adapter) was last updated on Mar 08, 2024.

Text editor powered by tinymce.