Continue to Site

Welcome to our site!

Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

  • Welcome to our site! Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

debouncing circuit

Status
Not open for further replies.

meowth08

Member
Hi,

I found this debouncing circuit with no component values.
I tried guessing values for R1, R3, and C1 since I have no idea on how to choose the values correctly.
Also, I am uncertain if the parameters of the PULSE controlling the voltage controlled switch will be like the situation in switch bounce.

Could you please guide me to find correct values for my components? Also kindly help in choosing the correct parameter for the PULSE.
 

Attachments

  • debouncing circuit.png
    debouncing circuit.png
    36.5 KB · Views: 293
  • sim for switch.asc
    1.5 KB · Views: 243
I mean I found the circuit here.

I was the one who made the simulation and the one who placed component values.
 
In that case, you're values look good. You have a time constant around 25mS and that should take care of most (all except a wire and nail) switch bounce situations.

Mike.
 
I thought the values are somewhat incorrect.
As we can see from the waveforms, V(n003) shows a switch bounce. From 5 volts, it goes down to 0 volts for about 2mS.
What I expect is that V(out) will remain at 5volts even there was a switch bounce but the waveform says my expectation is wrong.
 
I thought the values are somewhat incorrect.
The time constant R3C1 needs to be increased by a factor of ~100, e.g. make C1 = 470n. Your simulated switch bounce would be more realistic with at least ten cycles each having a period of, say, 2ms instead of 10ms.
 
Changing C1 to 470n and the PULSE, the output remained at 0 volts.
What I am expecting is that the moment the switch is turned on, the output will be at 5 volts.
Even when bounce occurs, the output will still hold a value of 5 volts.
 

Attachments

  • debouncing circuit2.png
    debouncing circuit2.png
    37.9 KB · Views: 267
D1 is the wrong way round.
 
Why the diode? I would lose the diode and make the resistor ratio higher, ie 1k and 47k. That will also slow down the time constant ie now 47k:4n7. GOing slower still won;t hurt, you could increase the cap size.
 
My mistake. The circuit I have posted was wrong.
The inverter should be an inverting schmitt trigger.

Starting with the switch open.

The capacitor C1 will charge via R1 and D1.
In time, C1 will charge and Vb will reach within 0.7V of Vcc.
Therefore the output of the inverting Schmitt trigger will be a logic 0.

Now close the switch

The capacitor will discharge via R2.
In time, C1 will discharge and Vb will reach 0V.
Therefore the output of the inverting Schmitt trigger will be a logic 1.

Now, could you please guide me on properly simulating the circuit and what proper values to place? Many thanks.
 

Attachments

  • switch debounce.png
    switch debounce.png
    43.4 KB · Views: 270
Those circuits are wrong. D1 should be reversed. The sim you posted in post #7 will work correctly if you just reverse the diode (see post #8).
 
The input is held at vcc causing the output to be low.
Switch closed...input low...output goes high....

Looks like it functions correctly (like the op wants) to me....

Diode is OK...but will work without it.

See sim...with new values.

eT
 

Attachments

  • Debounce2.png
    Debounce2.png
    84 KB · Views: 275
So why is the diode needed? With a big enough ratio between the two resistor values, there will be roughly the same time constant for cap charge as for cap discharge, which gives a perfect debouncing effect, and no diode is needed. I've never seen diodes in commercial debounce networks in products.
 
Those circuits are wrong. D1 should be reversed. The sim you posted in post #7 will work correctly if you just reverse the diode (see post #8).

Yes sir. The reason why there's already +1 below is that I tested it and it worked.

I'll try MrRB's approach. Losing the diode would be more economical as long as the desired effect is fulfilled.

@eTech: Thanks for the sim. Your test is more realistic bounce than what I posted. However, I'm still trying to learn the PWL. I have not much experience in simulations. As a matter of fact, the reason why R2 is not present is that I used a resistor as the switch when I first simulated the circuit. :D
 
I am a little surprised that Ganssle's excellent discussion has not been referenced in this thread:

http://www.ganssle.com/debouncing.pdf


The Schmitt inverter circuit, without diode, is discussed under RC Debouncer beginning on page 13 of the first link. It is also discussed in the second link.

John

Oops, how times change. I guess the original is no longer up. Both links I gave go to the same place now. Forget the page reference; just go to the RC Debouncer section.
 
Last edited:
So why is the diode needed? With a big enough ratio between the two resistor values, there will be roughly the same time constant for cap charge as for cap discharge, which gives a perfect debouncing effect, and no diode is needed. I've never seen diodes in commercial debounce networks in products.

Here's an excerpt from the ganssle doc linked in post 16:

"The diode is an optional part needed only when the math goes haywire. It's possible, with the wrong sort of gate where the hysteresis voltages assume other values, for the formulas to pop out a value for R1 + R2 which is less than that of R2. In this case the diode forms a short cut that removes R2 from the charging circuit. All of the charge flows through R1. The previous equation still applies, except we have to account for drop across the diode. Change Vfinal to 4.3 volts (5 minus the 0.7 diode drop), turn the crank and R1 pops out. "

eT
 
Thank you for that information. :)

It just needs the resistor ratio to be high enough ie >10:1 and it should always work with no diode needed.

With a ratio >10:1 you can virtually ignore the effect of the smaller value resistor so your RC time constant is almost totally dependent on the larger resistor and the cap.
 
The diode (when correctly polarised) reduces the response time of the circuit to switch closure, which may be important in some applications.
 
Status
Not open for further replies.

Latest threads

New Articles From Microcontroller Tips

Back
Top