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

Moderator: igrr

User avatar
By digitalkiwi
#34833 I'm putting the ESP to sleep using
Code: Select all  ESP.deepSleep(10000000, WAKE_RF_DEFAULT); // Sleep for 10 seconds
 

It seems to go to sleep but then upon waking it hangs, I have a Node MCU v2 breakout board similar to this.
http://www.aliexpress.com/store/product/New-Wireless-module-NodeMcu-Lua-WIFI-Internet-of-Things-development-board-based-ESP8266-Limited-number/1383971_32260333698.html

It seems I don't need the bridge from GPIO16 (D0) to reset it as it seems to wake up after the right time (I've tried with and without the bridge). It also has a red LED onboard that just stays on.

I can press reset and it will reboot and work fine.

Any ideas?

All my code here:
Code: Select all


/**************************************************************
 * Blynk is a platform with iOS and Android apps to control
 * Arduino, Raspberry Pi and the likes over the Internet.
 * You can easily build graphic interfaces for all your
 * projects by simply dragging and dropping widgets.
 *
 *   Downloads, docs, tutorials: http://www.blynk.cc
 *   Blynk community:            http://community.blynk.cc
 *   Social networks:            http://www.fb.com/blynkapp
 *                               http://twitter.com/blynk_app
 *
 * Blynk library is licensed under MIT license
 *
 *
 **************************************************************
 *
 *
 *
 * WARNING :
 * For this example you'll need SimpleTimer library:
 *   https://github.com/jfturcot/SimpleTimer
 * Visit this page for more information:
 *   http://playground.arduino.cc/Code/SimpleTimer
 *
 *
 *   DHT22 ----gpio12
 *
 **************************************************************/

#define BLYNK_PRINT Serial    // Comment this out to disable prints and save space
#include <ESP8266WiFi.h>
#include <BlynkSimpleEsp8266.h>
#include <SimpleTimer.h>
#include "DHT.h"

#define DHTPIN D6 //pin gpio 12 in sensor
#define DHTTYPE DHT22   // DHT 22 Change this if you have a DHT11
DHT dht(DHTPIN, DHTTYPE);

// You should get Auth Token in the Blynk App.
// Go to the Project Settings (nut icon).
char auth[] = "XXX";  // Put your Auth Token here. (see Step 3 above)

SimpleTimer timer;

float tick = 0;

void setup()
{
  Serial.begin(9600); // See the connection status in Serial Monitor
   Blynk.begin(auth, "XXX", "XXXX"); //insert here your SSID and password
 
  // Setup a function to be called every second
  timer.setInterval(2000L, sendUptime);

  timer.setInterval(5000L, fiveSecondTick);



}

void sendUptime()
{
  // You can send any value at any time.
  // Please don't send more that 10 values per second.
   //Read the Temp and Humidity from DHT
  float h = dht.readHumidity();
  float t = dht.readTemperature();
 
 // Blynk.virtualWrite(10, t); // virtual pin
 // Blynk.virtualWrite(11, h); // virtual pin
//  Blynk.virtualWrite(0, t); // virtual pin
 // Blynk.virtualWrite(1, h); // virtual pin
 
}

void fiveSecondTick()
{
  // You can send any value at any time.
  // Please don't send more that 10 values per second.
   //Read the Temp and Humidity from DHT
   
    tick = tick + 1;
   
  Blynk.virtualWrite(5, tick); // virtual pin
  Serial.println(tick);
  if (tick >= 5) {
    sleepMoFo();
  }
 
 
}

void sleepMoFo()
{
  // You can send any value at any time.
  // Please don't send more that 10 values per second.
   //Read the Temp and Humidity from DHT
   
    //tick = 0;
   
  //Serial.println("Sleepy time");
 
  ESP.deepSleep(10000000, WAKE_RF_DEFAULT); // Sleep for 10 seconds
 
}


void loop()
{
  Blynk.run();
  timer.run();
}
User avatar
By Venkatesh
#34836 You need pull-up on both GPIO 0 and 2 pins (Vcc --->4.7K --> GPIO2, Vcc --> 4.7K -->GPIO0). What happens is sometimes deep wake-up causes ESP hang so we need to pull-up on pins.
User avatar
By digitalkiwi
#34846 If you're ever in Melbourne I'll buy you a beer!

Thanks for that, I've spent all day trying to figure that out.

Is there a thread that exists for this issue? I'd love to know more about it.

Does putting the pull up resisters render those pins useless?
User avatar
By martinayotte
#34889 There are a lot of threads where it is mentioned that GPIO15 need to be pulled-down while GPIO2/GPIO0 needs to be pulled-up.
Those pins still can be used for something else, for example GPIO2/GPIO0 can be used as an I2C bus since such bus also requires pull-ups.