Article count:1547 Read by:1783867

Account Entry

If you want a switch to react quickly, a debounce circuit is essential! How to design it? Here's how

Latest update time:2022-04-27
    Reads:
Q
A
&

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.



How switch contacts work


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.
Mechanical switches sometimes list their bounce time information in the data sheet, as shown in Würth Elektronik 's WS-TASV Series J-Bend SMT Tactile Switch 4.7x3.5mm .




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.

Add filter


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
  • 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 diode


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.


Adding a buffer


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.


Transient protection


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.




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



Good stuff, share it
If you think this content is good
Please forward or share to Moments

DK Member Center Center Welfare

Have you joined?


Points can be exchanged for various gifts

Go to the "Member Benefits" page!

if there is any problem , Welcome to contact Digi-Key

Digi-Key Customer Service Team



China (RMB) Customer Service
400-920-1199
Support > Contact Customer Service > WeChat Customer Service
service.sh@digikey.com
QQ online real-time consultation | QQ number: 4009201199

China (US dollars) / Hong Kong Customer Service
400-882-4440
852-3104-0500
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

 
EEWorld WeChat Subscription

 
EEWorld WeChat Service Number

 
AutoDevelopers

About Us Customer Service Contact Information Datasheet Sitemap LatestNews

Room 1530, Zhongguancun MOOC Times Building,Block B, 18 Zhongguancun Street, Haidian District,Beijing, China Tel:(010)82350740 Postcode:100190

Copyright © 2005-2024 EEWORLD.com.cn, Inc. All rights reserved 京ICP证060456号 京ICP备10001474号-1 电信业务审批[2006]字第258号函 京公网安备 11010802033920号