I have an Arduino (Pro Mini) connected to an HMI display with a serial interface. When the user pushes a button on the HMI screen, it activates a relay attached to one of the digital pins on the Arduino.
For safety reasons, if the Arduino loses communications with the HMI, I want it to turn off the relay. So, when the button has been pushed, it triggers a polling sequence to verify that the button is still being pushed (I'm not relying on the button release event, again for safety). Essentially, the Arduino queries the HIM for a value. If none isn't returned within 100ms, the code times out and kills the relay. As I said, the code works if I pull the RX, TX or Ground connections from the HIM, the code kills the relay and everything keeps working fine. Pull the Bcc from the screen, though and stretching freezer with the relay engaged.
A few notes:
- The Arduino and HMI share a common 5V supply, but the HMI doesn't draw power from the Arduino
- It's a TTL level serial connection, not RS-232
- I don't think it matters, but the Arduino is using software serial on GPIO pins, not the built-in UART.
- The serial connection is running at 19.2K
My best guess, and it is a guess, is that the HMI screen momentarily attempts to draw current or dump a load via the I/O lines when it loses it's power source. This appears to be enough to cause the MCU to freeze not sure why.
Any suggestions? Should I have something in parallel with the data lines to protect the MCU?
What could be causing this, and what can I do to overcome the problem?