Two Ways to Reset Arduino in Software





Introduction: Two Ways to Reset Arduino in Software

If you want to RESET Arduino from the beginning without manually pressing the RESET button, there are a few ways. Here are two ways, using minimal wiring / circuitry. 

Step 1: Using 1 Wire Connected to the RESET Pin

1. electronically, using only 1 wire connecting an OUTPUT pin (12 in this example) to the RESET pin. (see the circuit)

In this example, pin 13, connected to the internal LED pin 13 is blinking. Pin 12 gets connected to the RESET pin by one wire.
-Typically, this would be a problem because when the application starts up, all pins get pulled LOW. This would therefore disable Arduino from every running. BUT, the trick is: in setup() function, the FIRST thing that happens is we write HIGH to the pin 12, which is called our reset pin (digitalWrite(resetPin, HIGH), thereby pulling the Arduino RESET pin HIGH. 

Step 2: Using Just Software

In this example, you do not need any extra wiring. We initialize the reset function, then call reset.

void(* resetFunc) (void) = 0;//declare reset function at address 0
resetFunc(); //call reset 



    • Water Contest

      Water Contest
    • Oil Contest

      Oil Contest
    • Clocks Contest

      Clocks Contest

    59 Discussions


    Question 12 hours ago

    Estou tentando fazer pelo Arduíno mega um botão de reset por um botão, para resetar um tempo quando apertado, porém a programação não esta funcionando.

    Well.. #1 is not really a software solution, is it, if you have to wire pins.. Also, this is not an advised solution, according to what I've read before.

    #2 Is just a hack that anyone could come up with, but still doesn't provide a real watchdog functionality (you have to trigger it, and thus can only be used as a reset method, not a WD (which seems to be what sme of you guys need).

    Let me give some details on the built-in arduino WD (yes, really) that can be used both as WD or as a reset device.

    You can set it from 15ms to 8s range. You need to reset it in software or otherwise it will trigger a reset (reverse to #2 method).

    Here's how to use it;

    #include <avr/wdt.h> //should be in any adruino IDE

    void setup() {
    wdt_disable(); //always good to disable it, if it was left 'on' or you need init time
    //do some stuff here
    wdt_enable(WDTO_8S); //enable it, and set it to 8s

    void loop() {
    //do some stuff here
    wdt_delay(5000) //instead of delay, i made my own delay to reset the WDT

    //this makes sure the WDT is reset immediately when entering the
    //function, but we can still benefit from a real 'delay'.
    //upon leaving the function, we reset it again.
    //i realize timing will be loose, you can always do something with
    //millies() if you need strict timing.
    //you might also need to adjust the '1000' if you WDT is shorter

    void wdt_delay(unsigned long msec) {

    while(msec > 1000) {
    msec -= 1000;

    //to reload the board, you only have to delay > WDT
    //another option is to set the WDT very short, and do a short delay

    void wdt_reload() {

    13 replies

    I did that, by using the WDT approach, and the board got stuck; I'm even unable to program the original code with Pololu USB programmer. Unfortunatelly, the board is battery powered and designers did not provide a RESET button, therefore it seems I'm in a big trouble. Did I miss something, or there are another way to put it to work again?

    what kind of board is this? it seems not a 'standard' arduino? eitherway if it uses the same ATmega328P-like chip, you should be able to find the reset pin on the processor and use that..? if you're stuck, and cannot program it, try the icsp connectors, which also have a reset pin..

    It is not working...

    After few seconds, LED on pin13 is blinking...

    Please make sure the board (and the bootloader!) support watchdog.

    Hi Steven,

    Above code is not working. Everytime reset is happens but if the watchdog overflows it is going to infinite reset loop(not once)

    Please make sure the board (and the bootloader!) support watchdog. This seems to happen with Arduino Pro Mini.

    This is interesting. Is the reset by the watchdog timer the same as if you would press the reset button?

    there are differences, can't remember exactly. I think it has to do with some pin state/config after the reboot.

    this has been discussed on the arduino playground. see

    I am sorry to say this, but many times the comments are much more useful than the article itself. Thank you.

    Thank you stevenk37 for an Arduino Watchdog. It is does the trick I need.

    It would be good if you would create a separate entry about it cause not all people read through comments :)

    resetFunc is a pointer to an invalid address! That's the reason the device 'resets', in fact it crashes. Don't rely on this malfunction method and maybe it can damage your device at the long run.

    The second method crash the Arduino, the Leonardo (Pro Mini) at least. So I think that is an hack and not a real solution. Normally, a null pointer (aka adress 0) is an unusable invalid address, when call or use a null pointer to access things, strange things can happen. In fact a bad instruction that can cause a crash or a reboot. Don't use it, it is not reliable.