Master RESET ESP8266 Wifi Module using Arduino mega 2560

Reset ESP8266 connection diagram

Master Reset ESP 8266 Wifi Module

Sometimes when working with ESP8266, the module stop replying to AT commands. To solve this issue, we have created a simple Master Reset Program to reset ESP8266 Module using Arduino Mega2560, however one can use Arduino UNO using Software Serial Library to achieve the same.

Connection Diagram:

Reset ESP8266 connection diagram

Connect ESP8266 with Arduino mega 2560 as shown in figure above.

Arduino Pins ESP8266 Pin
RX1 (19) TX
TX1 (18) RX
3.3 V EN or CH_PD
5 (Digital pin 5) RESET
3.3 V VCC
GND GND

 

After connections, compile the following program and upload it to Arduino Mega 2560.

[box type=”shadow” align=”aligncenter” class=”” width=””]

void setup()
{
Serial.begin(9600);
Serial1.begin(115200);
pinMode(5, OUTPUT);
digitalWrite(5, LOW);

for(int i=0;i<=200;i++)
{
delay(50);
Serial1.println(“AT+”);
}

digitalWrite(5, HIGH);
delay(1000);
digitalWrite(5, LOW);
Serial.println(“RESET Complete”);
delay(1000);
Serial1.println(“AT”);
}

void loop()
{
if(Serial.available() > 0)
{
Serial1.write(Serial.read());
}

if(Serial1.available() > 0)
{
Serial.write(Serial1.read());
}

}[/box]

 

Download the Arduino Sketch to Reset ESP8266 Wifi Module: Reset ESP8266 Arduino Sketch

It may take 10 to 15 seconds to reset, and once it is done you will receive some unknown bytes on Serial monitor as shown in Figure below:

reset esp8266 output after reset

 

To Test ESP8266, if it is working or not, download a simple Sketch after executing this sketch, Serial Monitor should show “OK“.

reset esp8266 verify

 

Enjoy!

 

Version: 1.0 (dated: 22-03-2017)

6 Comments on “Master RESET ESP8266 Wifi Module using Arduino mega 2560”

  1. boa tarde tem uma parte do programa que nao funciona.
    Serial1.println(“AT”);
    como faço para corrigir isso.

    1. Re-write this line by yourself in the code, sometimes when you copy the code, some of the characters are changed, that’s why the compiler shows syntax errors.

  2. Hello i am trying to reset my esp8266 wifi module using arduino uno and base on the instruction given i have included the software serial library, but then there is an error saying “Serial1 was not declared in this scope”. Below is my entire code.

    #include
    void setup() {

    Serial.begin(9600);
    Serial1.begin(115200);
    pinMode(5, OUTPUT);
    digitalWrite(5, LOW);
    for(int i=0;i 0)
    {
    Serial1.write(Serial.read());
    }

    if(Serial1.available() > 0)
    {
    Serial.write(Serial1.read());
    }
    }

    please can someone help me

    1. Arduino Uno has only a single serial port. You can only use Serial and not Serial1. If you have used Software serial, then replace Serial1 with the name of the software serial variable.

Leave a Reply

Your email address will not be published.