# Calculating R and C for schmitt trigger debouncer

I've been looking all over the internet to try to figure out the optimal values for R1, R2, and C but couldn't find info.

I'm trying to ideally make a debouncer that will work with any button on the first white keypad listed here.

I used 47nF for the capacitor and 2.2K resistors for each resistor but I'm not quite sure if that combo is right. I want the button to respond as fast as possible without debouncing. Say, maybe 500uS waiting time between presses.

I then searched for RC calculators online and found two that gave two different results based on the same values I used:

According to http://referencedesigner.com/rfcal/cal_05.php, their answer is 206.800 uS

According to http://sim.okawa-denshi.jp/en/CRtool.php, their answer is 769.60804203044Hz and converting that to time gives me 1.3mS.

Which answer is right? How do I determine lowest RC delay I should use?

The datasheet that comes with the above mentioned keypad does not specify the debounce rate of any of its buttons.

• Mike, that keypad is bare-bones and is actually meant to be scanned and debounced using software and an MCU. It has 7 pins for 12 switches.
– jonk
Apr 28, 2018 at 6:17
• I did get it working with 47nF for the caps and 2.2k for resistors and in software a 512uS delay between each scan Apr 28, 2018 at 16:45
• I'd like to see how you wired that up. It's really just supposed to be scanned and debounced in software (without more than perhaps some pull-up resistors if your I/O doesn't already include such things.)
– jonk
Apr 28, 2018 at 20:39

## 3 Answers

For filtering, C1 should be at the inverter. R2C2 form the debouncing filter. R2 can be a high value so C1 can be smaller. R2C2 also form a low pass filter to remove RF interference and noise spikes.

simulate this circuit – Schematic created using CircuitLab

R1 is sized to set the switch current. If you go looking closely, you will see that switches (and relays) have a minimum current, as well as a maximum current.

Non-gold/non-carbon contacts need significant current - not microamps.

When you operate them below the minimum current, oxides can build up on the contacts until they no longer conduct. This becomes an issue when you use something like a micro switch with silver contacts that is rated for 2A current.

Many switches have totally different contact versions in the same body. e.g these micro-switches have wetting current 1mA for 0.1A version and 160mA for the 10A version. The micro-load graph shows thar it is voltage dependent.

From just this one graph I will suggest a rule of thumb of 1/50 of maximum current.

Sometimes an electrolytic capacitor is across the switch, like your diagram, to ensure the oxide is burnt off in a small splat each time the contact closes. This can help high current contacts, but burn out low power gold ones.

In my experiments, I found that switches need to be sampled faster than 15Hz to avoid the perception that they are slow or miss. 10ms is probably an adequate debounce time, though there are some keyboards so bad they could play basketball.

• Non-gold/non-carbon contacts need significant current - not microamps. ... Do I just assume every key that doesn't have extended info (such as the one I show) have contacts that aren't gold or carbon? and how much current are we talking here? Apr 28, 2018 at 15:20
• keypads tend to be very low max current and gold or carbon 1k to 10k is good. go read datsheets. Apr 28, 2018 at 17:40
• below the minimum current, oxide can build up on the contacts. I don't understand? Could you please elaborate? Physics or Chemistry article on it maybe? Nov 30, 2021 at 17:22

Your human reaction times are far greater than your spec time. To make matters worse , the keypad degrades contact bounce frequency with excessive force often found at car wash kiosks with impatient drivers and other similar applications.

Since max key entry rates can be expressed as 10 Hz , but for short travel switches, a reasonable filter time is 5 to 15 ms. (test and verify and allow for finger trouble)

Since the logic gate hysteresis is 2/3 Vdd which is close to T=R2C1 use that for your design then verify. R1 is only to limit current should ESD ever get past the plastic edges to the input, which depends on the performance of the design and your system spec from 3kV to 15kV

• rates can be expressed as 10 Hz a reasonable filter time is 10 to 15 ms. ... I'm confused... isn't 10hz = 100ms? or are you caluclating the 10ms differently? Apr 28, 2018 at 15:22
• I forgot to mention user interface expects a fast response of about 10% latency of the maximum key entry rate. I would not want it too fast nor have latency limit key stroke entry rate. you will have to experiment with key velocity and travel for each key entry (1.5mm?) to determine how short an entry is valid. It may be less like 5ms. Apr 28, 2018 at 16:01

Designs are seldom optimal because too many parameters are unknown, uncontrolled, temperature-sensitive, etc.

When you want "As fast as possible", think about that.

What you want is NO BOUNCING, right?

Then be conservative in implementing a de-bounce function.