RC Debounce Network

R and C values to debounce a mechanical switch input.

// an RC across a switch, sized so the input threshold is crossed only after the contacts settle

VddRRsinCSW
Pull-up resistor
56 kΩ

exact 54.57 kΩ · with 100 nF the input crosses threshold after 5.13 ms

Release delay
5.13 ms
to 3 V (Vih)
τ
5.6 ms
R × C
Pull-up current
89.3 µA
while pressed
BOUNCE COVEREDThe threshold is crossed 1.03× later than the 5 ms bounce window. The Schmitt trigger cleans the slow edge into a sharp one.

// press (discharge) path

Press delay
26.5 µs
to 1.5 V (Vil)
Contact current spike
22.7 mA
limited by Rs
Asymmetry
194×
release vs press
▸ show formulas
τ = R × C
t_release = −τ × ln(1 − Vih/Vdd) // cap charges through R
t_press = −Rs × C × ln(Vil/Vdd) // cap dumps through the switch
I_spike = Vdd / Rs

Aim for the threshold crossing to take at least as long as the bounce: 1–10 ms covers most tactile switches, 10–20 ms for large mechanical ones. Too much and the button feels laggy.

Rs does two jobs: it limits the current the cap dumps through the contacts on each press, and it protects the pin. Without it the discharge is limited only by contact resistance.

Debouncing in firmware costs nothing in parts — sample the pin every few ms and accept a change only after N consecutive agreeing reads. Hardware still wins when the signal drives an interrupt, a counter, or logic with no CPU behind it.
debounceswitchRCcapacitornoise

About this calculator

Mechanical switch contacts do not close cleanly. They bounce apart and back together for anything from a few hundred microseconds to tens of milliseconds, and a microcontroller polling fast enough will read that as a burst of presses.

An RC network smooths the transition so the input crosses its logic threshold only once, after the contacts have settled. This calculator sizes the resistor and capacitor for your bounce time, or checks a pair you already have.

How it works

The standard circuit is a pull-up resistor to Vdd, the switch to ground, and a capacitor across the switch. Pressing shorts the capacitor out; releasing lets it charge back up through the resistor along an RC curve.

What matters is how long that curve takes to cross the input's logic threshold. For a CMOS input that is about 0.7 Vdd, which is −ln(1 − 0.7) ≈ 1.2 time constants. Make that crossing take longer than the bounce window and the contacts have finished chattering before the logic sees any change.

The press direction behaves quite differently. Closing the switch discharges the capacitor directly through the contacts — nearly instantly, and with a current spike limited only by contact resistance. A series resistor of a few hundred ohms tames that, protects the pin, and gives the press its own (shorter) time constant.

A slow RC edge into an ordinary logic input is not ideal: while the input dwells near its threshold it can oscillate and draw shoot-through current. Feeding it into a Schmitt trigger — a 74HC14, or a pin configured for hysteresis — converts the slow ramp into a clean fast edge.

τ = R × C
t_release = −τ × ln(1 − Vih/Vdd) charging through R
t_press = −Rs × C × ln(Vil/Vdd) discharging through the switch
I_spike = Vdd / Rs contact current on each press

Worked example

Debouncing a tactile pushbutton with about 5 ms of bounce, on a 5 V supply, feeding a 74HC14 Schmitt trigger.

  1. Choose C = 100 nF, a convenient ceramic
  2. Schmitt threshold ≈ 0.6 Vdd → −ln(1 − 0.6) = 0.916 time constants
  3. R = 5e-3 / (0.916 × 100e-9) = 54.6 kΩ
  4. Nearest E24: 56 kΩ
  5. Release time: 0.916 × 56000 × 100e-9 = 5.1 ms — just past the bounce window
  6. Add Rs = 220 Ω: press spike = 5 / 220 = 23 mA

56 kΩ pull-up, 100 nF capacitor, 220 Ω in series with the switch. The release edge takes 5.1 ms to cross threshold, comfortably outlasting the bounce, and the contacts only ever see 23 mA.

Practical notes

  • Typical bounce times: 1–5 ms for small tactile switches, 5–20 ms for larger mechanical switches and relays. Measure yours on a scope if it matters.
  • The series resistor Rs is not optional in practice. Without it, the capacitor dumps its charge straight through the contacts every press, which pits them and shortens switch life.
  • Too much RC makes the button feel laggy. Beyond about 50 ms users notice the delay.
  • Feed the output into a Schmitt-trigger input wherever you can. A slow ramp into a plain CMOS input can produce multiple transitions all by itself — exactly what you were trying to avoid.
  • Software debouncing is free. Sample the pin every few milliseconds and accept a change only after several consecutive agreeing reads. Hardware earns its place when the signal drives an interrupt, a counter, or logic with no CPU behind it.
  • For rotary encoders, RC debouncing is usually the wrong approach — it destroys the timing relationship between the two channels. Use a state-machine decoder instead.

Frequently asked questions

How do I debounce a switch with an RC circuit?

Pull-up resistor to Vdd, switch to ground, capacitor across the switch. Size RC so the release edge takes longer to cross the logic threshold than the contacts take to stop bouncing — typically a 5–10 ms time constant.

How long do switch contacts bounce?

Small tactile switches bounce for 1–5 ms; larger mechanical switches and relays for 5–20 ms. It varies with the switch, how hard it is pressed, and how worn it is.

Should I debounce in hardware or software?

Software when a CPU is already polling the pin — it costs nothing and is easy to tune. Hardware when the signal drives an interrupt, feeds a counter, or goes into logic with no processor, and when you need a genuinely clean edge.

Why do I need the series resistor?

It limits the current the capacitor dumps through the switch contacts on each press. Without it that surge is limited only by contact resistance, which pits the contacts and shortens the switch's life.

Why use a Schmitt trigger?

An RC produces a slow ramp, and an ordinary logic input hovering near its threshold can oscillate and draw excessive current. A Schmitt trigger has separate rising and falling thresholds, so it snaps cleanly once and stays there.