I have to admit that I had some bad experience when trying to flash new firmwares to my ESP-01 modules but today I have found an easy and reliable way to flash
ESP8266 firmware v1.5 (AT v0.51) using my Arduino Uno board as an FTDI controller.
Prerequisites
You need the following items:
- A Windows PC with Arduino IDE installed
- An Arduino Uno board
- A reliable connection between ESP-01 module and Arduino board. This procedure is based on my cheap Arduino WiFi shield with ESP-01
Wiring
First of all you have to build my
cheap Arduino WiFi shield with ESP8266. This will provide a solid foundation for powering the ESP module and setup the communication to the Arduino board.
Ensure you are able to issue simple AT commands to the ESP-01 board before proceeding.
Now modify the wiring as follows.
- Remove ATmega328P chip from the Arduino board. By removing the microcontroller you can use the Arduino Uno onboard FTDI interface to directly communicate with the ESP module.
- Connect ESP' RDX pin to the RX pin of Arduino (pin 0).
- Connect ESP's TXD pin to the TX pin of Arduino (pin 1).
Test connectivity
Open the Arduino IDE, select the correct port and open the serial monitor.
You should be able to issue AT commands and get a nice output. Try 'AT' and 'AT+GMR' commands.
If you do not get any output you can try the following.
- The serial monitor baud rate must correspond to the ESP UART baud rate. Old modules have 9600, newer ones have 115200.
- Try different settings for the 'Line ending' option of the serial monitor. For my ESP module I have to set it to 'Both NL & CR' as you can see in the screenshot.
Try different combinations until you are able to correctly interact with the ESP module using the serial monitor.
Download firmware and tools
Download the following files and extract them
Flash it!
To put the ESP module in flashing mode you must connect ESP's GPIO0 pin to ground.
- Unplug the Arduino board from the PC
- Put a jumper between GND and GPIO0 pin (see photo)
- Plug the Arduino board to the PC.
Follow these steps to flash the new firmware to the ESP-01 board.
- Close the Arduino IDE if still opened
- Launch the ESP flash download tool (ESP_DOWNLOAD_TOOL_V2.4.exe) you have previously extracted
- Apply the following settings
- Bin files (from the esp_iot_sdk extracted zip file) :
- bin\at\noboot\eagle.flash.bin - 0x00000
- bin\at\noboot\eagle.irom0text.bin - 0x40000
- bin\blank.bin - 0xfe000
- bin\blank.bin - 0x7e000
- Flash size: 8MBit
- COM port: choose your Arduino COM port
- Baud rate: 115200 or 345600 (this is not related to the ESP baud rate
Now press the START button and wait for the flashing process to complete.
Now press the STOP button and close the flashing tool.
Test connectivity and set default UART speed
Before proceeding it is better to verify that the new firmware is working fine.
- Unplug the Arduino board from the PC
- Remove the jumper between GND and GPIO0 pin
- Plug the Arduino board to the PC
Open the Arduino IDE, select the correct COM port and open the serial monitor.
Test connectivity with 'AT' and 'AT+GMR' commands. The correct settings for the ESP firmware v1.5 are:
- Speed: 115200
- Line ending: Both NL & CR
If you are going to use the ESP-01 module with Arduino Uno you have to lower the default baud rate because the SoftwareSerial interface maximum speed is around 38400 bps. I suggest to set the ESP module to use 9600 or 19200 bps. To set the correct baud rate use this command:
AT+UART_DEF=9600,8,1,0,0
Now set the serial monitor speed to 9600 and test again the communication.
Rebuild your ESP WiFi shield
Remove the modifications made to the ESP shield.
- Insert the ATmega328P chip back into the Arduino board
- Connect ESP' RDX pin to Arduino pin 7
- Connect ESP's TXD pin to Arduino pin 6
Compile and upload the updated sketch and you should be able to correctly interact with the ESP module.
Your ESP8266 board is now flashed with the updated firmware and ready to be used for your connected projects!
Don't forget to take a look at my
WiFiEsp library for Arduino.