Flashing “Hello World” to an ESP32-C3-Lyra V2.0 on Linux (ESP-IDF)
This post serves as a tutorial for how to build and flash the official ESP-IDF
hello_world example to an ESP32-C3-Lyra-V2.0 from a Linux machine, then verify output over UART. This tutorial works for any ESP32-C3, and is a precursor to conducting Wake-On-Word using ESP32-C3-Lyra V2.0
prerequisites:
Hardware
- ESP32-C3 development board
- USB cable
- USB-to-UART bridge presented as CP2102N (common on many ESP32 boards)
Software
- Ubuntu 22.04
- ESP-IDF v5.2.3 (installed from source)
Step 1: Verify the board appears as a serial device
Plug the board in over USB and check the kernel log:
sudo dmesg -T | tail -n 30
You should see something indicating a USB-to-UART bridge and the assigned device node, for example:
CP2102N USB to UART Bridge Controller... now attached to ttyUSB0
That means your UART port is likely /dev/ttyUSB0.
Exit the screen using Ctrl+A then K then y
Step 2: Install required packages
Install the typical ESP-IDF build dependencies:
sudo apt update && sudo apt install -y git python3 python3-venv python3-pip cmake ninja-build ccache libffi-dev libssl-dev dfu-util libusb-1.0-0
Step 3: Install ESP-IDF (v5.2.3) + ESP32-C3 toolchain
Clone ESP-IDF and install only what you need for ESP32-C3:
cd ~ && git clone -b v5.2.3 --recursive https://github.com/espressif/esp-idf.git && cd esp-idf && ./install.sh esp32c3
Then load the environment into your current terminal session:
. ./export.sh
From this point, idf.py should be available.
Step 4: Create a local hello_world project
Copy the example out of the ESP-IDF tree (so you can edit safely later):
cd ~ && cp -r ~/esp-idf/examples/get-started/hello_world ~/hello_world
Step 5: Set the target to ESP32-C3
cd ~/hello_world && idf.py set-target esp32c3
Step 6: Build, flash, and monitor
Flash to the detected serial port and open the monitor immediately:
idf.py -p /dev/ttyUSB0 flash monitor
If you get a permissions error on /dev/ttyUSB0, rerun with sudo:
sudo idf.py -p /dev/ttyUSB0 flash monitor
To exit the ESP-IDF monitor: press Ctrl + ].
Expected output
After flashing, the monitor should show hello_world output similar to:
Hello world!
This is esp32c3 chip with 1 CPU core(s), WiFi/BLE, silicon revision v0.3, 2MB external flash
Minimum free heap size: 328280 bytes
Troubleshooting
1) idf.py: command not found
Re-run:
. ./export.sh
2) Wrong serial port
Re-run:
sudo dmesg -T | tail -n 30
Look for ttyUSB0 vs ttyACM0, then update the -p argument accordingly.
3) Permission denied on /dev/ttyUSB0
- Use
sudoas shown above, or add your user to the serial group (commonlydialout) and re-login.
