Keyboard Connections
- Updated 23 September 2023
Unfortunately, not all keyboards are equal communicators. As technology has developed, protocols and connectors have continuously changed. Here is information about the most prominent protocols and connectors used at some point by IBM and family keyboards, as well some pinout diagrams and tables to help with keyboard conversion activities.
Contents
Term | Definition |
---|---|
Clock signal | Allows for synchronous communication between two devices. |
Mainboard header | An array of pins on the keyboard's controller or logic card used for socketing cables. |
SDL | Shielded data link, a type of electric connector designed by AMP resembling a flattened ethernet connector. IBM used them in 6-pin and 8-pin varieties for keyboards. |
SIO | Stands for "Serial Input/Output" |
Scancodes | Data sent from the keyboad to a connected host computer reporting any potential key presses. |
Wire colour coding key | Shows what header and plug pins the colour-coded wires inside IBM and family keyboard cables lead to. |
Code | Introduced | Description |
---|---|---|
Set 1 | August 1981 | IBM scancode set 1 (aka, "PC/XT" protocol) was the original PC scancodes introduced by the IBM Personal Computer (5150) and subsequently used for the IBM Portable Personal Computer (5155) and IBM Personal Computer XT (5160). Modern PCs are largely incompatible with interfacing directly with set 1 keyboards despite raw XT codes still technically supported by legacy BIOS and operating systems. |
Set 3 | October 1983 | IBM scancode set 3 (aka, "terminal" protocol) was introduced with the IBM 3270 PC (a PC-based IBM 3270 terminal emulator), largely remaining unique amongst IBM's terminals for the '80s and '90s. Whilst later PS/2 keyboards should be compliant with set 3, PCs then and now rarely had native support for this protocol. On the original host 3270 PCs, an add-on card and BIOS extension were needed to translate the keyboard's scancodes back into set 1 for the base PC to understand it. |
Set 2 | August 1984 (AT), April 1987 (PS/2) | The retroactively-named IBM scancode set 2 (aka, "PC/AT" protocol) was initially a subset of Set 3 introduced with the IBM Personal Computer AT (5170). A marked improvement over set 1, set 2 allows commands to be received by the keyboard, making features like lock indicators possible. Set 2 was later extended into PS/2 with the launch of its namesake family of computers - the IBM Personal System/2. As differences began to appear between IBM's terminals and PCs, set 2 and 3 eventually diverged with different scancodes for new key additions such as Windows keys during the late-'90s. |
HID | January 1996 | The Universal Serial Bus (USB) Human Interface Device (HID) class is an industry-standard specification dictating how computer peripherals such as keyboards operate, effectively ending the need for the three IBM scancode sets. All USB keyboards prescribe to HID and it has supplanted PS/2 in everything except legacy computing and scenarios that require keyboard-based interrupts instead of the host computer polling the keyboard (as what happens with USB communication). Some USB keyboards can support outputting PS/2 scancodes, however, making a simple passive adapter possible. |
Female connector pinouts
These are pinout diagrams for various IBM keyboard's connectors as they appear on either the computer-side or keyboard-side (if modular) sockets.
Host-side socket pinouts

XT with reset line 180° DIN

XT/AT 180° DIN

5155 XT modular-6P5C ("RJ-25" like)

Terminal 240° DIN

Terminal modular-8P5C ("RJ-45" like)

Terminal Model M2 modular-6P4C ("RJ-14" like)

PS/2 6-pin mini-DIN

Keyboard & mouse combo IBM keypad PS/2-like 6-pin mini-DIN

Apple Newton MessagePad X0044 8-pin mini-DIN
Device-side socket pinouts

Standard Model M SDL

RS/6000 Model M /w speaker SDL

Keyboard & mouse combo Model M3 modular-8P7C ("RJ-45" like)

Keyboard & mouse combo Model M4-1/M5-1/M5-2 SDL

4680 POS & Retail POS Model M7/M8/M9/M11 RS485 SDL

Retail POS Model M7/M8/M9/M11 PS/2 SDL (single plug cable)

Retail POS Model M7/M7-1/M8/M9/M11 USB 4x1 IDC

Pre-Modular POS Model M-e PS/2 ANPOS/CANPOS w/ Integrated Pointing Device SDL (dual plug cable)

Modular POS Model M-e USB & PS/2 6x2 IDC
Modular cable end-to-end mappings
These tables describe the pin translation between one end of a modular keyboard cable to another (in all present cases, a form of SDL to PS/2).
SDL end pin | PS/2 end pin | PS/2 end function |
---|---|---|
1 | - | N/C |
2 | 1 | DATA |
3 | 3 | GND |
4 | 5 | CLOCK |
5 | 4 | +5V |
6 | - | N/C |
6-pin SDL to dual PS/2
The Y-split PS/2 cables Model Ms that have an SDL socket and an integrated pointing device such as the Models M4-1, M5-1 and M5-2 use.
SDL end pin | PS/2 plug | PS/2 end pin | PS/2 end function |
---|---|---|---|
1 | Mouse | 5 | CLOCK (mouse) |
2 | Keyboard | 1 | DATA (keyboard) |
3 | Both | 3 | GND |
4 | Keyboard | 5 | CLOCK (keyboard) |
5 | Both | 4 | +5V |
6 | Mouse | 1 | DATA (mouse) |
8-pin SDL to PS/2
The single plug PS/2 cables such as P/N 42M599 that Models M7, M8, M9 and M11 use.
SDL end pin | PS/2 end pin | PS/2 end function |
---|---|---|
1 | 5 | CLOCK |
2 | 3 | GND |
3 | 4 | +5V |
4 | 2 | - |
5 | 6 | - |
6 | 3 | GND |
7 | 4 | +5V |
8 | 1 | DATA |
Header | Teensy 2.0 | Arduino Micro | Pro Micro |
---|---|---|---|
+5V | VCC | +5V | VCC |
GND | GND | GND | GND |
Data | D0 | D3 (SCL) | 3 |
Clock | D1 | D2 (SDA) | 2 |
5150/5155/5160 XT Model F
The IBM Personal Computer Keyboard (aka, the Model F/XT) exist in two electrical varieties - Types I and II. Type I are typically very early examples that include a reset pin, have a metal jacketed DIN plug and have a two-board internal controller. Type IIs lack a reset pin, have a plastic jacketed DIN plug and have a single controller card. Type IIs seem to be far more common than Type I. All 5155 Portable PC Keyboards are based on Type II.
Colour | Header | Plug (180-degree DIN) |
---|---|---|
Brown | +5V | 5 |
Red | GND | 4 |
White | Data | 2 |
Black | Clock | 1 |
Silver | N/A (grounding screw) | - |
Mainboard header
Orientation: position the host board as such that this header is to the left side of said board.
Header to Soarer's Controller mapping
Note that this keyboard's header pinout has three GND pins - you only need to use one of the pins and you're free to use any one of them.
Header | Teensy 2.0 | Arduino Micro | Pro Micro |
---|---|---|---|
Count 2 | B1 | SCK | 15 |
Count 4 | B2 | MOSI | 16 |
Count 8 | B3 | MISO | 14 |
Count 16 | B4 | D8 | 8 |
Count 32 | B5 | D9 | 9 |
Count 64 | B6 | D10 | 10 |
Key Down | D0 | D3 (SCL) | 3 |
GND | GND | GND | GND |
+5V | VCC | +5V | VCC |
Count 1 | B0 | RXLED | RXLED |
Strobe | D1 | D2 (SDA) | 2 |
Note
The cable header pins may be apart of a much larger array of pins. If this is the case, the missing pin indicated below can be used to recognise where to connect the cable or converter solution.
Colour | Header | Plug (PS/2) |
---|---|---|
Black | +5V | 4 |
Red | Clock | 5 |
White | GND | 3 |
Yellow | Data | 1 |
Silver | N/A (grounding screw) | - |
Mainboard header
Key: K - keyboard pin, M - mouse pin
Colour | Header | Plug (PS/2) |
---|---|---|
Yellow | 4 | 1 |
Green | 5 | 2 |
Blue | 6 | 3 |
Red | 7 | 4 |
White | 8 | 5 |
Black | 9 | 6 |
Black | 10 | PE |
- JP2: 5-pin (4 used) membrane rows
- JP3: 9-pin membrane columns
- JP4: 10-pin (9 used) magnetic stripe reader
Note: JP4 silkscreening has 0 to 1 as its range, which for the sake of readability, I've replaced with a scale of 1 to 10 respectively going forward.
Mainboard header
Orientation: use silk-screening on the PCB itself or the absent pin 17 as reference.
Note: pin 15 is shared between JP4 pin 1 and magnetic stripe reader shield (SHD).
Colour | JP4 pin |
---|---|
Black | 1 |
Brown | 2 |
Orange | 4 |
Yellow | 5 |
Green | 6 |
Blue | 7 |
Purple | 8 |
Grey | 9 |
White | 10 |