The serial Keyboard used on Personal Computers [PCs] is a [PS/2] 6 pin Circular DIN.
The pin-out for the PS2 Keyboard or Mouse port is: Pin 1; Data, Pin 2; Reserved, Pin 3; Ground, Pin 4; +5 Vdc, Pin 5; Clock, Pin 6; Reserved.
The computers key-board port is usually located right next to the mouse port and is color coded purple, to distinguish it from the mouse connector, which is green.
Another variant called the AT Keyboard uses a 5-pin DIN; with Pin 1; Clock, Pin 2; Data, Pin 3; Reserved, Pin 4; Ground, Pin 5; +5 volts.
The AT style keyboard was developed before the PS2 Keyboard interface, so most keyboards found these days will be the PS2 variant.
In fact many early personal computers did not color code their connectors, which would include the AT Keyboards.
Most new computers ship with keyboards using USB ports to handle this function, Universal Serial Bus [USB].
In general both the Obsolete AT keyboard and out-dated PS/2 style keyboard connector will not be present on the newest PC's.
|PS2 Keyboard||AT Keyboard|
|Pin Number||Function||Pin Number||Function|
These Keyboard interfaces are serial interfaces, using just one data line. The protocol is just like the RS232 interface, 8-bits of data with both a start and stop bit.
The 5-pin or 6-pin keyboard interface is not electrically compatible with the RS232 [EIA232] interface, but the same protocol is used in Personal Computers.
The data or keys are encoded using normal ASCII coding.
However some products use the term PS/2 PC Keyboard Scan codes [which implies something other than ASCII].
Of course ASCII may be converted to a key scan code.
The motherboard keyboard interface uses open-collector lines pulled to 5 volts to drive the data and clock signals compatible with TTL signaling levels.
A number of manufacturers produce Keyboard encoder ICs or modules.
A module would be called a Discrete Switch to PS2 or RS 232 Keyboard Converter.
Note that RS232 could be the same as TTL if the levels are confined to 5 volt TTL levels [which some RS232 interfaces use].
The 74C922  was a common 16-key [20-key] encoder.
Many designs just used a programmable IC, to handle any number of switch matrices.
Mouse and Key Board Manufacturers
All other PC interfaces are listed on the Personal Computer Buses page.
Use the Equipment Icon below to navigate to additional PC gear manufacturers.
Editor note; there are a great many issues relating to a computer keyboard;
It's physical size, key layout, keycap texture, illuminated keys [if any], spacing and alphanumeric key placement, additional pre-programmed keys and so on.
This site only addresses the electrical aspects of an interface and its physical connection [its cable].
So the important points here is how a keyboard communicates with a personal computer, over some number of wires and a particular connector.
How the keyboard is produced, what layout it uses and what it looks like is not addressed here.
However there is a general key layout used called Qwerty, and to a lesser extend a few other layouts which were used in the past.
The most common number of keys is 104, but 101, 102, 103 and 105 keys are also some what common.
Of course a keyboard could also be wireless and not have a physical interface at all, by not using a cable to pass the data.
A wireless interface would be a completely different interface, although the input device would still be a keyboard.
Than again the keyboard might have a port for a cable referenced above and also be wireless giving the user the option of either.
To summarize the keyboard my use a PS2 connection [referenced here], a USB connection [USB wired], or a wireless connection [USB RF wireless].
Just to be complete a wireless keyboard will require a battery to power the keyboard circuitry, while a wired key-board would derive power from the PC.