Your new topic does not fit any of the above??? Check first. Then post here. Thanks.

Moderator: igrr

User avatar
By jimthree
#19808 Hi Folks.

I've been having a problems getting my ESP-12 to stay asleep for any length of time. I believe I have it wired up fine, I have the reset pin and GPIO16 tied together, but when it goes to sleep it seems to wake up straight away.

The test code I'm using pulls GPIO4 (which is connected to a Red LED) high then low and then should sleep for 10secs before waking up. When it wakes, my understanding is that it just resets the board, which is why I have put everything in setup() rather then loop()

My code looks like this:

Code: Select all#include <ESP8266WiFi.h>

// We only power up the sensor when we need to read it,
// So we use a digital pin to toggle power
#define SENSOR_POWER_PIN 4

 
void setup()
{
  pinMode(SENSOR_POWER_PIN, OUTPUT);
  Serial.begin(115200);
  Serial.print("\n\n### Awake!!! ###");
 
  // Power up the sensor by lifting a digital pin high
  digitalWrite(SENSOR_POWER_PIN, HIGH);
  delay(100);
  digitalWrite(SENSOR_POWER_PIN, LOW);
 
  Serial.println("Going to sleep!!!\n\n\n\n\n");
 
  ESP.deepSleep(10000);
}

void loop()
{}


... and although it may not be much use, there is a youtube video here https://www.youtube.com/watch?v=zhkvbYF3K4c that show's it's behaviour.

If anyone has got any ideas what might be causing this to fail, I'd love to hear your thoughts!

Jim
User avatar
By torntrousers
#19811 Hi Jim, that all looks fine but the deepSleep value is in micro seconds, so you're just sleeping for a fraction of a second. Try changing the value to 10000000.