This article is a stub. You can help Deskthority by expanding it.
Contact bounce is a normal operating behaviour for switches with conductive contacts: a movable switch contact will bounce repeatedly for a short time after the impact of closing before settling into the closed position. Switches may also exhibit bounce when the contact is opened.
Switch manufacturers specify the maximum bounce time for switch series, which is typically ≤ 5 ms for keyboard switches.
The process of filtering out contact bounce is called debouncing. Insufficient debouncing results in key chatter.
Most keyboards perform debouncing entirely on the keyboard controller. Once closure has been detected, the controller must wait the required debouncing time interval before attempting to detect the switch as open, and vice versa.
A common method used for debouncing in firmware is to wait for contacts to be continuously closed (or open) for the debouncing interval before reporting it to be pressed (or released). This method is popular among engineers because it is also impervious to electrical noise and glitch in the switch contacts — but at the expense of added latency. Some firmware also focus on debouncing only one key at once, thus delaying debouncing of other keys that may have been pressed at the same time.
Mouse buttons, D-pads, digital joysticks and rotary encoders may also have electric switch contacts that need to be debounced. When switches are few and not in a matrix, debouncing can be done by an electronic circuit. Two-pin switches can be debounced with a low-pass filter that smoothens out the digital signal over time to an analogue curve. Contact is detected when the signal value is above a certain threshold. Three-pin switches with two pairs of contacts can be debounced using a flip-flop circuit.