Debounce with XOR gate

Thread Starter

jpanhalt

Joined Jan 18, 2008
11,087
I needed to debounce an SPST push-button switch for a counter and had a working debouncer based on a Schmitt NAND gate (CD4093), but out of curiosity, I tried to make one from an XOR gate. My plan was to use a capacitor (C1) to "snub" the bounces, which led to the circuit shown below. It seems to work fairly well, but what surprised me was the interdependence of the values. The value of C1 does not appear to be critical within a wide range. I settled a value for C1 of 220 to 820 pF. Higher values work, but the action is slower. I expected there might be a relationship between R2 and R3 and found the debounce worked best when they were equal (e.g., 1K0 or 1K5). What surprised me was that R1 had to be less than or equal to R2 + R3. In fact, the circuit works best when R1 = R2 +R3. If R1 is greater than that sum, the output stays low regardless of the switch position.

I suspect this is probably a well known filter arrangement , but I don't recognize it. Searches on "XOR debounce" have not been fruitful.

Does anyone recognize the configuration, and can you explain the relationship of R1 to R2 and R3?

Thanks. John
 

beenthere

Joined Apr 20, 2004
15,819
Never seen one before. I have always used a NAND R-S latch setup for debouncing. Check the 74xx279 or the CD4044 for details.
 

Thread Starter

jpanhalt

Joined Jan 18, 2008
11,087
Sometimes it helps simply to write the question out. The answer to the interrelationship question is that the threshold voltage at the top input is about 1/3 Vcc; thus the 2:1 relationship. R3 is not in that equation.

Still wonder if anyone recognizes the circuit. John

Edit: Re. the standard NAND debounce, I wanted to use only a SPST, which is what my foot switch is.
 

Thread Starter

jpanhalt

Joined Jan 18, 2008
11,087
Thanks. I will keep that chip in mind. I ordered the Max6816 earlier today. Boy, those chips are expensive. The MC14490 (hex debouncer) is $6.25 USD at DigiKey. It's about $2.00 per debounce, regardless of whether it is Motorola or Maxim. John
 

Papabravo

Joined Feb 24, 2006
22,116
You can also use an edge triggered flip-flop with either positive or negative edge triggering. The flip-flop also needs an asyncronous clear(set).

The switch is connected to the clock input. The D (or JK) input is setup to a constant value that is clocked in by the switch closure. The asyncronous clear(set) is used to arm the flip-flop for another switch closure.

I'll bet dollars to doughnuts that a garden variety dual flip-flop will beat the Maxim prices.

A transparent latch or a parallel load serial out shift register caqn be used to sample multiple switch inputs so you can debounce in firmware which may or may not be an option for you.

The author Jack Gansle has a huge paper on debouncing techniques. Y'all should give it the once over.
http://www.ganssle.com/debouncing.pdf
 

nomurphy

Joined Aug 8, 2005
567
Attached is a relatively cheap circuit I came up with to debounce multiple logic-level input switches of any type. As presented, it will debounce 16 switches, but you could remove the upper or lower two latches if you only need 8 lines or less. You could also increase the size easily, but closer attention to clock distribution maybe necessary. This is for logic-level applications where the output edge timing is not an issue.
 

Thread Starter

jpanhalt

Joined Jan 18, 2008
11,087
Thank you both. I guess every once in awhile, we all have to re-invent the wheel just to have something to do. True to Ganssle's monograph, R3 is superfluous in my circuit, except it keeps that input tied low. A jumper does the same thing, which gives me essentially the same circuit Ganssle presents (page 12). That is, it's just an RC debouncer with the cap discharging through R2. His does it on closing, mine on opening the switch.

At least now, I can calculate the component values with the confidence gained from a grizzled veteran of the bounce wars at squalid tavern (page 13).

John
 

Papabravo

Joined Feb 24, 2006
22,116
...

At least now, I can calculate the component values with the confidence gained from a grizzled veteran of the bounce wars at squalid tavern (page 13).
John
I thought you might enjoy that one. AFAIK it is the planet's only compendium of empirical switch bounce data.
 

Søren

Joined Sep 2, 2006
472
Hi,

Does anyone recognize the configuration, and can you explain the relationship of R1 to R2 and R3?
It's an "upside down" edge detector, hardly what you want to use for debouncing (au contraire), although it may do as intended IF you get the values to match the bounce time (and nothing drifts). It will have a slight delay though.
 
Top