I connected nodemcu with batteries and uploaded a code which sends http post request every 10 min and goes to deep sleep. But after 2 hours node mcu stops sending the data. Voltage regulator used is LD33V

Used AA batteries.

Battery level when stopped working was 2.5V.(Do not know why the power consumption was high though we used deepsleep mode).

#include <ESP8266WiFi.h>
#include <WiFiClientSecure.h>
#include <ESP8266HTTPClient.h>
long duration, distance;

char* ssid = "****";
char* password = "******";
void connectWiFi() {
  WiFi.begin(ssid, password);
  while (WiFi.status() != WL_CONNECTED) {
    WiFi.begin(ssid, password);
    delay(5000);
  }
}

void setup() {
    Serial.begin(115200);
    WiFi.mode(WIFI_STA);
    connectWiFi();
    WiFiClientSecure client;
    distance = 4;
    String data = " {\"value\":"+String(distance)+"}";
    if(client.connect("********.com",443)){
    client.println("POST /****/**** HTTP/1.1");
    client.println("Host:********.com");
    client.println("Content-Type:application/json");
    client.println("x-apikey:******************");
    client.print("Content-Length: ");
    client.println(data.length());
    client.println("");
    client.println(data);
    }
    delay(1000);
    ESP.deepSleep(600000000);
}

void loop() {

}

Your 'question' implies several possible questions, but contains none. You need to clarify what main point you wish to ask about.

You need to provide enough information to allow us to understand your design, and enough information about measurements that you (should) have made that will allow you and us to understand what is happening.

Saying "Used AA batteries" is similar to you saying "some 4 seater cars" or "some short people" and then you asking us for performance and resource information about them. AA is a size - that's a start. What chemistry (Alkaline, Nimh, ...) what brand and model and mAh capacity? Please provide a data sheet or at least enough specifications to allow battery capability to be determined.

VERY importantly, how many batteries?

A 3V3 LDO regulator requires more than 3V3 input at all times.
So you need >= 4 x NimH or Alkaline AA cells.

If using AA Alkaline batteries. Battery capacity is say 3000 mAh. Initial voltage is 1.6V, falling rapidly to 1.5V, then more slowly to an exhausted voltage of 1V then very rapidly to 0.9V. So -

If 2 x AA alkaline are used then Vcell = 2.25V when Vbattery = 2.5V. Cells have some capacity remaining. Regulator is supplied with well under Vin_min.
To ensure proper regulator action for the whole of the battery capacity with a 3V3 Vout regulator then at least 4 x AA Alkaline cells are needed.
Vbattery_new = 4 x 1.6V+ = 6.4V+.
This rapidly drops to 4 x 1.5V = 6V then more slowly to 4 x 0.9V = 3.6V.
At that stage the battery is fully exhausted BUT the regulator has had enough voltage throughout to supply 3.3V to the system.
At the 2 hour rate a 3000 mAh cell may provide say 2000 - 2500 mAh.
To exhaust such a battery in 2 hours requires an average current of about 1000 to 1250 mA. This is far higher than you would expect the NodeMCU to draw on average when operated as you indicate it is.

You say:

The issue was I was using ld33cv for voltage regulation which took 5ma quiescent current

5 mA x 2 hours = 10 mA-hours = under 1% of AA battery capacity (Alkaline or Nimh). That is NOT the reason for the problem that you described.


These - and many similar videos - may be of assistance.

12 minute video Power Saving with ESP8266 (Sleep Mode) Tutorial with some Tricks

9 minute video tutorial How to use the RTC Memory in ESP8266 and reduce power consumption by factor of 10

This video suggests a modification may be required to enable deep sleep.

  • The issue was I was using ld33cv for voltage regulation which took 5ma quiescent current – A C Sreedhar Reddy Aug 4 at 14:04
  • @ACSreedharReddy 5 mA will not "flatten" and sensible AA based battery. That is NOT the reason for the problem that you described. If changing the regulator to another type fixed the problem then it was either faulty or connected incorrectly. – Russell McMahon Aug 4 at 14:24
up vote 3 down vote accepted

LD33CV quiescent current is 5mA. This is the problem because even in deep sleep mode voltage regulator consumes power.

Your Answer

 

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Not the answer you're looking for? Browse other questions tagged or ask your own question.