Como obter maior duração da bateria do MCU com modo de suspensão de baixo consumo de energia

How to get longer MCU battery life with low-power sleep mode

There are generally six power modes in an MCU:

  1. Run : In full run mode, an MCU consumes full current. This mode is best suited for applications where energy efficiency is not essential.
  2. Dozing : As we know, power increases proportionally to frequency. Therefore, we can conclude that higher clock speeds tend to higher power consumption. Doze mode helps reduce power consumption. In Doze mode, the CPU and Flash memory run at a lower clock frequency than the rest of the chip because Flash and CPU are power-hungry components.
  3. Stopped : In idle mode, the CPU and Flash stop and the rest of the chip continues to operate.
  4. Sleep : In sleep mode, we can save more than 90% of the power consumed in Run. Typically, MCUs achieve the lowest power consumption in sleep mode, consuming nano amps or micro amps of current. The CPU, Flash, and most peripherals are disabled or offline in this mode. Some peripherals are available, such as A/D, UART Interrupt and some timers, which allow the MCU to perform some work on the system, waking it up at a specific time.
  5. Low Voltage Sleep : In this mode, a second regulator can be employed to reduce the voltage at the logic gates. This significantly reduces the leakage current of the MCU.
  6. Deep Sleep : In this mode, the CPU, flash, RAM and almost all peripherals are disabled. Only low-power peripherals, such as the real-time clock, Deep Sleep Brown-out to detect battery drain, a vigilance timer, and the ultra-low power wake feature, remain on. With power removed from most of the chip, current consumption can be as low as 20nA.

In this series, we will present three experiments to better understand low-power mode.

Experience 1

To aim
To run an MCU in low power mode, read the temperature and humidity reading using the AHT10 sensor and send the reading over WiFi.

Requirements

  1. UCM: ESP32-WROOM-32D (generic Wi-Fi + Bluetooth + Bluetooth LE MCU module)
  2. Sensor: AHT10 (temperature and humidity sensor)
  3. Battery: MX1500 AA Battery (3.6V, 2700mAh)

Theory
In this experiment, we are using ESP32-WROOM-32D MCU. Here we will learn how to use a timer to wake up the ESP32. The ESP32 will remain in active mode for 2-3 seconds, take the temperature and humidity reading and send it over WiFi. After that, the ESP32 will return to deep sleep mode. It will remain in deepsleep mode for five minutes.

ESP32 Power Modes
The ESP32 chip mainly has two types of processors, the main one and the ultra-low power, or ULP processor. ESP32 generally consumes about 75mA of current in normal operation and about 240mA when transmitting data over WiFi. ESP32 deep sleep mode will reduce power consumption and increase battery life as every mA is critical to a battery. Five configurable power modes manage the ESP32's current consumption.

  1. Active
  2. Modem Suspend
  3. Light sleep
  4. Deep sleep
  5. Hibernation

The table below details the power modes:


In deep sleep mode, the RTC (real-time clock) controller, peripherals, and memories are in active mode. Most of the RAM with all the digital peripherals and the CPU is turned off in deep sleep mode. Only the RTC module is active, which results in the loss of data not initially present in the RTC recovery memory. If the ULP coprocessor is turned on, the current consumption drops to 0.15 mA – 10 µA. Please note that the system cannot automatically enter deep sleep mode.

The function that can be used to activate deep sleep once wake sources are configured immediately is:
“esp_deep_sleep_start”

ESP32 wake up sources
There are several ways to wake up the ESP board from deep sleep mode.

  1. Timer, wake up. Wake up your ESP32 at predefined periods of time, which is achieved through the function: (esp_sleep_enable_timer_wakeup(sleep_time_in_us)”
  2. Touch pin activation. We can wake up the ESP32 from deep sleep using the touch pins obtained with the following function:
    “esp_sleep_enable_touchpad_wakeup”
  1. External awakening. We can activate ESP32 using multiple RTC GPIOs. There are two different logical functions.
    Activate ESP32 if any of the selected pins are high.
    Activate ESP32 if all selected pins are low.

We need to use the following function:
“esp_sleep_enable_ext1_wakeup(bitmask, mode)”

Schematic
In this schematic, you can recognize functions that we studied in previous articles to reduce energy consumption. We operate the circuit with a low power source (3V). The value of the resistor with the LED is high value (1K), and the pull up of the Enable pin is also high value (20K). We do not use the pull-ups for the I2C connection because we will use the ESP32's internal pull-ups instead.

Fig: 1 MCU Deep Sleep Mode Schematic

Experiment Setup
Below is the image showing the experiment setup.

Fig: 2 Experiment setup

Code

Observation table

Fig: 3 Current consumption per module

  1. The current consumption by the ESP32 in active mode is approximately 123 mA.
  2. The battery capacity is 2700 mAh.
  3. According to the battery's technical data sheet, its useful life is around seven years.
  4. The monthly self-discharge rate of the AA alkaline battery is 0.3%.
    Battery Capacity (mAH) * Self-Discharge Rate / 100 = Self-Discharge Current (mAH)
    2700 mAh * 0.3/100 = 8.1 mAh

This means that a 2700 mAH battery will automatically discharge 3% losses or 8.1 mAH of its capacity after one month.
Shelf life = 2700 mAH /( 8.1 mAH) = 333.3 months = ~ 27 years

  1. Battery life calculation,

Fig: 5 Battery life calculation

Results
Below are the results of device data sent to the ThinkSpeak platform.

Fig: 6 AHT10 sensor temperature readings (left). AHT10 sensor humidity readings (right)

According to the above, the battery with a capacity of 2700mAH will have a useful life of approximately 261 days if the current drawn from the battery is 123mA during active mode.

Related Content

Back to blog

Leave a comment

Please note, comments need to be approved before they are published.