How to reinstall the MicroPython firmware on an ESP8266 or ESP32 with the esptool.py script

In the previous tutorial, we were able to test the firmware MicroPython which is now pre-installed by default on the Wemos LoLin32 Lite. The MicroPython firmware is available for many micro-controllers. The pyBoard development boards (cards dedicated to MicroPython), WiPy carts, STM32 (STM32F4) based cards, Nucleo and Espruino Pico cards and ESP8266 and ESP32 development boards. To download the latest firmware that corresponds to your card, go to the official website of the MicroPython project on this page.

Install esptool

To install the MicroPython firmware on your card, you will need Espressif esptool tools. If you already have python (to find out, just run the command python –version in Terminal or command prompt on Windows), just run the command

To learn more about the esptool command-line tool, you can read this article.

Flash the MicroPython firmware on an ESP8266 or ESP32 card

If it’s not done yet, go to this page to download the latest firmware version for ESP8266 or ESP32. We download directly a binary file that we just need to upload to the card using a USB cable.

Here, I propose to (re) install the firmware on an ESP32 card. For the ESP32, it’s simple, there is only one binary available. For ESP8266 cards, there are three different firmwares:

  • The latest build (latest compilation), also called latest
  • A version with debug mode enabled by default and WebRPL disabled
  • A version for older ESP8266 with only 512KB of flash memory

Once downloaded, open the Terminal (Linux and macOS) or command prompt under Windows (or PowerSheel) and then plug in the card. Run the command ls/dev/tty*  on Linux or macOS and mode  on Windows to identify the USB port to which the card is connected. Here, an example on a Mac Mini (the bluetooth port is displayed).



If the card is not visible, you need to install the CH341 driver on your machine, follow this tutorial for that and come back after


Go to the download directory ( cd ~/Downloads/ ) and start the firmware installation with the following command. Remember to replace the COM port and the firmware name before running it.

The installation starts immediately and takes about 15 seconds.

We just have to check that everything works well by connecting with rshell presented in the previous tutorial.


Note. If you can not connect with rshell, no choice, it will restart the computer or the Raspberry Pi!

Subscribe to the weekly newsletter

No spam and no other use will be made of your email. You can unsubscribe anytime.

DIY Projects