Debounce calculator
Size the resistors and capacitor for an RC debounce filter on an active-low button, then check the result against your switch's longest bounce.
Values
Resistors and capacitors take values like 10k, 4k7, 100n or 2.2u. Take the thresholds from your input's datasheet, and check both ends of the range it gives.
Results
- Press delay
- Release delay
- Switch current
How it's calculated
Pressing the button discharges C through R2. The press delay is how long that takes to reach the falling threshold:
tpress = R2 C ln(VCC / VT−)
Releasing it charges C through R1 and R2 in series, up to the rising threshold:
trelease = (R1 + R2) C ln(VCC / (VCC − VT+))
Both delays assume clean contacts. The traces simulate one example bounce pattern spread over your bounce time, and count how often the input changes. Real switches bounce differently from press to press, so keep each delay longer than the longest bounce you've measured.
The calculation treats the switch as ideal and assumes the input draws no current. With very large resistors, input leakage starts to shift the voltages.