Device Power Management in IoT

One aspect to consider while developing an IoT project is device power management. With the rise of Internet of Things, the optimization of battery-operated devices is an important aspect that can make a difference. The Device Power Management in the IoT is a challenging task because a device could be always powered up and can be everywhere. Often IoT devices are located remotely and they must use a battery to work.

IoT Device Power Management: How to implement it

The device power management in IoT involves all the steps related to the designing process and it is very important to take into account how the device will behave and how this behavior affects energy consumption. The battery capacity and device behavior are two of the most important aspects. In more details, the device behavior can have a bad impact on energy management. Usually, we can model an IoT device power consumption using three different areas:

  • Microcontroller
  • Radio operations
  • Sensors and actuators

A typical IoT device use case is:

  • Acquiring data from sensors
  • Sending and receiving data
  • Controlling actuators

Usually, an IoT device uses one or more sensors to acquire information related to the environment. The data acquired are used locally or remotely to take decisions. Sensors acquire information and each sensor has specific power consumption. Therefore it is very important to select the sensors carefully to optimize power management.

An IoT device during its operations can send and receive data remotely. Usually, the IoT gateway connects several IoT devices. The gateway collects such information and sends them to the cloud. The sending and receiving operation is one of the most expensive tasks from the power management point of view. This operation involves the radio connection (cellular, Wi-Fi, Bluetooth, etc.).

Finally, using some specific business logic locally or remotely, an IoT device can control one or more actuators.

The microcontroller controls all the operations and it is the brain of the device and to work, it needs power.

Implementing power management in IoT

Now we have introduced some aspects related to the power management in an IoT device, it is time to describe how to implement it. To do it, we will describe some best practices from the development point of view covering how to write the code that takes into account the device power management.

The easiest way we use to develop an IoT application using Arduino, ESP8266 and other compatible devices is implementing the code in the loop() method. For example, when we have to acquire data from a sensor at specific time intervals we simply add the delay(..) method specifying how long the device should wait before starting again and repeat the same tasks. This approach isn’t the best one when we consider the power management aspect. There are different ways we can use to achieve a better result.

In more details, for example, an ESP8266 device has four different modes to “sleep” or save the battery:

  • No sleep
  • Modem sleep
  • Light sleep
  • Deep-sleep

This table describes these different sleep modes:

source “ESP8266 Low Power solution

No sleep

This is the most inefficient way to use this device. It is always on.

Modem-sleep mode

This mode is enabled only when the ESP8266 is connected to a Wifi. In this mode, the ESP8266 turns off the WiFi module between two DTIM Beacon intervals. The ESP8266 turns on again the WiFi module before the next Beacon. This is sleep mode is used when it is necessary to keep the CPU on.

Light-sleep mode

This is mode is very similar to the Modem-sleep mode but in this mode, ESP8266 suspends the CPU and turns off the clock. This mode is more efficient than the previous mode. In Light-sleep mode, the ESP8266 should be woken up using a GPIO pin.

Deep-sleep mode

In this mode, everything is turned off except the RTC (Real Time Clock), so that the ESP8266 can be turned on periodically. This is the most efficient mode. The deep-sleep mode can be used in scenarios where the device should send data at specific intervals. This is the example of an application that uses sensors. The application reads sensor data, sends the values and goes into the deep-sleep mode.


How to use Cayenne IoT with ESP8266 and MQTT: Complete Step-by-step practical guide

Build an IoT soil moisture monitor using Arduino with an IFTTT alert system

How to use the power management in ESP8266 to reduce the power consumption

Now it is time to build a simple example describing how to use the deep-sleep mode to handle power management in IoT. Let us suppose that our application has to read the temperature and send it to a remote IoT platform. The application structure must be:

  • Read data from the sensor
  • Send data
  • Goes into the deep-sleep mode for a predefined time interval
  • Repeat from the first step

How to enable deep-sleep mode in ESP8266

The first step is enabling the deep-sleep mode. The schematic below shows how to do it:

Power Management in IoT

In this case, we are connecting the pin D0 to the RST.

Tip: When you upload the code to your ESP8266 do not connect D0 to RST

The ESP8266 code below, show how to do it:

#include <ESP8266WiFi.h>
const char* WIFI_SSID="---";
const char* WIFI_PWD="----";
void setup() {
  // send data
  Serial.println("Going to deep sleep for 15 sec");
void loop() {
  // put your main code here, to run repeatedly:
void connectToWifi() {
  Serial.print("Connecting to Wifi:");
  WiFi.begin(WIFI_SSID, WIFI_PWD);
   while (WiFi.status() != WL_CONNECTED) {
    if (WiFi.status() == WL_CONNECT_FAILED) {
      Serial.println("Error during WiFi connection- ");
    Serial.print("Wifi IP:");
}Code language: PHP (php)

In this case, the ESP8266 goes into the deep sleep mode for 15 seconds. When it wakes up it starts from the beginning again, connecting to the WiFi and so on.

It is possible to use this approach to wake up the ESP8266 using a button to start it. We will cover it in another post.


At the end of this post, hopefully, you gained the knowledge about how to manage the power in IoT using some examples. The power management is very important in IoT, so it is important to take it into account.

  • Add Your Comment