This comes from an Espressif datasheet which is on Google Docs here \\ [[https://docs.google.com/file/d/0B9hyK_DA6VIiSWNRZ29sdG1UOVU/edit?pli=1|Smart Connectivity Platform: ESP8266]]. \\ The Olimex product sescription gives an insight too [[https://www.olimex.com/Products/IoT/MOD-WIFI-ESP8266-DEV/|Olimex Products: MOD-WIFI-ESP8266-DEV]]. ====== 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 ''system_deep_sleep([uint32_t time_in_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. #include // Ticker can periodically call a function Ticker blinker; // Ticker object called blinker. int ledPin = 5; // LED is attached to ESP8266 pin 5. uint8_t ledStatus = 0; // Flag to keep track of LED on/off status int counter = 0; // Count how many times we've blinked void setup() { pinMode(ledPin, OUTPUT); // Set LED pin (5) as an output blinker.attach(0.25, blink); // Ticker on blink function, call every 250ms } void loop() { } void blink() { if (ledStatus) digitalWrite(ledPin, HIGH); else digitalWrite(ledPin, LOW); ledStatus = (ledStatus + 1) % 2; // Flip ledStatus if (counter++ > 20) // If we've blinked 20 times ESP.deepSleep(60000000, WAKE_RF_DEFAULT); // Sleep for 60 seconds } To wake itself up, the ESP8266 uses the XPD pin to trigger its reset line so those two pins need to be connected together. XPD_DCDC connects to EXT_RSTB 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 ===== can be found at \\ [[http://bbs.espressif.com/download/file.php?id=253&sid=398301f84155a628a3a39725226e7379|http://bbs.espressif.com/download/file.php?id=253&sid=398301f84155a628a3a39725226e7379]]// [[http://bbs.espressif.com/viewtopic.php?f=21&t=645|http://bbs.espressif.com/viewtopic.php?f=21&t=645]]// An extract from which deals with deep sleep \\ ==== 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 user_init.\\ **__Prototype:__** \\ void system_deep_sleep(uint32 time_in_us)\\ **__Parameters:__** \\ uint32 time_in_us : during the time (us) device is in deep-sleep\\ **__Return:__** \\ null\\ **__Note:__** \\ Hardware has to support deep-sleep wake up (XPD_DCDC connects to EXT_RSTB with 0R).\\ system_deep_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 : // deep_sleep_set_option(0): Radio calibration after deep-sleep wake up depends on init data byte 108. \\ deep_sleep_set_option(1): Radio calibration is done after deep-sleep wake up; this increases the current consumption.\\ deep_sleep_set_option(2): No radio calibration after deep-sleep wake up; this reduces the current consumption.\\ deep_sleep_set_option(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:__** \\ Init data refers esp_init_data_default.bin.\\ **__Return:__**\\ true : succeed........ false : fail //