Device Power Management in IoT

DZone 's Guide to

Device Power Management in IoT

Learn how you can implement device power management in IoT.

· IoT Zone ·
Free Resource

power management iot

One aspect to consider while developing an IoT project is device power management. With the rise of the Internet of Things, the optimization of the battery-operated devices is an important aspect that can make a huge difference. Device power management in the IoT is a challenging task because a device could always be powered up and could be located 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 detail, 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. This information is acquired using sensors, and each sensor has specific power consumption. Therefore, it is very important to select sensors carefully in order to optimize power management.

An IoT device during its operations can send and receive data remotely. Usually, several IoT devices are connected to an IoT gateway that 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 is the brain of the device, and in order to work, it needs power.

Implementing Power Management in IoT

Now that we have introduced some aspects related to 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 Wi-Fi. In this mode, the ESP8266 turns off the Wi-Fi module between two DTIM Beacon interval. The ESP8266 turns on again the Wi-Fi module before the next Beacon. 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 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 the goes into a deep-sleep mode.

More interesting resources:

How to Use 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 again 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. When you upload the code to your ESP8266, do not connect D0 to RST.

The ESP8266 code below shows 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:");

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 Wi-Fi 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 example. The power management is very important in IoT, so it is important to take it into account.

arduino, devices, iot, microcontrollers, power, power management, sensors

Published at DZone with permission of Francesco Azzola , DZone MVB. See the original article here.

Opinions expressed by DZone contributors are their own.

{{ parent.title || parent.header.title}}

{{ parent.tldr }}

{{ parent.urlSource.name }}