Minimal, batteries-included OTA (Over-The-Air) update system for ESP32.
This module provides a simple, one-liner API for enabling OTA updates on ESP32 devices via Wi-Fi. It supports both Arduino IDE OTA (port 3232) and a web-based update interface at the root path "/".
Key features:
- One-liner setup:
beginWiFi() or begin()
- Arduino IDE OTA support with MD5 password authentication
- Web-based OTA UI with Basic Auth (username: "admin")
- Automatic mDNS hostname registration for discovery
- Optional AP fallback mode for Wi-Fi connection failures
- Progress/error/state callbacks for monitoring
- Low polling overhead: ~10-73µs when idle (<0.5% at 60 FPS)
Performance characteristics:
- Web OTA has ZERO polling overhead (runs in separate FreeRTOS task)
- Arduino IDE OTA: ~10-50µs (native) or ~73µs (ArduinoOTA fallback)
- Safe to call
poll() every loop iteration for LED animations
Architecture:
- Built on ESP-IDF native APIs (minimal Arduino dependency)
- Uses esp_http_server.h for async Web OTA (separate task)
- Uses esp_wifi.h for network transport
- Uses mdns.h for service discovery
- Future-proof: designed for ESP-IDF component migration
Platform support:
- ESP32 (all variants): Full feature set (Wi-Fi only)
- ESP8266: Reduced feature set (Wi-Fi only)
- Other platforms: Compile-time stubs (no-op)
Security notes:
- Arduino IDE OTA uses MD5 hash of password
- Web UI uses HTTP Basic Auth (plaintext over HTTP)
- Recommended: Use only on trusted networks or with HTTPS
Hardware considerations:
- OTA flash writes consume ~100-200mA on ESP32 (brief spikes to 300mA)
- LED arrays can draw significant current during animations
- Power supply recommendation: 5V 2A+ for ESP32 + moderate LED count
- During OTA update: Reduce LED brightness or count to prevent brownouts
- Use quality USB cable and power source (cheap cables may cause voltage drop)
- Optional: Add 100-1000µF capacitor between VIN/3.3V and GND for stability
- ESP32 variants with external antenna: Verify antenna is properly connected
- Wi-Fi performance: ESP32 only supports 2.4GHz band (not 5GHz)
Example usage:
#include <FastLED.h>
ota.beginWiFi(
"my-device",
"password",
"MySSID",
"wifi-pass");
ota.onProgress([](
size_t written,
size_t total) {
Serial.printf(
"Progress: %u/%u\n", written, total);
});
}
}
OTA (Over-The-Air) update manager for ESP32 platforms.
Minimal, batteries-included OTA (Over-The-Air) update system for ESP32.
Ethernet usage:
ETH.begin();
while (!ETH.linkUp()) delay(100);
ota.begin(
"my-device",
"password");
References:
Definition in file ota.h.