I have a CNC machine that I built and the Mach 3 program has limited inputs (5) which I use for E-Stop, 3 Axis homes, and a Z zero macro. The project I created was using a NANO with 7 inputs and 2 outputs. Six of the inputs are end of travel LS (limit switch) for the X and Y axes. Each LS has its own input so at some point later I may want to know which limit has activated. The last input is a toggle switch input which programmatically allows for E-Stop to be reset and allows moving off of the LS overtravel.
Each of the two outputs activates a relay, one for 250 ms to tell the control program (Mach 3) that there is an E-stop occurrence. The Second output is to enable movement by enabling the enable signal (to High) to the steppers
I have multiple power supplies some are energized whenever the main breaker is on, others are on when power is applied to the steppers and the VFD (BTW the VFD is a 2.2KW system) One of the boards, the break-out board, (BOB) in the circuitry is powered by a USB cable from the PC, in addition, and also has a 12VDC source. All power supplies have a common ground tying back to The main ground coming into the circuit. All circuitry is connected to the same ground as well. All of the switches are connected to the NANO ground which is connected to the common ground. I step down the 12VDC to 5 VDC with a Buck Converter.
Pretty simple, one relay controls the 5VDC to enable input on the stepper drivers, and the other triggers an E-Stop to Mach 3. The BOB where the 5 inputs are connected is sitting around 11 VDC and go to the ground when activated, the NANO has a max of 5VDC so that is why the one relay and rather than supplying the current needed for the Enable signals through the NANO, I opted for the relay just controlling the 5VDC.
That is the description of the circuit and its functions. When powered by a static 5VDC and neither of the Steppers nor the VFD is powered, everything works just as I had planned it. I can activate any LS and the E-Stop will trigger for 250 ms, I can then toggle the enable input and the other relay will reconnect the 5 volts to the stepper drivers and bypass the limit switches so that I can reset E-Stop in Mach 3.
Now the problem, as soon as I power up the rest of the system, ie VFD and Steppers, the E-Stop relay toggles continuously, not always at the same repetition rate, however. I thought that perhaps there was noise now on the lines so I made some RC filters for each of the LS, no help there, if I activated an LS, then while depressed the E-Stop relay stopped cycling, as soon as I released the switch, the relay started up again. Seems like something is cycling something or triggering within the NANO I disconnected all the switches and sequentially reconnect only one at a time, no love there either, as soon as one was connected, or even just touching the screw, the relay would start cycling. Another interesting point: When holding a switch in the activated position, grounded every 4-10 seconds or longer, with no pattern, the E-Stop relay would cycle.
I suspected noise on the switch lines at first, but even just holding the tip of the screwdriver against the input connection would impact the ES relay.
Do I need to put the NANO in a shielded box?
Any thoughts or suggestions?
I would have attached a schematic and the program sketch, just couldn't figure out how to attach them.







