Random restarts


I am trying to understand what is creating this problem, I have a clone Mega 2560 with a sensor shield v2 and a number of sensors. My sensor test program will randomly resets / reboots where the bootloader restarts the program (i.e. pin 13 flashes) and the serial output on my bluetooth link shows the program has restarted. The system I am connecting to is Windows 7 64 bit, and it would appear that this only happens while the USB is connected, but I am not 100% sure on this. Is this a normal issue while running the IDE under Windows or have I got some other issue to track down?

Opening or closing the serial port will cause the board to auto-reset.

It is possible that your application opens the serial port, causing the reset. It is also possible you have some application running in the background on the PC that scans for serial ports, causing the reset.

If your devices aren't properly decoupled (with decoupling capacitors) or draw too much current, it could be a power-related problem.

Lastly, if you are using lots of Strings or character arrays (like with Serial.print()s), you could be running out of SRAM.