Wednesday, January 3, 2024

IBM AT (PS/2) to XT (DIN) keyboard conversion

In my blog post here: https://davidegironi.blogspot.com/2023/12/vintage-ibm-5160-xt-pc-restoration.html I've talked about the restoration of an IBM 5160 vintage PC.

The first time I've tried to boot this PC it ends up with an error. The error was due to the missing keyboard. Investigating further It turns out that I need an XT keyboard in order to make this PC works.


IBM PC of that era uses the XT protocol to communicate with the keyboard. From the 1984 IBM starts building AT compatible keyboard. Starting from 1987 IBM also introduce another kind of connector for the AT keyabords, the PS/2 mini-DIN 6 pin connector.

There are a few differences between the XT and AT protocol, the main difference is that XT can only send data, while AT can receive and send data. Under the hood they are completely different protocol, so it's not just a matter of changing the connector wiring, one have to write some logic in order to make an XT keyboard work.

So, in order to boot my PC I need an XT keyboard, which I don't have. I have searched for an used one but I can not find it. Well I've found it later on after a few months, but at that time I don't have that keyboard, so I decided to build it.

There are a few DIY commercialized adapter, but I've an Arduino micro clone and I want to use this cheap board. I've found a PS/2 to XT code for Arduino on github (https://github.com/kesrut/pcxtkbd).


Just I have to wire it according to the DIN connector pinout, XT keyboards uses a 5 pin DIN connector with the following pinout:

  1. clock
  2. data
  3. /
  4. ground
  5. +5V
Then I've compiled and upload the Arduino firmware and I've tried it using a PS/2 keyboard as the master.
It works!

I don't like to have the adapter flying on the bench, so I've decided to pack it in an IBM 90's keyboard, the IBM KB-7953 model.


I've opened it, and wire the internal PCB to the Arduino and the Arduino to the DIN connector, using the original keyboard PS/2 wire. I've exposed a 5 pin adapter to eventually update a new firmware to the Arduino in the future.

The keyboards is now ready, compact and perfect for my vintage IBM pc.

Notes
  • read risk disclaimer
  • excuse my bad english