Deep Sleep
Posted: Thu Apr 18, 2019 5:35 pm
Hi,
I am trying to use Deep Sleep on my Wemos D1 Mini in order to be able to use it with batteries. I found many sources online that say the same thing pretty much:
1. Connect D0 and RST with a jumper wire
2. Use the following code:
ESP.deepSleep(5000000);
delay(100);
I have done this exactly. When I run the code, it seems the board does go to sleep for 5s in my case, and wakes up once. It does not wake up after one cycle. Also, I get jibberish on my Serial monitor when it wakes up.
Any help would be greatly appreciated!
If it helps, here is my code:
I am trying to use Deep Sleep on my Wemos D1 Mini in order to be able to use it with batteries. I found many sources online that say the same thing pretty much:
1. Connect D0 and RST with a jumper wire
2. Use the following code:
ESP.deepSleep(5000000);
delay(100);
I have done this exactly. When I run the code, it seems the board does go to sleep for 5s in my case, and wakes up once. It does not wake up after one cycle. Also, I get jibberish on my Serial monitor when it wakes up.
Any help would be greatly appreciated!
If it helps, here is my code:
Code: Select all
#define BLYNK_PRINT Serial
#include <ESP8266WiFi.h>
#include <BlynkSimpleEsp8266.h>
#include "DHT.h"
#include <SimpleTimer.h>
#define DHTTYPE DHT11
#define dht_dpin D6
DHT dht(dht_dpin, DHTTYPE);
SimpleTimer timer;
char auth[] = "xxxx";
char ssid[] = "xxxx";
char pass[] = "xxxx";
float t;
float h;
void setup()
{
Serial.begin(9600);
pinMode(D0, OUTPUT);
Blynk.begin(auth, ssid, pass);
dht.begin();
//timer.setInterval(2000, sendUptime);
}
void loop()
{
Blynk.run();
//timer.run();
float h = dht.readHumidity();
float t = dht.readTemperature();
// Check if any reads failed and exit early (to try again).
if (isnan(h) || isnan(t)) {
Serial.println("Failed to read from DHT sensor!");
return;
}
Serial.print("Current humidity = ");
Serial.print(h);
Serial.print("% ");
Serial.print("temperature = ");
Serial.print(t);
Blynk.virtualWrite(V0, t);
Blynk.virtualWrite(V1, h);
ESP.deepSleep(5000000);
delay(100);
}
void sendUptime()
{
}