Installing Micropython on an ESP32.

This page describes how to install Micropython on an ESP32. It is only required after receiving brand new ESP32 devices.

Prerequisites

Flashing the Firmware

  1. Connect the ESP32 to your computer via USB.
  2. Open a terminal and run the following command to erase the flash memory:
    esptool.py erase_flash
    

    You may need to press the boot button while running this command to put the ESP32 into bootloader mode. You can release it as soon as the command starts running.

  3. Flash the Micropython firmware using the following command (in the same directory as the downloaded firmware):
     esptool.py --baud 460800 write_flash 0x1000 ESP32_GENERIC-20250415-v1.25.0.bin
    
  4. Test if everything worked with mpremote:
    mpremote
    

    A successful connection should show the Micropython version and other information about the ESP32.

Troubleshooting

If esptool.py or mpremote commands fail, try using the prefix python -m instead of the .py commands. For example:

python -m esptool erase_flash
python -m mpremote

Further information