Random Nerd Tutorials
Share

Flash/Upload MicroPython Firmware to ESP32 and ESP8266

Share

This posts shows how to flash MicroPython firmware to ESP32/ESP8266 boards using the uPyCraft IDE software. It works on Windows, Linux, and Mac OS X.

Before continuing with this tutorial, make sure you follow one of these guides to install uPyCraft IDE on your computer:

With uPyCraft IDE installed in your computer, you can easily flash your ESP32 or ESP8266 boards with the MicroPython firmware. This post is divided in two parts, read Part 1 or Part 2 depending on your board:

  • Part 1 – ESP32
  • Part 2 – ESP8266

Note: After installing MicroPython firmware on your ESP32 or ESP8266, you can go back and use Arduino IDE again. You just need to upload code using Arduino IDE. Then, if you want to use MicroPython again, you need to flash MicroPython firmware.

[Part 1 – ESP32] Downloading and Flashing the MicroPython Firmware on ESP32

To download the latest version of MicroPython firmware for the ESP32, go to the MicroPython Downloads page and scroll all the way down to the ESP32 section.

You should see a similar web page (see figure below) with the latest link to download the ESP32 .bin file – for example: esp32-20181007-v1.9.4-631-g338635ccc.bin.

Note: if you’re using a different board (like a PyBoard, WiPy, or other), go to MicroPython Downloads page and download the right firmware for your board.

Selecting Serial Port

Go to Tools > Serial and select your ESP32 COM port (in our case it’s COM5).

Important: if you plug your ESP32 board to your computer, but you can’t find the ESP32 Port available in your uPyCraft IDE, it might be one of these two problems: 1. USB drivers missing or 2. USB cable without data wires.

1. If you don’t see your ESP’s COM port available, this often means you don’t have the USB drivers installed. Take a closer look at the chip next to the voltage regulator on board and check its name.

cloud-download

The ESP32 DEVKIT V1 DOIT board uses the CP2102 chip.

Go to Google and search for your specific chip to find the drivers and install them in your operating system.

You can download the CP2102 drivers on the Silicon Labs website.

After they are installed, restart the uPyCraft IDE and you should see the COM port in the Tools menu.

2. If you have the drivers installed, but you can’t see your device, double-check that you’re using a USB cable with data wires.

USB cables from powerbanks often don’t have data wires (they are charge only). So, your computer will never establish a serial communication with your ESP32. Using a a proper USB cable should solve your problem.

Selecting the Board

Go to Tools > Board. For this tutorial, we assume that you’re using the ESP32, so make sure you select the “esp32” option:

Flashing/Uploading MicroPython Firmware

Finally, go to Tools > BurnFirmware menu to flash your ESP32 with MicroPython.

Select all these options to flash the ESP32 board:

  • board: esp32
  • burn_addr: 0x1000
  • erase_flash: yes
  • com: COMX (in our case it’s COM5)
  • Firmware: Select “Users” and choose the ESP32 .bin file downloaded earlier

After pressing the “Choose” button, navigate to your Downloads folder and select the ESP32 .bin file:

Having all the settings selected, hold-down the “BOOT/FLASH” button in your ESP32 board:

While holding down the “BOOT/FLASH“, click the “ok” button in the burn firmware window:

When the “EraseFlash” process begins, you can release the “BOOT/FLASH” button. After a few seconds, the firmware will be flashed into your ESP32 board.

Note: if the “EraseFlash” bar doesn’t move and you see an error message saying “erase false.“, it means that your ESP32 wasn’t in flashing mode. You need to repeat all the steps described earlier and hold the “BOOT/FLASH” button again to ensure that your ESP32 goes into flashing mode.

[Part 2 – ESP8266] Downloading and Flashing the MicroPython Firmware on ESP8266

To download the latest version of MicroPython firmware for the ESP8266, go to the MicroPython Downloads page and scroll all the way down to the ESP8266 section.

You should see a similar web page (see figure below) with the latest link to download the ESP8266 .bin file – for example: esp8266-20180511-v1.9.4.bin.

Note: if you’re using a different board (like a PyBoard, WiPy, or other), go to MicroPython Downloads page and download the right firmware for your board.

Selecting Serial Port

Go to Tools > Serial and select your ESP8266 COM port (in our case it’s COM5).

Important: if you plug your ESP32 board to your computer, but you can’t find the ESP32 Port available in your uPyCraft IDE, it might be one of these two problems: 1. USB drivers missing or 2. USB cable without data wires.

1. If you don’t see your ESP’s COM port available, this often means you don’t have the USB drivers installed. Take a closer look at the chip next to the voltage regulator on board and check its name.

The ESP8266 ESP-12E NodeMCU board uses the CP2102 chip.

Go to Google and search for your specific chip to find the drivers and install them in your operating system.

You can download the CP2102 drivers on the Silicon Labs website.

After they are installed, restart the uPyCraft IDE and you should see the COM port in the Tools menu.

2. If you have the drivers installed, but you can’t see your device, double-check that you’re using a USB cable with data wires.

USB cables from powerbanks often don’t have data wires (they are charge only). So, your computer will never establish a serial communication with your ESP8266. Using a a proper USB cable should solve your problem.

Selecting the Board

Go to Tools > Board. For this tutorial, we assume that you’re using the ESP8266, so make sure you select the “esp8266” option:

Flashing/Uploading MicroPython Firmware

Finally, go to Tools > BurnFirmware menu to flash your ESP32 with MicroPython.

Select all these options to flash the ESP8266 board:

  • board: esp8266
  • burn_addr: 0x0
  • erase_flash: yes
  • com: COMX (in our case it’s COM5)
  • Firmware: Select “Users” and choose the ESP8266 .bin file downloaded earlier

After pressing the “Choose” button, navigate to your Downloads folder and select the ESP8266 .bin file:

Having all the settings selected, hold-down the “BOOT/FLASH” button in your ESP8266 board:

While holding down the “BOOT/FLASH“, click the “ok” button in the burn firmware window:

When the “EraseFlash” process begins, you can release the “BOOT/FLASH” button. After a few seconds, the firmware will be flashed into your ESP8266 board.

Note: if the “EraseFlash” bar doesn’t move and you see an error message saying “erase false.“, it means that your ESP8266 wasn’t in flashing mode. You need to repeat all the steps described earlier and hold the “BOOT/FLASH” button again to ensure that your ESP8266 goes into flashing mode.

Wrapping Up

We hope you’ve found this tutorial useful. Your ESP32/ESP8266 should now be flashed with MicroPython firmware. To learn more about MicroPython read: Getting Started with MicroPython on ESP32 and ESP8266.

If you liked this post, you might like our next ones, so make sure you subscribe to the RNT blog and download our free electronics eBooks.

Learn ESP32 with Arduino IDE

This our complete guide to program the ESP32 with Arduino IDE, including projects, tips, and tricks! The registrations are open, so SIGN UP NOW »

Recommended Resources

Home Automation using ESP8266 »
Build IoT projects and home automation gadgets with the ESP8266 Wi-Fi module.

Build a Home Automation System »
Learn how to build a automation system using open-source hardware and software from scratch.

Arduino Step-by-Step Projects »
Build 25 cool Arduino projects with our course even with no prior experience!

Leave a Comment:

Add Your Reply

Grab our Electronics and Programming Courses