Some power saving questions

ESP_Sprite
Posts: 26
Joined: Fri Oct 24, 2014 7:58 pm

Some power saving questions

Postby ESP_Sprite » Fri Dec 05, 2014 6:45 pm

I was browsing the sources for the RTOS port you guys just posted, and I saw some nice functions I have a couple of questions on:

About system_rtc_mem_read and system_rtc_mem_write: I presume this is meant to store data over a reset cycle, so you can save stuff when going to deep sleep without having to put it in flash? If so, how much memory is available? I also assume the main memory isn't kept over a deep sleep cycle?

I see there's a wifi_station_disconnect there. Does this disable the WiFi hardware when the module is in STA mode?

I'm asking this because I'm thinking about a sensor that runs on batteries. What I'd like to do is to have it wake up say every 30 seconds or so, take a sample, store it in RTC memory, then go to sleep again. Every 5 minutes, it will enable the WiFi stack and send the collected data. I would not want the sensor to have to start the WiFi electronics every 30 seconds, because that'd mean a fairly big drain on the batteries. Is such an use case possible?

ESP_Sprite
Posts: 26
Joined: Fri Oct 24, 2014 7:58 pm

Re: Some power saving questions

Postby ESP_Sprite » Mon Dec 08, 2014 7:27 pm

And another question: As far as I can see, a return from sleep mode now involves a complete reset, which means the device has to do a scan, associate and dhcp request in order to get the network working; I measured that to take about 5 seconds, which at 70mA average (assumed) is quite long if you have a thing running from a battery. When you sleep only 5 minutes or so, a lot of the variables detected (access point channel, association data, IP address) will be the same as on the previous startup. Is there a possibility to store these in RTC RAM and reload them on wakeup in order to cut out the scanning etc and get a speedier wake-up process?

ESP_Sprite
Posts: 26
Joined: Fri Oct 24, 2014 7:58 pm

Re: Some power saving questions

Postby ESP_Sprite » Sat Dec 13, 2014 5:11 am

I'm going to kick this once more, I really hope the Espressif people can give some answers; getting this to work a bit better would make the ESP way more usable as a low-power sensor thing. At the moment, I measure the ESP coming up, sending an HTTP request and going to sleep takes about 5 seconds. Of these 5 seconds, it seems that:
- 0.3 seem to be general chip read and init stuff.
- 1.8 are used to scan for the access point. After scanning, connecting with it happens instantaneous
- 1.0 is used to get a DHCP lease
- 1.5-1.9 is used to send the actual HTTP request and receive data.

In general, all operations seem to average about 70mA of power, but the scan and DHCP lease bit seem to pull more than the HTTP thing. See the attached scope image.

My idea is, if there's a way we can read and set the specific access point settings and DHCP lease info to RTC ram and restore them when the chip wakes up again, we can save more than half the time the thing is awake. Because it pulls way less power when doing the HTTP request, I think devices running on battery will get about 3 times as much lifetime than when just rebooting.

My question is: Espressif guys/gals, is there a plan to implement this kind of sleep/wakeup behaviour? If there isn't, can you implement an API to get/set the access point details, so scanning for them on wakeup becomes superfluous? We can implement the DHCP and save/load-from-RTC-ram bit ourselves if needed. (As a final alternative: any chance the phy etc libraries can be open-sourced?)
Attachments
DS1Z_QuickPrint2.png
DS1Z_QuickPrint2.png (66 KiB) Viewed 26471 times

Lars R.
Posts: 13
Joined: Thu Oct 30, 2014 8:05 pm

Re: Some power saving questions

Postby Lars R. » Sun Dec 14, 2014 4:11 pm

I like to support this request and comment:

. If a full reset is involved, I would prefer storing in Flash rather than RTC ram.
. Success of speeding up connecting and DHCP lease might depend on access point behavior/settings.
. Power consumption might be optimized with
.. TX power. Already asked for API.
.. ESP8266 system clock frequency.
.. Flash clock frequency.
.. GPIO pullup (UART).

frob
Posts: 8
Joined: Mon Dec 08, 2014 1:07 am

Re: Some power saving questions

Postby frob » Tue Dec 16, 2014 7:48 am

According to the brief datasheet, ESP-8266 supports "WMM power save U-APSD" (part of 802.11e)

It there was an easy way to "turn this on" it would probably allow for the lowest possible power consumption in this kind of use scenario.

ESP_Faye
Posts: 1646
Joined: Mon Oct 27, 2014 11:08 am

Re: Some power saving questions

Postby ESP_Faye » Fri Dec 19, 2014 1:34 pm

During deep sleep, only RTC still working, so maybe we need to save some user data in RTC memory. Only “user data” area can be used by user.
|_ _ _ _ _system data _ _ _ _ _|_ _ _ _ _ _ _ _ _ user data _ _ _ _ _ _ _ _ _|
| 256 bytes | 512 bytes |

Note: RTC memory is 4 bytes aligned for read and write operations. Parameter “des_addr” means block number(4 bytes per block). So, if we want to save some data at the beginning of user data area, “des_addr” will be 256/4 = 64, “save_size” will be data length.
Prototype:
bool system_rtc_mem_write (uint32 des_addr, void * src_addr, uint32 save_size)
Parameter:
uint32 des_addr —— destination address (block number) in RTC memory,
des_addr >=64
void * src_addr —— data pointer.
uint32 save_size —— data length ( byte)
Return:
True, succeed;False,fail.

Lars R.
Posts: 13
Joined: Thu Oct 30, 2014 8:05 pm

Re: Some power saving questions

Postby Lars R. » Fri Dec 19, 2014 10:41 pm

@Espressif_Faye:
Deep sleep is a great feature that enables battery applications. This is particularly helpful when sensor data is transferred with long time interval like 10 minutes.

But how can we reduce regular power consumption when NOT in deep sleep? For applications that need to check switches or short-interval sensors, a low power mode could prove useful. Can we achieve that by reducing wake-up time and reconnecting time, by reducing clock frequencies (system and flash) and by reducing/modifying transmission power?

Best regards
Lars

jackon
Posts: 28
Joined: Thu Oct 23, 2014 9:05 am

Re: Some power saving questions

Postby jackon » Fri Dec 19, 2014 11:00 pm

Lars R. wrote:@Espressif_Faye:
Deep sleep is a great feature that enables battery applications. This is particularly helpful when sensor data is transferred with long time interval like 10 minutes.

But how can we reduce regular power consumption when NOT in deep sleep? For applications that need to check switches or short-interval sensors, a low power mode could prove useful. Can we achieve that by reducing wake-up time and reconnecting time, by reducing clock frequencies (system and flash) and by reducing/modifying transmission power?

Best regards
Lars


ESP8266 have three low power modes:
1. Modem sleep, average current is 15mA;
2. Light sleep, average current is 0.9mA;
3. Deep sleep, average current is 10uA.

Modem sleep & light sleep are just effective in station only mode.

ESP_Sprite
Posts: 26
Joined: Fri Oct 24, 2014 7:58 pm

Re: Some power saving questions

Postby ESP_Sprite » Sun Dec 21, 2014 7:53 pm

Espressif_Faye: Thank you very much! Now all we need is an interface to load and save the WiFi parameters (channel, ssid, DHCP address etc) so we can just load those on startup and be up and running within 2 seconds.

Jackon: How do you use those sleep modes? I've seen the new wifi_set_sleep_type call in the 0.9.4 SDK but I don't really see any difference in behaviour after I call them: system_deep_sleep still takes as long as it did, and when I leave the system running I still get an average power use of 50mA. Is there a wifi_sleep() call or something I'm missing?

ESP_Faye
Posts: 1646
Joined: Mon Oct 27, 2014 11:08 am

Re: Some power saving questions

Postby ESP_Faye » Tue Dec 23, 2014 8:10 pm

@Sprite_tm , it seems that you have many questions about how to use our APIs, please contact sales@espressif.com to sign NDA, then you can get our documents about APIs and else. ;)
interface to load and save the WiFi parameters: wifi_softap_get_config and wifi_softap_set_config
wifi_set_sleep_type to set sleep type for power saving. Set NONE_SLEEP_T to disable power saving. Default to be Modem sleep. Power saving is only enabled in station mode,because softap can not sleep.
Thanks for your interest in ESP8266 !

Who is online

Users browsing this forum: Google [Bot] and 19 guests