Subscribe to EDN
RSS
Reprints/License
Print
Email

Examining switch-debounce circuits

By Ron Mancini -- EDN, February 21, 2002

When a switch closes, the contacts do not close instantly and finally. The contacts close, then bounce open, and this cycle repeats for a period, depending on the switch-manufacturing technology. The length of the bounce cycle is the "bounce time" (TB).

You must eliminate switch bounce because each switch closure causes the output to change its voltage level, and the multiple switching sends a series of pulses to the remaining circuitry. A counter counts the bounces and flip-flops act crazy, so reliable operation requires the elimination of the bounces.

Switch-debounce circuits have been around for a long time, but I'm revisiting them because the art of designing them has skipped a generation of engineers. One example of a switch-debounce circuit puts a hysteresis gate after the switch, hoping that the gate's input hysteresis will pull the input up through the gate threshold. This battle is a losing one because the hysteresis, combined with the switch bounce, causes rail-to-rail switching. Another type of switch-debounce circuit uses a flip-flop after the switch, hoping that the flip-flop's feedback will cause it to change state on the first bounce. This circuit is subject to Murphy's law; it works 99% of the time and seems to fail only when management or customers are watching. Often, the first bounce has enough energy to get the flip-flop to change its output state, but the bounce lacks enough energy to meet the flip-flop's setup-time requirements. Thus, the flip-flop reverts to its original state.

Figure 1 works in all cases when you correctly design it. Before the switch closure, the capacitor charges to 5V, and the gate output is low. When the switch closes, the capacitor discharges through R2 until the voltage decreases enough to cause the gate to switch. Thus, the key to reliable operation is to ensure that the switch bounce stops before the gate reaches its input threshold voltage. Otherwise, the discharge time, R2C, must be greater than the bounce time, TB. This example uses a CMOS hysteresis gate with a threshold voltage of 0.45 to 0.55 times VCC. The discharge equation is:

where TB=1 msec, Vth=0.55VCC, R2C=1.67(10–3), C=0.1 µF, and R2=16.7 kΩ.

The measured time until the gate reaches its threshold voltage is a bit longer than you might predict because the switch bounce prolongs the capacitor discharge time when it opens the circuit. R2 must sink the input leakage or the low-level input current that flows out of the gate. In this CMOS example, the gate input current is on the order of 1 µA, so the final low-level input voltage is 16.7(103)(10–6)=16.7 mV. If this were a junction transistor gate, the input current would be in the milliamp range. You use a hysteresis gate because the R2C filter causes the gate voltage to have a slow fall time. Slow rise or fall times keep the gate in its low-noise-immunity-threshold region for a long time, so you need hysteresis to pull the input out of the threshold the first time the gate switches.

When the switch opens, C charges through R1 and the diode. You can select a small value for R1 because switches do not tend to bounce when they open; the switch manufacturer or measurements must verify the bounce time and whether there is no bounce on opening. Selecting R1C as a small time constant enables a fast recovery time; this quick recovery time helps prevent malfunction when an operator actuates the switch multiple times. You size R by the amount of idle current you are willing to sacrifice.



Author Information
Ron Mancini is staff scientist at Texas Instruments. You can reach him at 1-352-569-9401, rmancini@ti.com.
RSS
Reprints/License
Print
Email
Canon Resource Center

Featured Company


Most Recent Resources

Advertisement
Related Content

No related content found.

  • 0 rated items found.
Advertisement

KNOWLEDGE CENTER

Datasheets.com Parts Search

185 million searchable parts
(please enter a part number or hit search to begin)
Engineering Careers
Jobs sponsored by
Advertisement
About EDN   |   Site Map   |   Contact Us   |   Subscription   |   RSS
© 2012 UBM Electronics. All rights reserved.
Use of this Web site is subject to its Terms of Use | Privacy Policy

Please visit these other UBM Canon sites

UBM Canon | Design News | Test & Measurement World | Packaging Digest | EDN | Qmed | Pharmalive | Appliance Magazine | Plastics Today | Powder Bulk Solids | Canon Trade Shows