Debouncing for Fun and… Mostly, Just for Fun

In our minds and our computer screens, we live in an ideal world. Wires don’t have any resistance, capacitors don’t leak, and switches instantly make connections and break them. The truth is, though, in the real world, none of those things are true. If you have a switch connected to a lightbulb, the little glitches when you switch are going to be hard to notice. Hook that same switch up to a processor that is sampling it constantly, and you will have problems. This is the classic bane of designing microcontroller circuits and is called switch bounce. [Dr. Volt] covers seven different ways of dealing with it in a video that you can see below.


While you tend to think of the problem when you are dealing with pushbuttons or other kinds of switches for humans, the truth is the same thing occurs anywhere you have a switch contact, like in a sensor, a mechanical rotary encoder, or even relay contacts. You can deal with the problem in hardware, software, or both.



Adding a low-pass filter with a resistor and a capacitor is one method. But you might be surprised to find that some circuits will be happy with that and others won’t. Why? [Dr. Volt] will show you on a scope.


Before you head to the comments to tell us that you can do it with a 555 timer, don’t worry. He covers that too, as well as some software methods, including what to do if you are using interrupts. We like that the example circuit was a VFD tube counter circuit.


We’ve presented our solutions to this ..

Support the originator by clicking the read the rest link below.