0
0
AutocadHow-ToBeginner · 3 min read

How to Reset Arduino: Manual and Programmatic Methods

You can reset an Arduino by pressing the RESET button on the board, which restarts the program. Alternatively, you can reset it programmatically by connecting the RESET pin to GND briefly or using code tricks like the watchdog timer.
📐

Syntax

The Arduino reset can be triggered manually or by hardware connections. The main parts involved are:

  • RESET button: A physical button on the board that when pressed connects the RESET pin to GND.
  • RESET pin: A pin on the Arduino that can be connected to GND to reset the board.
  • GND pin: Ground pin used to complete the reset circuit.

There is no direct Arduino code command to reset, but hardware or watchdog timer methods can be used.

arduino
Manual reset:
Press the RESET button on the Arduino board.

Hardware reset:
Connect RESET pin to GND briefly.

Programmatic reset (watchdog timer example):
#include <avr/wdt.h>
void setup() {
  wdt_enable(WDTO_15MS); // Enable watchdog timer for 15ms
  while(1) {} // Wait for watchdog to reset
}
void loop() {}
💻

Example

This example shows how to reset the Arduino programmatically using the watchdog timer. The watchdog timer forces a reset if not cleared in time.

arduino
#include <avr/wdt.h>

void setup() {
  Serial.begin(9600);
  Serial.println("Starting...");
  delay(2000); // Wait 2 seconds

  Serial.println("Triggering reset via watchdog timer...");
  wdt_enable(WDTO_15MS); // Enable watchdog timer for 15 milliseconds
  while (1) {
    // Wait for watchdog to reset the board
  }
}

void loop() {
  // This code never runs because of reset
}
Output
Starting... Triggering reset via watchdog timer... (Arduino resets and restarts the program)
⚠️

Common Pitfalls

Common mistakes when resetting Arduino include:

  • Pressing the RESET button too briefly or not fully, so the reset does not trigger.
  • Connecting RESET pin to GND for too long, which can cause the board to stay in reset.
  • Trying to reset using code without enabling the watchdog timer or proper hardware support.
  • Not allowing enough delay after reset for the board to restart properly.
arduino
Wrong way (holding reset too long):
// Holding RESET pin to GND continuously

Right way (brief pulse):
// Connect RESET pin to GND for about 100 milliseconds then release
📊

Quick Reference

MethodHow to ResetNotes
Manual ResetPress RESET button on boardSimple and immediate
Hardware ResetConnect RESET pin to GND brieflyUse a momentary connection (~100ms)
Programmatic ResetUse watchdog timer in codeRequires library
IDE ResetUpload new sketchAutomatically resets board before upload

Key Takeaways

Press the RESET button on the Arduino board to manually restart the program.
Briefly connect the RESET pin to GND to perform a hardware reset.
Use the watchdog timer in code to trigger a programmatic reset.
Avoid holding RESET pin to GND too long to prevent the board from staying in reset.
Uploading a new sketch from the Arduino IDE also resets the board automatically.