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.println("\n\nWake up");
  // 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);
    digitalWrite(BUILTIN_LED, HIGH);
  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() {
  • 1
    Could you say a few more words about what you actually observed, what you expected to observe, and how they differ? Have you tried disconnecting everything from the serial port of the ESP8266, as suggested by one tutorial? (Alas, this makes debugging much more difficult). – David Cary Feb 2 '17 at 15:53
  • 3
    definitely you gpio16 (D2), as that is the pin that is used for waking up from deepsleep ... note Serial.println("sleep finished"); won't be executed after the chip wakes up, the ESP will basically shutdown, then reboot after deepsleep period ... – Jaromanda X Apr 26 '17 at 1:05
  • oh, GPIO16 is D0 on the weemos d1 mini and D2 on the "non" mini ...why can't they just label GPIO16 as GPIO16!!! – Jaromanda X Apr 26 '17 at 6:12
  • One question about your board What board you must to select for the Wemos 2015-08 under arduino 1.8.5?? Wemos D1 R1 or Wemos D1 R2/mini??? – Miguel Angel Salinas Gancedo Mar 2 '18 at 22:32
  • If you need deep sleep, you should not use boards with USB-to-serial chips which cannot be sent to sleep. Think about using a "naked" ESP-12f and an external USB UART which only will be connected for programming. – gone Mar 3 '18 at 0:27

I had to physically connect D0 to RST to wake up the wemos.

  • the confusion may be that ... D0 on the Weemos d1 mini is gpio16 ... D2 on the Weemos d1 is gpio16 – Jaromanda X Apr 26 '17 at 1:07
  • 1
    Welcome. Please be sure to take the tour at arduino.stackexchange.com/Tour – SDsolar Apr 26 '17 at 1:48

In fact it works well using a wire between D2 and RESET pins. But sending the program to the board, you must first disconnect these pin (the arduino IDE will send a hard reset during process, so this D2 reset must not be in place). When the program is uploaded to the ESP and start running, you connect D2 and RESET and it works well, ESP will go to deep sleep mode as expected.

Because it is not a mini, the board has another chip (usb) that will not got to sleep mode, so on my board it will use about 17mA in deep sleep (compare with 80mA in wifi normal operation). Still worth the trick.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.