deepSleep power consumption ~ 77mA
Posted: Sun May 17, 2020 10:34 am
Hello, I am using NodeMCU 12E esp 8266, I connect to Wifi, messure temperature on GPIO 2, send it to database and than I go to sleep with this command ESP.deepSleep(1200e6). And power consumption is always around 77mA and datashet said that consumption should be around 20 mikro Ampers. Please help.
The board goes to deep sleep for 20 minutes and wakes up, no problem, but power consumption in deepSleep is problem. Here is the code:
The board goes to deep sleep for 20 minutes and wakes up, no problem, but power consumption in deepSleep is problem. Here is the code:
Code: Select all
#include <OneWire.h>
#include <DallasTemperature.h>
#include "ESP8266WiFi.h"
#include <ESP8266HTTPClient.h>
#include <WiFiClient.h>
const char* ssid = "njka Local";
const char* password = "!3bNwjSf9";
const char* serverName = "http://controltemp.online/emmezeta/connect_dako.php";
String sensid = "dse1p2";
const int oneWireBus = 2;
OneWire oneWire(oneWireBus);
DallasTemperature sensors(&oneWire);
void setup() {
Serial.begin(115200);
WiFi.begin(ssid, password);
while (WiFi.status() != WL_CONNECTED)
{
delay(500);
Serial.print("*");
}
sensors.begin();
sensors.requestTemperatures();
float temperatureC = sensors.getTempCByIndex(0);
if(WiFi.status()== WL_CONNECTED){
HTTPClient http;
http.begin(serverName);
http.addHeader("Content-Type", "application/x-www-form-urlencoded");
String httpRequestData = "&sensid=" + sensid + "&temp1=" +
String(temperatureC) + "";
Serial.print("httpRequestData: ");
Serial.println(httpRequestData);
int httpResponseCode = http.POST(httpRequestData);
if (httpResponseCode>0) {
Serial.print("HTTP Response code: ");
Serial.println(httpResponseCode);
}
else {
Serial.print("Error code: ");
Serial.println(httpResponseCode);
}
// Free resources
http.end();
}
else {
Serial.println("WiFi Disconnected");
}
//Send an HTTP POST request every 20 minutes
ESP.deepSleep(1200e6, WAKE_RF_DEFAULT);
}
void loop() {
}