I have an Arduino Mega with a RAMPS 1.4 shield running 4 stepper motors, an LCD screen and endstops. The board is powered by a 24V power supply, brought down to 12V by a buck converter and connected to the RAMPS board using the green terminal block connectors. The motors are powered directly from the 24V supply and connected to the board using external TB6600 drivers.
Occasionally, when the system is idle, the Arduino will restart, like when pressing the restart button or when something shorts out. Interestingly, this doesn't happen when the board is also connected to the USB power supply (to the computer). It also seems like this doesn't happen when the endstops are turned off (not enabled in the software). If I understand it correctly, the USB connection does some form of voltage regulation, so it would seem that something is happening that makes the board panic and restart when the USB is not connected, but that the voltage regulation prevents the restart when it is connected. It seems like the endstops could be responsible - is it possible these are occasionally shorting out? Everything works fine apart from these unpredictable restarts.
I understand the problem description is not clear enough for someone to provide a solution, however I would be grateful if someone could point me towards ways of investigating this problem and understanding what is happening. Could it simply be that the RAMPS board endstops are unreliable?