Sleeping the ESP8266

ESP8266 Electrical characteristics

Section 7.1 of this Espressif datasheet provides data on current consumption. These data are based on 3.3V supply, and 25C ambient, using internal regulators. Measurements are done at antenna port without SAW filter. All the transmitter’s measurements are based on 90% duty cycle, continuous transmit mode.

Mode

Min

Typ

Max

Unit

Transmit 802.11b, CCK 1Mbps, POUT=+19.5dBm

215

mA

Transmit 802.11b, CCK 11Mbps, POUT=+18.5dBm

197

mA

Transmit 802.11g, OFDM 54Mbps, POUT =+16dBm

145

mA

Transmit 802.11n, MCS7, POUT=+14dBm

135

mA

Receive 802.11b, packet length=1024 byte, -80dBm

60

mA

Receive 802.11g, packet length=1024 byte, -70dBm

60

mA

Receive 802.11n, packet length=1024 byte, -65dBm

62

mA

Standby

0.9

mA

Deep sleep

10

µA

Power save mode DTIM 1

1.2

mA

Power save mode DTIM 3

0.86

mA

Total shutdown

0.5

µA

In deep sleep mode, the ESP8266 maintains its RTC but shuts everything else off to hit about 60 µA. Respectable, if not MSP430 levels. It can pull upwards of 200mA while it’s transmitting, and I usually measure an average of about 75mA in normal operation. In deep-sleep mode I can get the ESP8266 Thing down to about 77µA.

Deep Sleep Mode

There is a modification to be made – both in hardware and software – to get current consumption low. On the firmware end, the Espressif SDK has made a systemdeepsleep([uint32t timein_us]) function available, which puts the ESP8266 to sleep for a specified number of microseconds. When it wakes up, it begins running the user program from the very beginning. If you’re using the ESP8266 Arduino IDE, they’ve wrapped that function and another into a very nice ESP.deepSleep([microseconds], [mode]) function. Here’s a quick example Arduino sketch for the ESP8266 that blinks the on-board LED 10 times, sleeps for 60 seconds, then repeats.

To wake itself up, the ESP8266 uses the XPD pin to trigger its reset line so those two pins need to be connected together. XPDDCDC connects to EXTRSTB with 0R
Wiring up XPD to DTR works. ( Note there is a small capacitor between them on Sparkfuns Thing board on the DTR line)

More data from expressif

6.system_deep_sleep

Function:
Configures chip for deep-sleep mode. When the device is in deep-sleep, it automatically wakes up periodically; the period is configurable. Upon waking up, the device boots up from userinit.Prototype:
void systemdeepsleep(uint32 timeinus)Parameters:
uint32 timeinus : during the time (us) device is in deep-sleepReturn:
nullNote:
Hardware has to support deep-sleep wake up (XPDDCDC connects to EXTRSTB with 0R).
systemdeep_sleep(0): there is no wake up timer; in order to wakeup, connect a GPIO to pin RST, the chip will wake up by a falling-edge on pin RST

7.system_deep_sleep_set_option

Function:

Call this API before system_deep_sleep to set what the chip will do when deep-sleep wake up.\\

Prototype:

bool system_deep_sleep_set_option(uint8 option)\\

Parameter:

uint8 option : //

deepsleepsetoption(0): Radio calibration after deep-sleep wake up depends on init data byte 108.
deepsleepsetoption(1): Radio calibration is done after deep-sleep wake up; this increases the current consumption.
deepsleepsetoption(2): No radio calibration after deep-sleep wake up; this reduces the current consumption.
deepsleepsetoption(4): Disable RF after deep-sleep wake up, just like modem sleep; this has the least current consumption; the device is not able to transmit or receive data after wake up.Note: