Continue to Site

Welcome to our site!

Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

  • Welcome to our site! Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

Switch Debouncer - What's Best?

Status
Not open for further replies.

adamey

Member
I'vebeen searching for a simple reliable switch debouncer and have come across so many different ways of doing it. From simple RC circuits to invertors/nand gates to 555 timers to dedicated IC's made just for this.

So why do we need so many different methods to debounce a switch? Is any method better? Do we really need 20 ways to do this?
 
There are often many different ways to solve a problem. The fact that there are so many different ways to debounce a switch only makes life easier. The best method depends on the application.
 
I think a lot of it has to do with cost. Debouncing against every effect and transient involved requires bulky expensive circuitry that takes up a lot of room. Depending on the operating environment and the sensitivity of the circuitry the switch is leading to you aren't always concerned with, you don't always have to take precations to shield the circuitry from all transient effects. So you can save on cost and space by reducing the analog parts of the debouncer, and maybe even reduce it to all digital (but this is mainly for debouncing ICs where using flipflops, timers, and counters to the debouncing takes up no extra space despite all the parts involved), all the way down to software only.

I think there, in general, there are 3 basic levels
Software only
The least expensive and smallest, but least robust method. ALso eats up processing cycles. Does not protect against real world transients and ringing that may be present. Requires the input signal to meet the strict voltage thresholds and timings of a square wave digital signal.

Digital hardware
Similar to software method except does not eat up processing cycles and takes up more space. Usually a lot more space if you actually build it out of discrete logic gates, counters, registers, and timers. It's no problem for ICs built to do the debouncing though since they can miniaturize everything. Such ICs usually have some analog components on the front end to better cope better with ringing and transients.

Analog hardware
THe most robust, but most expensive and bulky approach. Analog components are used to filter, clamp, or dampen the signal in the analog domain to deal with ringing, transients, and otherwise potentially non-squarewave like characteristics of an input waveform. They also use comparators to convert a low-rise time input waveform into a square-wave form better suited for digital processing.

And of course, you can cascade these methods or mix and match pieces of each together. For example, you can have some rudimentary analog parts on the front end of a digital hardware or software only approach to help cope with damaging real world transients. Or you might use the analog filter to condition the input waveform into the comparator, and then follow it with a digital filter of sorts (whether with software or digital hardware) to further extend the stablization time required.

YOu might have picked up on this or not...but it's not a good idea to use heavy analog filtering without a comparator because they can slow the rise time of the signal to the point where it no longer meets the timing requirements for a digital circuit to properly pick it up. Even comparators can have such requirements but can include large hysteresis to cope so you don't spend any time in the "gray region" where a digital circuit's voltage thresholds won't work properly.
 
Last edited:
Status
Not open for further replies.

New Articles From Microcontroller Tips

Back
Top