Table of Contents
Debouncing aims to eliminate the unavoidable rapid switching that usually occurs while the metal contacts of mechanical switches come together and bounce off each other repeatedly.
When metal comes into contact with metal, the energy that brought them together is usually high enough that they bounce off each other slightly. Often bouncing multiple times, until they settle down.
Whatever is holding the metal contacts may also shift, causing them to bounce even more.
Switches have the 2 states of either being on or off.
- On is commonly approx. 5V (when powering the circuit with 5 volts). That is usually referred to as a high signal in digital electronics.
- While off is commonly approx. 0V. This is usually referred to as a low signal in digital electronics.
- You can can often be about 2 volts away from 0V or 5V and the input of many circuits will still sense a high or low change of state.
- Schmitt trigger hysteresis adds a small range of voltages between 2 change of state voltages. In the hysteresis range, the input stays in the last high/low state that it was put into.
- Example: If there is hysteresis, and 0 to 2V is considered low, while 3 to 5V is considered high, then the output will not change high or low state while the signal voltage is between 2 and 3 volts.
Circuitry that is highly sensitive to rapid voltage changes, might respond to each bounce. That is a problem when the number of input signal changes matters.
Debouncing:
Adding a capacitor and discharge resistor will slow down how quickly the voltage can drop. You want it to be slow enough that it doesn’t drop in between bounces, but quicker than how often you will be pressing the button again.
Inputs that are sensitive to switch bouncing likely already have a pull up or pull down resistor to prevent stray signals from false triggering them. That resistance can be used to discharge the capacitor. A load or low impedance input may also help discharge the capacitor.
You will have to try out different value capacitors until you find the one that works best considering the variables mentioned above.
You will actually probably need to use a integrated circuit that can deliver timed pulses or other bounce free outputs. They respond to either the rising edge, or falling edge of a signal. Ignoring any bouncing shortly afterwards.
Video:
To support this site, check out the following links:
Art of electronics is easily my favorite learning electronics book. It helps to already be familiar with basic electronics while studying it. It inspires many of my demonstration circuits. An affiliate link ad that supports this site.
- Become a Patron!
- Check out my YouTube videos! https://www.youtube.com/c/Electronzap/videos
- Products I used in my videos or otherwise think look like a good buy. As an Amazon associate, I earn from qualifying purchases. https://www.amazon.com/shop/electronzapdotcom
- Information on this site is not guaranteed to be accurate. Always consult the manufacturer info/datasheet of parts you use. Research the proper safety precautions for everything you do.
- Electronzap is a participant in the Amazon Services LLC Associates Program, an affiliate advertising program designed to provide a means for sites to earn advertising fees by advertising and linking to amazon.com.