Connect an ESP32 to Clavda: Arduino IDE, PlatformIO or ESP-IDF
The ClavdaOTA library gives an ESP32 over-the-air updates, a remote Serial Monitor and a live dashboard, from anywhere. Choose the guide for how you build: Arduino IDE, PlatformIO or ESP-IDF, in C or C++.
Updated 2 min read
An ESP32 does not run the Clavda agent. It runs the ClavdaOTA library inside your own firmware, which connects the board to Clavda over Wi-Fi. Once it is connected, from anywhere, you can:
- update its firmware over the air, with no cable,
- watch its serial output and type commands back,
- build a live dashboard of its readings and controls.
It works on the ESP32, ESP32-S2, S3, C3 and C6. Like every Clavda device, the board dials out to the relay, so it needs no public address and no port forwarding.
Choose how you build
Each guide is complete on its own: setup, over-the-air updates, the Serial Monitor and the dashboard, with every program in C and in C++.
Arduino IDE
The Arduino IDE 2 and Espressif's Arduino core: sketches with setup() and loop().
PlatformIO
PlatformIO in VS Code with the ESP-IDF framework. No Arduino core.
ESP-IDF
Espressif's own framework and idf.py, with ClavdaOTA as a component.
How they differ
| Arduino IDE | PlatformIO | ESP-IDF | |
|---|---|---|---|
| Framework | Arduino core 3.x | ESP-IDF | ESP-IDF 5 or later |
| The program starts | in setup() and loop() | in app_main() | in app_main() |
| The library from | a ZIP, and ArduinoJson from the Library Manager | src/idf_component.yml | main/idf_component.yml |
| Room for updates | Tools → Partition Scheme | partitions.csv in platformio.ini | partitions.csv and sdkconfig.defaults |
| The file to upload | <sketch>.ino.bin | .pio/build/<env>/firmware.bin | build/<project>.bin |
C or C++
The library has a C++ API, ClavdaOTA, ClavdaSerial and ClavdaWidget, and a C API, the clavda_* functions, with the same features. The file decides which one you get: ClavdaOTA.h gives C++ in a .cpp or .ino file, and C in a .c file. Each guide shows both, so pick the language you write.
What you need
- An ESP32 board and a USB cable, for the first flash only.
- A 2.4 GHz Wi-Fi network the board can join.
- A Clavda account. See Before you start.