The part of the computer that we come into most contact with is probably the piece that we think about the least. But the keyboard is an amazing piece of technology. For instance, did you know that the keyboard on a typical computer system is actually a computer itself?


Your basic Windows keyboard

At its essence, a keyboard is a series of switches connected to a microprocessor that monitors the state of each switch and initiates a specific response to a change in that state. In this edition of How Stuff Works, you will learn more about this switching action, and about the different types of keyboards, how they connect and talk to your computer, and what the components of a keyboard are.

Types of Keyboards
Keyboards have changed very little in layout since their introduction. In fact, the most common change has simply been the natural evolution of adding more keys that provide additional functionality.

The most common keyboards are:

  • 101-key Enhanced keyboard
  • 104-key Windows keyboard
  • 82-key Apple standard keyboard
  • 108-key Apple Extended keyboard

Portable computers such as laptops quite often have custom keyboards that have slightly different key arrangements than a standard keyboard. Also, many system manufacturers add specialty buttons to the standard layout. A typical keyboard has four basic types of keys:

  • Typing keys
  • Numeric keypad
  • Function keys
  • Control keys

The typing keys are the section of the keyboard that contain the letter keys, generally laid out in the same style that was common for typewriters. This layout, known as QWERTY for the first six letters in the layout, was originally designed to slow down fast typists by making the arrangement of the keys somewhat awkward! The reason that typewriter manufacturers did this was because the mechanical arms that imprinted each character on the paper could jam together if the keys were pressed too rapidly. Because it has been long established as a standard, and people have become accustomed to the QWERTY configuration, manufacturers developed keyboards for computers using the same layout, even though jamming is no longer an issue. Critics of the QWERTY layout have adopted another layout, Dvorak, that places the most commonly used letters in the most convenient arrangement.


An Apple Extended keyboard.

The numeric keypad is a part of the natural evolution mentioned previously. As the use of computers in business environments increased, so did the need for speedy data entry. Since a large part of the data was numbers, a set of 17 keys was added to the keyboard. These keys are laid out in the same configuration used by most adding machines and calculators, to facilitate the transition to computer for clerks accustomed to these other machines.

In 1986, IBM extended the basic keyboard with the addition of function and control keys. The function keys, arranged in a line across the top of the keyboard, could be assigned specific commands by the current application or the operating system. Control keys provided cursor and screen control. Four keys arranged in an inverted T formation between the typing keys and numeric keypad allow the user to move the cursor on the display in small increments. The control keys allow the user to make large jumps in most applications. Common control keys include:

  • Home
  • End
  • Insert
  • Delete
  • Page Up
  • Page Down
  • Control (Ctrl)
  • Alternate (Alt)
  • Escape (Esc)

The Windows keyboard adds some extra control keys: two Windows or Start keys, and an Application key. The Apple keyboards are specific to Apple Mac systems.

Inside the Keyboard
The processor in a keyboard has to understand several things that are important to the utility of the keyboard, such as:

  • Position of the key in the key matrix.
  • The amount of bounce and how to filter it.
  • The speed at which to transmit the typematics.


The microprocessor and controller circuitry of a keyboard.

The key matrix is the grid of circuits underneath the keys. In all keyboards except for capacitive ones, each circuit is broken at the point below a specific key. Pressing the key bridges the gap in the circuit, allowing a tiny amount of current to flow through. The processor monitors the key matrix for signs of continuity at any point on the grid. When it finds a circuit that is closed, it compares the location of that circuit on the key matrix to the character map in its ROM. The character map is basically a comparison chart for the processor that tells it what the key at x,y coordinates in the key matrix represents. If more than one key is pressed at the same time, the processor checks to see if that combination of keys has a designation in the character map. For example, pressing the a key by itself would result in a small letter "a" being sent to the computer. If you press and hold down the Shift key while pressing the a key, the processor compares that combination with the character map and produces a capital letter "A."


A look at the key matrix.

The character map in the keyboard can be superseded by a different character map provided by the computer. This is done quite often in languages whose characters do not have English equivalents. Also, there are utilities for changing the character map from the traditional QWERTY to DVORAK or another custom version.

Keyboards rely on switches that cause a change in the current flowing through the circuits in the keyboard. When the key presses the keyswitch against the circuit, there is usually a small amount of vibration between the surfaces, known as bounce. The processor in a keyboard recognizes that this very rapid switching on and off is not caused by you pressing the key repeatedly. Therefore, it filters all of the tiny fluctuations out of the signal and treats it as a single keypress.

If you continue to hold down a key, the processor determines that you wish to send that character repeatedly to the computer. This is known as typematics. In this process, the delay between each instance of a character can normally be set in software, typically ranging from 30 characters per second (cps) to as few as two cps.

Keyboard Technologies
Keyboards use a variety of switch technologies. It is interesting to note that we generally like to have some audible and tactile response to our typing on a keyboard. We want to hear the keys "click" as we type, and we want the keys to feel firm and spring back quickly as we press them. Let's take a look at these different technologies:

  • Rubber dome mechanical
  • Capacitive non-mechanical
  • Metal contact mechanical
  • Membrane mechanical
  • Foam element mechanical


This keyboard uses rubber dome switches.



Probably the most popular switch technology in use today is rubber dome. In these keyboards, each key sits over a small, flexible rubber dome with a hard carbon center. When the key is pressed, a plunger on the bottom of the key pushes down against the dome. This causes the carbon center to push down also, until it presses against a hard flat surface beneath the key matrix. As long as the key is held, the carbon center completes the circuit for that portion of the matrix. When the key is released, the rubber dome springs back to its original shape, forcing the key back up to its at-rest position.

Rubber dome switch keyboards are inexpensive, have pretty good tactile response and are fairly resistant to spills and corrosion because of the rubber layer covering the key matrix. Membrane switches are very similar in operation to rubber dome keyboards. A membrane keyboard does not have separate keys though. Instead, it has a single rubber sheet with bulges for each key. You have seen membrane switches on many devices designed for heavy industrial use or extreme conditions. Because they offer almost no tactile response and can be somewhat difficult to manipulate, these keyboards are seldom found on normal computer systems.

Capacitive switches are considered to be non-mechanical because they do not simply complete a circuit like the other keyboard technologies. Instead, current is constantly flowing through all parts of the key matrix. Each key is spring-loaded, and has a tiny plate attached to the bottom of the plunger. When a key is pressed, this plate is brought very close to another plate just below it. As the two plates are brought closer together, it affects the amount of current flowing through the matrix at that point. The processor detects the change and interprets it as a keypress for that location. Capacitive switch keyboards are expensive, but do not suffer from corrosion and have a longer life than any other keyboard. Also, they do not have problems with bounce since the two surfaces never come into actual contact.

Metal contact and foam element keyboards are not as common as they used to be. Metal contact switches simply have a spring-loaded key with a strip of metal on the bottom of the plunger. When the key is pressed, the metal strip connects the two parts of the circuit. The foam element switch is basically the same design but with a small piece of spongy foam between the bottom of the plunger and the metal strip, providing for a better tactile response. Both technologies have good tactile response, make satisfyingly audible "clicks" and are inexpensive to produce. The problem is that the contacts tend to wear out or corrode faster than on keyboards that use other technologies. Also, there is no barrier that prevents dust or liquids from coming in direct contact with the circuitry of the key matrix.

From the Keyboard to the Computer
As you type, the processor in the keyboard is analyzing the key matrix and determining what characters to send to the computer. It maintains these characters in a buffer of memory that is usually about 16 bytes large. It then sends the data in a stream to the computer via some type of connection.


A PS/2 type keyboard connector.

The most common keyboard connectors are:

  • 5-pin DIN (Deustche Industrie Norm) connector
  • 6-pin IBM PS/2 mini-DIN connector
  • 4-pin USB (Universal Serial Bus) connector
  • internal connector (for laptops)

Normal DIN connectors are rarely used anymore. Most computers use the mini-DIN PS/2 connector; but an increasing number of new systems are dropping the PS/2 connectors in favor of USB. No matter which type of connector is used, two principal elements are sent through the connecting cable. The first is power for the keyboard. Keyboards require a small amount of power, typically about 5 volts, in order to function. The cable also carries the data from the keyboard to the computer.

The other end of the cable connects to a port that is monitored by the computer's keyboard controller. This is an integrated circuit (IC) whose job is to process all of the data that comes from the keyboard and forward it to the operating system. When the operating system is notified that there is data from the keyboard, a number of things can happen:

  • It checks to see if the keyboard data is a system level command. A good example of this is Ctrl-Alt-Delete on a Windows computer, which initiates a reboot.
  • The operating system then passes the keyboard data on to the current application.
  • The current application understands the keyboard data as an application-level command. An example of this would be Alt - f, which opens the File menu in a Windows application.
  • The current application is able to accept keyboard data as content for the application (anything from typing a document to entering a URL to performing a calculation), or
  • The current application does not accept keyboard data and therefore ignores the information.

Once the keyboard data is identified as either system-specific or application-specific, it is processed accordingly. The really amazing thing is how quickly all of this happens. As I type this article, there is no perceptible time lapse between my fingers pressing the keys and the characters appearing on my monitor. When you think about everything the computer is doing to make each single character appear, it is simply incredible!