Lowest power consumption while maintaining an association
Posted: Sat Nov 17, 2018 11:41 pm
I'm trying to determine the lowest power consumption that I can get while maintaining an AP association. So far I'm arriving at ~20-25mA, is this the best I can expect?
Overall, I do not understand why Espressif does not provide functions to power down the chip without disconnecting from the AP. As far as I can tell, the majority of APs keep an association alive even if they don't hear from a device for a minute. Why can't I initiate light-sleep with a value up to a minute without disassociating from the AP?
I'm looking at use-cases where the esp32 is battery powered and needs to last for at least a week, if not more, or is solar powered by a small panel. For example as a serial bridge type of debugging tool attached to some other battery operated device in the field, or as an RF-Wifi gateway away from power. In some of these use-cases deep-sleep is not a real option because the esp32 should respond to the network in under a minute (whether that's <5 secs or <60 secs depends on the specific use-case). Using deep-sleep has the overhead of re-associating every time it wakes up.
I have started to work with the latest power-save example IDF application (IDF git head version). I changed the app to have my local Wifi creds and to set the listen interval to 5, i.e. 500ms given the std 100ms beacon interval on my AP. I'm enabling power management with light_sleep and frequency scaling from 10 to 80Mhz. Here is what I observe:
The scope shot has 500ms per horizontal division and 100mA per vertical. The current is captured using a uCurrent Gold. The board is an Adfruit Huzzah32, i.e. esp-wroom-32. What I'm seeing:
The most relevant log lines pertaining to power management are the following ones:
The questions I'm left with:
Overall, I do not understand why Espressif does not provide functions to power down the chip without disconnecting from the AP. As far as I can tell, the majority of APs keep an association alive even if they don't hear from a device for a minute. Why can't I initiate light-sleep with a value up to a minute without disassociating from the AP?
I'm looking at use-cases where the esp32 is battery powered and needs to last for at least a week, if not more, or is solar powered by a small panel. For example as a serial bridge type of debugging tool attached to some other battery operated device in the field, or as an RF-Wifi gateway away from power. In some of these use-cases deep-sleep is not a real option because the esp32 should respond to the network in under a minute (whether that's <5 secs or <60 secs depends on the specific use-case). Using deep-sleep has the overhead of re-associating every time it wakes up.
I have started to work with the latest power-save example IDF application (IDF git head version). I changed the app to have my local Wifi creds and to set the listen interval to 5, i.e. 500ms given the std 100ms beacon interval on my AP. I'm enabling power management with light_sleep and frequency scaling from 10 to 80Mhz. Here is what I observe:
The scope shot has 500ms per horizontal division and 100mA per vertical. The current is captured using a uCurrent Gold. The board is an Adfruit Huzzah32, i.e. esp-wroom-32. What I'm seeing:
- There are ~125mA current spikes every 100ms, what is that? Is that due to the wifi beacon even though I set listen_interval to 5? Or some other timer-based housekeeping?
- The current spikes are a bit fatter every 5ms, so the listen interval does do something.
- There are ~550mA current spikes almost every second. I assume that's Wifi TX? Are those ACKs for some random packets destined to the esp32? I'm pinging it (ICMP) every 5 seconds, so one of those spikes could be the Wifi ACK and then ping-reply TX.
- The base power consumption is around 11mA (can't tell that from this particular scope shot), is that the lowest it can go? The datasheet says "light sleep ... 0.8mA". I'm not seeing that.
The most relevant log lines pertaining to power management are the following ones:
Code: Select all
I (346) cpu_start: Starting scheduler on PRO CPU.
I (0) cpu_start: Starting scheduler on APP CPU.
I (517) pm_esp32: Frequency switching config: CPU_MAX: 80, APB_MAX: 80, APB_MIN: 10, Light sleep: EN
ABLED
I (527) wifi: wifi driver task: 3ffc09ec, prio:23, stack:3584, core=0
I (527) wifi: wifi firmware version: a85ca5e
I (527) wifi: config NVS flash: enabled
I (537) wifi: config nano formating: disabled
I (537) system_api: Base MAC address is not set, read default base MAC address from BLK0 of EFUSE
I (547) system_api: Base MAC address is not set, read default base MAC address from BLK0 of EFUSE
I (597) wifi: Init dynamic tx buffer num: 32
I (597) wifi: Init data frame dynamic rx buffer num: 32
I (597) wifi: Init management frame dynamic rx buffer num: 32
I (597) wifi: Init static rx buffer size: 1600
I (597) wifi: Init static rx buffer num: 10
I (607) wifi: Init dynamic rx buffer num: 32
I (717) phy: phy_version: 4000, b6198fa, Sep 3 2018, 15:11:06, 0, 0
I (717) wifi: mode : sta (30:ae:a4:23:86:64)
I (717) power_save: SYSTEM_EVENT_STA_START
I (717) power_save: esp_wifi_set_ps(2).
I (717) wifi: Set ps type: 2
I (727) power_save: listen inverval: 5
I (837) wifi: n:1 0, o:1 0, ap:255 255, sta:1 0, prof:1
I (2797) wifi: state: init -> auth (b0)
I (2797) wifi: state: auth -> assoc (0)
I (2807) wifi: state: assoc -> run (10)
I (3027) wifi: connected with tve-home, channel 1
I (3037) wifi: pm start, type: 2
I (4567) event: sta ip: 192.168.0.130, mask: 255.255.255.0, gw: 192.168.0.1
I (4567) power_save: SYSTEM_EVENT_STA_GOT_IP
I (4567) power_save: got ip:192.168.0.130
- Why doesn't the IDF seupport light-sleep while keeping wifi on?
- Why does the esp32 wake up every 100ms even though listen-interval is 5?
- How do I bring the baseline/minimum power consumption level down to 0.8mA?
- Can you publish whatever app you use to test list-sleep and achieve the lowest power consumption while maintaining an association?
- Is there anything that jumps out that I'm missing or doing wrong?