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.
- 1 Before you start with the ESP8266
- 2 Why flash the original firmware ?
- 3 Preparing the ESP-01 for Flashing
- 4 What software to flash the firmware of the ESP-01?
- 5 Update firmware
- 6 Verify that the update is working
- 7 Test your first Arduino program on your ESP8266
- 8 Error Messages and Remedies
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.
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.
ets Jan 8 2013,rst cause:1, boot mode:(3,7)
If you get the message below, your ESP is in “Flashing Mode”, this is not a mistake
ets Jan 8 2013,rst cause:2, boot mode:(1,6)
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.
You will need the following materials (commercial links):
(liens commerciaux) :
|ESP-01 module (ESP8266)|
|ESP-01 adaptor with 5V to 3.3V tension regulator (better)|
|USB FDTI module or cable|
|Resistor 220 ohm (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.
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.
For 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).
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:
- V0.9.2.2 AT Firmware.bin
- V18.104.22.168 AT Firmware.bin
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.
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.
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.
Go to the map manager and look for esp8266, then click install.
When 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.
Open the Serial Monitor (at 115200 baud). Your ESP-01 now scans your Wifi network and returns the found networks.
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.
|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)