-->
Page 1 of 1

Deep Sleep wakeup

PostPosted: Wed Nov 02, 2016 10:56 am
by Robbert S
Hello everyone,

First of all, sorry for my english, I'm from the Netherlands. :D
For a project I'm working with a ESP8266 ESP-12E and 1 sensor, I want to have the ESP in deep sleep mode for low power consumption.

I want the ESP to be in deep sleep for +- 5 mins, so that would mean ESP.deepSleep(us, mode) andGPIO16 to RST right? The sensor is only active when it is above a set threshold, can I also connect the sensor to RST so the ESP can wakeup before the 5 mins has passed?

And to prevend the sensor from resetting the ESP while it is running, would it be good to connect GPIO to reset and set it HIGH while the ESP is running?

Re: Deep Sleep wakeup

PostPosted: Fri Nov 04, 2016 9:41 am
by mrburnette
This example runs on a NodeMCU by Lolin ... essentially any ESP8266 should work.

I wired D0 to RST on the NodeMCU. Change this line as needed:
system_deep_sleep(10000000); // deep sleep for 10 seconds


Code: Select allextern "C" {
#include "user_interface.h"
}

// #include "./MyInclude.h"

void setup() {
  rst_info *rsti;
  Serial.begin(115200);
  rsti = ESP.getResetInfoPtr();
  Serial.println("\r\nStart...");
  Serial.println(String("ResetInfo.reason = ") + rsti->reason);
}

// the loop function runs over and over again forever
void loop() {
  Serial.println("going to sleep now...");
  system_deep_sleep_set_option(0);
  system_deep_sleep(10000000);            // deep sleep for 10 seconds
  delay(1000);
}

/* 
 *  Sketch uses 225,445 bytes (21%) of program storage space. Maximum is 1,044,464 bytes.
 *  Global variables use 32,152 bytes (39%) of dynamic memory, leaving 49,768 bytes for local variables. Maximum is 81,920 bytes.
 */



Ray