Arduino Projects

External reset button for Arduino or Reset Arduino with Code

Learn how to add an external reset button to Arduino and also learn to reset Arduino from program code.

As we all know Arduino UNO has built in reset button on the board, but sometimes while using it in projects we wont be able to reach the button in some cases like when enclosed in a case or when the button is malfunctioning or not working. So, in this tutorial, first we will learn how to connect an external button which works as a reset button for Arduino and next lets try to reset Arduino using program code.

Adding External reset button to Arduino

Imagine that you have some Arduino shield on top of your Arduino board which makes it difficult for you to click on the reset button, you may already tired of taking a screw driver or similar to be able to click on the built in reset button. Or that your prototyping is enclosed in a case where you finger wont even enter. In all this scenarios connecting an external reset button solves the issue.

Interesting project: Arduino Stopwatch with Start Stop Reset button

Building this external reset button on Arduino is very easy with very minimal components. Take a look at the below required components and circuit diagram so you will know how easy it is.

Required Components:

Product NameQuantityamazon logoamazon logo india
Arduino Microcontroller1
Tactile Push Button1
5V power supply (Micro USB or External).1
Few Connecting Wires
You can buy the required components from the given best buy links. We choose the components according to value for money.

Circuit Diagram:

connecting external reset button to Arduino circuit diagram

At this point, you may have already noticed that there is a specific reset pin on Arduino board, which is created to serve our purpose to reset externally when accessing the built in button is not possible. From the above circuit diagram RESET pin is connected to one of the external push button pin and another pin of push button is connected to GND.

How external reset button works:

When the button is not pressed the reset pin is in normal state as the circuit is open and when the push button is pressed, the circuit of reset pin and GND pin of Arduino gets closed and the reset button will see 0V from GND pin and becomes LOW.

Also read : Measure voltages with Arduino voltage sensor

According to the Official Arduino Documentation, it is stated that “bring the RESET pin to LOW for at least 2.5 µs(insanely quick) to reset the microcontroller”. So when button is pressed Reset pin gets connected to GND pin it goes to LOW state and resets Arduino board.

Reset Arduino with Program code:

Lets imagine there is a scenario where you need to reset the board every time when you start the project, or any other reason or need to restart the board for the project to work. As a programmer you know to reset the board to make it work but others may not know. Sometimes we need to reset the board for particular time intervals which is very hard manually.

To solve this we can reset the board from the code itself. We can also create some creative code to reset the board if we see any errors and crashes in the executions.

There is an Arduino Library named wdt.h which has access to the watchdog timer. By using it we can reset the board. But before using this library we must make sure that we can use it with our Arduino board. To do this, the bootloader of our board must have foreseen the use of this library and its functionality. With the Arduino UNO rev 3 there is no problem.

For this you don’t need any external components

Program Code:

#include <avr/wdt.h> // Include the ATmel library
void setup()
    wdt_disable(); // Deactivates the function while configuring the time in which it will be reset
    wdt_enable(WDTO_2S); // We set the timer to restart in 2s
void loop()
    wdt_reset(); // Update the watchdog so it doesn't cause a reboot

In the wdt_enable() function we can pass these constants:

WDTO_15MS = 15 miliseconds
WDTO_30MS = 30 miliseconds
WDTO_60MS = 60 miliseconds
WDTO_120MS = 120 miliseconds
WDTO_250MS = 250 miliseconds
WDTO_500MS = 500 miliseconds
WDTO_1S = 1 second
WDTO_2S = 2 seconds
WDTO_4S = 4 seconds
WDTO_8S = 8 seconds

This operation is very simple and we can combine with other programs and achieve the required need without manually pressing the reset button.

If you like this tutorial please subscribe to our YouTube Channel “Circuit Schools to encourage us to publish more interesting projects. If you have any doubts write to us from below comment section.

CircuitSchools Staff

We at CircuitSchools publish on basics of electronics and electric components and everything related to evolution of electrical technology with complete analysis of development boards and modules along with latest projects with innovative ideas.

Related Articles

Leave a Reply

Your email address will not be published. Required fields are marked *

Back to top button