ESP-01: Reinstalling the Original NodeMCU Firmware (ESP8266)

The ESP-01 is a small module that adds a Wifi connection to an Arduino. In this article we will learn how to reinstall the original firmware. You may need it if you get an error code during the boot, reinstall the original firmware after testing NodeMCU, retrieve the AT commands, or simply if you think your ESP-01 is faulty.

The ESP-01 is certainly the most popular member of the large family of WiFi modules ESP8266 (18 at the time of writing this article). We will find them in a future article. It is a very economical module. For less than 3 € from Asia, you add a Wi-Fi card to your Arduino. It is much cheaper than a Arduino Wifi Shield or the Arduino Yun.

Before you start with the ESP8266

If you discover the ESP8266 (and the ESP-01), it’s a bit like Arduino clones, you will find many manufacturers / sellers. Therefore, you may purchase different versions of the firmware. If you have just purchased your ESP8266, you can easily check the information using the AT commands. Once you have uploaded an Arduino program to your ESP, the AT commands will no longer be accessible via the Series Monitor (or via Putty).

To wire, follow the paragraph “Prepare the ESP-01 for flashing” below.

From the Arduino IDE, launch the Serial Monitor. Select the mode “Both, NR and CR” and a speed of 9600 baud. Turn on your ESP, after a while you should get a message containing the seller’s name followed by an OK. If you can not read (incomprehensible ASCII codes), try changing the speed to 115200 baud.

Type the AT command and then Send. If everything is normal, the ESP will return OK. Finally, type AT + GMR and then Send. In return, the ESP returns you the version of the AT command interpreter as well as the version of the installed SDK.

ESP01 ESP8266 AT+GMT AT SDK version

Why flash the original firmware ?

First of all, ESP01 can sometimes be misleading. This can happen after a faulty installation (other firmware, program …). If the module returns you the following error code via the Serial Monitor, the best is to flash the original firmware of Espressif.

If you get the message below, your ESP is in “Flashing Mode”, this is not a mistake

The other great strength of the ESP8266 is the ability to install the firmware of its choice (and even develop its own with the SDK). The Arduino IDE is still the simplest way to program the ESP8266, in which case you will need to re-install the original firmware.

Preparing the ESP-01 for Flashing

Before flashing the original firmware, you must already set the ESP-01 “Flashing Mode”. To do this, the GPIO must be connected to the GND when the power is turned on. Upgrading the firmware is energy intensive, so make sure you have sufficient power before performing the operation.

Necessary material

You will need the following materials (commercial links):

(liens commerciaux) :

esp8266 esp-01 module Wifi ESP-01 module (ESP8266)
adaptateur regulateur 5v 3V esp-01 esp8622 ESP-01 adaptor with 5V to 3.3V tension regulator (better)
module ftdi USB FDTI module or cable
 jumper dupont Jumper Dupont
bouton-poussoir Button (optional)
resistance 220ohms Resistor 220 ohm (optional)
breadboard Breadboard (optional)

Powered by 3.3Volts

All ESP8266 modules must be supplied with 3.3 Volts. Be careful not to exceed this voltage because no protection is provided. Another important point is the power supply. It is better to have at least 500mA (see 1A) for the firmware update. It is therefore not recommended to use the power supply of the USB port. For my part, I simply use two AA (new) batteries in a case with a switch. This saves me from wiring a Reset button and I’m sure the ESP-01 starts in Flashing Mode when power is turned on.

You can also invest in a 3.3V / 5V power supply for breadboard. This is not an unnecessary expense if you have several nice DIY projects in mind.

3.3V 5V arduino power supply breadboard alimentation électrique

You can finally use a power supply of a smartphone. For this you will need a jack adapter with a screw terminal and a voltage regulator (LD1117V33 for example) to deliver the 3.3 Volts required for your ESP8266. Be careful not to exceed the recommended supply voltage (consult the technical documentation). Finally, take into account in designing your projects that the LD1117 heats up (a lot). You can also add a 10μF capacitor for a more stable power supply.

alimentation 3.3V breadboard arduino LD1117 jack

Connection

Pin ESP-01For the ESP to start in Flashing Mode, the GPIO0 pin must be connected to the GND. Connect the pins as follows:

GND <-> Connect the GND of the battery together with the GND of the FTDI module. You can also wire a reset resistor.

GPIO0 <-> GND

RX <-> FTDI TX

TX <-> FTDI RX

CH_PD <-> + 3.3V

VCC <-> + 3.3V

The wiring that I offer is much simpler than what you can find on the internet but it works and requires only a few Dupont cables.

Do not connect anything to the GPIO2 pin while updating the firmware (also when you want to upload a program from the Arduino IDE).

ESP-01-ESP8266-wiring-flashing-mode

Click to enlarge

What software to flash the firmware of the ESP-01?

There are at least two solutions for flashing the original firmware. The first solution is to use the original update software from Espressif. The Flash Tool lets you flash all the modules in the ESP8266 family. The hardest part is finding the right flash parameters. I have tried many without success. I do not give up this solution but for this article I propose instead to use ESPFlasher which works very well and that does the job without any adjustment. You can download it at this address. The ZIP archive contains the update software esp8266_flasher.exe and the firmware (ESP_8266_BIN0.92.bin). There seems to be no version for Mac OS, Linux (or Raspberry) users.

In case of failure, you can also test an alternative firmware available here:

  • Ai-thinker-0.9.5.2-9600.bin
  • V0.9.2.2 AT Firmware.bin
  • V1.1.1.1 AT Firmware.bin

Update firmware

Turn on your ESP-01. You should only have the red LED on.

Start esp8266_flasher.exe and specify the COM port on which your ESP-01 is located. To find out which COM port your ESP01 is connected to, you can use the Arduino IDE. Do not change the address (0x00000)

Start the firmware update by pressing “Download”. Esp8266_flasher.exe will first erase the flash memory and then download the update. The operation lasts about one minute. Do not worry about the error message at the end of the operation.

ESP01 ESP8266 espflasher.exe mise a jour firmware

Verify that the update is working

To verify that the update is correct, the easiest way is to use the Arduino IDE Series Monitor (you can also use Putty). Follow the steps in the introductory paragraph. If all went well you should get OK with the AT command and the AT and SDK versions with the AT + GMG command.

ESP01 ESP8266 AT+GMT AT SDK version

So, if everything works your ESP-01 is like new. You can use the AT commands again and upload your program from the Arduino IDE. Remember that AT commands will no longer be available after an Arduino program has been uploaded.

Test your first Arduino program on your ESP8266

If you discover the ESP8266, you must first install the library to program the esp8266 cards to your Arduino IDE. To do this, open the preferences and add to the list of packages.

IDE Arduino 1.6.8 esp8266 package

Go to the map manager and look for esp8266, then click install.

IDE Arduino 1.6.x ajouter carte esp8266

esp01 esp8266 generic module arduino ide configurationWhen the installation is complete, select “Generic ESP8266 Module“. The configuration for an ESP-01 is as follows:

  • Flash Mode: DIO
  • Flash Frequency: 40 MHz
  • CPU Frequency: 80 MHz
  • Flash Size: 512K
  • Upload Speed: 115200 baud

Choose ArduinoISP as a programmer.

In the list of examples ESP8266Wifi, choose WifiScan. Put your ESP in Flashing Mode and then upload the program. If your connection is correct, points indicating the download progress will appear.

ESP01 ESP8266 download wifi scanner

Open the Serial Monitor (at 115200 baud). Your ESP-01 now scans your Wifi network and returns the found networks.

ESP01 ESP8266 Test wifi scanner

Error Messages and Remedies

I have listed some error messages that you may encounter as well as a few tracks to resolve them. If you have other solutions, do not hesitate to share them in the comments so that I can add them.

Message  Possible causes Solutions


 ESP is not in Flashing Mode Choose ArduinoISP as a programmerCheck the connection of the serial link (reverse TX / RX)

Is the GPIO0 good at the GND?

Your diet too low. It must deliver at least 300mA when flashing the firmware

Add a reset resistor to the GPIO0 or connect the GND of the 3.3V power supply to the GND of the FTDI module

Unplugging / replacing the ESP8266

Disconnect / reconnect to another USB port your FTDI module

Restart the computer (if the FTDI module can not be found)

Subscribe to the weekly newsletter

No spam and no other use will be made of your email. You can unsubscribe anytime.

Tags:

  • Janiar

    Nice tutorial, thanks !

    • Thank you very much Janiar. With pleasure 😀

  • Josh Wells

    Hey, I can’t update the firmware with the given software. The log file gives this error:

    SerialException: could not open port ‘COM9’: WindowsError(5, ‘Access is denied.’)

    The ESP-01 is connected through an Arduino Uno. I also tried when running as admin, and made sure the serial monitor of the Arduino IDE is closed when trying the flashing.
    Would appreciate help.

    • Hi Josh. It’s normal. You must close the serial monitor on the Arduino IDE (or exit the Arduino IDE) before you can flash the firmware. There can only be one software connected to the ESP8266’s serial port at a time. Have a good day

      • Josh Wells

        Thanks for your reply. What I meant is that even though I closed the serial monitor and the Arduino IDE, still I had this error message.
        I have these questions:
        1. What should be the code uploaded to the Arduino Uno while flashing?
        2. What should be the board selected in the Arduino IDE? Arduino Uno / ESP-8266?

        Thanks

  • krishna mohan

    the pin diagram sequence of esp01 is wrong, you have swapped GPIO0 & GPIO2 with one another, please check.

  • john Mclane

    Thank you!

DIY Projects