Limit switch wiring

I'm just in the throws of assembling my camera slider. The v-slot rail is 1.5M long with a nema17 stepper one end, an idler pulley at the other, and a carriage moved via toothed belt.

The stepper is controlled by an Arduino UNO with Adafruit motor shield on top.

At each end of the rail is a micro switch for stopping.

My question is this. Should the wiring from the micro switches to Arduino be sheathed cable?


In general this is always a good idea - then the risk of noise is much reduced. If you don't use shielded cable, use twisted pair (easy to twist wire with a hand drill or electric drill and a small vice).

Using a 2k2 pull up resistor (rather than relying on the weak internal pull-up) will improve noise immunity too. Adding 10nF to 100nF to ground on the signal wire at the Arduino end will also help.

You may need some, none, or even all of these precautions depending on the electrical noise in the environment.

Never run sensor signal wires alongside motor wiring.