×

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 co keyboards, as well some pinout diagrams and tables to help with keyboard conversion activities.

Main keyboard protocols

Code
Introduced
Description
Set 1
August 1981
The Set 1 (PC/XT) protocol was the original PC scancodes effectively 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/XT keyboards despite raw XT codes still technically supported by legacy BIOS and operating systems.
Set 3
October 1983
The Set 3 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. Even on the 3270 PC, an add-on card and BIOS extension were needed to translate the keyboard's scancodes back into Set 1/XT for the base PC to understand it.
Set 2
August 1984 (AT), April 1987 (PS/2)
The retroactively-named Set 2 (PC/AT) protocol was initially a subset of Set 3 introduced with the IBM Personal Computer AT (5170). A marked improvement over Set 1/XT, Set 2/AT allows commands to be received by the keyboard, making features like lock-lights 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 Set 3 eventually ended up 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 Set scancodes. 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.

Computer-side socket pinouts

Keyboard-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 (eg, standard Model M cable)

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 (eg, Model M4-1, M5-1 & M5-2 cable)

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 (eg, P/N 42M599 Model M7, M8, M9 and M11 cable)

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

Mainboard header pinouts

The following diagrams detail what the pins on the keyboard's logic/controller board do. The help with orientation, a solid white filled-in block represents clip location, empty boxes represent absent pins, and a small number in the top-left corner state the pin number as described in the keyboard's or host system's hardware maintenance manual. However, if all three of these are absent, orientation will instead be described. Additionally, a block with just an "X" inside denote an unused but present pin.

IBM 5150/5155/5160 XT Model F

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

IBM 104-key "unsaver", 122-key and 5170 AT Model F, and 122-key Model M

X
+5V
Clock
GND
Data

Lexmark-era 101-key/102-key fixed cable Model M

+5V
Clock
GND
Data

IBM 5322/5324 Datamaster and 5291 Model F

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

P/N 69H8533 IBM 5535-ZPP numeric keypad

Key: M denotes a mouse pin and K denotes a keyboard 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

Cable wire colour coding keys

The following tables show what header and plug pins the colour-coded wires inside IBM and co keyboard cables lead to. Note that having a third-party cable on your keyboard is possible, so if you're not sure about if the cable is original or not, you can double-check the colour coding yourself by observing what header pins the individual coloured wires connect to.

IBM 5150/5155/5160 XT Model F

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

Lexmark-era 101-key/102-key fixed cable Model M

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 IBM 5535-ZPP numeric keypad

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

Header to Soarer's microcontrollers mappings

The following tables describe how you can connect various microcontrollers (currently Teensy 2.0, Arduino Micro and Pro Micro) to the headers of various IBM keyboard's mainboards as a part of a USB conversion process. These have only be tested to work for Soarer's Converter and Controller active converters, although they may be of use on other types of converters too. Please see the various diagrams above for a visual representation of the keyboard headers.

IBM XT, AT, 104-key "unsaver" and 122-key Model F, and 101/102 and 122-key Model M

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

IBM 5322/5324 Datamaster and 5291 Model F

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

Sources