ESP8266 Deep Sleep (simple mode)

An ESP8266 will consume about 70mA when running normally and quite a bit more at times. This level of consumption will run a battery down quite quickly. If you just want your ESP8622 to perform some function, like take a sensor reading once in a while, you can save battery life by putting the ESP8266 to sleep periodically. The current consumption during deep sleep will be only 70μA or less.

Setting up deep sleep mode is easy and only requires a single line of code.

**PLEASE NOTE!** You need to put all the actions of the script in the setup() section as everything after the go-to-sleep instruction will be ignored.

The ESP8266 will wake itself up by sending a signal on pin D0 (GPIO16 - Arduino pin 16) to perform a wake-up reset. You must connect pin D0 (GPIO16 - Arduino pin 16) to RST. You must disconnect this link when you want to upload a sketch and reconnect it when the sketch is running.

Remember that all variables will reinitialised when the ESP8266 wakes up. You are starting from a reset.

The sleep period is set in millseconds. Using the exponential expression makes life easy as the first part of the expression is the sleep time in seconds. E.g. to sleep for ten seconds use ESP.deepSleep(10e6);.

This very simple example shows how it is done…

void setup() {
  Serial.println("\n\nI'm awake, but I'm going into deep sleep mode for ten seconds");
void loop() {