Skip to main content

Posts

Showing posts with the label IoT

Optimizing IoT Battery Life: ESP32 Deep Sleep with RTC Memory Data Preservation

  In the constraint-heavy world of low-power IoT, the radio is your enemy. An ESP32 attempting to maintain a Wi-Fi connection consumes between 160mA and 260mA. In contrast, Deep Sleep mode draws approximately 10µA to 150µA (depending on the board design). The mathematical reality is harsh: if you transmit data every time you sample a sensor (e.g., every minute), a 2500mAh battery might last a few days. If you batch data and transmit once an hour, that same battery can last months. However, Deep Sleep introduces a significant architectural hurdle:  Volatility . When the ESP32 enters Deep Sleep, the main CPU, wireless peripherals, and standard SRAM (volatile memory) are powered down. When the device wakes up, it does not resume execution where it left off; it reboots. It runs the bootloader and  setup()  from scratch. Consequently, your sensor reading variables, counters, and flags are wiped. Writing to NVS (Non-Volatile Storage) or EEPROM every minute is not a viable ...