I have a Wemos D1 (ver. 2015-08) and I am trying to get it to sleep. I've managed to get it generally up and running/got wifi to work etc, but the deep sleep function is beyond me.
I tried connecting RX<-D0 pin to RESET, also tried with a 10k resistor. Neither worked. I then tried D2 (listed as gpi016 on the back of the board) to RESET, this also didn't work. Any ideas? It seems like this would be an incredible chip if I could get it to sleep. The example sketch below uploads fine and contacts the serial monitor, up until the point it sleeps.
/* Deep Sleep - Blink
*
* Blinks the onboard LED, sleeps for 10 seconds and repeats
*
* Connections:
* D0 -- RST
*
* If you cant reprogram as the ESP is sleeping, disconnect D0 - RST and try again
*/
// sleep for this many seconds
const int sleepSeconds = 5;
void setup() {
Serial.begin(9600);
Serial.println("\n\nWake up");
pinMode(BUILTIN_LED, OUTPUT);
// Connect D0 to RST to wake up
pinMode(D0, WAKEUP_PULLUP);
// LED: LOW = on, HIGH = off
Serial.println("Start blinking");
for (int i = 0; i < 20; i++) {
digitalWrite(BUILTIN_LED, LOW);
delay(100);
digitalWrite(BUILTIN_LED, HIGH);
delay(100);
}
Serial.println("Stop blinking");
Serial.printf("Sleep for %d seconds\n\n", sleepSeconds);
// convert to microseconds
ESP.deepSleep(sleepSeconds * 1000000);
Serial.println("sleep finished");
}
void loop() {
}
Serial.println("sleep finished");
won't be executed after the chip wakes up, the ESP will basically shutdown, then reboot after deepsleep period ...