Keyboard Connections

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

Explanations (WIP)

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.

Main keyboard protocols

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

Device-side socket pinouts

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).

6-pin SDL to single PS/2

The single plug PS/2 cables most Model Ms that have an SDL socket use.

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

General

The following information may apply to many different keyboards.

Header to Soarer's Converter mapping

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.

Type I mainboard header

X
Clock
Data
GND
Reset
+5V
X
X
X
X
X
X
X
X

Type II mainboard header

X
Clock
Data
GND
X
+5V
X
X
X
X
X
X
X
X

Type II Wire colour coding key

Colour Header Plug (180-degree DIN)
Brown +5V 5
Red GND 4
White Data 2
Black Clock 1
Silver N/A (grounding screw) -

5291/5292 Model F

Mainboard header

Orientation: position the host board as such that this header is to the left side of said board.

10
Count 64
9
Count 32
8
Count 16
7
X
6
X
5
X
4
Count 8
3
Count 4
2
1
Count 2
11
Key Down
12
GND
13
+5V
14
X
15
X
16
X
17
Count 1
18
GND
19
Strobe
20
GND

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

Type II 104-key, 122-key and 5170 AT Model F & 122-key Model M

Mainboard header

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.

X
+5V
Clock
GND
Data

Lexmark or Unicomp 101/102-key fixed cable Model M

Mainboard header

+5V
Clock
GND
Data

Wire colour coding key

Note: this has only been verified with Lexmark made examples (1992-1996).

Colour Header Plug (PS/2)
Black +5V 4
Red Clock 5
White GND 3
Yellow Data 1
Silver N/A (grounding screw) -

P/N 69H8533 5535-ZPP Numeric Keypad

Mainboard header

Key: K - keyboard pin, M - mouse pin

1
X
2
X
3
X
4
1: DATA (M)
5
2: DATA (K)
6
3: GND
7
4: +5V
8
5: CLOCK (M)
9
6: CLOCK (K)
10
PE

Wire colour coding key

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

Reference photos

P/N 40N6377 4820 SurePoint Keypad

Mainboard connectors

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).

1
9 (JP3)
3
7 (JP3)
5
4 (JP3)
7
6 (JP3)
9
1 (JP3)
11
3 (JP2)
13
2 (JP2)
15
1 (JP4) & SHD
17
19
5 (JP4)
21
7 (JP4)
23
9 (JP4)
2
8 (JP3)
4
3 (JP3)
6
5 (JP3)
8
2 (JP3)
10
1 (JP3)
12
4 (JP2)
14
1 (JP2)
16
2 (JP4)
18
4 (JP4)
20
6 (JP4)
22
8 (JP4)
24
10 (JP4)

Wire colour coding key (JP4)

Colour JP4 pin
Black 1
Brown 2
Orange 4
Yellow 5
Green 6
Blue 7
Purple 8
Grey 9
White 10

Sources