Two independent paths depending on your background. Start with MicroPython if you've never touched a microcontroller — it's the fastest first success.
- Python 3.11+ on your host
esptool.py(pip install esptool)mpremote(pip install mpremote)- A pre-built MicroPython image from https://micropython.org/download/esp32/
(e.g.
esp32-20241016-v1.24.0.bin)
# Linux / macOS
esptool.py --chip esp32 --port /dev/ttyUSB0 erase_flash
esptool.py --chip esp32 --port /dev/ttyUSB0 --baud 460800 write_flash 0x1000 esp32-20241016-v1.24.0.binWindows: replace /dev/ttyUSB0 with the COM port (e.g. COM3) shown in Device Manager.
mpremote connect /dev/ttyUSB0 cp micropython/boot.py :boot.py
mpremote connect /dev/ttyUSB0 cp micropython/main.py :main.py
mpremote connect /dev/ttyUSB0 resetOr the shorthand:
make mpy-runWatch the output:
mpremote connect /dev/ttyUSB0 replCtrl-C to interrupt, Ctrl-D to soft reset, Ctrl-] to exit.
- Rust stable + rustup
espup(cargo install espup) — installs the Xtensa Rust fork required to target the classic ESP32 (LX6 core). ESP32-S3/C3 use RISC-V and don't need this, but we target the classic ESP32 here.espflash(cargo install espflash)- On Linux: your user must be in the
dialoutgroup to open the serial port (sudo usermod -aG dialout $USERthen log out/in).
cargo install espup
espup install
. $HOME/export-esp.sh # Add this to your shell rc
cargo install espflashcd rust
cargo run --release # builds + flashes + opens the serial monitorOr the shorthand from the repo root:
make rust-flashThe default log level is INFO. Change with ESP_LOG=debug cargo run --release.
- "permission denied" on
/dev/ttyUSB0: on Linux add yourself todialout, or run one-timesudo chmod 666 /dev/ttyUSB0. - Windows COM port not showing: install the CP210x or CH340 USB-serial driver corresponding to your dev board.
- Rust build fails on non-
esptoolchain: make surerust-toolchain.tomlis honoured (rustup showinrust/should sayesp). - MicroPython "MemoryError": the DHT22 lib is optional; the code catches its import failure.