Close

Deep Sleep

A project log for ESP8266 Native

Exploring running native applications on the ESP8266 modules

matt-callowMatt Callow 12/09/2014 at 05:502 Comments

I've been testing the deep sleep mode on the ESP-03. I loaded the frankenstein firmware from here https://github.com/nekromant/esp8266-frankenstein onto the module to test the deep sleep mode.

Note, you need to tie gpio15 to GND in order to boot any firmware on this module as shown in this table

GPIO15GPIO0GPIO2ModeDescription
LLHUARTDownload code from UART
LHHFlashBoot from SPI Flash
HxxSDIOBoot from SD-card

On the ESP-01 modules, GPIO15 must be tied to GND on the board. But on this module because the pin is broken out, you need to make sure that it's grounded at boot.

So, with the firmware running, I connect GPIO16 and RESET together and send the module into a deep sleep...

 === Press enter to activate this console === 
��rll��|�l�|�l�b|����r�b�b��nn�lnn���bplblrlp�n��lbn�|��l���b��nn�l��l`�nn�lnr���n���lp�n�r�����bn�|�l��b��nn��l`�nnl�l`nr���nbl``�n��b�nl���nn��lp�n�r�����bn�|���b��nn�l�l`�nnl`nr���nb�l`r��nb�l`25901
(c) Andrew 'Necromant' Andrianov 2014 
This is free software (where possible), published under the terms of GPLv2
frankenstein > deepsleep 10000000
Frankenstein ESP8266 Firmware
Powered by Antares 0.2-rc1, Insane Mushroom

While the module is awake, current draw is round 70mA. In deep sleep this drops to 600uA which rather high (stated deep sleep current is <10uA) I try it again, and this time the current drops to 45uA, which is a lot better.

What I'd like to do, is create a battery powered sensor running of a old Nokia 890mAh 3.7v LiPo

Some quick calculations:

So each hour, the device would be awake 12 times an hour for 30 seconds at a time, (360 seconds or 0.1 hours) and asleep for the remainder of the time (0.9 hours). So average current consumption in any given hour is (100*0.1) + (0.05*0.9) = 10.045mA

So the 890mAh battery would only last 89 hours, or less than 4 days. That's not really good enough for a battery sensor. (Compare this to some other battery sensors that I've build using NRF24L01+ modules which get about 10 weeks life out of the same battery)

I'll do some experiments to validate my estimates (especially the awake time) to see if this can be improved.

Discussions

new wrote 03/02/2015 at 18:34 point

Interesting, I've been playing with the sleep modes myself, my notes are here: 

http://41j.com/blog/2015/01/esp8266-sleep-modes/

the assembler instruction 

"waiti 0" also compiles, have you tried it?

  Are you sure? yes | no

Matt Callow wrote 03/03/2015 at 01:15 point

I've not tried the waiti instruction.

As stated in your blog, the latest API seems to have better support for sleep modes. I need to try this out.

Also, the use of RTC RAM is documented, which I want to test.

  Are you sure? yes | no