3

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() {
}
5
  • 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
    Commented Feb 2, 2017 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 ... Commented Apr 26, 2017 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!!! Commented Apr 26, 2017 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??? Commented Mar 2, 2018 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
    Commented Mar 3, 2018 at 0:27

2 Answers 2

3

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

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

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 and acknowledge you have read our privacy policy.

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