The Rusty Spike

A Railroad Fan's Website


Pushbutton ‘Bouncing’ and How to Fix It

I recently ran across an article on the TI Wiki that does a great job explaining the strange behavior of a pushbutton when attached as an input to a Launchpad. I was getting very erratic pin HI LO readings when a pushbutton was pressed or released. I have re-posted some of the contents here on my blog for my own personal reference. The original author retains the copyright.

Bouncing occurs while a pushbutton is changing state and during the first few nanoseconds after state has stopped changing. It is a physical machine and the electrical contact is not perfect. We should not expect perfect electrical performance. Pushbutton Bouncing fixWhen controlling a light, LED, or motor directly, these bounce effects are so miniscule that they are often unnoticed. A microcontroller is extremely sensitive to electrical noise and pushbutton bounce is a bit of an issue.

Since bounce is simply unstable performance during state change, a capacitor can be used to smooth out performance. The picture shown depicts a pin (P1.3) attached to a pull up resistor and a pushbutton is used to ground the pin. Note the capacitor wired in parallel to the switch. Wired in this fashion, the capacitor acts as a ‘buffer’ to smooth out the poor electrical performance of the pushbutton.

Again, this information can be found in a bit more detail on TI’s information Wiki.

Leave a Reply

Your email address will not be published. Required fields are marked *