Author Topic: Hardware debounce/buffer for a tilt switch  (Read 8457 times)

0 Members and 1 Guest are viewing this topic.

Offline mcinqueTopic starter

  • Supporter
  • ****
  • Posts: 1131
  • Country: it
  • I know that I know nothing
Hardware debounce/buffer for a tilt switch
« on: December 20, 2013, 07:24:51 pm »
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.
 

Offline SeanB

  • Super Contributor
  • ***
  • Posts: 16386
  • Country: za
Re: Hardware debounce/buffer for a tilt switch
« Reply #1 on: December 20, 2013, 07:39:33 pm »
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.
 

Offline mcinqueTopic starter

  • Supporter
  • ****
  • Posts: 1131
  • Country: it
  • I know that I know nothing
Re: Hardware debounce/buffer for a tilt switch
« Reply #2 on: December 21, 2013, 11:36:24 am »
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.
 

Offline tszaboo

  • Super Contributor
  • ***
  • Posts: 8285
  • Country: nl
  • Current job: ATEX product design
Re: Hardware debounce/buffer for a tilt switch
« Reply #3 on: December 21, 2013, 12:01:03 pm »
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.
That 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.
 

Offline dannyf

  • Super Contributor
  • ***
  • Posts: 8221
  • Country: 00
Re: Hardware debounce/buffer for a tilt switch
« Reply #4 on: December 21, 2013, 12:11:08 pm »
Quote
Trying the the "standard" debounce circuit with a capacitor and a schmitt trigger (Image courtesy by Ikalogic),

That'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.

Quote
Changing the value of C1 doesn't help.

The usual mistake made here is to increase C1.
================================
https://dannyelectronics.wordpress.com/
 

Offline mcinqueTopic starter

  • Supporter
  • ****
  • Posts: 1131
  • Country: it
  • I know that I know nothing
Re: Hardware debounce/buffer for a tilt switch
« Reply #5 on: December 21, 2013, 04:27:09 pm »
The correct debouncer has one extra resistor, and it is implemented differently from the schematic you attached later.

Could you please link a schematic?
 

Offline 6502nop

  • Regular Contributor
  • *
  • Posts: 88
  • Country: us
  • $EA
Re: Hardware debounce/buffer for a tilt switch
« Reply #6 on: December 22, 2013, 09:30:02 am »
Thirty three years 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...)
 

Offline nctnico

  • Super Contributor
  • ***
  • Posts: 28503
  • Country: nl
    • NCT Developments
Re: Hardware debounce/buffer for a tilt switch
« Reply #7 on: December 22, 2013, 12:41:27 pm »
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.
There are small lies, big lies and then there is what is on the screen of your oscilloscope.
 

Offline mcinqueTopic starter

  • Supporter
  • ****
  • Posts: 1131
  • Country: it
  • I know that I know nothing
Re: Hardware debounce/buffer for a tilt switch
« Reply #8 on: December 24, 2013, 01:54:53 pm »
thank you 6502nop!
 

Offline Pack34

  • Frequent Contributor
  • **
  • Posts: 753
Re: Hardware debounce/buffer for a tilt switch
« Reply #9 on: December 24, 2013, 07:47:48 pm »
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.

 

Offline calexanian

  • Super Contributor
  • ***
  • Posts: 1886
  • Country: us
    • Alex-Tronix
Re: Hardware debounce/buffer for a tilt switch
« Reply #10 on: December 24, 2013, 07:55:05 pm »
I specify my switches with the highest durometer material I can find. That way they bounce less!  O0 hahahahaha
Charles Alexanian
Alex-Tronix Control Systems
 

Offline Mr Smiley

  • Frequent Contributor
  • **
  • Posts: 324
  • Country: gb
Re: Hardware debounce/buffer for a tilt switch
« Reply #11 on: December 25, 2013, 07:24:30 pm »
The correct debouncer has one extra resistor, and it is implemented differently from the schematic you attached later.

Could you please link a schematic?

Here you go  :-+

http://www.labbookpages.co.uk/electronics/debounce.html

hope it helps, there are other methods shown as well


 :)
There is enough on this planet to sustain mans needs. There will never be enough on this planet to sustain mans greed.
 

Offline Pack34

  • Frequent Contributor
  • **
  • Posts: 753
Re: Hardware debounce/buffer for a tilt switch
« Reply #12 on: December 25, 2013, 08:27:40 pm »
The correct debouncer has one extra resistor, and it is implemented differently from the schematic you attached later.

Could you please link a schematic?

Here you go  :-+

http://www.labbookpages.co.uk/electronics/debounce.html

hope it helps, there are other methods shown as well


 :)

Interesting 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.
 

Offline mcinqueTopic starter

  • Supporter
  • ****
  • Posts: 1131
  • Country: it
  • I know that I know nothing
Re: Hardware debounce/buffer for a tilt switch
« Reply #13 on: December 26, 2013, 05:31:04 pm »
 


Share me

Digg  Facebook  SlashDot  Delicious  Technorati  Twitter  Google  Yahoo
Smf