Go Down

Topic: ESP-12 LED Slightly ON in Deep Sleep (Read 1 time) previous topic - next topic

androidfanboy

Nov 27, 2017, 01:33 am Last Edit: Nov 27, 2017, 02:04 am by androidfanboy
I have a NodeMCU with an LED connected to GPIO12 (pin D6) with a 330 Ohm resistor going to GND. The LED blinks perfectly fine with the blink sketch, but once I include the ESP.deepSleep(<time>) it turns *very slightly* ON and draws about 1uA. My question is, why is this and how can I prevent it?

EDIT: I've also noticed the same behavior on other pins. Also, when I simply touch the positive leg of the LED with my finger when the LED is dim, it turns off completely. I also tried increasing the resistor from 330 to 1k and still the same problem.

Code: [Select]
#define LED 12

void setup() {
  pinMode(LED, OUTPUT);
}

void loop() {
  digitalWrite(LED, HIGH);
  delay(1000);
  digitalWrite(LED, LOW); // Runs great up to here, LED is completely off!
  delay(1000);

  ESP.deepSleep(5000000); // Once this runs, the LED turns very slightly on...
}

Wawa

What if you connect the LED-resistor between pin and VCC (3.3volt).
Leo..

androidfanboy

#2
Dec 02, 2017, 06:52 pm Last Edit: Dec 02, 2017, 06:52 pm by androidfanboy
Yes, I thought about doing that (since that's what the built-in LED on the ESP-12 module does on GPIO2) and that setup works, but what I don't understand is why it won't work when the LED goes to GND. I guess I just shouldn't question it and just do what works lol.

Wawa

Seems the pin has a weak internal  pull up in sleep mode.
Connecting the LED between pin and VCC prevents that pull up current flowing to ground.
Leo..

androidfanboy


Go Up