Why does using ESP8266 in deep sleep mode still drain the battery quickly?
I've made a "weather station" using the ESP8622. To save battery I'm using sleep mode but still the battery is drained after a couple of days. According to this post it should last at least a year.
I haven't done any measurements yet, wanted to know if there's something obvious that I've missed that could explain why the battery is drained so quickly? Attaching code and an image showing the hardware setup.
#include "DHT.h"
#include <ESP8266WiFi.h>
#include <ESP8266HTTPClient.h>
#define DHTPIN D2
#define DHTTYPE DHT22
DHT dht(DHTPIN, DHTTYPE);
const char* ssid = "xxxx";
const char* password = "xxxx";
const char* host = "xxxx";
void setup() {
Serial.begin(115200);
dht.begin();
delay(10);
Serial.print("Connecting to ");
Serial.println(ssid);
WiFi.mode(WIFI_STA);
WiFi.begin(ssid, password);
while (WiFi.status() != WL_CONNECTED) {
delay(500);
Serial.print(".");
}
readSensorsAndPost();
ESP.deepSleep(18e8); //30 minutes
}
void readSensorsAndPost() {
float h = dht.readHumidity();
float t = dht.readTemperature();
if (isnan(h) || isnan(t)) {
Serial.println("Failed to read from DHT sensor!");
return;
}
char charVal[10];
dtostrf(t, 5, 2, charVal);
makeAnHttpRequest(charVal);
}
bool makeAnHttpRequest(String msg) {
//send the value
}
void loop() {
}
esp8266 battery sleep
add a comment |
I've made a "weather station" using the ESP8622. To save battery I'm using sleep mode but still the battery is drained after a couple of days. According to this post it should last at least a year.
I haven't done any measurements yet, wanted to know if there's something obvious that I've missed that could explain why the battery is drained so quickly? Attaching code and an image showing the hardware setup.
#include "DHT.h"
#include <ESP8266WiFi.h>
#include <ESP8266HTTPClient.h>
#define DHTPIN D2
#define DHTTYPE DHT22
DHT dht(DHTPIN, DHTTYPE);
const char* ssid = "xxxx";
const char* password = "xxxx";
const char* host = "xxxx";
void setup() {
Serial.begin(115200);
dht.begin();
delay(10);
Serial.print("Connecting to ");
Serial.println(ssid);
WiFi.mode(WIFI_STA);
WiFi.begin(ssid, password);
while (WiFi.status() != WL_CONNECTED) {
delay(500);
Serial.print(".");
}
readSensorsAndPost();
ESP.deepSleep(18e8); //30 minutes
}
void readSensorsAndPost() {
float h = dht.readHumidity();
float t = dht.readTemperature();
if (isnan(h) || isnan(t)) {
Serial.println("Failed to read from DHT sensor!");
return;
}
char charVal[10];
dtostrf(t, 5, 2, charVal);
makeAnHttpRequest(charVal);
}
bool makeAnHttpRequest(String msg) {
//send the value
}
void loop() {
}
esp8266 battery sleep
First do measurments
– SilvioCro
Dec 16 '18 at 17:02
add a comment |
I've made a "weather station" using the ESP8622. To save battery I'm using sleep mode but still the battery is drained after a couple of days. According to this post it should last at least a year.
I haven't done any measurements yet, wanted to know if there's something obvious that I've missed that could explain why the battery is drained so quickly? Attaching code and an image showing the hardware setup.
#include "DHT.h"
#include <ESP8266WiFi.h>
#include <ESP8266HTTPClient.h>
#define DHTPIN D2
#define DHTTYPE DHT22
DHT dht(DHTPIN, DHTTYPE);
const char* ssid = "xxxx";
const char* password = "xxxx";
const char* host = "xxxx";
void setup() {
Serial.begin(115200);
dht.begin();
delay(10);
Serial.print("Connecting to ");
Serial.println(ssid);
WiFi.mode(WIFI_STA);
WiFi.begin(ssid, password);
while (WiFi.status() != WL_CONNECTED) {
delay(500);
Serial.print(".");
}
readSensorsAndPost();
ESP.deepSleep(18e8); //30 minutes
}
void readSensorsAndPost() {
float h = dht.readHumidity();
float t = dht.readTemperature();
if (isnan(h) || isnan(t)) {
Serial.println("Failed to read from DHT sensor!");
return;
}
char charVal[10];
dtostrf(t, 5, 2, charVal);
makeAnHttpRequest(charVal);
}
bool makeAnHttpRequest(String msg) {
//send the value
}
void loop() {
}
esp8266 battery sleep
I've made a "weather station" using the ESP8622. To save battery I'm using sleep mode but still the battery is drained after a couple of days. According to this post it should last at least a year.
I haven't done any measurements yet, wanted to know if there's something obvious that I've missed that could explain why the battery is drained so quickly? Attaching code and an image showing the hardware setup.
#include "DHT.h"
#include <ESP8266WiFi.h>
#include <ESP8266HTTPClient.h>
#define DHTPIN D2
#define DHTTYPE DHT22
DHT dht(DHTPIN, DHTTYPE);
const char* ssid = "xxxx";
const char* password = "xxxx";
const char* host = "xxxx";
void setup() {
Serial.begin(115200);
dht.begin();
delay(10);
Serial.print("Connecting to ");
Serial.println(ssid);
WiFi.mode(WIFI_STA);
WiFi.begin(ssid, password);
while (WiFi.status() != WL_CONNECTED) {
delay(500);
Serial.print(".");
}
readSensorsAndPost();
ESP.deepSleep(18e8); //30 minutes
}
void readSensorsAndPost() {
float h = dht.readHumidity();
float t = dht.readTemperature();
if (isnan(h) || isnan(t)) {
Serial.println("Failed to read from DHT sensor!");
return;
}
char charVal[10];
dtostrf(t, 5, 2, charVal);
makeAnHttpRequest(charVal);
}
bool makeAnHttpRequest(String msg) {
//send the value
}
void loop() {
}
esp8266 battery sleep
esp8266 battery sleep
asked Dec 15 '18 at 13:16
ChristianChristian
1162
1162
First do measurments
– SilvioCro
Dec 16 '18 at 17:02
add a comment |
First do measurments
– SilvioCro
Dec 16 '18 at 17:02
First do measurments
– SilvioCro
Dec 16 '18 at 17:02
First do measurments
– SilvioCro
Dec 16 '18 at 17:02
add a comment |
1 Answer
1
active
oldest
votes
The example shows a Sparkfun Thing, which the article notes doesn't have extra peripherals. What you show is something different, like a NodeMCU dev board, which typically has a linear regulator, possibly a power LED (which the article notes can be removed).
I see you're using a DHT11 or DHT22, which has a pull-up resistor. The pull-up resistor is constantly using power. Instead of connecting the pull-up to the power rail, you can connect it to a GPIO pin and pull that pin LOW before you go into sleep, which effectively disables the sensor and stops it from drawing power just to keep the data line high.
Safe to say that somewhere there is something drawing power -- have you measured the actual current draw in deep-sleep, or are you only noting that your batteries run low sooner than expected?
I haven't done any measurements yet but when I have I will post the result. Will also change the setup as per your suggestion.
– Christian
Dec 15 '18 at 14:30
2
You are also powering the USB interface chip, which never goes to sleep.
– Majenko♦
Dec 15 '18 at 17:20
@Majenko is there an easy way to disable powering the USB interface chip?
– Christian
Dec 16 '18 at 8:27
Migrate to a standalone module without all the extra junk and use an external USB adapter.
– Majenko♦
Dec 16 '18 at 8:58
add a comment |
Your Answer
StackExchange.ifUsing("editor", function () {
return StackExchange.using("schematics", function () {
StackExchange.schematics.init();
});
}, "cicuitlab");
StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "540"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});
function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: false,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: null,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});
}
});
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2farduino.stackexchange.com%2fquestions%2f58779%2fwhy-does-using-esp8266-in-deep-sleep-mode-still-drain-the-battery-quickly%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
The example shows a Sparkfun Thing, which the article notes doesn't have extra peripherals. What you show is something different, like a NodeMCU dev board, which typically has a linear regulator, possibly a power LED (which the article notes can be removed).
I see you're using a DHT11 or DHT22, which has a pull-up resistor. The pull-up resistor is constantly using power. Instead of connecting the pull-up to the power rail, you can connect it to a GPIO pin and pull that pin LOW before you go into sleep, which effectively disables the sensor and stops it from drawing power just to keep the data line high.
Safe to say that somewhere there is something drawing power -- have you measured the actual current draw in deep-sleep, or are you only noting that your batteries run low sooner than expected?
I haven't done any measurements yet but when I have I will post the result. Will also change the setup as per your suggestion.
– Christian
Dec 15 '18 at 14:30
2
You are also powering the USB interface chip, which never goes to sleep.
– Majenko♦
Dec 15 '18 at 17:20
@Majenko is there an easy way to disable powering the USB interface chip?
– Christian
Dec 16 '18 at 8:27
Migrate to a standalone module without all the extra junk and use an external USB adapter.
– Majenko♦
Dec 16 '18 at 8:58
add a comment |
The example shows a Sparkfun Thing, which the article notes doesn't have extra peripherals. What you show is something different, like a NodeMCU dev board, which typically has a linear regulator, possibly a power LED (which the article notes can be removed).
I see you're using a DHT11 or DHT22, which has a pull-up resistor. The pull-up resistor is constantly using power. Instead of connecting the pull-up to the power rail, you can connect it to a GPIO pin and pull that pin LOW before you go into sleep, which effectively disables the sensor and stops it from drawing power just to keep the data line high.
Safe to say that somewhere there is something drawing power -- have you measured the actual current draw in deep-sleep, or are you only noting that your batteries run low sooner than expected?
I haven't done any measurements yet but when I have I will post the result. Will also change the setup as per your suggestion.
– Christian
Dec 15 '18 at 14:30
2
You are also powering the USB interface chip, which never goes to sleep.
– Majenko♦
Dec 15 '18 at 17:20
@Majenko is there an easy way to disable powering the USB interface chip?
– Christian
Dec 16 '18 at 8:27
Migrate to a standalone module without all the extra junk and use an external USB adapter.
– Majenko♦
Dec 16 '18 at 8:58
add a comment |
The example shows a Sparkfun Thing, which the article notes doesn't have extra peripherals. What you show is something different, like a NodeMCU dev board, which typically has a linear regulator, possibly a power LED (which the article notes can be removed).
I see you're using a DHT11 or DHT22, which has a pull-up resistor. The pull-up resistor is constantly using power. Instead of connecting the pull-up to the power rail, you can connect it to a GPIO pin and pull that pin LOW before you go into sleep, which effectively disables the sensor and stops it from drawing power just to keep the data line high.
Safe to say that somewhere there is something drawing power -- have you measured the actual current draw in deep-sleep, or are you only noting that your batteries run low sooner than expected?
The example shows a Sparkfun Thing, which the article notes doesn't have extra peripherals. What you show is something different, like a NodeMCU dev board, which typically has a linear regulator, possibly a power LED (which the article notes can be removed).
I see you're using a DHT11 or DHT22, which has a pull-up resistor. The pull-up resistor is constantly using power. Instead of connecting the pull-up to the power rail, you can connect it to a GPIO pin and pull that pin LOW before you go into sleep, which effectively disables the sensor and stops it from drawing power just to keep the data line high.
Safe to say that somewhere there is something drawing power -- have you measured the actual current draw in deep-sleep, or are you only noting that your batteries run low sooner than expected?
answered Dec 15 '18 at 14:06
jose can u cjose can u c
5,7952724
5,7952724
I haven't done any measurements yet but when I have I will post the result. Will also change the setup as per your suggestion.
– Christian
Dec 15 '18 at 14:30
2
You are also powering the USB interface chip, which never goes to sleep.
– Majenko♦
Dec 15 '18 at 17:20
@Majenko is there an easy way to disable powering the USB interface chip?
– Christian
Dec 16 '18 at 8:27
Migrate to a standalone module without all the extra junk and use an external USB adapter.
– Majenko♦
Dec 16 '18 at 8:58
add a comment |
I haven't done any measurements yet but when I have I will post the result. Will also change the setup as per your suggestion.
– Christian
Dec 15 '18 at 14:30
2
You are also powering the USB interface chip, which never goes to sleep.
– Majenko♦
Dec 15 '18 at 17:20
@Majenko is there an easy way to disable powering the USB interface chip?
– Christian
Dec 16 '18 at 8:27
Migrate to a standalone module without all the extra junk and use an external USB adapter.
– Majenko♦
Dec 16 '18 at 8:58
I haven't done any measurements yet but when I have I will post the result. Will also change the setup as per your suggestion.
– Christian
Dec 15 '18 at 14:30
I haven't done any measurements yet but when I have I will post the result. Will also change the setup as per your suggestion.
– Christian
Dec 15 '18 at 14:30
2
2
You are also powering the USB interface chip, which never goes to sleep.
– Majenko♦
Dec 15 '18 at 17:20
You are also powering the USB interface chip, which never goes to sleep.
– Majenko♦
Dec 15 '18 at 17:20
@Majenko is there an easy way to disable powering the USB interface chip?
– Christian
Dec 16 '18 at 8:27
@Majenko is there an easy way to disable powering the USB interface chip?
– Christian
Dec 16 '18 at 8:27
Migrate to a standalone module without all the extra junk and use an external USB adapter.
– Majenko♦
Dec 16 '18 at 8:58
Migrate to a standalone module without all the extra junk and use an external USB adapter.
– Majenko♦
Dec 16 '18 at 8:58
add a comment |
Thanks for contributing an answer to Arduino Stack Exchange!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2farduino.stackexchange.com%2fquestions%2f58779%2fwhy-does-using-esp8266-in-deep-sleep-mode-still-drain-the-battery-quickly%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
First do measurments
– SilvioCro
Dec 16 '18 at 17:02