Achievement Unlocked: First CUT. Not the right bit etc, but, it works.
Limit switches are trippy, even with the capacitor, and the arduino also trips, so theres some EM noise I need to sort out, but, it works!
This may sound strange but from the perspective of digital logic all mechanical switches are noisy. Switch contacts exhibit what is referred to as “switch bounce”. Something we do not perceive, but high speed electronics does. CNC control software usually has a way to compensate for this phenomena too. Although there is a hardware solution for it too if that is what you really want to do.
It depends on where the noise is coming from. Converting to a differential signal at the switch and back to logic levels at the CPU helps. Using shielded cable (only ground at one end not both) would also help.
Yeah I’m pretty sure I have a grounding issue there. I also use a chinese DC-DC to provide the 5V, and that’s one of these where they forgot to put the decoupling
Alrighty, I had the same problem. To fix it, I bought shielded alarm wire from Home Depot. They sold it by the foot, so it only cost me around 10$ for all of it. I rewired the switches with that. I then connected a disc capacitor between each limit switch input pin and the ground pin on the arduino. I also connected the shield of the wire to ground. With both of those, I haven’t had a false trigger since.
I’ve mostly fixed the power rail noise problem, but the arduino is still tripping. I’ve got some 10000uF’s to add tho, that should help.
And yes, I already add .47uF’s on the limit switches, but I’m now added 100uF’s nearer the IO pins, that should solve the limit switch tripping.