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
- esptool installed via pip or the github releases.
- Micropython Firmware, Direct Download v.1.25.0
- mpremote (To check if the installation was successful)
Flashing the Firmware
- Connect the ESP32 to your computer via USB.
- Open a terminal and run the following command to erase the flash memory:
esptool.py erase_flashYou 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.
- 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 - Test if everything worked with mpremote:
mpremoteA 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