Hardware debounce/buffer for a tilt switch - Page 1
Forum section: electronics / projects

author: mcinque
author_rank: Unknown
timestamp: December 20, 2013, 07:24:51 pm
content: I'm trying to clean up the output signal coming out from a standard "ball" tilt switch, and I can't do it by software, it must be done in hardware. I know that in software it would be damn easy, but as I stated before, I can't use software in this.Trying the the "standard" debounce circuit with a capacitor and a schmitt trigger (Image courtesy by Ikalogic),I see that most of the bounces are cut out during normal operations, but when the tilt switch SW is tilted at 45 degree I can see many bursts of readings caused by the unstable position of the ball inside the switch.Changing the value of C1 doesn't help.I need to cut out all the burst generated by that switch and obviously a Schmitt trigger can't do that kind of job since it simply"keep its outputs unchanged until the input have safely reached above or below some threshold values, which define the High and Low logic states."Setting the right div/ms on the DSO shows that those bursts are infact a very fast sequence of logic states (the schmitt trigger is doing its job).After some resarch I've found a component that could solve my issue: MAX6816 "These switch debouncers remove bounce when a switch opens or closes by requiring that sequentially clocked inputs remain in the same state for a number of sampling periods.The output does not change until the input is stable for a duration of 40ms."That's exactly what I need, but they are available only in SOT SMD package: it's too small to solder without the proper equipment.Do you know any other TH equivalent component? Or maybe can you suggest me a TH circuit that could act as a buffer, changing the output only when the input is stable for a duration of Xms?Many thanks for your help.

author: SeanB
author_rank: Super Contributor
timestamp: December 20, 2013, 07:39:33 pm
content: Resistor pull up of around 1k2, 10uF capacitor and a series resistor to the switch of around 220R will help to get a lot of the bounce out. The resistor slows down the discharge and forms a low pass filter to get a lot of the noise out but has a pretty long delay on the switch output.

author: mcinque
author_rank: Unknown
timestamp: December 21, 2013, 11:36:24 am
content: Thank you!Since I need a lot of delay I've put a bigger cap and since the output has some ripple I've put a 1uF decoupling on the output of the schmitt trigger. Tested with DSO and works really fine, no interferences at all.

author: tszaboo
author_rank: Super Contributor
timestamp: December 21, 2013, 12:01:03 pm
content: Quote from: mcinque on December 21, 2013, 11:36:24 amThat is 470 uF you put on a digital signal. I have less capacitance on switching converters. It will power your circuit through the trigger when you turn it off.Why don't just use a retriggerable monostable multivibrator.

author: dannyf
author_rank: Super Contributor
timestamp: December 21, 2013, 12:11:08 pm
content: QuoteThat's the usual but always wrong debouncer you see everywhere: it works really well with poor quality switches but poorly with good quality switches, particularly when the capacitor is of high capacitance - just think about the discharge of the capcitor when the switch is closed.The correct debouncer has one extra resistor, and it is implemented differently from the schematic you attached later.QuoteThe usual mistake made here is to increase C1.

author: mcinque
author_rank: Unknown
timestamp: December 21, 2013, 04:27:09 pm
content: Quote from: dannyf on December 21, 2013, 12:11:08 pmCould you please link a schematic?

author: 6502nop
author_rank: Regular Contributor
timestamp: December 22, 2013, 09:30:02 am
content: Thirty threeyears ago, I bought a book at Radio Shack that solves your problem.I'm with Nand on this one:Why not use a retriggerable monostable multivibrator?And,Why not Zoidberg?The venerable 555 fits the bill perfectly. The switch triggers the timer, which ignores any further input until the timing period is done. Simple.Also, Slashdot is having (had?) a question-and-answer with Forrest.nop(Kudos should really go to Hans, though...)

author: nctnico
author_rank: Super Contributor
timestamp: December 22, 2013, 12:41:27 pm
content: The problem with that circuit is that a pulse (ESD event) could trigger a false pulse. I like the solution proposed by SeanB: just filter the signal and run it through a Schmitt-trigger.

author: mcinque
author_rank: Unknown
timestamp: December 24, 2013, 01:54:53 pm
content: thank you 6502nop!

author: Pack34
author_rank: Frequent Contributor
timestamp: December 24, 2013, 07:47:48 pm
content: Wouldn't using a 555 like that for switch denouncing be a bit excessive if you're using more than one switch? If you have a setup using 10 or more switches, wouldn't a simple low-pass filter and Schmitt trigger combo be the more cost efficient solution? Then you could always double it up with some software denouncing by requiring the switch to be low for two cycles through the loop before activating the bit in firmware.555s aren't the most expensive chip but if you need one for every input then it can add up rather quickly.

author: calexanian
author_rank: Super Contributor
timestamp: December 24, 2013, 07:55:05 pm
content: I specify my switches with the highest durometer material I can find. That way they bounce less! O0 hahahahaha

author: Mr Smiley
author_rank: Frequent Contributor
timestamp: December 25, 2013, 07:24:30 pm
content: Quote from: mcinque on December 21, 2013, 04:27:09 pmHere you gohttp://www.labbookpages.co.uk/electronics/debounce.htmlhope it helps, there are other methods shown as well

author: Pack34
author_rank: Frequent Contributor
timestamp: December 25, 2013, 08:27:40 pm
content: Quote from: Mr Smiley on December 25, 2013, 07:24:30 pmInteresting thought with the diode in the LP-Schmitt debouncing circuit. However, depending on the expected speed at which the switch the extra component may, or may not, be necessary. Assuming a 10k pull-up and a generic 10k an 0.1uF LP filter your total charge time for the cap will be 6 msec as opposed to 3 msec for the circuit with the diode. The added diode improves the circuit but may or may not be necessary.

author: mcinque
author_rank: Unknown
timestamp: December 26, 2013, 05:31:04 pm
content: Quote from: Mr Smiley on December 25, 2013, 07:24:30 pmThank you!!