Undoubtedly, the ESP32 is a strong competitor to many WiFi/MCU SoCs, offering a clear advantage in performance and price. However, depending on its intended use, the ESP32 can be a power-intensive device.

When your IoT projects are powered by household AC power, you won’t be too concerned about power consumption. However, if you’re using batteries to power your projects, you’ll need to calculate the current per megawatt (MA).

The solution here is to utilize one of its sleep modes to reduce the ESP32’s power consumption. In fact, this is a good strategy that can significantly improve battery life for items that don’t need to be constantly active.

ESP32 chip internal

To understand how the ESP32 achieves energy saving, we first need to understand the internal workings of the chip. The following diagram shows the functional block diagram of the ESP32 chip.

ESP32's sleep modes and their corresponding power consumption

At the core of the ESP32 chip is a dual-core 32-bit microprocessor with 448 kb of ROM, 520 kb of SRAM, and 4 MB of memory.

The chip also includes a WiFi module, a Bluetooth module, an encryption accelerator (a coordinator specifically designed to perform encryption operations), an RTC module, and many peripheral devices.

ESP32 power mode

Thanks to the ESP32’s advanced power management, it offers five configurable power modes. The chip can switch between different power modes depending on power consumption requirements. These modes are:

  • ● Activity Mode
  • ● Modem sleep mode
  • ● Light sleep mode
  • ● Deep sleep mode
  • ● Sleep mode

Each mode has its own unique features and energy-saving capabilities. Let’s take a look at them one by one.

ESP32 Activity Mode

Normal mode is also known as active mode. In this mode, all functions of the chip remain active.

Because the active mode continuously runs all operations (especially the WiFi module, processing core, and Bluetooth module), the operating chip requires more than 240mA of current. High power spikes (up to 790mA) can also be observed if WiFi and Bluetooth are used together at the same time.

ESP32's sleep modes and their corresponding power consumption

This is clearly the least efficient mode and consumes the most current. Therefore, if you want to save power, you must utilize another power mode to disable unused functions.

ESP32 Modem Sleep

In modem sleep mode, everything except Wi-Fi, Bluetooth, and RF remains active. It also allows the CPU to run, and the clock is configurable.

In this mode, the chip consumes approximately 3mA at slow speeds and 20mA at high speeds.

ESP32's sleep modes and their corresponding power consumption

To keep the WiFi/Bluetooth connection active, Wi-Fi, Bluetooth, and RF devices wake up at predefined intervals. This is known as the Association Sleep Pattern.

In this sleep mode, the ESP32 switches between active mode and modem sleep mode. For this purpose, the ESP32 uses the DTIM beacon mechanism to connect to the router in station mode.

To conserve power, the ESP32 disables the Wi-Fi module between two DTIM beacon intervals and automatically wakes up before the next beacon arrives. The sleep time is determined by the router’s DTIM beacon interval, typically ranging from 100ms to 1000ms.

ESP32 Light Sleep

Light sleep is similar to modern sleep. The chip also follows the associated sleep pattern.

The only difference is that in light sleep mode, digital peripherals, most of the RAM and CPU are clock-gated.

In light sleep mode, the CPU pauses by shutting down its clock pulses, while the RTC and ULP-CoproCessor remain active. This results in lower power consumption than the approximately 0.8mA of a modem’s sleep mode.

ESP32's sleep modes and their corresponding power consumption

Before entering light sleep mode, the ESP32 stores its internal state in RAM and resumes operation when waking from sleep. This is called full RAM retention.

Once the wake source is configured, use the esp_light_sleep_start() function to enter a light sleep.

ESP32 Deep Sleep

In deep sleep mode, the CPU, most of the RAM, and all digital peripherals can be shut down. The only part of the chip that remains operational is:

  • ● ULP coprocessor
  • ● RTC controller
  • ● RTC peripheral equipment
  • ● RTC fast and slow memory

The chip will consume approximately 0.15 mA (if the ULP coprocessor is enabled) up to 10 µA.

ESP32's sleep modes and their corresponding power consumption

In deep sleep mode, the main CPU is shut down, while the UltraLowPower (ULP) coprocessor can take sensor readings and wake the CPU if necessary. This sleep mode is called ULP sensor monitoring mode. This is useful for applications designed to be woken up by external events or timers, or a combination of both, while maintaining minimal power consumption.

Along with the CPU, the chip’s main memory is also disabled. Therefore, everything stored in that memory is deleted and becomes inaccessible.

Because the RTC memory is constantly powered, its contents are retained even during deep sleep and can be retrieved after the chip wakes up. This is why the chip stores Wi-Fi and Bluetooth connectivity data in the RTC memory before entering deep sleep.

If you want to use the data after a reboot, define a global variable using the `RTC_DATA_ATTR` attribute and store it in RTC memory. For example, `RTC_DATA_ATTR int myVar = 0;`

After emerging from deep sleep, the chip restarts via a reset and begins executing the program from the very beginning.

Unlike other sleep modes, the system cannot automatically enter deep sleep mode. The esp_deep_sleep_start() function is used to configure the wake source and immediately enter deep sleep.

ESP32 Sleep Mode

Unlike deep sleep mode, hibernation mode disables the internal 8 MHz oscillator and ULP processor. RTC recovery memory is also turned off, meaning that no data can be retained in hibernation mode.

Except for an RTC timer (in slow clock mode) and some RTC GPIOs, everything else is turned off. They are responsible for waking the chip from sleep mode.

ESP32's sleep modes and their corresponding power consumption

This further reduces power consumption. In sleep mode, the chip consumes only about 2.5 μA. This mode is particularly useful if you are building a project that doesn’t need to be constantly active.

error: Content is protected !!
Scroll to Top