Skip to content

Power reduction

Mitra Ardron edited this page Feb 3, 2026 · 1 revision

#Frugal-IoT: Power reduction


Note (Nov 2025), this is a work in progress (the documentation may not match reality), questions and corrections are welcome.

See issue #23 for current status, (and a good place to ask questions).


There are two aspects to managing power requirements on Frugal-IoT devices.
a: Power supply b: Power reduction - reducing the amount used.

These work in tandem, the more we can reduce the load, the less we need to spend on supplying reliable power.

Sleep modes

The principle approach in Frugal-IoT is by setting power modes.

In the top of each main.cpp or xxx.ino is a line like:

  frugal_iot.configure_power(Power_Deep, 70000, 10000); 

This sets a power mode, cycle_ms, how often, in Milliseconds, the loop will be run - and a live time, wake_ms, how long (Minimum) it will remain awake each loop.

Experience is showing that not all modes of sleep work with all processors. At the moment we are assuming none of them work on ESP8266,

The most common power mode is Power_Loop which should always have cycle_ms == wake_ms, it stays away, and just runs the loop each cycle.

We've tested three other modes: Power Light does a light sleep for the rest of the cycle, this keeps memory alive, but drops WiFi and MQTT so re-establishes each cycle, which takes a few seconds. We haven't tested over LoRa yet.

Power_LightWiFi: This keeps WiFi and mostly MQTT alive, but so far has generated very low power savings - which may be because the UART is alive to monitor it.

Power_Deep: The largest power savings, but the device effectively restarts each time around the loop, so this is best with long times between readings, and a longer wake time so that it can reestablish WiFi and MQTT, for example frugal_iot.configure_power(Power_Deep, 3600000, 20000) would wake up for 20 seconds, once an hour.

Note that there is a function sleepSafeMillis() which is like millis() but, if using Power_Deep adjusts for time spent asleep as millis restarts its count each cycle.

We will also experiment with Power_Modem but can't see any difference (so far) with Power_LightWiFi

Preparing for and Recovering from sleep modes

A set of functions exist that can manage modules before and after sleep. bool prepareForLightSleep() Called before going into Light Sleep - shuts down WiFi. (MQTT will try and stay alive) bool recoverFromLightSleep() Called when wakes from Light Sleep - restarts WiFi and tries to resume MQTT session or create new one.

Similarly there will be functions for prepareFor and recoverFrom for other power modes.

Any module (sensor, actuator, control, system) that cares, should implement these functions.

Behavior of these functions is a Work-In-Progress, but I am happy to work on specific requirements as they will help drive how the design looks.

To come ....

(See issue #23 )

  • A defined way to integrate and order prepareForXxxSleep and recoverFromXxxSleep
  • Some measurement and comparison of power modes
  • Testing matrix of processor to power modes.

Clone this wiki locally