Switch bounce and RC debouncing
A push button is two pieces of springy metal that you press together. They don't meet once and stay: the moving one hits, bounces off, hits again, and settles a couple of thousandths of a second later.
Too fast to see or feel, but not too fast for a circuit. Anything that counts presses, a menu that moves on one place per press, say, sees every touch.
Here a 10 kΩ pull-up holds the button's output at 9 V, and the button pulls it to 0 V when pressed. The scope's probe is on the output, and the simulation runs in slow motion, a fiftieth of real time.
Press Run, then press and hold the button. The scope catches the moment the output first falls.
How many times did the output fall to 0 V for that one press?
- Once
- Twice
- Four times
- Seven times
Averaging the chatter
A resistor and capacitor can't follow anything much faster than their time constant. Feed the bouncing output through one with τ well over 2 ms, and the capacitor only sees the average: it starts falling at the first touch, barely rises in the short gaps, and passes half the supply once, on its way down.
With a 10 kΩ filter resistor, what capacitor gives a time constant of 10 ms, five times the bounce?
Answer in F.
The filter resistor is on the board, from the output to column 11, with probe 2 at its far end. Add the 1 µF capacitor: + leg in column 11, − leg to the − rail. Then Run and press the button again.
What would a 100 µF capacitor do instead?
- Still one clean fall, but about 0.7 s after the press: the button would feel slow
- Stop the bounce better, with no downside
- Let the bounce through again
Switch bounce and debouncing:
- mechanical contacts bounce for a millisecond or two each time they close or open;
- an RC filter with τ a few times longer than that averages the chatter into one smooth change;
- too large a τ makes the button feel sluggish.
On a real bench the filtered voltage glides through the middle slowly, where an ordinary logic input can dither, so it goes into a Schmitt trigger input, which switches at one voltage on the way down and another on the way up. Microcontrollers often skip the capacitor altogether and debounce in software: they read the pin, wait 10 or 20 ms, and read it again.