Q:
Switch bounce in mechanical switches and debounce circuits
Sometimes you may have built a fast-response circuit using a tactile or mechanical switch and wondered why it wasn't working properly. This could be due to contact bounce, also known as chattering.
It seems intuitive that a switch used to make a connection would be quick, direct, and secure. But the reality is slightly different.
Figure 1: Ideal state of switching signal
Figure 2: Actual status of the switching signal
In practice, the switch contacts between conductive points are established or separated by movable mechanical elements. Due to factors such as aging of the switch contact surface, operating inertia, mechanical design, and microscopic conditions, a general switch will undergo multiple transitions within the tens of milliseconds required to open or close the connection. This behavior is often referred to as "switch bounce" and is unavoidable in actual use.
Design of Debounce Circuit
Below we share a simple debounce circuit that can be used to make a low-pass filter using some common discrete components to eliminate this unwanted signal.
A simple RC filter is one of the most economical and simplest ways to make a low-pass filter. When the switch is open, the capacitor is charged through R1+R2, causing the voltage to rise slowly. When the switch is closed, the capacitor is discharged at a controlled rate through R2.
If the filter components are chosen properly, the switch bounce can be absorbed during the charge and discharge process for a smooth transition. To calculate the value of the capacitor and resistor, you can use the following time constant formula for the above circuit:
τ = (R1 + R2)
⋅
C1
-
τ
: time constant (in seconds)
-
R: resistance value (in
Ω
)
-
C: Capacitance value (in F)
The time constant is a balance between the time required to debounce the switch and the time it takes the circuit to respond. In one time constant, the voltage will rise to 63% of its final value or fall to 37% of its final value. In both cases, the voltage will reach 99% after five time constants.
For example:
-
Bounce time: The specification specifies 10ms
-
R1 is chosen to limit the current, a typical value of
1
kΩ
is acceptable.
-
R2: Choose from two standard values for debounce: 10 kΩ
and
47
kΩ
-
The power supply voltage is 5 VDC
Therefore, the two capacitor values are calculated as:
C1= τ / (R1+R2)
This then yields two ranges of values for this circuit:
-
Solution 1: R1 = 1 kΩ
,
R2 = 10 kΩ
,
C1
= 1
µF
-
Solution 2: R1 = 1 kΩ
,
R2 = 47 kΩ
,
C1 = 220 nF
Adding a D1 diode across R2 allows the charge and discharge times to be controlled separately. This way, using R1 and D1 gives a faster transition time for charging the capacitor, while using only R2 gives a different discharge time for the capacitor because the diode is in a blocking state in this case.
If the application cannot support undefined values (such as 0.8V and 2.5V), it may be necessary to use a Schmitt trigger buffer with hysteresis. The following figure shows a circuit with different turn-on and turn-off times and additional hysteresis. The response time of the circuit may need to be coordinated with the sampling time of the microcontroller.
If the switch is located further away or at the end of a long line, protection from overvoltage, ESD or other transients may be required. This can be as simple as a ferrite bead and TVS diode in front of the input circuit.
For more technical information about switches, please see the following
:
Finally, if you like this article, please share it with more friends
!
Remember to give it a thumbs up
!
Tips
Click on the menu to design
Design
support: Engineer Tips, get more tips for engineers
If you
think this content is good
Please forward or share to
Moments
if there is any problem
,
Welcome to contact Digi-Key
Digi-Key
Customer Service Team
China (RMB) Customer Service
Support > Contact Customer Service > WeChat Customer Service
QQ online real-time consultation | QQ number: 4009201199
China (US dollars) / Hong Kong Customer Service
china.support@digikey.com
Search for "digikey"
or "
Digikey Electronics"
on WeChat,
follow our official WeChat account and register as a member to receive engineers' tips every week, earn points, exchange for gifts, and enjoy benefits.
↙
Click "Read More" below to see more
Let me know you
're
watching