Electromagnetic field

Hi,
I made a project which uses 4 stepper motors controlled by A4988 driver connected to arduino. For each stepper, I used one limitswitch.

The wires of the steppers and the limitswitchs are grouped together, which I think is affecting an electromagnetic field affecting the signal of the limitswitchs that false trigger.

I tried a 10uf capacitor over the limitswitchs but it solved 75% of the problem, one of the limitswitchs still false trigger.

What is the best way to stop the problem?
Best regards,,

What is the best way to stop the problem?

To accurately describe the wiring of your limit switch.

I would wire a limit switch from the normally closed contacts to ground with a 1K external pull up resistor.

So normally the input reads low, but when it reaches the limit or the wires are broken going to the switch, then it reads high.

Mike has it... sounds like it's floating.

Its best not to run the switch wires alongside the motor wires. If you have to, then use shielded cables for
the switches, and connect the shield to ground only at the Arduino end to avoid a ground-loop.

The motor windings wires ought to be twisted pair, one pair for each winding, to reduce induced voltages
in the vicinity.

Definitely go with low-valued pull-up resistors like 1k, add 1µF or so to ground at the Arduino inputs for the switches. The internal pullups are way too weak for this amount of electrical noise.

Thank you too much, actually I’m using the same endstop used in the 3D-Printers which already contains a pull-up resistor.
I will try to twist the wires as you mentioned

I'm using the same endstop used in the 3D-Printers which already contains a pull-up resistor.

What value?
You can always add an external one in parallel if it is too high.

I will try to twist the wires as you mentioned

Not too sure if you mean that literally, you should be soldering all the wires in an application like this.

I am not sure if this going to help but you could try to use a ferrite bead that acts like a low pass filter rejecting unwanted noise, like this one

Hi,

Can you please post a copy of your circuit, in CAD or a picture of a hand drawn circuit in jpg, png?

This will be invaluable as it will be worth more than a thousand words.

Please do not use Fritzy.

Thanks.. Tom.. :slight_smile:

For a more industrial solution, send power to the limit switch, and from the limit switch to a relay coil.

Your MCU could monitor the relay NO/NC contacts without interference issues.