Flash Program ESP-01 using USB Serial Adapter

Flash Program ESP-01 using USB Serial Adapter. Programming ESP is a bit hard for beginners. In this tutorial, we will make it easy for you to understand the initial step so you can do it your self.

How to Program or Flush ESP-01
ESP-01

How to Flash or Program ESP-01?

ESP-01 is a black colored module with 1024k memory. ESP-01 requires only 3.3 volts to power up. To flash or upload firmware/sketch, we need an external USB Serial Board adapter that supports 3.3 volts.

USB to Serial Board Adapters

In this tutorial, we will use 4 different kinds of Serial Board:

  1. ESP8266 Serial Module Board
  2. USB to TTL CH340G Converter Module Adapter
  3. FT232RL
  4. Arduino UNO

 

1. Flashing ESP-01 using Esp8266 Serial Module Board

Serial Adapter Module - how to program esp-01
ESP8266 Serial Module Board Development

 

Flushing ESP-01
This is how it looks after inserting ESP-01 on the serial adapter

Wiring ESP-01 to set on programming mode

To set ESP-01 on programming mode, we need to set a jumper wire to Ground and Io0 (IO Zero)

To make an easy jumper, I soldered 8 pins behind the serial module. This may help us later in testing the program after the firmware is uploaded.

Serial Adapter Module - how to program esp-01

Esp-01 programming mode wiring
Jumper wire is placed on GND and Io0

How to upload sketch on ESP-01 using Arduino?

Insert the serial adapter to your computer USB port and open Arduino software. You should get “Port:” enabled. Just select the port shown on your side, in my case I got Com3. Yours may be different. If you got the port number, just select it and skip the following step and proceed to ESP-01 Arduino Board Configuration

 

How to get Port number manually without using Arduino Software?

If you don’t use Arduino software and just want to use other esptool for direct flashing of compiled binary bin files, you may need to find port number manually.

Go to Control Panel >> Device Manager >> Ports >>

Get Port number manually

If you have more than one port showing, just remove the Serial Module from USB and see what port disappeared. Insert the USB again and look for the new port number. This how to get the port number manually.

 

ESP-01 Arduino Board Configuration

Arduino port esp-01

Next, select the right Board. On Arduino software click Tools >> Board: “???” >> Find Generic ESP8266 Module and select it

Now change the board settings:

  • Flash Mode: “DIO”
  • Flash Frequency: “40MHz”
  • CPU Frequency: “80 MHz”
  • Flash Size: “1M (64K SPIFFS)”
  • Debug Port: “Disabled”
  • Debug Level: “None”
  • Reset Method: “ck”
  • Upload Speed: “115200”

Now it’s all set. Let’s upload a sketch. Open an example sketch. Open the blink sketch on Arduino.

Arduino blink sketch

 

Upload the blink sketch by pressing ctrl+u or go to Sketch and click Upload. You will see a progressing dot while uploading. Sometimes uploading take a minute or two.

Arduino blink sketch progress

If you get an error like:

  • warning: espcomm_sync failed
  • error: espcomm_open failed
  • error: espcomm_upload_mem failed

The wirings maybe not properly connected. It’s good to remove the USB first from the computer and check the wirings if properly connected and proceed again

After the upload, you should see your ESP-01 blinking. You have made a successful upload.

Esp-01 blink sketch

 

2. Flash ESP-01 using USB to TTL CH340G Converter Module Adapter

This serial adapter has a simple design but a bit complex to use in programming an ESP compare to the first one we used. It has 5v, TX, RX, GND and 3.3v which make it fit to program an ESP.

TTL CH340G Converter Module Adapter Flashing Esp-01

The process of flashing ESP-01 using this adapter is almost the same as the first one we used. The only addition to the process is to add a jumper wire between the 3V3 and EN of ESP. Check the image below:

TTL CH340G Converter Module Adapter Esp-01 wirrings

Let’s see it on the actual wirings

Esp-01 Programming mode wirings

The wiring of ESP to Serial should be:

  • 3v3 – 3v3
  • RX – TXD
  • TX – RXD
  • GND – GND

Please ensure the jumper wires are connected properly to make it work.

Again we need to select the right Board. On Arduino software click Tools >> Board: Generic ESP8266 Module

Board settings:

  • Flash Mode: “DIO”
  • Flash Frequency: “40MHz”
  • CPU Frequency: “80 MHz”
  • Flash Size: “1M (64K SPIFFS)”
  • Debug Port: “Disabled”
  • Debug Level: “None”
  • Reset Method: “ck”
  • Upload Speed: “115200”

Now we are ready to start an upload.

 

3. Flash ESP-01 using USB to TTL CH340G Converter Module Adapter

Using TTL CH340G adapter to program ESP is the same as the process we had discussed above. RX should be connected to TX and TX to RX. Just dont forget to always use 3.3v to power up the ESP.

Programming ESP-01 using USB to TTL CH340G Converter Module Adapter

Again we need to select the right Board. On Arduino software click Tools >> Board: Generic ESP8266 Module

Board settings are the same as the previous one:

  • Flash Mode: “DIO”
  • Flash Frequency: “40MHz”
  • CPU Frequency: “80 MHz”
  • Flash Size: “1M (64K SPIFFS)”
  • Debug Port: “Disabled”
  • Debug Level: “None”
  • Reset Method: “ck”
  • Upload Speed: “115200”

Now we are ready to upload a sketch

 

4. Flash ESP-01 using Arduino Uno

Arduino Uno is the very commonly used to flash/program the ESP.

  • Esp RX is going to Uno Rx <-0
  • Esp Tx going to Uno Tx->1.
  • Esp 3.3v+EN to Uno 3.3v
  • GND+Io0 to GND.

Arduino Uno flush program Esp1

 

One final thing is the board settings of Arduino software. Go to Tools >> Board >> Select NOT Arduino UNO but select Generic ESP8266 Module.

And ensure you have these settings:

  • Flash Mode: “DIO”
  • Flash Frequency: “40MHz”
  • CPU Frequency: “80 MHz”
  • Flash Size: “1M (64K SPIFFS)”
  • Debug Port: “Disabled”
  • Debug Level: “None”
  • Reset Method: “ck”
  • Upload Speed: “115200”

Adruino board settings for flushing ESP-01