Categories
ESP32 Python

ESP32 and MicroPython

I have some ESP32 based boards lying around and stumbled across MicroPython, which appealed to me as I have some Python code I wanted to try and port to an ESP32 board. MicroPython supports ESP32 and any board should work, I am using an ESP32-WROOM-32.

ESP32-WROOM-32 board
ESP32-WROOM-32

Download the firmware

Download the latest version of the firmware from the MicroPython website, at the time of writing this was version 1.18 for the generic ESP32.

Flashing the firmware

Esptool must be used to flash the firmware, install via pip -:

pip install esptool

Use esptool to erase the flash and then flash the firmware, note I am using a Macbook so my serial port is /dev/cu.usbserial-0001, Windows users use whatever your serial port is -:

esptool.py --port /dev/cu.usbserial-0001 erase_flash

You can then deploy the downloaded firmware -:

esptool.py --chip esp32 --port /dev/cu.usbserial-0001 write_flash -z 0x1000 esp32-20220117-v1.18.bin

Connecting via serial to the ESP board with a baud rate of 115200 should present you with an interactive python prompt.

Interactive MicroPython Prompt
Interactive MicroPython Prompt

In another post we will create a python script and have the ESP32 run this script on boot.

Leave a Reply

Your email address will not be published. Required fields are marked *