debounce
To remove the small ripple of current that forms when a mechanical switch is pushed in an electrical circuit and makes a series of short contacts.
debounce: killing the electrical noise of mechanical switch closure
When a mechanical switch closes, its contacts do not settle instantly. Instead, the metal surfaces touch, bounce apart slightly, and reconnect several times in rapid succession, producing a series of electrical pulses over 5 to 50 milliseconds. This bouncing creates noise in the circuit: a controller expecting a single clean signal sees multiple transitions instead. Debouncing removes these spurious pulses so downstream logic reads only one clean state change per physical switch action.
Hardware debouncing uses a capacitor placed across the switch terminals. As contacts bounce, the capacitor charges and discharges, smoothing the voltage transitions and filtering out the high-frequency ripple. The RC time constant is chosen to pass the genuine contact closure while rejecting bounce frequencies. An alternative hardware method uses a Schmitt trigger buffer with hysteresis, which ignores voltage noise smaller than its trip margin. Some circuits combine both approaches for maximum noise immunity.
When reading a switch input via a microcontroller, debouncing happens in code: the controller samples the switch pin repeatedly, typically every 5 to 20 milliseconds, and only registers a state change if the input remains stable across two or more consecutive samples. This costs almost nothing in CPU time but introduces latency proportional to the debounce window. Real-time systems must balance responsiveness against reliability; a 10-millisecond debounce delay is usually imperceptible to users but catches 99 percent of bounce noise.
Debouncing matters most in industrial control, where switch inputs trigger relays, motors, or safety interlocks. A single bounced pulse might cause a counting error, trigger an unintended action, or log a false alarm. Conversely, over-aggressive debouncing can make the system feel sluggish or miss genuine rapid inputs. The choice of debounce strategy depends on switch type: a worn relay contact may bounce longer than a fresh tactile button.
The term comes directly from the physical phenomenon: you are bouncing the signal back to a clean state by filtering out the mechanical bounce. In modern systems with millisecond-scale switching, debouncing is often invisible to the user but essential to correct operation.