Skip to content

Button Debouncing

Normal push buttons are not perfect at their contact points. It may cause to produce multiple press effects when we just click it once. That will cause undesired side effects on the program running microcontrollers.

Debouncing means to convert those unwanted presses to single press for a definite period.

This very good and detailed article helped me to understand the concept well: Embed With Elliot: Debounce Your Noisy Buttons, Part I

Debouncing can be handled either by software or by hardware methods.

By Software

It is easier to perform software debouncing as it does not require circuit changes. However it will reduce performance of the program running in microcontroller as microcontroller will invoke the event handler for all of the multiple presses physically produced by the button.

The idea is to keep track of the last press time and not to invoke button press handling code if more presses happen within a time period.

By Hardware

It requires change in circuit. But it is efficient as undesirable event handler executions will not be happening in microcontrollers.

The simplest way would be the one as shown below.

Simple button debouncing

More elegant one with hysteresis fix can be achieved with logic chips like 74HC14. Here is the one I commonly use in my circuits.

Button debouncing using 74HC14

Of course it has disadvantages like requiring more components and space.