Updating many ESP32 devices at once
Sending a new firmware to one ESP32 is a solved problem. Sending it to two hundred devices at customers' sites is a different one: if the build has a bug that only shows in the field, you want to learn that from five of them, not from all two hundred.
What goes wrong with "update everything"
- A build that boots but cannot reconnect (a changed WiFi setting, a certificate, a partition table) leaves every updated device unreachable, and only a site visit fixes it.
- A crash that needs a few minutes or a rare input to appear passes your bench test and then hits the whole fleet at once.
- Devices that are offline during the update come back later on the old firmware, and the fleet ends up split without anyone noticing.
The three pieces of a safe update
- Rollback in the bootloader. With
CONFIG_BOOTLOADER_APP_ROLLBACK_ENABLEin ESP-IDF, a new image starts on trial and is only kept once the application callsesp_ota_mark_app_valid_cancel_rollback(). Call it only after the device has proved itself, for example once it reached your server. On Arduino-ESP32, definebool verifyRollbackLater() { return true; }in the sketch, or the core accepts every image as soon as it boots. - Waves. Update a small share first, wait, check, then the next share. Ten, fifty, a hundred percent is a common split.
- A health check that can stop the rollout. After each device updates: did it come back on the new version, and did it stay up without crashing for a few minutes? If not, stop before the next wave.
Doing this yourself means a server that knows which device runs which build, serves images, tracks each device's state through download, reboot and verification, and stops on failures. It is a few weeks of work and a service to keep running.
With Pinscope
Upload the .bin (and the .elf, for decoded crashes) and start a rollout from the dashboard or from CI:
curl -fsSL https://pinscope.dev/ci.sh | sh -s -- --token $PINSCOPE_TOKEN --project 12 \ build/app.bin build/app.elf --rollout
- Waves of 10, 50 and 100 percent by default, or all at once for a handful of devices.
- Each device is checked: it has to come back within 15 minutes, on the new build (if the bootloader rolled back, that counts as a failure), and stay connected for 5 minutes without a crash.
- The rollout stops as soon as more devices fail than you allow (none, by default), and you get an email. Devices not yet reached keep their firmware.
- Offline devices are skipped after 30 minutes rather than holding the rollout.
- Tags (for example
betaorcustomer-a) let you roll out to a group first.
The image travels over the connection the device already keeps open, so there is no port to open and no download URL to protect. For one device at a time, see updating ESP32 firmware over the internet; for Arduino sketches, ArduinoOTA over the internet.
Try it
Three devices are free, and no card is needed. Create an account, or read the five-minute guide first.
More
- Remote access to an ESP32 without TLS: what it measured and what it costs
- Reaching an ESP32 web server from outside its network
- Updating ESP32 firmware over the internet, with rollback
- Guru Meditation Error: decoding the backtrace, and crashes from the field
- Remote logging: ESP_LOG without a serial cable
- Heap and stack monitoring in the field
- An ESP32 behind CGNAT, 4G or Starlink
- TLS memory usage on the ESP32, and how to reduce it
- Sharing an ESP32 sensor page with anyone, without port forwarding
- ArduinoOTA over the internet, with a rollback
- ESP32 remote access compared: port forwarding, ngrok, Cloudflare Tunnel, Tailscale
- esp_http_server slow? The 250 ms delay and the fix
- Before the first ESP32 ships: a field support checklist
- ESP32 exception decoder: a Guru Meditation backtrace to lines, in the browser