Minimizing power consumption while connected to WiFi
Posted: Fri Jun 02, 2017 12:23 am
Hello, I've been trying to characterize, and minimize, the energy used by the ESP32. Particularly when it is "idle", and all it needs to be doing is maintaining a WiFi connection.
The datasheet claims that modem sleep should achieve 20 mA (at worst?). However, in my experiment I have found that current draw while modem sleep is enabled is ~80% at ~50 mA, ~20% at ~150 mA.
How did I measure this: I used a ~10 ohm piece of wire as a shunt resistor:
This lets me graphically see what's happening over time. What you are looking at is powered off, then power up and connect to wifi, then modem sleep. Yes, it is upside down..
I got my numbers from what my power supply (Mastech HY3005D) was reporting as the current draw. I'll readily admit that what I'm doing to measure current isn't ideal, I'm just using what I have on hand.
I'm using the WROOM-32, powering through its 3v3/GND pins. No other sources of power (e.g. USB) are involved.
The code is extremely bare-bones, all it does is connect to an AP, and then enter modem sleep. Note, it doesn't use taskdelay to "sleep".
Question 1: How did the author of the datasheet measure 20 mA for modem sleep? What do the "Max speed", "Normal speed", "Slow speed" in the datasheet mean?
Question 2: the datasheet describes an "association sleep pattern" of switching between the "active", "modem sleep" and "light sleep" modes. Is this a feature of the chip - or the ROM - or implemented in ESP-IDF - and how do we access it? It sounds like "light sleep" in FreeRTOS is still not hammered out yet. Is there a timetable for this feature? This post by ESP_Angus seems to be mentioning this feature, or something like it.
Question 3: what exactly does modem sleep do? Does it leave the RX radio on but power off the TX radio? What does it do in response to DTIM beacons? In particular, I noticed after leaving the ESP32 on for a while, modem sleep seemed to be having some trouble doing much sleeping at all:
What kinds of things cause a wakeup from modem sleep? How can I get this behavior under control?
The datasheet claims that modem sleep should achieve 20 mA (at worst?). However, in my experiment I have found that current draw while modem sleep is enabled is ~80% at ~50 mA, ~20% at ~150 mA.
How did I measure this: I used a ~10 ohm piece of wire as a shunt resistor:
This lets me graphically see what's happening over time. What you are looking at is powered off, then power up and connect to wifi, then modem sleep. Yes, it is upside down..
I got my numbers from what my power supply (Mastech HY3005D) was reporting as the current draw. I'll readily admit that what I'm doing to measure current isn't ideal, I'm just using what I have on hand.
I'm using the WROOM-32, powering through its 3v3/GND pins. No other sources of power (e.g. USB) are involved.
The code is extremely bare-bones, all it does is connect to an AP, and then enter modem sleep. Note, it doesn't use taskdelay to "sleep".
Question 1: How did the author of the datasheet measure 20 mA for modem sleep? What do the "Max speed", "Normal speed", "Slow speed" in the datasheet mean?
Question 2: the datasheet describes an "association sleep pattern" of switching between the "active", "modem sleep" and "light sleep" modes. Is this a feature of the chip - or the ROM - or implemented in ESP-IDF - and how do we access it? It sounds like "light sleep" in FreeRTOS is still not hammered out yet. Is there a timetable for this feature? This post by ESP_Angus seems to be mentioning this feature, or something like it.
Question 3: what exactly does modem sleep do? Does it leave the RX radio on but power off the TX radio? What does it do in response to DTIM beacons? In particular, I noticed after leaving the ESP32 on for a while, modem sleep seemed to be having some trouble doing much sleeping at all:
What kinds of things cause a wakeup from modem sleep? How can I get this behavior under control?