ESP8266-12 HANGS WHEN COMING OUT OF DEEP SLEEP MODE

TheWho
Posts: 9
Joined: Sun Sep 27, 2015 12:26 pm

ESP8266-12 HANGS WHEN COMING OUT OF DEEP SLEEP MODE

Postby TheWho » Sun Sep 27, 2015 12:57 pm

I'm using adafruits' esp8266 HUZZAH board (ESP8266-12) connected to a temp / humidity sensor (DHTxx) which is sending temp / humidity data to thingspeak.

The issue is that the ESP8266 will hang when coming out of deep sleep. Whens it's in a deep sleep the red LED will be dim. When it hangs, it turns bright red and the blue light may or may not be lit. It works for hours and then fails for hours with no distinct pattern.

What has me stumped is that I've tried multiple power supplies and cannot detect a pattern.

Any reasons or solutions?

ESP_Faye
Posts: 1641
Joined: Mon Oct 27, 2014 11:08 am

Re: ESP8266-12 HANGS WHEN COMING OUT OF DEEP SLEEP MODE

Postby ESP_Faye » Fri Oct 09, 2015 3:07 pm

Hi,

Documentation about sleep mode

To wake up from deep-sleep, XPD_DCDC needs to connects to EXT_RSTB with 0 ohm resistor.

TheWho
Posts: 9
Joined: Sun Sep 27, 2015 12:26 pm

Re: ESP8266-12 HANGS WHEN COMING OUT OF DEEP SLEEP MODE

Postby TheWho » Sat Oct 10, 2015 2:11 pm

The system is on a breadboard so the jumper is directly corrected with no resistance. See attached photo.
Could the resistance be incorrect?

********************************************************************************************************************
Here's the code I'm using.
********************************************************************************************************************
#include <DHT.h>
#include <ESP8266WiFi.h>

// replace with your channel's thingspeak API key,
String apiKey = "<Key>";
const char* ssid = "<Network>";
const char* password = "<Key>";

const char* server = "api.thingspeak.com";
#define DHTPIN 5 // what pin we're connected to

DHT dht(DHTPIN, DHT11, 15);
WiFiClient client;

void setup() {
// Time to sleep (in seconds):
const int sleepTimeS = 300;

float h = dht.readHumidity();
float t = dht.readTemperature(true);

Serial.begin(115200);
delay(10);
dht.begin();

WiFi.begin(ssid, password);

Serial.println();
Serial.println();
Serial.print("Connecting to ");
Serial.println(ssid);

WiFi.begin(ssid, password);

while (WiFi.status() != WL_CONNECTED) {
delay(3000);
Serial.print(".");
}
Serial.println("");
Serial.println("WiFi connected");

if (isnan(h) || isnan(t)) {
Serial.println("Failed to read from DHT sensor!");
return;
}

if (client.connect(server, 80)) { // "184.106.153.149" or api.thingspeak.com
String postStr = apiKey;
postStr += "&field1=";
postStr += String(t);
postStr += "&field2=";
postStr += String(h);
postStr += "\r\n\r\n";

client.print("POST /update HTTP/1.1\n");
client.print("Host: api.thingspeak.com\n");
client.print("Connection: close\n");
client.print("X-THINGSPEAKAPIKEY: " + apiKey + "\n");
client.print("Content-Type: application/x-www-form-urlencoded\n");
client.print("Content-Length: ");
client.print(postStr.length());
client.print("\n\n");
client.print(postStr);

Serial.print("Temperature: ");
Serial.print(t);
Serial.print(" degrees Fahrenheit Humidity: ");
Serial.print(h);
Serial.println("% send to Thingspeak");
}
client.stop();

//Serial.println("Waiting...");
// thingspeak needs minimum 15 sec delay between updates
// delay(300000);

// deepSleep time is defined in microseconds. Multiply
// seconds by 1e6
ESP.deepSleep(sleepTimeS * 1000000);
delay(1000);
}

void loop() {
}

TheWho
Posts: 9
Joined: Sun Sep 27, 2015 12:26 pm

Re: ESP8266-12 HANGS WHEN COMING OUT OF DEEP SLEEP MODE

Postby TheWho » Sat Oct 10, 2015 2:11 pm

The system is on a breadboard so the jumper is directly corrected with no resistance. See attached photo.
Could the resistance be incorrect?

********************************************************************************************************************
Here's the code I'm using.
********************************************************************************************************************
#include <DHT.h>
#include <ESP8266WiFi.h>

// replace with your channel's thingspeak API key,
String apiKey = "<Key>";
const char* ssid = "<Network>";
const char* password = "<Key>";

const char* server = "api.thingspeak.com";
#define DHTPIN 5 // what pin we're connected to

DHT dht(DHTPIN, DHT11, 15);
WiFiClient client;

void setup() {
// Time to sleep (in seconds):
const int sleepTimeS = 300;

float h = dht.readHumidity();
float t = dht.readTemperature(true);

Serial.begin(115200);
delay(10);
dht.begin();

WiFi.begin(ssid, password);

Serial.println();
Serial.println();
Serial.print("Connecting to ");
Serial.println(ssid);

WiFi.begin(ssid, password);

while (WiFi.status() != WL_CONNECTED) {
delay(3000);
Serial.print(".");
}
Serial.println("");
Serial.println("WiFi connected");

if (isnan(h) || isnan(t)) {
Serial.println("Failed to read from DHT sensor!");
return;
}

if (client.connect(server, 80)) { // "184.106.153.149" or api.thingspeak.com
String postStr = apiKey;
postStr += "&field1=";
postStr += String(t);
postStr += "&field2=";
postStr += String(h);
postStr += "\r\n\r\n";

client.print("POST /update HTTP/1.1\n");
client.print("Host: api.thingspeak.com\n");
client.print("Connection: close\n");
client.print("X-THINGSPEAKAPIKEY: " + apiKey + "\n");
client.print("Content-Type: application/x-www-form-urlencoded\n");
client.print("Content-Length: ");
client.print(postStr.length());
client.print("\n\n");
client.print(postStr);

Serial.print("Temperature: ");
Serial.print(t);
Serial.print(" degrees Fahrenheit Humidity: ");
Serial.print(h);
Serial.println("% send to Thingspeak");
}
client.stop();

//Serial.println("Waiting...");
// thingspeak needs minimum 15 sec delay between updates
// delay(300000);

// deepSleep time is defined in microseconds. Multiply
// seconds by 1e6
ESP.deepSleep(sleepTimeS * 1000000);
delay(1000);
}

void loop() {
}
Last edited by TheWho on Sat Oct 10, 2015 2:13 pm, edited 1 time in total.

TheWho
Posts: 9
Joined: Sun Sep 27, 2015 12:26 pm

Re: ESP8266-12 HANGS WHEN COMING OUT OF DEEP SLEEP MODE

Postby TheWho » Wed Oct 21, 2015 9:21 am

Bump

ESP_Faye
Posts: 1641
Joined: Mon Oct 27, 2014 11:08 am

Re: ESP8266-12 HANGS WHEN COMING OUT OF DEEP SLEEP MODE

Postby ESP_Faye » Thu Oct 22, 2015 3:43 pm

Hi,

To wake up from deep-sleep, XPD_DCDC has to connect to EXT_RSTB with 0 ohm resistor.

Thanks for your interest in ESP8266!

TheWho
Posts: 9
Joined: Sun Sep 27, 2015 12:26 pm

Re: ESP8266-12 HANGS WHEN COMING OUT OF DEEP SLEEP MODE

Postby TheWho » Fri Oct 23, 2015 11:09 am

GPIO16 is connected directly to RST with wire. No resister in place. Please explain why the resister is needed.

thank you.

OlgaPaw
Posts: 2
Joined: Wed Aug 12, 2015 5:25 pm

Re: ESP8266-12 HANGS WHEN COMING OUT OF DEEP SLEEP MODE

Postby OlgaPaw » Wed Oct 28, 2015 10:02 pm

Hello.
I'm trying to run deep sleep with SDK code, but have no idea in which code place it wakes up. After wakeup esp prints some unidentified chars to UART, but nothing else happend. I use esp-12. With no extra connections. Also tried with esp-01 with the same result.
What should I do? Should I connect GPIO16 to sth? To What?

thanks for answers

TheWho
Posts: 9
Joined: Sun Sep 27, 2015 12:26 pm

Re: ESP8266-12 HANGS WHEN COMING OUT OF DEEP SLEEP MODE

Postby TheWho » Thu Oct 29, 2015 12:30 am

OlgaPaw wrote:Hello.
I'm trying to run deep sleep with SDK code, but have no idea in which code place it wakes up. After wakeup esp prints some unidentified chars to UART, but nothing else happend. I use esp-12. With no extra connections. Also tried with esp-01 with the same result.
What should I do? Should I connect GPIO16 to sth? To What?

thanks for answers


GPIO will need to be connected to RST pinout. I used a jumper to do that or you can solder a wire.
I'm using the ESP-12 on a breakout board. The ESP-01 requires a wire to be soldered from the chip wire to the pin.
The deep sleep code will wake up and restart at the beginning.

TheWho
Posts: 9
Joined: Sun Sep 27, 2015 12:26 pm

Re: ESP8266-12 HANGS WHEN COMING OUT OF DEEP SLEEP MODE

Postby TheWho » Mon Nov 02, 2015 9:44 am

bump

Who is online

Users browsing this forum: No registered users and 8 guests