Introduction: Two Ways to Reset Arduino in Software

Picture of 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

Picture of 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

Picture of 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 


illumation_ (author)2018-01-09

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.

stevenk37 (author)2016-01-04

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() {

AssiniH2 (author)stevenk372017-11-29

It is not working...

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

stevenk37 (author)AssiniH22017-12-01

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

AssiniH2 (author)stevenk372017-12-01

Thanks for the reply.

ChandanD19 (author)stevenk372017-12-01

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)

stevenk37 (author)ChandanD192017-12-01

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

ChandanD19 (author)stevenk372017-12-01

I'm using above code in arduino Atmega2560

gussmith (author)stevenk372017-08-12

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

stevenk37 (author)gussmith2017-12-01

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

stevenk37 (author)gussmith2017-08-18

this has been discussed on the arduino playground. see

FirstN1 (author)stevenk372016-09-26

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

pinp2 (author)stevenk372016-05-02

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 :)

FellaMegaOld. (author)2017-10-11

FellaMegaOld. (author)2017-10-11

illumation_ (author)2017-09-01

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.

TimN33 (author)2016-06-22

Isn't a software reset a bit scary?

Maybe you can answer this: if the loop simply called the reset function every time. then you could never stop it, or am I mistaken? Is there something in the arduino PC app that allows you to break into it?

MithunK3 (author)TimN332017-08-03

Yup its every bit scary. If you mistakenly put in some bad logic and burn it on the board and reset gets called in every loop your board will not remain programmable anymore!

akn10red (author)TimN332016-08-16

Well it depends on your software logic. Lets say you are controlling your arduino from smartphone via wifi/bluetooth. You send a command from your phone to change (lets say) the wifi ssid or password it is connecting to.... You get that command in arduino, store the new ssid/password in eeprom or sd card and RESET your arduino. Now when your arduino resets it will get the data from eeprom/sd card and connect with new wifi credentials.

BerryM4 (author)2017-07-11

Hi, my name is marlin. Good article, this is very interesting and can increase my knowledge. thank you for sharing. always success

<a href="">Arduino Tutorial For Begginers</a><br />

<a href="">Arduino Uno Project For Beginners</a><br />

<a href="">How To Reset Arduino Uno</a>

micahmelnyk (author)2017-06-30

Thanks Gabby for posting this.

One comment perhaps of interest to some, I have found more success with the hard reset (using a pin to take the reset LOW) than the soft reset in terms of serial communications stability. With the soft reset I would often get garbled serial communications after reset, while with the hard reset (still resetting based on the software, but requiring additional external wiring) the serial comms were stable every time.

katonafull (author)2016-10-20

I found the solution to save String (or anithing else) from a subrutine that you have to reset.
You have to store the data in the Flash or the EEPROM memori.
I especially store my String class in the EEPROM. You can follow that here:

LoryanT (author)2016-10-07

what if like this is happened what maybe the next step

AnthonyP15 (author)2016-04-27

Very helpful, thankyou.

werose (author)2016-02-18

thank you for that

BadASszZ (author)2016-02-06

Thanks, just what I was looking for. :)

ali alshamary (author)2015-12-20

Wonderful, I have benefited from it, Thanks

wilber adonayP (author)2015-12-04

Hi all, I need help, the Arduino Uno can be used only once or is there some way to put factory again, I would appreciate the help because I'm new at this. THANKS

stringstretcher (author)2012-11-09

Ok, so teach me, why would I need to do this / want to do this? Why wouldn't this just loop, resetting over and over?

This post is EXACTLY what I needed! The software reset (Step 2 in this instructable) works perfectly for what I need to do. I am using an nRF24L01+ 2.4GHz transceiver, with the RF24 library by ManiacBug, and I used the above software reset code to make my program more robust. In certain circumstances (for example, a brown-out on the 3.3V power pin to the RF24L01+ module), the transceivers lose connection and stop working. I tried for many hours to get the 2.4GHz modules to reset themselves and reconnect, but I could not figure it out. Finally, I wrote a code that says to each device, "if you haven't received a successful packet in 100ms" (average time to do so is 5ms for my code), "then do an Arduino software reset." This works! Finally, I can get the modules to automatically reconnect if they have an anomaly that causes them to lose connection. answer your question, this is where the software reset code is useful!


BTW. This is exactly the same issue I've experienced and the reason I use this code. Very useful.

PS. more info. on the module is here:

Nadr0j (author)stringstretcher2012-12-19

You're right. In this example it will loop indefinitely.

It could have more useful applications in larger programs though. For example..

I once wrote a program when I was in geometry for a watch to extend its functionality. After every set of numbers I input I wanted it to give me an answer, wait 5 seconds and then reset itself so it was primed up for another set of numbers.

Admittedly this was a very lazy way for me do accomplish this but it got the job done.

Hope that helps.

hakk3r (author)2015-09-21

Great article thanks! Step 1 works like a charm. Only problem is that once I set the reset pin to OUTPUT I lose connection to the programmer and the next time i go to upload avrdude complains that it can't access the board (like RX is blocked). So if you run into this, make sure you only enable the pin right before you release the board to use. Otherwise the only way I found I can reprogram the board is to disconnect/reconnect the board and quickly push out the newer version before that pin goes to OUTPUT.

burn317 (author)2015-07-09

So happy I found this thread! I'm building a starter project of an autonomous wheeled bot with ultrasonics that fairly frequently report a ping of 0 when I start it up for the first few tries.
I decided to put a simple systems check into the setup so it will check the motors and ultrasonics are functioning both on the software side (ultrasonics), and the hardware side (enough juice in the batteries to run?).
The second method listed here finally solved my if statement problem I was having!

PramodT (author)2015-05-22

Does the watchdog reset affect the external RESET pin? I mean WDT resets the device, does the RESET pin go LOW(assuming RESET pin to be active LOW and is tied high always)?

nqtronix (author)PramodT2015-05-26

No, both reset circuits are completly sepereate.

Check the datasheet, chapter 11 Figure 11-1 for the "Reset Logic". Arrows indicate a on-way signal, similar to a simple diode.

Hope this helps :)

praju1 (author)2015-05-06

This is really helpful. Tried using software reset and it worked for my project.

costy35 (author)2015-02-01

I used

asm volatile("rjmp 3584\n\t");

Where 3584=$0E00 (bootloader address)

But is little difficult ,because bootloader address can may differ from one arduino to other!

It's equivalent with hardware reset (reset button)

reset function to address 0, is not ecquivalent with hardware reset.

soapergem (author)costy352015-02-04

Thanks costy35. How would one go about finding out what the $0E00 bootloader address is for any given board?

costy35 (author)soapergem2015-02-11

Any board (atmega processor) have custom bootloader address. You can see and decode fusebit of ....


and see fusebits... but here not talk about this problem ... it's only an idea!!!

subnet (author)2014-11-09

thanks, very helpful :-)

the method 2 seems to work for me even out of a for loop, if using it in a if statement, but only if resetFunc function is declared before setup.

NomanAhmed3 (author)2014-08-18

it really helped thanks

laptophead (author)2014-03-03

I tried to apply your sketch to reset the processor as soon as a number count was larger than 33. It did not work, I wonder if you can help.

Thanks a lot


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

void loop()

for (int i=0; i <= 255; i+=3){

if (i>33) {


manuradha (author)laptophead2014-05-16

you have to call the resetFunc() in side the "for" loop like.

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

void loop()


for (int i=0; i <= 255; i+=3){

if (i>33) {



ma_partha (author)manuradha2014-06-11

Why should resetFunc() be called inside a loop? Why does it not work if it is called outside the "for" loop?

manuradha (author)ma_partha2014-06-12

in the cord above ........ int "i" variable is declared inside the FOR loop, and infarct the variable that drives the FOR loop(till "i" reach 255)... And it is a local variable so it can not be accessed outside the loop... also in this case if some how we could access the "I", by the time FOR loop finish it would be 255 :)

Hwolfw (author)laptophead2014-03-11

The for loop doesn't include what you want it to do. The way you coded it, it will continue up to 255 then reset, never reaching the if statement.

void(* resetFunc) (void) = 0;//declare reset function at address 0
void loop()
for (int i=0; i <= 255; i+=3){
if (i>33) { //needs to be within the loop
resetFunc(); //to check i for greater than 33

//outside of loop, will never be looked at.
// if (i>33) {
// resetFunc();
// }

linker210 (author)2013-12-14

Is there a way reset millis to a previous time besides zero using this function?

About This Instructable




More by gabriellalevine:two ways to reset arduino in softwareDJI Groundstation instructions for flying an octocopter on autopilotinterfacing u.fl connectors
Add instructable to: