IOT devices running on batteries may need an on off switch. To reduce part count, I have though of a way to allow for the ESP 8266 to sleep and wake using only one extra resistor a switch and two GPIO.

This project assumes that 10k pullup on RST is already installed.

1) Connect the RST line to an unused GPIO that is not 0,2,15 or 16.

2) Pick a second IO that cannot be 0, 2 or 15 and connect a <1k resistor to ground

3) Connect the switch between the RST and the 1k resistor.

4) Insert the following code and it will work.

void setup() {
    pinMode(GPIO_TO_RST, OUTPUT);
    digitalWrite(GPIO_TO_RST, HIGH);
void loop() {

    static unsigned long timeout = 0;
    static boolean pin_state = false;
    static boolean pin_state_prev = false;

    if (timeout < millis()) // simple debouce
        pin_state_prev = pin_state;
        pin_state = digitalRead(GPIO_TO_RESISTOR);
        timeout = millis() + 50;
    if (pin_state_prev && !pin_state)
        pinMode(GPIO_TO_RESET,  INPUT);