-
Notifications
You must be signed in to change notification settings - Fork 74
Wifi low power #101
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Wifi low power #101
Conversation
Relevant to issue #63 I'd welcome some eyes on this, especially to confirm that NINA already uses MIN modem low power mode. I have an INA219 on order to make better measurements. In any case, this would allow the option of turning modem low power mode on and off. |
@anecdata does this require any specific build of the NiNa Firmware? |
@jerryneedell No, it's independent of any other feature added, and should work all the way back to 1.2.2 at least. The only caveat I'd add is if the build or IDF changed the default modem low power mode at some point, then default behavior could be different. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ran a test running "cheerlights" on a grandcentral_m4_express with NiNa 1.6
"normal" current draw is 70mA quiet and 130mA active
"power_mode - False" cirrent draw is 140ma quiet to 160mA actve
the LED color was the same for both test (16 Neopixel ring)
looks like it has a significant impact
better example -- just run esp32spi_simpletest with wiifi_set_power_mode(False) it stays at ~140mA after completion |
Thanks, Jerry. That's similar to the pattern I observed, and appears to confirm that MIN power save is on by default (at least in recent version of NINA). |
From research for this issue, it seemed the feature in IDF pre-dates our NINA (2017-ish), |
@brentru Any thoughts? If there's little value in being able to turn off low-power (or perhaps that and using this as a stub for later adding the |
@anecdata Agreed - let's close this in favor of adding the more effective power save mode in nina-fw. Thanks for trying it out. |
Expose the NINA firmware
setPowerMode
function. Note that:NINA firmware currently implements only
WiFi.lowPowerMode()
orWiFi.noLowPowerMode()
, and low power mode defaults toWIFI_PS_MIN_MODEM
:Preliminary testing of low power mode vs. no low power mode indicates potentially significant difference in power usage, but it is dependent on AP settings and wi-fi usage within the client CircuitPython application.
However, though I may be misunderstanding something, it appears that the default NINA build enables
WIFI_PS_MIN_MODEM
(though I don't pretend to understand the build process and can't find where it's done in the code). Crude testing with this PR code shows similar battery life for code with no call toesp.wifi_set_power_mode()
and call toesp.wifi_set_power_mode(True)
. Call toesp.wifi_set_power_mode(False)
does increase power usage, but there may be a benefit in some cases:Background information is here:
https://docs.espressif.com/projects/esp-idf/en/latest/esp32/api-guides/wifi.html#esp32-wi-fi-power-saving-mode
A future enhancement for lower power usage, which would require a change to NINA, could add the option for the higher power saving mode by using
esp_wifi_set_ps()
with theWIFI_PS_MAX_MODEM
value (caveats in the link above), instead of the current call toWiFi.lowPowerMode()
.There are other low-power features of the ESP32, but they would require development from scratch in the NINA firmware, plus exposure in this library. There's always the
EN
pin for super low power usage ;-)