DEV Community

Cover image for How to Flash ESP-01 with esptool

Posted on

How to Flash ESP-01 with esptool


I am just learning how to flash firmware in ESP-01. So, i just wanna share what i learned.

Let's get started.

First. you need some hardware to flash ESP-01. the hardware is:

  1. Arduino Uno R3
  2. ESP-01 (Of Course)
  3. Jumper Cable
  4. Bread board

And you need software also:

  1. Esptool (Python, Pip)
  2. Arduino IDE
  3. Firmware

Installation Software

In case, i assume you already install Arduino IDE and because i am a linux user, python was already installed in my system. So, i just explain how to install esptool and pip.

First, open your terminal and install pip with this command:

$sudo apt install pip

And then, install esptool with pip.

$sudo pip install esptool

After esptool installed, we ready to flash our ESP-01. before we flash it, don't forget to download the firmware. here i use firmware from ai-thinker. you can download it in Link. you can also use another firmware like Micropython.


We wire up the circuit to make Arduino Uno into USB-to-Serial Converter. then, we can flash ESP-01 through Arduino Uno. you can follow this scheme:

Be careful, and double-check your wiring before your connect the Arduino to your computer. otherwise, your circuit will be short.

Erase & flash Firmware in ESP-01

Previously, we were already install esptool. we can use esptool to
erase and flash firmware in ESP-01.

Erase Firmware

You can follow this command to erase firmware:

$sudo python3 --port /dev/ttyUSB0 erase_flash

If you found errors, remove the usb and plug it in again. and repeat the command after 5s.

Flashing Firmware.

You can follow this command to flash firmware:

sudo python3 -p /dev/ttyUSB1 -b 115000 write_flash 0x000000 ai-thinker-v1.1.1-115200.bin

If you not found any errors, you already succeed to flash firmware in ESP-01.

Discussion (0)