Re: switch debouncing
- From: Fred Bloggs <nospam@xxxxxxxxxx>
- Date: Mon, 17 Oct 2005 13:50:40 GMT
Is there a standard or best way to de-bounce a switch?
What is it with you people looking for a "standard way" all the time?
After googling for a bit, this seems to be a good candidate:
VCC | \ R1 / \ / | Schmitt | trig inverter | |\ +---/\/\/--+-----| >-- out | R2 | |/ S1 \ = C | | --- --- GND GND
R2 might be 18 k, and R1 82 k, with a 1uF cap as per this article:
http://www.embedded.com/showArticle.jhtml?articleID=18902552
Seems like it should work. Any comments?
Pure "bit head" guess work. The worst case occurs when the switch opens on bounce immediately after pulling the Schmitt input across its low threshold and the circuit starts to recharge C back towards Vcc. You obviously don't want the voltage to cross the positive threshold again. Using VT+ as positive threshold, VT- as negative threshold, and VH as hysteresis, a worst case calculation for the 74HC14 would look something like this when you settle on a maximum bounce time an order of magnitude larger than switch specification. This usually means less than one chance in a billion of ever seeing a glitch aka switch has failed. A 5ms switch calculation would look like so:
View in a fixed-width font such as Courier.
. . . . VCC . | . | . [R1] . | . | . | |\ . +-[R2]-+----| o-------> . | | |/ . o | . -| === 74HC14 . o |C . | | . +------+ . | . --- . /// . . . . Vcc-VT- . Worst Case: tau=(R1+R2) x C Tchrg= tau x LN( ------ ) . Vcc-VT+ . . Vh,min 0.4 . Tchrg= tau x LN ( 1 + -----------) = tau x LN(1 + -----) . Vcc-VT+,min 5-1.7 . . . . Tchrg,min= tau x 0.1 must exceed Tbounce_high,max . . . R1=82K and R2=18K C=1u => tau=100ms => Tchrg,min= 10ms . . . This is insufficient. Allow for Tbounce_high,max=50ms then . . . tau x 0.1 = 50ms or tau=500ms => C=4.7u for R1=82K and R2=82K . . . 1u . max lkg charge up = dV/dt = --- = 0.2uV/us x 50ms=10mV worst case . 4.7u . . -5 . maximum hold down time= 18K x 4.7U x LN( ---- ) = 150ms . -0.9 . . .
.
- References:
- switch debouncing
- From: Mac
- switch debouncing
- Prev by Date: Re: Digital<->RF 900MHz tranceiver chip
- Next by Date: Re: Which pin is pin 1, followup
- Previous by thread: Re: switch debouncing
- Next by thread: Re: switch debouncing
- Index(es):
Relevant Pages
|