I'm using two nanos connected to a PC usb. Sending a serial signal to each.
One is then switching digital outputs on or off depending on the signal (sending a string of characters A-R in alphabetical order, lowercase switches an output off, uppercase switches it on) These then switch the transistors of a ULN2003 which in turn switch relays which in turn operate solenoids and three phase contactors.
The other nano, when it receives a signal relays the state of it's inputs back to the PC as a string of 1s and 0s. These inputs come via ULN2003 transistors, with pull up resistors (or internal pull ups enabled) on both sides of the transistor, allowing the input to the transistor to be pulled down to common ground, switching the transistor off thus the input of the arduino is pulled high. Releasing the input, the transistor is pulled high, pulling the arduino input to ground.
All works fine on the desk. However, once I connect the system up to the machine, it runs for a few minutes, then one or other Arduino stops responding.
Do I need to opto-isolate the inputs and outputs? Not sure if this will be practical as the ground line on the Arduino is connected to the earth on the PC, which is then connected to earth the same as the machine.
Update:
Pressing the reset button on the nano doesn't start it responding again, the com port either has to be disabled and re-enabled in device manager, reboot the pc, or unplug the usb lead and plug it back in. Would this suggest it's the onboard CH340 adaptors that are crashing rather than the microcontroller?
Would using a separate USB to serial converter help, connected to the Rx and Tx lines of the Arduino maybe through opto-isolation? How about reducing the baud rate?