Here you will learn how to program/update the ESP-01 firmware to use AT commands using any programming board or any Arduino Board. Test the firmware operation at the end with simple AT command.
There are several programmers dedicated exclusively to programming microcontrollers, such as the FTDI board used here. However, sometimes we don´t have one of these programmers, so we have to use other alternatives. Of these alternatives, I highlight here the Arduino UNO, since it has a programmer and it has serial communication pins accessible, as you can see in this tutorial.
Parts Required
- ESP-01 or ESP-01S;
- Arduino Board (UNO, Mega …) or YP-05 FTDI programmer module;
- Breadboard;
- Jumper wires;
- ESP FLASH DOWNLOAD TOOL (click to download);
- ESP-01 Firmware (click to download).
Programming Procedure
The programming procedure is explained in this tutorial for FTDI board and it is explained in this tutorial for using Arduino Board to program ESP-01. Therefore, you must follow the instructions present in the tutorial that is most suitable for your case. In the programming procedure, you need to follow the first two steps (described below), taking into account the electrical circuits present in these tutorials.
Step 1: Enter programming mode by pressing the FLASH and RESET buttons;
Step 2: Release the RESET button and then release the FLASH button. You are in programming mode (first RESET button and then FLASH button);
You are in programming mode on your ESP-01.
Step 3: Open the Windows “Control Panel”, “Device Manager”, and in the window that opens, go to “Ports (COM and LPT)”. You will be able to see the connected device and the COM port numbers it has been allocated to. As a demonstration, the programmer is connected to Serial Port 6, as you can see in the next figure:
Step 4: Download the tool and bin file (firmware) from the links in the Parts Required section;
Step 5: Open your ESP_DOWNLOAD_TOOL_V2.4.exe;
Step 6: You must change the fields marked in red color, it must be equal to the fields presented in the following figure:
Step 7: Click on the Start button to the test connection. If Sync is returned, the connection is established successfully;
Note: If FAIL is returned (next figure), you possibly have the serial port open on your Arduino IDE (or another program), or the ESP-01 is not in programming mode. In these last case, you can try to enter programming mode again, following the tutorials suggested above.
Step 8: Select the .bin file you downloaded using the “…” button. Click on the left check box to select the firmware. Then, click on the START button to start de upload to the ESP-01, as you can see in the next figure.
The Upload is finished when you see the “com closed” in the terminal and FINISH word on the green button.
Step 9: Restart ESP-01 by removing and inserting the USB cable. Now the ESP-01 cannot be in programming mode, the normal switch ON is required. Open the Arduino IDE, Serial Monitor and then put the “AT” command and click on the “Send” button, as you can see in the next figure.
The result is presented here in the next figure. Congratulations!!!!
ESP-01 is reprogrammed for the use of AT commands. Now, you can check on the internet which AT commands it accepts and just keeps playing. 🙂
Important Note: If you use an Arduino board to program your ESP-01 then make sure the Arduino is not running in a program that uses the serial port. if it is running another program that uses Serial Port 0 (Arduino Serial Port), there will be communication conflicts and esp programming will not be successful.
So you must load the program code that is in the last section of this tutorial. You must load the code before connecting the ESP-01.
Code
The code presented here is just to make sure that the Arduino is not occupying the Serial Port used to program the ESP-01.
void setup() { } void loop() { //idle }