If you're interested in the Arduino ecosystem, you've no doubt come across the Wemos family of boards. Based on the ESP8266, they have WiFi and TCP / UDP support built in! While that's very cool indeed for such a low-power device, in this post I'll be focusing on another cool aspect of the chipset, as I'm going to need to for a project in the nearish future (which I might blog about too!).
Curiously, the ESP chipset carries a unique ability to go into so-called 'deep sleep', which turns off everything but an internal counter, which emits a pulse on a specified pin when the sleep time is up. By wiring this specified pin to the RST (Reset) pin with a jumper cable, we can get it to automagically wake itself up after the deep sleep cycle is completed.

This is a lot simpler than the sleep modes available on other (non-ESP) chips - which are explained here for those interested. Here's an example:
void setup() {
Serial.begin(9600);
Serial.print("Initialising - ");
pinMode(D0, WAKEUP_PULLUP);
Serial.println("done");
Serial.println("Waiting: ");
for(int i = 0; i < 5; i++) {
delay(1000);
Serial.print(".");
}
Serial.println();
Serial.println("Entering deep sleep. Goodnight!");
ESP.deepSleep(5 * 1000000);
}
void loop() {
}
Nice and easy, right? You can see how you'd need to factor this into the design of your program before you get too far into it. Note that I multiply the number of seconds by 1000000 - this is because the sleep time is specified in microseconds - not milliseconds or seconds.
When in deep sleep, people have managed to reduce it's power consumption down to ~100µA(!) - I'll update this post once I manage to make some measurements of my own.
That's about everything I wanted to mention - just to remind myself on how to do it in a few weeks time :-)
Found this useful? Got a question? Comment below!