A keyboard controller is the circuitry responsible for scanning the keyboard matrix, debouncing switch activity and reporting key presses and key releases to the host computer. The term is also used to refer to the microcontroller IC that forms the central part of this system.
Since the 1980s, it is typical for desktop computer keyboards to be fully standalone devices: they are external to the computer, communicate with the computer using a keyboard protocol, and all of the operational circuitry is contained entirely within keyboard. This is in contrast to 70s terminals and 80s home computers where the keyboard was often built into the computer, and either part of the motherboard or with the keyboard matrix connected directly to the motherboard.
Most of the work involved in handling keyboard operation takes place on a microcontroller: a microprocessor, software and memory held in a single microchip. An Intel 8049 chip such as the one illustrated below provides 2 kB ROM and 128 bytes of RAM. Software is stored on this chip to provide the functionality of the keyboard. Factory-supplied keyboards generally store this software permanently, but some commercial keyboards such as the KBC Poker II support firmware upgrades by storing the software in flash memory.
Modern keyboards tend to have a single microchip with a small amount of auxiliary components (typically resistors and capacitors) while older keyboards would have a number of additional support chips in addition to the microcontroller. In many keyboards, the controller is a separate PCB that can be removed from the keyboard. This is true of all membrane keyboards by necessity, but also true of other types of keyboard as well. The Kitten Paw custom keyboard controller depicted below is made possible because many Costar keyboards place the controller circuitry onto a removable daughterboard that can be removed and replaced with a custom controller board.
For 2KRO keyboards and similar, the keyboard controller needs to detect when too many keys are being pressed at once, and block the additional keys to prevent ghosting from occurring.
The keyboard controller also takes requests to update lock status, and switches the lock LEDs on and off as required. It communicates with the host computer via the applicable bus, be that USB, XT, AT (also PS/2 with a different connector), ADB or a proprietary connection.
Some keyboard enthusiasts create their own controllers to permit vintage keyboards to work on newer computers, such as rewiring a Macintosh 128 keyboard to function on a modern computer; custom controllers can also add new features such as multiple input layers. The Teensy programmable microcontroller is a popular board for producing keyboard controllers.
Controller board from an Acer 6312-TW membrane keyboard — older membrane keyboards had full-size ICs
Keyboard controller and associated circuitry from an NTC KB-6153EN keyboard
Kitten Paw custom keyboard controller
Tipro (MID series) removable controller with its connection cable to the PCB
Dell L100 controller PCB