So you're a Noob? Post your questions here until you graduate! Don't be shy.

User avatar
By EdTheLoon
#79811 I am having an issue with putting the NodeMCU 1.0 (ESP8266-12E) into deep sleep. As per the instructions I have found in numerous places, I connected GPIO16 (marked D0 on the board) to RST. I uploaded simple code to light the on-board LED for a set amount of time, turn it off and then deep sleep. The board goes into deep sleep but once the wake-up signal is sent to RST it constantly resets the board.

Powering up the ESP8266 with RST already connected to GPIO16 also causes the board to constantly reset. I have tried the exact same code and wiring on two units and I am experiencing the same problem. I noticed some people also had this issue but never found a solution.

Am I doing something wrong or is there another issue at play here?

This is the code that was flashed to the unit using Arduino IDE.
Code: Select allvoid setup() {
  pinMode(LED_BUILTIN, OUTPUT);
  digitalWrite(LED_BUILTIN, LOW);
  delay(5000);
  digitalWrite(LED_BUILTIN, HIGH);
  ESP.deepSleep(10e6); // 10 seconds
}

void loop() { }
Last edited by EdTheLoon on Thu Jan 03, 2019 10:22 pm, edited 1 time in total.
User avatar
By torntrousers
#79831 Funny!

Its because the NodeMCU variant defines LED_BUILTIN as 16, see: https://github.com/esp8266/Arduino/blob ... uino.h#L35. So as you have GPIO 16 connected to RST then when you set the pinMode it resets the ESP!

It looks like you on the NodeMCU you just can't use LED_BUILTIN at the same time as you've connected GPIO16 to RST for deepSleep.
User avatar
By EdTheLoon
#79853
torntrousers wrote:Funny!

Its because the NodeMCU variant defines LED_BUILTIN as 16, see: https://github.com/esp8266/Arduino/blob ... uino.h#L35. So as you have GPIO 16 connected to RST then when you set the pinMode it resets the ESP!

It looks like you on the NodeMCU you just can't use LED_BUILTIN at the same time as you've connected GPIO16 to RST for deepSleep.


Oh I completely forgot that LED_BUILTIN is pin 16 (that's the trouble with using common definitions, you forget things). I'll give it a try by wiring up an LED to a different pin.

Edit: It's working now. Thank you.