ESP32-Lifecycle-Manager (LCM) is a smart “control tower” for your ESP32 device. At startup, LCM takes charge first: it handles network setup, update management, recovery procedures, and more — so your application can focus on its actual tasks. In this post, we’ll dive into how LCM works, how to integrate it, and why it’s a great addition to your ESP32 projects.

What is ESP32 Lifecycle Manager?
LCM is a lightweight firmware layer that runs before your own application and manages the “lifecycle” of the device.
Instead of building everything yourself — captive portal, OTA updates, recovery flows, provisioning — LCM provides these features out of the box.
Key points:
- LCM starts at every reset before your app.
- It decides whether the device can boot normally, or if it needs configuration/maintenance first.
- It works with signed firmware, ensuring only trusted updates are installed.
- It includes recovery mechanisms such as software reset or hardware reset triggers.
Think of it as a “meta-firmware” running alongside your app.
Features in Detail
Here are the most important features of LCM, plus why they matter:
Access Point (AP) and Captive Portal
If the device has no network configuration, LCM starts a temporary Wi-Fi access point with a captive portal. From there you can:
- Select and configure Wi-Fi.
- Add hidden networks manually.
- Configure which GitHub repo should be used for updates (
main.bin
+main.bin.sig
). - Blink an LED to identify the specific device.
This makes first-time setup and re-provisioning user-friendly.

Firmware Download & Validation
Once Wi-Fi is set up, LCM fetches the firmware files:
main.bin
(application firmware)main.bin.sig
(digital signature)
It validates both:
- The SHA-384 signature.
- The reported file size.
Only if everything checks out is the firmware activated.
OTA Updates
LCM supports triggering updates via OTA (Over the Air), for example with an HTTP request (ota_trigger
).
This makes it possible to keep devices updated remotely without physical access.
Hardware-Assisted Updates
You can configure LCM to require a physical button press or other hardware action to start or confirm updates. Useful for devices deployed in the field where accidental or unwanted updates must be avoided.

Reset and Recovery Options
LCM supports multiple reset mechanisms:
- Software factory reset: via the LCM API, clear all configuration and restart.
- Hardware factory reset: if you power-cycle or restart the ESP32 ten times in a row, LCM detects this pattern, waits ~11 seconds, then wipes config and restores defaults.
This ensures you always have a safe fallback if something breaks.
Firmware Version Stamping
During install or update, LCM writes the value of LIFECYCLE_DEFAULT_FW_VERSION
. That means you can remotely verify exactly which firmware version your device is running.
Typical Setup Workflow
Here’s the typical flow when using LCM in your ESP32 project:
- First Boot — Device boots into AP mode and shows a captive portal.
- Provisioning — You enter Wi-Fi credentials and specify the GitHub repo for firmware updates.
- Firmware Acquisition — LCM downloads
main.bin
andmain.bin.sig
, validates them, and installs firmware if correct. - Normal Operation — Your application runs, with LCM in the background handling updates and recovery.
Build and Flashing
Install ESP-IDF (see Espressif’s official guide).
Select the correct target chip (ESP32, ESP32-S2, ESP32-S3, etc.).
Build with:
idf.py build
This produces main.bin
in the build/
folder.
Sign the firmware:
openssl sha384 -binary -out build/main.bin.sig build/main.binprintf "%08x" "$(wc -c < build/main.bin)" | xxd -r -p >> build/main.bin.sig
Or simply run the included generate_sig.sh
.
Flash everything with esptool.py
, for example (ESP32):
python -m esptool --chip esp32 -b 460800 --before default_reset --after hard_reset \
write_flash --flash_mode dio --flash_size 4MB --flash_freq 40m \
0x1000 esp32-bootloader.bin \
0x8000 esp32-partition-table.bin \
0xe000 esp32-ota_data_initial.bin \
0x20000 esp32-lifecycle-manager.bin
Adjust the addresses if you’re targeting S2, S3, or other ESP chips.
Why Use LCM?
- Hands-free provisioning: No need for serial cables or re-flashing in the field.
- Secure updates: Signed firmware ensures only trusted code is installed.
- Recovery safety net: Hardware/software reset paths keep devices recoverable.
- Fleet management: Deploy multiple devices and update them centrally via GitHub or your server.
Tips & Best Practices
- Keep your signing keys safe. Without the correct
.sig
, updates will fail. - Test recovery features (power-cycle reset, software reset) during development.
- Ensure your update server (GitHub or custom) is always reachable.
- Handle edge cases (Wi-Fi dropouts, incomplete downloads) gracefully.
- Verify partition offsets for your specific ESP32 variant.
ESP32-Lifecycle-Manager takes a lot of heavy lifting out of your hands. Instead of reinventing provisioning, OTA, and recovery, you get a battle-tested framework to build reliable IoT products.