In this tutorial, we’ll discuss the available ESP32 sleep modes (low-power modes) and the power consumption in each mode. You’ll learn how to maximize the power-saving while using ESP32 to achieve the required functionalities of your application and maintain the battery life for extended periods of operation.
The ESP32 is a very powerful microcontroller that runs at much higher frequencies compared to other Arduino boards and it has on-chip WiFi, Bluetooth, and radio support that make it an even more power-hungry microcontroller. For some IoT applications, battery life can be a very critical resource that we need to carefully manage. And that’s exactly what we’ll be doing in this tutorial.
Table of Contents
- ESP32 Sleep Modes & Power Modes
- ESP32 Active Mode
- ESP32 Modem Sleep Mode
- ESP32 Light Sleep Mode
- ESP32 Deep Sleep Mode
- ESP32 Hibernation Mode
- ESP32 Power OFF
- ESP32 Sleep Modes Conclusion
ESP32 Sleep Modes & Power Modes
The ESP32 power management features provide the user with 5 configurable and selectable power modes. And we as system designers have to choose between the 5 different power modes according to the application’s needs. You can also programmatically switch from one mode to another while operating, which needs to be implemented carefully in the code.
The ESP32 Power Modes Are:
- Active Mode
- Modem Sleep Mode
- Light Sleep Mode
- Deep Sleep Mode
- Hibernation Mode
ESP32 Low-Power Modes are: (Modem Sleep, Light Sleep, Deep Sleep, and Hibernation). Each one of the ESP32 sleep modes has its own list of activated features as well as deactivated features in order to achieve certain levels of power consumption. Depending on your application’s need, you get to choose the most convenient power mode in order to prolong the battery life as much as possible and perform the required tasks.
Please be advised that all current consumption values listed in this article are meant to be for the bare ESP32 chip, not the whole ESP32 dev board. Any ESP32 dev board will have much higher power consumption due to having onboard LEDs, resistors, and other passives that sum up to a larger current consumption than the values listed hereafter in this article.
For low-power applications, you need to have your custom PCB design with the ESP32 target microcontroller with minimal on-board passives to achieve the needed functionalities with minimal power consumption.
ESP32 Active Mode
The ESP32 Active Mode is the normal operation mode in which all the peripherals are working, WiFi and Bluetooth are enabled, and the chip can transmit, receive or listen.
The only way to save some power in Active Mode is to control the clock frequency at which the CPU is running and/or change the RF operation mode according to your application’s needs and to the following table.
|WiFi TX, DSSS 1 Mbps, POUT = +19.5 dBm||240 mA|
|WiFi TX, OFDM 54 Mbps, POUT = +16 dBm||190 mA|
|WiFi TX, OFDM MCS7, POUT = +14 dBm||180 mA|
|WiFi RX (listening)||(95~100) mA|
|BT/BLE TX, POUT = 0 dBm||130 mA|
|BT/BLE RX (listening)||(95~100) mA|
ESP32 Active mode current consumption is: (95~240) mA, depending on the WiFi/BLE mode and the CPU clock speed at which you’re operating the microcontroller.
This clearly shows that ESP32 Active mode is the least power-efficient mode and you should consider disabling any unused feature by running in any other low-power mode as long as it’s not needed by your application.
ESP32 Modem Sleep Mode
In Modem Sleep Mode, the ESP32 core is operational, the clock is configurable, and every other peripheral is functional except for the (Radio, WiFi, and Bluetooth) which are disabled. Therefore, current consumption in this mode is totally dependent on the CPU clock rate. Reducing the clock frequency will reduce the current consumption and vice versa.
ESP32 Modem Sleep Mode Current Consumption is (2~4)mA @ 2MHz “Slow Speed”, (20~25)mA @ 80MHz “Normal Speed”, and (30~50)mA @ 240MHz “Max Speed”.
ESP32 Modem Sleep Mode Wake-Up Latency is: immediate!
So we can interpret the ESP32 Modem Sleep mode as follows: if you’re going to disable Radio, Bluetooth, and WiFi, then it’s going to be up to the CPU frequency in order to reduce the current consumption even more. And it’s going to be just like any microcontroller sleep mode.
However, if you still need WiFi, you’ll have to keep switching between active and sleep modes periodically after connecting to the access point (AP) successfully. In the modem sleep mode, Radio, WiFi, and BT are turned OFF in order to reduce power consumption. The ESP32 device (station) can keep the connection with the AP in modem sleep mode. This is using what’s known as DTIM (Delivery Traffic Indication Message).
The basic idea behind the DTIM beacon technique is to periodically send a message with beacons. Which notifies all stations to wake up from sleep state and synchronize between all the members in the network. The DTIM beacon interval time dictates the sleeping time in which the ESP32 will be in “modem sleep mode” before it switches back to “active” in order to receive the DTIM frame from the AP.
This process can happen more or less frequently, leading to the emergence of 2 additional derivatives of the “Modem Sleep Mode”. These two modes are as follows:
- Minimum Modem Sleep: In minimum modem sleep mode, the ESP32 wakes up every DTIM to receive a beacon. Broadcast data will not be lost because it is transmitted after DTIM. However, it can not save much more power if DTIM is short for DTIM is determined by AP.
- Maximum Modem Sleep: In maximum modem sleep mode, the ESP32 wakes up every listen interval to receive a beacon. Broadcast data may be lost because the ESP32 may have been in sleep mode at DTIM time. If listen interval is longer, more power is saved but broadcast data is more likely to be lost.
ESP32 Light Sleep Mode
The ESP32 Light Sleep Mode is very similar to the Modem Sleep Mode. However, the only difference is that in light sleep mode, the CPUs are stalled (clock-gated) as well as most of the RAM, and the digital peripherals. Their supply voltage is also reduced in order to save more power.
ESP32 Light Sleep Mode Current Consumption is: ~0.8mA
Wake-Up Latency in ESP32 Light Sleep Mode is: less than 1ms
Clock-gating the digital peripherals, RAM, and CPUs causes them to stop without losing context or any data. And it does bring the current consumption down to nearly 800µA. Upon exit from Light Sleep, the digital peripherals, RAM, and CPUs resume operation and their internal states are preserved.
ESP32 Deep Sleep Mode
In ESP32 Deep Sleep Mode, the CPUs, most of the RAM, and all digital peripherals that are clocked from APB_CLK are powered OFF. The only active parts of the chip are RTC Memories, RTC Controller, and the ULP coprocessor.
The Ultra-Low-Power (ULP) coprocessor can still do some simple tasks like reading data coming from sensors or RTC GPIOs. Therefore, we can use RTC peripherals (Timers, GPIOs, etc) as well as the ULP to generate various “wake-up” events in order to wake up the device from “Deep Sleep” mode.
In Deep Sleep Mode, the CPU context is lost and whenever the CPU wakes up from “Deep Sleep”, it’s going to start program execution all over again from the very beginning. The RTC power domain () is the only section in the microcontroller that preserves its context before going into “Deep Sleep”.
Therefore, if you need to store any data and retrieve it after a “Deep Sleep”, you have to save it in the RTC memory. (e.g. RTC_DATA_ATTR int data = 0; // This global variable will retain its value even after a deep sleep wake-up)
ESP32 Deep Sleep Mode Current Consumption is: ~(10-150)µA Depending on what features are activated according to the following table.
ESP32 Deep Sleep Mode Wake-Up Latency is: less than 1ms
|Power Mode||Activated Features||Current Consumption|
|Deep Sleep||The ULP Coprocessor is ON||150µA|
|RTC Timer + RTC Memory||10µA|
ESP32 Hibernation Mode
In ESP32 Hibernation Mode, all oscillators, the RTC peripheral domain, and RTC memories are all disabled as well as the ULP. The only remaining active parts are one RTC timer as well as a few certain RTC GPIOs in order to wake up the device from hibernation. It’s the strongest low-power mode by far and it can achieve current consumption levels as low as 5µA.
ESP32 Hibernation Mode Current Consumption is: ~5µA
ESP32 Hibernation Mode Wake-Up Latency is: less than 1ms
ESP32 Hibernation Mode is very similar to “Deep Sleep Mode”. However, in Hibernation Mode, only 1 RTC Timer is available (on the slow clock) and certain RTC GPIOs are only active not all RTC GPIOs as the case in “Deep Sleep”. This is the major difference between the two modes.
ESP32 Power OFF
This is not an operational mode, because it can’t be reached by software and there is no wake-up from power OFF unless an external controller is handling this operation by any defined hardware mechanism. In order to go into power OFF, the CHIP_PU pin is set to LOW, consequently, the chip will be powered OFF. The current consumption will drastically drop down to 0.1µA.
Which in many cases isn’t practical because of the implementation complexity of the power down and ON mechanism as well as the need for hardware modification. Because the CHIP_PU pin is serving as a RESET pin for the ESP32 and can’t be controlled programmatically on most ESP32 dev boards unless we make some custom hardware changes.
ESP32 Sleep Modes Conclusion
To conclude this tutorial, we’ll highlight the fact that you can’t compare the current consumption values given in the datasheet and listed here in this article with any measurements you’d probably take on any ESP32 development kit due to the fact that it’s most probably will have on-board extra hardware passive components that will disrubt the measurement process and make it harder.
It’s only comparable if you could isolate the ESP32 chip or ideally design your own custom ESP32 PCB if you’re targeting low-power applications.