Keeps Resetting
Arduino Microcontroller Board
Severity:What Does This Error Mean?
Arduino keeps resetting is usually caused by the watchdog timer triggering because wdt_reset() was not called in time, or a brownout from insufficient power during peak current draw. Disable the watchdog temporarily to confirm it is the cause, and add a 100µF capacitor near the power input to stabilize voltage.
Affected Models
- Arduino Uno
- Arduino Mega
- Arduino Nano
- Arduino Leonardo
- Arduino Micro
Common Causes
- Watchdog timer enabled in code (or by a library) and not being reset in time
- Brownout reset — supply voltage dipped below the brownout detection threshold
- Stack overflow — uncontrolled recursion or very large local variables
- Infinite loop in an interrupt service routine — CPU stuck, watchdog fires
- Power supply too weak — breadboard power rail voltage unstable under load
How to Fix It
-
Add Serial.println() at the start of setup() to confirm resets.
Put Serial.begin(9600) and Serial.println("RESTART") as the very first lines in setup(). Open Serial Monitor. If you see repeated 'RESTART' messages, the Arduino is definitely resetting — not just re-executing loop().
-
Disable the watchdog timer.
If you or a library enabled the watchdog (wdt_enable()), add wdt_disable() at the very start of setup() before any other code. If the resets stop, the watchdog was firing because your code was not calling wdt_reset() in time. Either lengthen the watchdog timeout or add wdt_reset() calls in long-running sections.
-
Improve power supply stability.
Add a 100µF electrolytic capacitor between VCC and GND near the Arduino power input. If powering from USB, try a different USB port or a 1A+ USB charger. If powering external hardware (motors, relays, servos) from the Arduino's 5V pin, use a separate power supply — the Arduino's regulator cannot supply more than 50mA on the 5V pin.
-
Reduce recursion and local variable sizes.
A stack overflow will cause the ATmega to behave erratically and often reset. Avoid recursive functions. Do not declare large arrays as local variables inside functions — declare them globally or use malloc. Check available SRAM with the free memory technique: int freeRam() { extern int __heap_start; return ((int)&__heap_start) - (int)SP; }
-
Check for a brownout reset indicator.
On AVR Arduinos, you can read the MCUSR register at startup to determine if a brownout occurred. Add at the start of setup(): if (MCUSR & (1<<BORF)) Serial.println("Brownout reset"); If this prints, improve the power supply as described above.
When to Call a Professional
If an Arduino resets repeatedly with a known-stable power supply and no watchdog in the code, suspect a hardware fault or bootloader corruption. A bad crystal or fuse bit misconfiguration can also cause reset loops.