Machsupport Forum
Mach Discussion => General Mach Discussion => Topic started by: GuyFawkes on June 23, 2009, 08:44:18 AM
-
By this I mean when you get a "limit switch triggered" message and everything stops, but no limit switches have been physically triggered.
I've been playing with this for some months now, applying the scientific method.
I tried all the usual scenarios, from really cheap and crap single core conductor with crimped spade terminals wiring all the limit switches in series, right up to grounded high quality shielded cable soldered on to the limit switches.
In between I have played with all the debounce settings too, even setting them as high as 20,000.
I have even played with all the possible earthing methods between machine tool, computer, parallel port breakout card, you name it.
To be sure, ALL these variables had some effect, as indeed did other devices on the same mains circuit switching in and out, and indeed the various routings and separations of various cables.
However, attach an oscilloscope to the limit switch circuit and suddenly things become clearer, especially when you set things back to the bad scenarios rather than the "that seems to be working fine now" scenarios.
Sit there with your eyes glued to the scope screen and every single phantom limit switch event is mirrored by a spike in the noise shown on the oscilloscope waveform.
N.B. I have not been able to determine from mere observation where this noise is coming from, for all I know it could be the neighbours mobile phone or the workshop computer wireless network card, there was no obvious trigger such as "there goes the compressor" or "I just started the lathe motor inverter."
I think that all this investigative work is important, other wise you have "cures" that work for me, but not for you, e.g. raising debounce to 3,000, because all these cures are in effect lucky guesses that mask the problem, rather than curing it. I wasn't content with fixing it for me, I wanted to fix it for everyone, including me on my next machine, or after I move this one, or after I add another tool to the workshop, etc etc.
The definitive cure is to purchase a single 0.1 uF (micro-farad) polyester capacitor (electrolytics are no good as they have +ve and -ve preferences) and attach it across the two limit switch wires close to where they join the parallel port breakout board.
Here in the UK you can buy them individually from Maplins for 13p each.
I would not go any smaller than 0.1 uF initially, nor would I go bigger, too big will dump too much current when the limit switches actually close, but you could buy three or four 0.1 uF and parallel them up one by one to test if required.
Instantly I had to increase the gain on the oscilloscope by 10x to see the same noise spikes, and even then they were significantly reduced and much more rounded with shallower slopes.
As far as curing the phantom limit switch problem goes I was able to set everything back to "worst" case scenarios with minimal debounce and the phantom limit switch problem appears to have been totally eliminated.
Given that this is a potential cure that costs the price of a cigarette, is easy to test (just clip the cap across the wires with two croc clip test leads) and doesn't require altering anything else, I would suggest you try it out as a FIRST resort rather than last, if you have phantom limit switch issues.
HTH etc
(http://uk.farnell.com/productimages/farnell/standard/100601605-40.jpg)
-
The one thing I forgot that also counts.
Your stepper controllers, PSUs and breakout board all REQUIRE forced air cooling, I run a couple of standard PC 80mm fans @ 12 volts on exhaust at the top of my cabinet, if I turn them off I get random limit switch events after about 15 minutes.
-
This seems like an excelent cure. Isn't it curious how the solution to the most vexing problems turn out to be so obvious . . AFTER they are found.
Even at my 'Electronics for Dummies' level, I know that caps are a common solution for dirty signals. Can't believe I've not read this cure before.
I solved my phantom triggers AND my inaccurate homing in one swoop with photointerruprors and shielded cable, and I also wired to accomodate 12v or 24v operation if that becomes neccessary.
Methinks now I would definately try the caps first.
Kudos to you for the great tip!
-
I've always had a minor problem with limit triggers, probably due to my low level of electrical wiring expertise. By setting the debounce to 1500, my "phantom events" occurred about every 15 hours or so of operation. Since I'm a hobby user, this has been a minor problem (far exceeded by my struggles in learning how to fixture parts well!), but aggravating.
I installed a filter cap as outlined by above by GF and reset the debounce to 400. As yet (probably ~30 hours of operation) I haven't had a limit switch shutdown. I'm guardedly optimistic that this problem has gone away for good...
Thanks for what seems to be a simple, elegant solution...
SF
-
Hello everyone. I think this only my second post.I have just finished bolting together fine line automation 100,and the 5 volt limit switches are giving me fits.I rewired them in parallel with shielded cable. I like parallel because I can see witch switch is triggered in Mach3. I am using the hobby cnc pro controller with nema 23 steppers. I bought the capacitors you recommended,but am not clear how to use them. Would one leg of a capacitor go pin #11 for X axis limits and home, and the other leg to the common terminal? and so on for the rest of the inputs? Sorry to ask such basic questions,I am a retired brick mason whose electrical know how is limited to plugging it up and hoping it switches on.
Thanks for any help
-
This cure has been brought up on here before, but it always helps to keep it fresh. Well done for the effort put in to find it.
-
I would be willing to bet simple adding stiff pullup resistors would have yielded the same result, without the potential delays that sizable capacitors can introduce....
Regards,
Ray L.
-
Not sure how wiring in parallel allows you to see individual switches in Mach, I presume you mean you wired them all separate and use an input for each?
Hood
-
I think I should have said that I wired each axis in series. I know little about electronics and less about the termonology. Can you explain in a step by step way the connections of the capacitors and the use of a (stiff ?) resistor mentioned in the post by Guy and Himy.
-
Wouldnt be series either, what I would think you have is possibly taking each switch from an input and then combining the other side of the switches and then to 0v.
For the capacitor you would connect between the input and 0v (Gnd)
Hood
-
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.
-
Thanks for the replies. I will try your suggestions this weekend.