Go Down

Topic: Schmitt trigger questions (Read 3910 times) previous topic - next topic

randydpeck

I have several different push buttons in my project and think I'll just use Schmitt triggers to deal with debounce, rather than adding complexity to my code.  But I have a couple of questions:

1. I have seen two different schematics for how to connect a Schmitt trigger for debouncing switches with Arduino.  Can anybody advise if one is better than the other, and why?  Examples of each version attached.  You can see that one circuit has an addition resistor, R2.  Not sure what that does?

2. Possibly related...my understanding is that with a Schmitt trigger (and surrounding resistor-capacitor circuit) I don't need a pull-up or pull-down resistor between the Schmitt output and the Arduino input pin, because the Schmitt trigger will always put out either a high or low signal (so long as it has power) -- correct ASSumption?

Thanks for your valuable insight!

Randy

larryd

#1
Mar 28, 2016, 10:01 pm Last Edit: Mar 28, 2016, 10:05 pm by LarryD
#1 has delay on release.
#2 has delay on push and longer delay on release.

Your schmitt trigger is either high or low.
No technical PMs.
If you are asked a question, please respond with an answer.
If you are asked for more information, please supply it.
If you need clarification, ask for help.

randydpeck

All settled!  Thanks Larry!

Randy

MarkT

The circuit with one resistor shorts the 10uF capacitor to ground though the switch
contacts, which might cause wear and tear to the switch when large discharge currents
flow.

Software debounce can be easier - so long as you keep the debounce code separate from the
rest of the logic, either via a function or library - then it won't add complexity to the business
logic.  You can then tune the debounce delay later without having to resolder your circuit!
[ I DO NOT respond to personal messages, I WILL delete them unread, use the forum please ]

Paul__B

Proper software debounce - not using interrupts - is much more reliable.

The whole point of using microcontrollers is to reduce the need for hardware solutions to problems.  It is most unlikely that you will be running out of code space just for some proper debounce code.





The resistor values are wrong, resulting in asymmetry.

gpsmikey

The second one with the two resistors is definitely the better way to go - especially if you have one of those tactile type switches with light contacts.  Discharging the capacitor directly without any current limit will eat those switches in a fairly short period of time - the second one with R2 as a current limit for the discharge is much better (you could even go lower on R2 to make it faster).
mikey
-- you can't have too many gadgets or too much disk space !
old engineering saying: 1+1 = 3 for sufficiently large values of 1 or small values of 3

123Splat

Paul_b hit the nail on the head.  If you don't want to use software to serve the solution, why are you wasting time with a micro controller?  I've got bucket loads of 2n2222's, 2n3904's, NE555's, and 74xx chips you can use.


Go Up