I built a CNC router about a year back and have had intermittent limit switch triggering for a good while.

After doing everything I could to remove any EM interference from the system (run the signals through optocouplers with isolated PSUs, shield all wires, star connect all earths, etc. etc.) I then got to the point where I gave up as it only triggered when doing heavier cutting, so I just ran the machine at half feed and got on with my day.

But I had a brainwave the other day and realised that it might just be mechanical vibration causing the intermittent triggering rather than interference... So I got to testing (tapping each switch with the back of a screwdriver) and it seemed my theory was right!

At this point, my switches are NC microswitches, so I thought I'd get some slightly better switches more suited (they're still cheap but they at least they're called limit switches).

But, same problem, when I tap them, they trigger. Then I realised that because they're NC, it only needs to slightly break contact to trigger (whereas if they were NO, the contact would have to move the entire way to the other contact inside the switch). So I tested this by wiring as NO and it seemed that tapping the switch didn't cause it to trigger anymore.

But the reason I chose to wire as NC in the first place, was because if they fail, they would trigger (and apparently they're less prone to EM interference).

So, here's my 2 options (sorry about the backstory, I thought it might help):

Option 1:
Remain as NC and buy high quality switches? (The problem is the switches I've seen are easily £50 each and I need 6... The switches I currently have about £1.50 each...

Option 2:
Rewire as NO, (This solves the mechanical shock issue, but has no failsafe if they go wrong). The only other issue is that I also have a NC touch sensor which would be in series with one of these NO switches, so I would have to invert that somehow, and have a NC and NO switch in series which I don't know how to do.

Thanks in advance and sorry for the long explanation but more often than not, when you explain the whole problem, people sometimes come up with a much better solution that I hadn't even considered!


2 Answers 2


Your switches are probably working against the pull-up resistors in the controller. These are probably 50 kΩ - 500 kΩ. When your switches are closed (as they normally are) there may not be enough "wetting" current to break through the oxidation of the contacts.

I recommend that you try addition of a lowish-valued pull-up resistor to positive supply to ensure that a few mA flows through the closed contacts. 1 kΩ would do the trick. If you want you could lower it further and add a series LED.

A squirt of contact cleaner may help if you can get it in there.

  • \$\begingroup\$ Thanks for the response, I added a resistor like you suggested but a small tap is enough to trigger them still. \$\endgroup\$ Mar 20, 2021 at 12:09
  • \$\begingroup\$ I think the best bet might be to just switch to NO all round, but I am unsure of how to invert the signal into the opto (for the touch sensor)? \$\endgroup\$ Mar 20, 2021 at 12:09

Optos and isolated supplies are usually not necessary and can sometimes make the problem worse in regards to interference. Careful wiring and shielding is a better approach. From what you describe, your controller needs better debouncing/filtering on the inputs. If your controller is using interrupts for these inputs, that’s usually a sign of bad design - limit switches work in the realm of milliseconds whereas interrupts are sub microsecond. Not only is there the issue of contact bounce, there’s electrical interference and as you’ve observed, mechanical vibration. Software filtering to ensure a minimum pulse width is interpreted as an active operation is required. NC is used for the reasons you’stated. If you want an off the shelf solution, then ASI bus sensors might be of use. Expect to pay for the privilege though.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.