I have a nema 34 along with two limit switches. It is used to move an electrostatic spray gun up and down in a vertical motion between the two limit switches in a clockwise and counterclockwise stepper movement.
I have wires the limit switches and the stepper motor with shielded cable and grounded the drain cable at one end.
I just set this up and now when I activate the trigger on the spray gun (which generates an electric field to charge the paint for its process) that my stepper motor will start to trip out and either stop completely and lock up, go CW and CCW at its own discretion, or act like the limit switch was hit (which is coded to reverse direction).
I know this must be some type of electrical interference so I am looking for some input as to what I can do to try to block the electrical interference from getting to the limit switches and stepper motor so I can use this setup as intended.
Just tell in words where the "ground" goes. Does it make a complete connection to the ground pin of your mains power plug? Are the grounds of your paint system and your Arduino connected at some point? Should be. Could be the mains power plug. Are the Arduino and your paint system all powered from the same side of your 220 VAC mains power?
Then the switches may be floating when the switch is open. A switch that is not held at a logic state (high or low) is floating and is subject to spurious switching by environmental noise. The way to wire a switch is one side to ground and the other side to an input set to pinMode INPUT_PULLUP. A schematic would still be welcome.
I have grounded the arduino, stepper drive (dm860T) and the drain wire of the shielded cable going to the stepper motor to the same ground in the electrical control box.
Those switches are going to pick up garbage from the air unless they are pulled up (since they are wired to ground) with either the internal or external pullups.
The optional cap will help to filter noise and provide some switch debounce.
Limit switches should be wired Normally Closed.
Then you have grounded switch contacts during normal operation, which reduces noise pickup,
and you have added safety in case a wire breaks.
Must have a 10-100n ceramic cap between pin and ground, close to the Arduino pin.
Leo..
Recommend on fail-safe conditions to stop your stepper motor when a wire breaks or a connection fails by using NC for CW and CCW.
And with the alarm lamp + reset switch as an option, latch the alarm to check the wiring or connection before resetting for restart.
The moving timeout may be required to prevent the motor moving issue.