1

Kind of desperate here. I tried every solution found on this forum / google and others. My sketch works perfectly with a NodeMCU 1.0 The same script should work on a Lolin Mini D1, everything works except the wake up after deep sleep. Wiring is clearly identical.

That pinMode(D0, WAKEUP_PULLUP) is the latest addition, found in a post here. Nothing changed.

The program reads the values from a sensor and then goes to sleep. Changing the sleep mode does not chenge the results. In ESP.deepSleep I tried every possible value I found around. No luck.

After the 15 seconds the built led flashes, something weird appears in the serial monitor, and then the only solution is the reset button.

I even thought it was bad soldering, so I tested the RST with an external pushbutton and the D0 with a led. Electrically it's allright. If I press the external pushbutton (NOT the builtin) the D1 mini resets. Last, I've put a resistor between D0 and RST, which helps with the frequent flashing, but did not solve.

Any help super appreciated.

Edit after some of the comments below (thank you all). Set the baud rate to 74880 and here's the result At second 02 I pressed manually the reset button. At second 19 the board wakes, but the program does not restart

17:12:02.002 -> ets Jan 8 2013,rst cause:2, boot mode:(3,6)
17:12:02.002 -> load 0x4010f000, len 3424, room 16 
17:12:02.045 -> tail 0
17:12:02.045 -> chksum 0x2e
17:12:02.045 -> load 0x3fff20b8, len 40, room 8 
17:12:02.045 -> tail 0
17:12:02.045 -> chksum 0x2b
17:12:02.045 -> csum 0x2b
17:12:02.045 -> v000421a0
17:12:02.045 -> ~ld
17:12:02.088 -> rf cal sector: 1020
17:12:02.089 -> freq trace enable 0
17:12:02.135 -> rf[112] : 0�xx
17:12:02.135 -> Wating some moments before going to sleep
17:12:04.099 -> Now going to sleep for 15000000 microseconds
17:12:19.009 -> ets Jan 8 2013,rst cause:2, boot mode:(3,6)

enter image description here

#define LED D4 // built in led on board
#define RED_LED D2
#define WHITE_LED D1
#define DHTPIN D7 // Digital pin connected to the DHT sensor 
#define DHTTYPE DHT22 // DHT 22 (AM2302)
#include <ESP8266WiFi.h>
#include <ESP8266HTTPClient.h>
#include <WiFiClient.h>
#include <DHT.h> 
#include <DHT_U.h>
// WiFi parameters to be configured
const char* ssid = "hfghjfjfghj"; // Write here your router's username
const char* password = "fghjfghjf"; // Write here your router's passward
DHT dht(DHTPIN, DHTTYPE);
void setup(void)
{ 
 pinMode(LED, OUTPUT); // LED pin as output.
 pinMode(RED_LED, OUTPUT); // LED pin as output.
 pinMode(WHITE_LED, OUTPUT); // LED pin as output.
 pinMode(D0, WAKEUP_PULLUP); // doesn't change anything
 
 Serial.begin(115200); // or 9600
 while(!Serial) {}
 Serial.println("xx"); // this starts a new line in the console after all the rubbish during the connection
 Serial.println("Connecting to WiFi");
 // Connect to WiFi
 digitalWrite(RED_LED, LOW);
 digitalWrite(WHITE_LED, LOW);
 digitalWrite(LED, HIGH); // this actually switches OFF
 
 WiFi.begin(ssid, password);
 // while wifi not connected yet, print '.'
 int k = 0;
 while (WiFi.status() != WL_CONNECTED) {
 digitalWrite(LED, HIGH);
 delay(100);
 digitalWrite(LED, LOW);
 delay(100);
 }
 
 // Print the IP address
 Serial.println(WiFi.localIP());
 
 dht.begin();
}
void go_to_sleep(float minutes) {
 blink_times(LED,5,30);
 Serial.print("Now going to sleep for ");
 long msecs = minutes * 60 * 1000 * 1000;
 Serial.print(msecs);
 Serial.println(" microseconds");
 ESP.deepSleep(msecs, WAKE_RF_DEFAULT); // or WAKE_RF_DISABLED, doesn't work either
}
void loop() {
 Serial.println("Main loop");
 delay(2000); // Wait a few seconds between measurements
 float humidity = dht.readHumidity(); 
 float temperature = dht.readTemperature(); 
 if (isnan(humidity) || isnan(temperature)) { 
 Serial.println("Failed to read from DHT sensor!"); 
 return; 
 } 
 Serial.print("Humidity: "); 
 Serial.print(humidity); 
 Serial.print(" %\t"); 
 Serial.print("Temperature: "); 
 Serial.print(temperature); 
 Serial.println(" *C");
 go_to_sleep(0.25);
}
asked Nov 1, 2024 at 21:07
7
  • the pull-up resistor maybe too strong Commented Nov 2, 2024 at 5:30
  • not an electronic expert, so I tried two that normally come with builder kits. It does not work even with a direct wire. Actually I found on various forums, my exact problem, unsolved mostly. People suggesting: * resistor * led * adding delay(2000) after deepSleep * changing the wake up mode (I tried all the available values) * adding pinMode(D0, WAKEUP_PULLUP) None of these have worked. I'm starting to think the board is simply defective Commented Nov 2, 2024 at 10:21
  • the reset pin has a pull-up resistor on "Wemos D1 mini". that one maybe too strong for the io 16 to pull it down Commented Nov 2, 2024 at 10:25
  • On a further note, after having spent hours searchign the web, it seems that the garbage is normal. Data sent at a different baudrate when the board starts. So the first line is when I power it, the second after the wake. So it does wake, only the program does not restart (this even in my stripped version, with an empty loop() Commented Nov 2, 2024 at 10:29
  • Do you have the same problem when you use a much simpler test setup like the one described in this tutorial: randomnerdtutorials.com/esp8266-deep-sleep-with-arduino-ide ? Note that there is a timeout on the serial connection so it does not block permanently if serial is unavailable at wakeup. Commented Nov 2, 2024 at 15:19

0

Know someone who can answer? Share a link to this question via email, Twitter, or Facebook.

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

By clicking "Post Your Answer", you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.