I have problems like this with arduino mega use ethernet shield and 8 channel 5v optocoupler relay, sometimes arduino is restarted with mysterious reason I don't know..., if I try in my lab all fine, when I move it to terrace near water pump, everything doesn't work properly, but now without change everything was works for over 7x24 hours, with same ethernet wire, same power supply, same code, only I place it in top of brick and near AC 220v wire also near water pump, maybe something interfere my arduino, and I was scare to change my arduino code, risking my arduino not work properly again....Here is the schematic for the motorView attachment 234137
And here is the schematic for the arduino power
View attachment 234138
The high side diode is to prevent the motors from stealing charge from the arduino, and the low side diode is to prevent the motors from moving the ground plane. I've tried without the low side diode, and there's still an issue with the restarts.
I'm running out of theories for what could explain this issue. It's very temperamental, sometimes it's quite stable and sometimes it immediately resets. I'm thinking that there may be some interference issue, possibly from the relays. But I'm not sure how to test that theory, and how I would fix the issue.
Moderator edit: New thread created from this.