I have a simple circuit, pictured below, that uses an Arduino to control two large bidirectional motors via 12V relays. Normally this works a treat, but sometimes the Arduino ends up resetting itself.
I think what's happening is that the motors eat up a lot of power when starting, causing the arduino to have a momentary loss of power wherein it resets. To remedy this, I added a 1000uF electrolytic capacitor, and a 22uF ceramic capacitor. Additionally, I "walled off" the arduino's power/ground planes with 1N4001 diodes so that the motors aren't able to steal charge from the arduino during a power drop.
Looking at the VIN/GND to the arduino, I still see the occasional power drop, but with the diodes/capacitors the spikes are very short and sharp. What's surprising is that these power drops don't always precede a restart as far as I can tell.
My current working theory is that the power drops are corrupting memory or just precipitating instability in the arduino, which is why power drops don't generally immediately cause a restart.
I've spent a few days struggling with this problem, and I'm still completely lost as to what I should do to fix it. I don't understand why there would be sudden loss of power on the arduino when it's walled off with diodes. Any and all help would be appreciated.
Edit 1 Here's the schematic for the motor control. Ambiently relays are on GND, only one is on during a movement. Looking at the scope, I do see some spikes on the gate. I added 10uF ceramic capacitors to the gate lines, but that did not completely fix the restart issue.
And here is the schematic for the power going to the Arduino. I have a diode on the high side and on the low side. The high side diode is to prevent the motors from stealing charge from the capacitors, and the low side capacitor is to prevent the motors from moving the ground plane. The issue persists with or without the low side diode in place.
I don't think that the issue is from the power side, I can unplug the power and the arduino continues to run for roughly two seconds. I've spent multiple days on this, and I have not found anything that makes this circuit reliable. I'm at a loss for what to try.
Edit 2 I think that the issue is that the relays sometimes arc, which causes EMI that interferes with the arduino. I need an RC snubber to eliminate that, but how do I properly connect such a snubber on my circuit?