Switch Bounce

Most people who have dabbled in embedded design know that all mechanical switches have some amount of “bounce” where they are not making solid contact for a short time after being pressed or released.  If you manage to read the button fast enough that you make more than one reading while the button is still bouncing you can get erroneous readings.  I was working on a lab for my microcomputer class that used a flip-flop to de-bounce the rising edge of the button press, but I was still getting extra button press readings when I was releasing the button.  This was obviously a job for scopezilla.  What I found was interesting:

The Culprit!

Rising Edge

Falling Edge

So, the big problem?  Well, it turns out that the glitch that can be seen in the falling edge image was really the problem, not bouncing on the rising edge.  It didn’t occur every time I pressed and released the button, but frequently enough to be a real pain (perhaps 10%).  All of the de-bouncing in the world on the leading edge could not keep the processor from interpreting the high after the glitch as a second button press.  Obviously more sophisticated de-bouncing is required.

About the Author