Hello Guest it is April 20, 2021, 06:53:11 AM

Author Topic: Phantom Limit Switch Events  (Read 8721 times)

0 Members and 1 Guest are viewing this topic.

Re: Phantom Limit Switch Events
« Reply #10 on: February 25, 2012, 06:32:12 PM »
There are two basic ways to connect home/limit switches to use a single input:

1) Series - this requires using normally closed switches that open when the home/limit is hit.  A pullup resistor is connected between +5V and the input pin.  The first switch has one terminal connected to the input pin, and the other to one terminal of the second switch.  The second terminal of the second switch is connected to one terminal of the third switch, and so on for however many switches you need.  The second terminal of the last switch is connected to Ground.  When ANY switch opens, the input will go high.

2) Parallel - this requires using normally open switches the close when the home/limit is hit.  A pullup resistor is again connected between +5V and the input pin.  Each switch has one terminal connected to the input, and the other terminal connected to ground.  When ANY switch closes, the input will go low.  Note that this scheme uses considerably more wire than the series case.  As a result, it will also pickup more noise.

Switches are more likely to fail open than closed.  For that reason, the series connection is preferred, since, if a switch fails, you will know BEFORE you need it.

Noise reduction can be performed several ways.  By far the best is to determine WHERE the noise is coming from, and eliminate it at the source.  If you can't, or won't, do that, then you're left with doing what you can to make the other circuits not misbehave as a result of the noise.  The two most common ways of doing that are adding a pullup or pulldown resistor, and/or adding a capacitor.  Both have the effect of attenuating the noise.  In the case of the resistor, there should be little or no change in the signal timing, while the capacitor can delay the transitions of the signal.  So, a resistor is preferred, if it will accomplish what's needed.  Most logic outputs can sink considerable current, but can source very little current.  For that reason, I always prefer to use a pull-up resistor, and let the switch pull the signal low when active.  I've seen very few, if any, cases where a stiff pull-up (100-300 ohms) will not kill any noise.  If the noise is so bad that this does not work, then you REALLY need to figure out where it's coming from, and reduce  or eliminate it at the source.  It should nearly always be possible to do this.

You can also improve noise margin by using higher voltage.  It's common to run limit/home switches using up to 30V.  But this requires some means of reducing the 30V signal to a safe level for a 5V or 3.3V logic input.  This can be done with a simple series current limiting resistor between the switches and the input pin.

Just as an example, I have ALL of the electronics for my mill in a single 12"x24"x24" enclosure - the PC, the servo drives, servo power supplies, a VFD, a bunch of relays, a Modbus board, a SmoothStepper, a KFlop, several breakout boards, and several other things.  I have not had to use ANY capacitors, and I have NEVER had a noise problem, even using all 5V limit/home switches.  The secret is in proper grounding (star connections for all power and ground connections), and making appropriate use of shielded cables.

Regards,
Ray L.
Regards,
Ray L.
Re: Phantom Limit Switch Events
« Reply #11 on: February 26, 2012, 12:54:11 AM »
Thanks for the replies. I will try your suggestions this weekend.