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"

The three pieces of a safe update

  1. Rollback in the bootloader. With CONFIG_BOOTLOADER_APP_ROLLBACK_ENABLE in ESP-IDF, a new image starts on trial and is only kept once the application calls esp_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, define bool verifyRollbackLater() { return true; } in the sketch, or the core accepts every image as soon as it boots.
  2. Waves. Update a small share first, wait, check, then the next share. Ten, fifty, a hundred percent is a common split.
  3. 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

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