Although it may seem obvious now that keys on a keyboard would use simple electrical switching, this was not always the obvious choice. Switch bounce necessitated alternative approaches to keystroke detection until viable means were found to satisfactorily accommodate conductive switching.
Conductive switches occupy a range of reliability levels. Although they will never reach the highest tier of reliability reserved for contactless switching techniques, rated lifetimes of 100 million keystrokes are claimed by some mechanical switch types. Conductive switches are subject to a number of additional limitations over contactless switching. Conductive switches are more susceptible to ingress of foreign materials. The metal switch contacts can corrode and fail: even if the contact surfaces were pure gold, the body of the switch contacts will be a metal subject to oxidisation. The switch contacts can lose their correct elastic properties and misregister, and the contacts may suffer physical damage.
In realistic terms, however, well-made conductive switch designs should offer many years of reliable service. IBM’s Model M keyboards demonstrate that even membrane keyboards will hold up reliably for decades; the main flaw with their product range was the use of heat staking instead of metal tabs or screws to secure the membrane assembly backplate, not the membranes themselves.
Various characteristics of a switch degrade with age and wear, in particular:
- Contact resistance will increase as the contact surfaces wear, which will eventually cause switches to stop registering; this is especially true of conductive rubber switches where the conductive surface fails and needs to be cleaned or renewed
- Bounce time will increase as the contacts age, eventually leading to chatter
Switch contacts are formed around elastic materials such as phosphor bronze, polyester and silicone rubber. When a switch changes its state, the contact body takes a few milliseconds to settle in its new position. This can be visualised as dropping an elastic ball onto the floor: it will bounce back into the air each time it strikes the floor, with each rebound reaching a lower height until the ball finally stops moving. For a ball, this process make take a few seconds; for switch contacts, the target bounce time willl be as low as 2–10 milliseconds depending on the switch type and intended usage and price point. Unfortunately, to machine, 2 milliseconds is a long time, and electronic hardware will interpret the repeated contact closures as the button being pressed repeatedly in rapid succession.
Debouncing is the process of filtering out this period of instability, either electronically, or by simply waiting for the switch contacts to settle. Various techniques exist, with varying levels of bulkiness and complexity. These techniques include:
- A double-throw switch can be connected through a flip-flop (latch), with each throw connected to one flip-flop input. The flip-flop will remember the last switch position and hold it while the contacts settle. This approach was used by Micro Switch for their contact buffer circuits sold for use with PB series switches, but has yet to be observed in a keyboard.
- A resistor–capacitor (RC) filter can be used to smooth out the changes in current until the switch settles. This too is not known from any keyboards.
- Mercury switch contacts, as used in the Mercutronic line of switches from Mechanical Enterprises. Liquid conductive surfaces will presumably fuse instead of bounce hard, ensuring clean make and clean break.
- Timed delay: once a keystroke is detected, wait a defined period (e.g. 10 ms) for the switch contacts to settle. If the switch is still conducting after this period, the switch is successfully closed and the keystroke should be registered. If the switch is no longer conducting, then the keystroke could have been spurious (as a result of electromagnetic interference) or unintentional. Single-chip encoders extensively used this technique, pausing the scanning process to allow time for the switch to settle. Timed delay is trivial to implement in logic (both hardware and firmware) but it does come with a limitation: any key that continues to bounce beyond the expected limit will stop being filtered, leading to duplicate keystrokes being reported.
The Ganssle Group has written a detailed article on contact bounce and various techniques that can be used to combat it, entitled Debouncing Contacts and Switches in Embedded Systems.
When the bounce time exceeds the time limit set by time-based debouncing, the bounce is referred to as “chatter”. Causes of chatter include an incorrect pairing of encoding logic and switches (where the switches by design are outside of the tolerance of the debounce logic) and switches that are out of tolerance due to manufacturing defects, damage or age. Switch contact cleaner can be used to restore chattering switches back to an acceptable bounce time.
In his article “Real-Time Time Conversions” (Personal Computing, May 1980), James Nestor wrote, “If your keyboard bounces (don’t they all?) and puts an extra L in London, the name will be rejected, Try again.” The article would suggest that consumer computers of the era simply ignored key bounce, but as the article describes a program that the author wrote for a Radio Shack TRS-80, the author may have been experiencing a curious defect of that specific model of computer. In his article Model I Keybounce, Matthew Reed notes that the Level II BASIC ROM for the TRS-80 Model 1 did not include a debounce routine. Separate software—Keyboard Debounce and Real-Time Clock, known as “KBFIX”—had to be loaded into memory to add a debounce routine, each time the computer was started. It seems that debouncing was present in Level I BASIC, but anyone upgrading to Level II BASIC would lose that facility.
In this instance, the severity of the contact bounce was attributed to the lack of protection afforded by the switches against the ingress of foreign matter (with cigarette smoke being signficantly blamed). The switch type is not named, but from the description—where removing a keycap exposes the switch contacts—this would have been the Hi-Tek “High Profile” keyboards. The later Alps KCC seemed to be a lot less susceptible.
Avoiding contact bounce and its attendant complexity was a driving factor in a number of other fundamentally different switch types. In particular this included photoelectric, Hall effect, capacitive and inductive sensing. Capacitive and Hall effect keyboards never went out of production, while photoelectric keyboards have made a comeback.