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.
These are pinout diagrams for various IBM keyboard's connectors as they appear on either the computer-side or keyboard-side (if modular) sockets.
XT/AT 180° DIN
5155 XT modular-6P5C ("RJ-25" like)
Terminal 240° DIN
Terminal modular-8P5C ("RJ-45" 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
Standard Model M SDL
Keyboard & mouse combo Model M3 modular-8P7C ("RJ-45" like)
Keyboard & mouse combo Model M4-1/M5-1/M5-2 SDL
Retail POS Model M7/M8/M9/M11 PS/2 SDL
Retail POS Model M7/M7-1/M8/M9/M11 USB 4x1 IDC
Modular POS Model M-e USB & PS/2 6x2 IDC
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).
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.
Orientation: position the host board as such that this header is to the left side of said board.
Key: M denotes a mouse pin and K denotes a keyboard pin.
The following tables show what header and plug pins the colour-coded wires inside IBM and family 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.
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.
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.