Ground noise issue

I finally got around to completing my XCarve build, and I’m having an issue with noise on the end stop wires causing random USB disconnects.
I’m using an Arduino running GRBL and a Gecko G540 board I had lying around for the electronics.

I’m at a bit of a loss how to resolve this short of finding a way to run the end stop wires away from the stepper cables.
I’ve grounded the shielding on the stepper wires which helped a little, I added filters to the end stops which resolved them triggering any time the stepper moved.

I know it’s the ground on the end stops causing the issue, because if I disconnect them everything works as expected, I assume the issue is the stepper wires are causing the ground of the Arduino to fluctuate enough that the USB connection becomes unreliable.
While I have a USB connection it all works as expected, I just get intermittent dropouts.

Does anyone have any suggestions?

Thanks I’m going to give this a shot.

How does it work? And if you use these do you even need grounding?

Your missing what I’m saying Phil.
I’m only using the limit switches for home, what’s happening is when the switches are connected to the arduino and the stepper motor are enabled, the noise on the side of the switch connected to ground is causing enough of a fluctuation in the arduinos ground to disconnect the USB.
I can trivially prove this is the issue because if I disconnect the ground side of the limit switches it all magically works, I can also tell you it’s only the two longer sets of wires, Y on it’s own doesn’t cause the issue, X and Z do.
I know it’s the steppers and not the Spindle because the G540 has a switch that enables/disables them and the disconnects only happen when the steppers are enabled.

The usual solution to this is just shielding the cables, the stepper wires are shielded and I have grounded the shields, it did make a marginal difference.

I’m going to try using the ferrite cores on the limit switch and USB cables, it’s an easy thing to try, if that doesn’t work I’ll rerun the limit switch wiring, with shielded cable, and if that fails I’ll interface through something that isn’t USB.

Why not tie your switches into your G540 and then use the pins on the DB25 on the G540 to go to the Arduino.

Unless this is what you’re already doing but the way I read your posts, the switches are directly connected to the Arduino.

And if they aren’t, try going direct to the arduino instead of through the G540.

I have the switches running direct to the Arduino right now, the primary reason for this was that the enclosure I have on the G540 doesn’t expose the top connector, and I was too lazy to drill a hole in it.
Its certainly worth a shot though.