The keyboard is a device used by human beings to interact with a computer (in more technical terms, a human interface device). Input takes place when the user presses the keys on the keyboard. The keys themselves consist of electro-mechanical switches, the precise operation of which is dependent on the type of keyboard being used. Each key sends a unique signal to the computer when pressed, so that the computer knows which keystroke has occurred.
The input takes the form of alpha-numeric characters, punctuation characters or commands, each of which may involve either a single keystroke or a combination of two or more keys being pressed at the same time. Every key on the keyboard carries a symbol that tells the user which character or control function it represents. In many cases, additional symbols appear on a key to indicate a secondary function that can be invoked by pressing the key while another key (such as the ALT, CTRL or SHIFT key), or key combination (usually the ALT, CTRL or SHIFT keys in some combination), is held down.
The layout of the keyboard and the total number of keys provided can vary considerably. Generally speaking, most of the keyboard layouts in use today are based on the traditional layout of mechanical and electronic typewriters (the typewriter was invented well over a hundred years ago), with the addition of a number of computer-specific control keys. This traditional layout was retained because it made the transition from using a typewriter to using the keyboard on a modern word processor or computer easier, and removed the need for any significant retraining of typists or secretarial staff (who effectively now became computer operators).
The number of keys can vary between 80 and 110, depending on the type of computer hardware the keyboard is designed for. Laptop and netbook computers tend to have fewer keys and more restrictions on the way in which the keyboard is laid out than desktop computers, because the space available is limited. Some keyboards are designed for a particular operating system (OS) such as Microsoft Windows, and may have additional function keys that are OS-specific. The overall layout of the keys can vary depending on where in the world the keyboard will be used, since different countries have different character sets. The layout may also vary in accordance with the requirements of various ergonomic designs (more about this later).
A Carona portable typewriter keyboard, circa 1920
From the keyboard layout shown above, it can be seen that the primary function of each key is to print a letter of the alphabet or a punctuation character. The default behaviour of keys used to type letters of the alphabet is to print a lower-case version of the character when struck. If the Cap key is held down at the same time however, an upper-case version of the character is produced. If the Fig key is held down, the result will be a numeric character (0-9) for the top row of keys.
For most of the other keys, holding down the Fig key will produce either a punctuation character or some other special character. If you study the keyboard layout below, which is a fairly standard layout for a desktop computer keyboard, you will note that the alpha numeric keys and space bar are present in more or less the same positions they occupy on the typewriter keyboard.
A typical desktop computer UK keyboard layout
The major differences are that the numerical keys (0 to 9) are now separate from the top row of characters (Q to P), and the overall number of keys (there are far more keys in total). Above the main body of alpha-numeric keys are the Escape key and the special function keys (F1 to F12). To the right of the main body there is a group of control keys that are used for various purposes including navigating around the screen by changing the position of the cursor. To the right of this there is a numeric keypad that allows the user to enter numbers and basic arithmetic operators.
Closer inspection of the numeric keypad will reveal that most of these keys duplicate the functionality of the cursor controls keys found in the group to their left. Note that the main body of keys includes several very important keys, including Ctrl, Alt and Shift. These keys are used either on their own or in combination to modify the signals sent to the computer when other keys are pressed. Hover over the image above to see a description of the function of each key, or group of keys.
An IBM Model M keyboard, circa 1985
The layout of the keyboard, together with the number of keys and the precise function of each key, can vary widely from country to country. It can also vary considerably depending on the purpose for which the keyboard is intended. Laptop and netbook computers, for example, tend to omit some keys or groups of keys (such as the numeric keypad) due to limitations on the space available.
Modern keyboards for desktop computers frequently have additional keys for specialised purposes such as invoking multimedia software, accessing the Internet via a web browser, controlling the volume of audio output, or sending the computer into power saving mode. Keyboards may also be designed for optimal performance with a particular operating system such as Mac OS, Windows or Linux, and may include keys that invoke operating system-specific commands or menus. The alpha-numeric keys at the heart of the keyboard generally fall into the same pattern, however.
In the UK, most keyboards are based on the traditional QWERTY layout found in typewriters. This layout, which clearly does not follow an alphabetical ordering, is named after the first six letters in the top row of keys on early mechanical typewriters. It owes its adoption to the physical characteristics of these devices, in which the typeface was located at the end of a mechanical lever. When a key was pressed, the lever would push the typeface against a ribbon impregnated with ink, forcing it against the paper and creating an image of the character on the paper. When the key was released, the lever would return to its starting position.
Problems arose when two or more keys were pressed in quick succession, allowing insufficient time between keystrokes for each key to return to its starting position. Keys would collide with each other and would often get jammed together. In order to reduce the likelihood of this occurring, the inventor Christopher Scholes (who was primarily responsible for the development of the world's first commercially successful typewriter in the late 1860s) developed the QWERTY layout. The layout was chosen in order to ensure that keys that were frequently used together were located some distance apart from each other, reducing the speed at which successive keystrokes occurred.
In many European countries, the layout used varies from the QWERTY layout in that certain characters may appear in different locations or be replaced altogether, and the special characters invoked by using a particular key together with a modifier key such as Ctrl or Alt may be language specific. In some Arabic or Asiatic countries, a western-style keyboard may have its keys remapped in order to be able to produce characters not found in the Western (Latin) alphabets. This remapping is usually carried out by operating system or application software, and the character produced by pressing a key often bears no resemblance to the character that appears on the face of the key.
Keyboard remapping can also be carried out in software to enable a standard UK keyboard to emulate layouts used in other countries. In fact, most current operating systems allow the user to select a particular keyboard layout during installation, or during subsequent reconfiguration. There are also some alternative (though rarely used) layouts such as the Dvorak layout, named after its creator August Dvorak, in which the arrangement of keys is radically different from QWERTY-based layouts.
The size, shape and spacing of keys is generally consistent from one keyboard to the next regardless of layout, and has evolved to suit the needs of the operator. The keys themselves must be large enough to be individually pressed by the operator's fingers, and relatively close together in order to minimise the amount of physical movement required when entering data. The original keyboards provided by IBM for its personal computers had fewer keys than their modern counterparts. During the mid-1980s however, IBM added the 17-key numeric keypad to facilitate faster data entry (this is often omitted on desktop and notebook computers due to space restrictions, as illustrated below).
The numeric keypad followed roughly the same format found on adding machines and calculators. IBM also added various function and control keys that had specific roles under the DOS operating system. Today, the role of these keys in a command line environment remains largely unchanged, but for more sophisticated operating systems such as Windows or Linux that provide an event-driven graphical user interface, and even within different applications, the purposes for which these keys are used are considerably more diverse.
An 84-key HP Mini 2140 Netbook computer keyboard
The switches on a computer keyboard are all connected to a microprocessor that controls the keyboard's operation via a fairly complex electrical circuit called the keyboard matrix. One of the earliest keyboard switch technologies used for computers was developed by the Key Tronic Corporation in 1978 and used capacitive switches. The technology is noteworthy for the fact that it did not involve the closing of a circuit. Instead, the bottom of the key had a foam disk coated on the underside with a film of conducting material.
Beneath each key were two semi-circular conducting pads coated with a dielectric (insulating) material, each of which was connected to the keyboard matrix. When the key was pressed, the capacitance between the disk on the bottom of the key and the semi-circular pads was increased. This increased capacitance caused a small current to flow in the circuit, which could be detected by the keyboard's microcontroller.
IBM later devised a capacitive switch technology that utilised a buckling spring mechanism in which the action of striking a key caused a spring beneath the key to buckle. This in turn caused a metallic plate beneath the spring (effectively the upper plate of the capacitor) to pivot downwards, briefly increasing the capacitance at that point in the keyboard matrix. This technology featured in the Model F keyboards supplied with early IBM personal computers.
Most modern computer keyboards use a technology based on the idea of a flexible membrane, coated on its underside with a conducting material and separated from the keyboard matrix by a layer of non-conducting material. The non conducting material has holes underneath each key so that when the key is pressed the conducting material on the membrane makes contact with the keyboard matrix and completes the circuit at that point. From around 1984, IBM adapted their buckling spring technology to use membrane switches instead of capacitive switches for their Model M personal computer keyboards.
The keyboard matrix (see illustration below) is either a standard printed circuit board or (in some cheaper keyboards) may consist of conductive tracks printed onto a plastic sheet. Above this is a sheet of non-conducting material with holes in it corresponding to the position of the keys. The top layer is a moulded rubber or silicone sheet that has a number of dome-shaped protrusions. The underside of each dome is coated in a conducting material, and the top of each dome corresponds to the position of a key. When the key is pressed, the underside of the dome is forced downwards, making contact with the keyboard matrix and completing an electrical circuit at that point.
A typical keyboard matrix printed circuit
Rubber domes positioned over a keyboard matrix PCB
The keys are housed in designated locations in the top portion of the keyboard casing, which is a one-piece plastic moulding. Each key is made (usually) from a single piece of plastic and clips relatively loosely into its position within the housing, allowing it a degree of vertical movement. Each key includes a plunger that extends downwards through the housing and rests on top of one of the dome-shaped protrusions.
When pressed, the plunger forces the dome downwards, and the conductive coating completes a circuit on the keyboard matrix. When the key is released, the rubber dome springs back into its original shape, pushing the key back up into its starting position and breaking the circuit again. The vertical distance by which the key moves when fully depressed is called its travel.
The physical response felt by the operator when pressing a key is called the tactile response, and is a form of positive feedback. In early computer keyboards the degree of travel was greater than in modern keyboards, and tactile response was often more pronounced and accompanied by an audible click. This was due in part to the mechanisms used, but was also an attempt to emulate the typewriter keyboard. Modern keyboards tend to be quieter, require less force to fully depress a key, and have a smaller travel distance.
The action of pressing or striking a key is often accompanied by vibration, the effect of which is that what is perceived by the user as a single keystroke actually results in several separate instances of the circuit being alternately opened and closed in rapid succession before a firm contact is established.
An analogy would be an object that is dropped onto the ground and bounces a few times before coming to rest. Indeed, when applied to electrical circuits the phenomenon is often referred to as "bounce". The keyboard's microcontroller aggregates these rapid connection fluctuations (which occur both when the key is initially pressed and when it is released) to ensure that only one keystroke is recorded for a given period of time (typically a few milliseconds), a process known as "de-bouncing".
If a key is held down continuously over a significant period of time, on the other hand, it is usually interpreted as multiple consecutive keystrokes. The number of keystrokes registered in a given time frame when a key is held down in this way is usually determined by the operating system software, although it can usually be adjusted by the user if required.
The keyboard matrix consists of a large number of interconnected circuits wired to the inputs of the keyboard's microcontroller, which is mounted on a circuit board inside the keyboard. Each circuit is open until closed by the action of pressing the key associated with it. Closing the circuit sends a unique signal to the microcontroller that identifies the key's row and column coordinates on the keyboard, allowing the microcontroller to identify which key has been pressed (a further signal is generated when the key is released).
The microcontroller associates each row and column pairing with a scan code stored in its read-only memory (ROM). Each time a key is pressed or released, the relevant scan code is sent (asynchronously) to the computer's I/O controller hub (the Southbridge chip on the motherboard) via the connection between the keyboard and the computer. Usually this is a cable that connects to a serial, PS/2 or USB port but may be a wireless connection (or an internal connection in the case of a laptop or netbook computer).
For serial or PS/2 connections, the signals go to the Southbridge via the Super I/O chip, which incorporates keyboard and mouse control logic (the Southbridge itself may provide control logic for these devices, although this is rare). For USB connections, the signals go to a USB host controller built into the Southbridge.
To simplify somewhat, depending on the type of connection used, the control logic on the Super I/O chip or the USB host controller in the Southbridge will generate an interrupt each time a key press is detected. The scan code is transferred to one of the CPU's registers, and the CPU calls the relevant interrupt handler (usually part of the operating system software unless specific keyboard driver software has been loaded).
The operating system reads the scan code to see what key has been pressed, and checks the current status of any modifier keys such as the Shift, Ctrl or Alt keys. If the key press represents a system command, the operating system will take whatever action is called for. If not, the keystroke will be passed to the application that is currently active.
Interpretation of scan codes is done in software, since different operating systems use different system commands, and application software often will define its own set of keyboard commands and shortcuts. This can extend to the interpretation of alphanumeric and punctuation character key scan codes if a remapping of the keyboard is currently active.
Note that USB keyboards usually come with an adapter that allows them to be connected to a PS/2 port. The microcontroller on the keyboard should be able to detect which type of port is being used, and will automatically use the appropriate data communications protocol for that type of port.
Note also that communication between the keyboard and the computer is two-way, since the control hardware on the computer's motherboard must be able to switch indicator lights on the keyboard or off to notify the user of the status of certain keys such as the Caps Lock, Scroll Lock and Num Lock keys (some keyboards are also equipped with internally illuminated keys, so that they can be used with relative ease in a darkened environment). The keyboard also obtains its power supply via the cable connection from the computer.
Wireless keyboards usually communicate with the computer either via a USB dongle that has a built-in wireless transceiver (transmitter-receiver) or via a transceiver built into the computer. Although infrared communication has been used for this purpose, it requires a clear line-of-sight between the keyboard and the computer's base unit. It is far more common to find Bluetooth (high frequency, short range radio) devices in use which do not have this requirement.
Although wireless keyboards are very convenient to use, they have the disadvantage that they must either have their own mains power supply unit or (as is more commonly the case) they must be powered by a battery. There may also be security issues, since communication between the keyboard and the computer is effectively being broadcast on radio frequencies.
A Logitech K350 Wireless Keyboard with USB wireless dongle
Alternative keyboard formats
Various alternatives to the "traditional" keyboards most often associated with desktop computers exist. One of the more frequently seen variations involves an ergonomic keyboard layout designed to allow the operator's hands to assume a more natural position when typing. Prolonged and constant use of a keyboard can lead to a repetitive strain injury such as carpal tunnel syndrome, which affects the wrists and can be both painful and difficult to treat.
Various designs exist, most of which split the keyboard into two halves placed at an angle to one another and slightly apart, so that the wrists and forearms are aligned with each other in a more natural position when typing. The keyboard may also have a padded extension at the front to provide additional support for the wrists when at rest (although they should not be used whilst actually typing).
Note however that simply having an ergonomically designed keyboard does not eliminate the risk of repetitive strain injury. Adequate breaks, adopting the correct posture when typing, and having a properly designed workstation are also essential.
An Adesso Tru-Form Pro ergonomic keyboard with built-in wrist support
A software keyboard is sometimes used in which an image of the keyboard generated by software is projected onto a screen or displayed on a computer monitor. The keys can be activated by clicking on them using a mouse. If a touch-screen monitor is used, the user can activate a key by touching its image on the screen, although there is no real tactile feedback.
The same is true for images projected onto a screen equipped with appropriate technology, such as an interactive whiteboard. Software keyboards are particularly useful for mobile computing applications where a keyboard would otherwise be impractical. The illustration below shows a virtual on-screen keyboard displayed on a TabletKiosk Tablet PC.
TabletKiosk's Sahara Slate PC i400 series Tablet PC
Foldable (or flexible) keyboards are constructed from flexible materials (such as soft plastic or silicone) so that they can be rolled up or folded in order to be easy to carry whilst travelling. Their flexible nature means that they can be used on uneven surfaces, and they are often designed to be waterproof. This makes them useful in environments such as hospitals and laboratories, since they can sustain spills without being damaged, and can be easily disinfected. They can also be used to provide keyboard functionality for mobile devices such as smartphones. On the downside, as with software keyboards there is little tactile feedback from this type of keyboard, making them somewhat less user friendly than conventional formats.
A flexible keyboard can be rolled up or folded