ESP.deep.Sleep Mode on Wemos d1, not wake up

Hy guys

I use on of my Wemos d1 with battery. Works great. But the deep.Sleep mode works not so goog.

The problem:
Sometimes, i think, the wemos not wake up.

I bridge D0 to RST for the wakeup siginal.

My code is this:

//WIFI und HTTP ESP8266 Libary ##############################
  #include <ESP8266WiFi.h>
  #include <WiFiClientSecure.h>
  #include "certs.h"
  #include <ESP8266HTTPClient.h>
//WIFI ENDE#################################################

//fuer volt anzeige
ADC_MODE(ADC_VCC);

//WLAN und HTTP############################################
//#########################################################
  #ifndef STASSID
  #define STASSID "ssid"
  #define STAPSK "pw"
  #endif

  const char* ssid = STASSID;
  const char* password = STAPSK;
  X509List cert(cert_DigiCert_Global_Root_CA);
  HTTPClient http; 
  WiFiClient client;
//WLAN und HTTP ENDE#######################################
//#########################################################

void setup() {

//Serial begin##############################
  Serial.begin(115200);
  Serial.println("Der ESP8266 ist aufgewacht!");



//WLAN connection aufbauen und ausgeben#####
  Serial.println();
  Serial.print("Connecting to ");
  Serial.println(ssid);
  WiFi.mode(WIFI_STA);
  WiFi.begin(ssid, password);
  while (WiFi.status() != WL_CONNECTED) {
    delay(500);
    Serial.print(".");
  }
  Serial.println("");
  Serial.println("WiFi connected");
  Serial.println("IP address: ");
  Serial.println(WiFi.localIP());
  //WLAN ENDE##############################


Wire.begin(sdaPin, sclPin);


}// void setup Ende#########################################


void loop() {

//Hier beginnt der eigentliche Code
// der Arduino (Wemos D1) wacht auf
// Warte nun ein wenig, bevor wieder in den Deep-Sleep-Modus wechselt. Ausgehen sollte sich: 1. Wlan verbinden, 2. MEssung durchführen, 
  
delay(3000);
double voltsd = static_cast<double>(ESP.getVcc()) / 1000;
      float volts = voltsd;
      char v[8] = {0};
      dtostrf(volts, 4, 3, v);//4 is   width,  precision


// SENDE BMP180 Temp_innen und Luftdruck MITTELS HTTP#####################################################  
                //Check WiFi connection status
                if(WiFi.status()== WL_CONNECTED){
                  HTTPClient http;
                   String url = "http://192.168.1.80/files/BMP_180.php";
                   String temp_url_part = "?temperatur=";
                   String luftdruck_url_part = "&luftdruck=";
                   String altitude_url_part = "&altitude=";
                   String voltage_url_part = "&volt=";
                   String serverurl = url + temp_url_part + temperatur_bmp180 + luftdruck_url_part + pressure_bmp180 + altitude_url_part + real_altitude_bmp180 + voltage_url_part + v;
                   Serial.println(serverurl);
                 
                  // Your Domain name with URL path or IP address with path
                  http.begin(client, serverurl);
                  
                  // Send HTTP GET request
                  int httpResponseCode = http.GET();
                  
                  if (httpResponseCode>0) {
                    Serial.print("HTTP Response code: ");
                    Serial.println(httpResponseCode);
                    String payload = http.getString();
                    Serial.println(payload);
                  }
                  else {
                    Serial.print("Error code: ");
                    Serial.println(httpResponseCode);
                  }
                  // Free resources
                  http.end();
                }
                else {
                  Serial.println("WiFi Disconnected");
                }
            //SENDE Temp_innen und Luftdruck ENDE##############################################################
  

  // Gib dem ESP8266 Zeit, die Nachricht zu senden, bevor er in den Deep-Sleep-Modus geht
  delay(2000);

  // ESP8266 in den Deep-Sleep-Modus versetzen
  // Die Zeit ist in Mikrosekunden angegeben
  // 1 Sekunde = 1.000.000 Mikrosekunden
  // In diesem Fall wird der ESP8266 alle 3 Stunden aufwachen
  
  ESP.deepSleep(10800e6);

}//Void loop Ende

i remove the sensor part, because the sensor works. there isn't any problem

So.... i try to deteect the failure

if i delete the deepSleep Mode line at the end, the wemos print all lines correct into the serial monitor.

If i USE the deepSleep code line, during the wemos is conntected to my pc, it works too (the bridge is not use)

BUT IF i connect D0 and RST and connect the wemos to my pc, i don't get any serial message.

/* For testing i use ESP.deepSleep(5000000); it should be 5seconds.

do you have any idea?
Thank you

check with

uint32_t deepSleepMaxSeconds = ESP.deepSleepMax() / 1000000; // returns an uint64_t see https://github.com/esp8266/Arduino/blob/master/cores/esp8266/Esp.cpp#L135

the true maximum for your ESP.
3h is alsready close the maximum I've seen so far.

See also some notes on deepsleep on my page - for example a template for longer intervals:
https://werner.rothschopf.net/microcontroller/202311_esp8266_deepsleep_en.htm

okay, i tested it with 0.5h.
that should be no problem, or?

do you know why i don't get a serial output, when i connect the esp to my pc (when the bridge is in use?)
thank you

test it - tell us.

btw.: read that link.

okay, i will test it. thank you!
the link is great!

i read abouzt a delay about 100 after deepsleep... don't know this

tested it
i got max. time about 220min....
it works at this moment.
i append the delay(100) after sleepdelay. It is a really good idea.

But the question is the same: why i can't use the serial monito, when i use the bridge from D0 to reset?

thank you a lot

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.