Skip to content Skip to sidebar Skip to footer

How to Reset Arduino Board using Soft Reset Method

Reset Arduino Board

How to Reset Arduino using Hardware & Software - In some uses of electronic equipment, we will need a reset mode to position the program at 0x000000000, which will affect the program reading at the start of the program.

There are two methods to reset the Arduino and this can also be applied to other AVR microcontroller variants, namely "Soft Reset" and "Hard Reset".

Soft Reset means resetting the microcontroller through Program Codes (Software), while Hard Reset means we reset the microcontroller directly on the physical microcontroller (hardware).

The following is the method I use to reset the program by soft reset. First, we take advantage of the digital pin to provide a logic low to the reset pin, so that the reset will occur. Second, we use the resetFunc() function.

 

A. Soft Reset Arduino (Software & Hardware Combine)

This method involves both hardware and software. I am attaching the circuit below. You can follow this circuit by connecting digital pin 2 to the reset pin.
 
In this experiment I use digital pin 2, you can use other digital pins, according to your needs.

 

 Upload the following program to your Arduino board, then click Serial Monitor. You can see if your Arduino board has successfully reset or not. 

#define pinReset 2

void setup() {
digitalWrite(pinReset, HIGH);
Serial.begin(9600);
Serial.println("Reset Successs");
pinMode(pinReset, OUTPUT);
delay(3000);
}

void loop() {
Serial.println("Ready to Reset!");

for (int cnt = 0; cnt < 20; cnt++) {
Serial.print(".");
delay(50);
}

Serial.println("");
delay(3000);
digitalWrite(pinReset, LOW);

Serial.println("Reset Failed");
}

Work principle:
We first define the pinReset used, namely digital pin 2. Then for the setup() function, at the beginning of the program we directly apply digital pin 2 to output High (1) logic.
 
This resulted in the microcontroller will never be "reset", because the microcontroller will reset when given a logic Low (0).
 
We initialize the serial to be able to display data to Serial Monito with the Serial.begin(9600) command.
 
Then in this part of the setup() function we give the command to the Serial Monitor that the Reset was successful. Why? Because when the reset occurs, it will read the setup() function first and will tell us via the serial monitor that the microcontroller has been reset.

In the loop() function, the main command to reset is digitalWrite(pinReset, LOW);
 
When the reset pin receives a logic Low(0) from digital pin 2, the microcontroller will reset quickly, and will read back the setup() program then loop();
 
However, when the reset does not occur, the serial monitor will provide information. Reset failed, because we have made the command Serial.println("Reset Failed");
 

B. Soft Reset Arduino (Software Only)

In the second program this is a simpler way to reset your arduino. Please upload the following program to your Arduino, then open Serial Monitor.
void (* resetFunc) (void) = 0;

void setup() {
Serial.begin(9600);
Serial.println("Reset Success");
delay(5000);
}

void loop() {
Serial.println("Ready to Reset!");
for (int cnt = 0; cnt < 20; cnt++) {
Serial.print(".");
delay(50);
}

Serial.println("");
delay(3000);
resetFunc();

Serial.println("Reset Failed");
}

This is the Arduino Reset method that I have tried. Done.

Post a Comment for "How to Reset Arduino Board using Soft Reset Method"