A mechanical contact bounces dozens of times per press, and an unconditioned counter goes wild. This page covers bounce reality, the RC plus Schmitt pairing, and the 74HC14 at work.
Contact closure bounces for 5 to 20ms - dozens of transitions that a counter reads as many presses. The hardware fix is two layers: an RC network to absorb the fast edges, and a Schmitt trigger to restore a clean slope. The hysteresis is the point: a 74HC14 switches at about 2.4V rising and 1.4V falling (5V rail), so the RC charge creeping through the middle region cannot make the output dither - exactly what a plain CMOS input, which amplifies noise linearly in that region, cannot promise.
The standard button circuit: closure discharges the capacitor through a 100Ω limit resistor, release charges it through a 10kΩ pull-up into the 74HC14. With 2.2 to 3.3µF the tau of 20 to 30ms covers a 20ms bounce; response delay of 15 to 30ms is invisible to a human. One 74HC14 serves six buttons at pennies each. Rules for multiple channels: independent RC per channel, unused inputs tied high or low, mind the inversion (74HC14 is an inverting buffer), and a 1kΩ series resistor on long switch lines against static and induction. Too small an RC (tau 1ms) lets through the rare bounce that takes weeks to trace.
| Application | R value | C value | Debounce time |
|---|---|---|---|
| Panel buttons | 10kΩ | 2.2µF | About 25ms |
| Fast counter input | 10kΩ | 0.47µF | About 5ms |
| Long-line limit switch | 10kΩ + 1kΩ series | 4.7µF | About 50ms |
| Rotary encoder | 10kΩ | 0.1µF | About 1ms with software |
| Relay contact feedback | 10kΩ | 1µF | About 10ms |
| Optocoupler shaping | 10kΩ pull-up | 0.22µF | About 3ms |
Workflow: capture one press on the scope to measure real bounce, set tau to 1.5 or 2 times that, mind the output polarity into the MCU. Start panel buttons at 10kΩ plus 2.2µF and adjust from evidence.
The quantities and component characteristics discussed here follow current national standards and the corresponding IEC documents: Digital IC specification per GB/T 17574 (IEC 60748 series); logic symbols per GB/T 4728. Always check the device datasheet and the product design file for ratings and derating.
Locate the issue with the approach above, then confirm with measurements; safety-related circuits must follow the standards and manufacturer requirements.