# How to take "bounce" out of switch ??

Discussion in 'Electronic Basics' started by Thomas, Apr 26, 2005.

1. ### ThomasGuest

I have a small magnetic switch that is triggering when I hit a bump or rough
spot in the road. Moving the switch or changing it is nearing impossible so
I need to take out the "false" triggers. Need something simple and reliable.
I am thinking 1 second or less should do it... Any and all help is
appreciated.

2. ### John FieldsGuest

---
Can you tell us more about the circuit?

What is the voltage across the switch?

How much current does it switch?

How is it used in the circuit? (can you post a schematic?)

Is it a magnetic switch or a relay of some sort?

3. ### ThomasGuest

Its just a basic magnetic switch detecting when I have the lid closed.
Operates on 5V DC. Due to the nature of the beast, it is not feasable to
change the existing switch. I need to take the bounce out. I am currently
using the switch to detect when the lid is open and when it is, a small DC
relay is used to turn some lights on. The lid and/or switch can not be
changed. Right now, potholes, speedbumps and the occasional varmit cause
the magnetic switch to detect the opening. I was thinking of a small
circuit to put between the switch and realy to provide a time constant
before the relay is pulled. Maybe something with a pot to vary the time from
1 sec down. Would a one shot 555 work?

4. ### Terry PinnellGuest

The simplest circuit requires adding just one resistor and capacitor,
as shown here:
http://www.terrypin.dial.pipex.com/Images/MagSwitchDebounce.gif

5. ### ThomasGuest

Thanks for the input. Would the circuit vary if 12V instead of 5V would be
used? Also, is that a 22 Ohm resistor in series with the pot? And again, I
really appreciate the help!

6. ### ThomasGuest

Also Terry, do you have the formula for me to calculate on the resistor /
cap compos to get the time variance?

7. ### Lord GarthGuest

It's there in case the pot is turned to one extreme thus putting the power
supply directly
across the capacitor. The time constant is T=RC and if 12 volts is applied,
be sure you
use a 16 volt capacitor.

8. ### Terry PinnellGuest

If everything was in proportion, then no, the circuit could be the
same. IOW, if the pull-in voltage of the 12V relay was (12/5)*4 =
9.6V, and the its DC resistance was (12/5)*400 = 960 ohms, then the
timing would follow a similar curve.

Yes, it is a 22 ohm resistor. With the pot at its maximum, the total
resistance in series with the big cap is therefore 90 ohms.

Dealing with your other post's query, a formula (which would be
complex, as we're dealing with exponential voltage over time) would be
of little practical value to you. As I said, your relay will not have
the specs I've assumed.

There are also other factors I didn't raise earlier, which will also
have a bearing on the practical results, and reinforce my suggestion
to use trial and error (assuming you want to use this ultra-simple
circuit). In practice I suspect the lid won't be as co-operative as in
my simplistic assumptions. IOW, it won't falsely open for 0.1 - 1
second and then stay closed again for a second or so before opening
again (giving the 4700uF capacitor plenty of time to discharge through
the relay's coil). It will probably be opening and closing to some
extent constantly - almost vibrating - with some jumps higher and
therefore lasting longer than others. That sort of behaviour presents
quite a complex signal at the input to the series resistor.

9. ### Terry PinnellGuest

John Homppi emailed me pointing out a careless mistake in my drawing:
I had the cap shorted to ground! Thanks, John, well-spotted. Now
corrected.

10. ### Rich GriseGuest

First, please don't use the term "bounce" for what is merely false
triggering. Switch bounce is an entirely different thing - it's very
fast spikes caused by the switch contacts themselves bouncing when
they crash together. All you have is a switch that opens when you
whack it.

So, all you need is a time delay on "open" - a 555 and a little logic
should be fine. And with a decent capacitor, you shouldn't even need
a pot - just get values from the chart in the data sheet.

Good Luck!
Rich

11. ### JeffMGuest

I have a small magnetic switch that is triggering
Can you use a stronger magnet?

12. ### ThomasGuest

I am using a 4700uF cap with a 20 Ohm resistor and it works GREAT. I get
about a 1.5 second delay before the coil discharges. I really appreciate
it!

Many thanks!!!!

13. ### Terry PinnellGuest

Pleased to hear it.

Coming from me, always keen to get electronics into any gadget, this
is an odd observation - but I'm curious why you didn't go for some
simpler solution? How about a simple catch that can be slipped off
when you open the lid?

14. ### Terry PinnellGuest

====================

It's best to keep your posts in the original thread, not via email.

I don't understand your follow-up question. The circuit I posted for
you already delays the action of the relay, for a time determined by
the capacitor and the resistance, due to the capacitor charging up
from zero to the pull-in voltage. And then, when the lid closes, there
will be a shorter delay before the relay contacts open again, while
the capacitor discharges via the relay coil until its voltage is below
the (lower) drop-out level.

I was also surprised by your earlier post in which you said the
discharge delay was as long as 1.5 s. Please draw your circuit and
state the voltage supply, measured pull-in and drop-out voltages, and
the resistance of the disconnected relay.

15. ### ThomasGuest

You are correct. I don't know what I was thinking. I really appreciated the
help.

16. ### Guest

Thomas schreef:
If you draw your problem on paper and scan it to my e-mail ( 100 dpi
in JPG)

maybe I can help you by sending you a other scan with the solution to
your
problem.

17. ### Guest

my email is williamdobAThotmail.com

18. ### Terry PinnellGuest

Did you not notice that this was sorted fairly conclusively a couple
of days after Thomas posted his original enquiry (12 days ago)?

19. ### Paul JonesGuest

There is nothing ! How does it know what a "real" bump is ?!
Your circuit needs to be intellegent enuf to reject a false bump

You need a "mass" and spring and a pot to measure the travel an
something to integrate all this .

what you are doin is not simple