ESP8266 Wi-Fi Module Battery to Use

Hi everyone. I am creating my project on asset tracing using wifi modules. The projects include the wifi module and the power supply only. Right now I am using 2- 18650 batteries and a battery shield. So, I power the module directly using a cable. The program uploaded to the wifi module, just collects Access Points nearby and then send it to a server. 1 Wifi module has delay of 30 mins, while another one is in deep sleep mode for 30 minutes

I already tried running down the ESP8266 module. But there are no differences on the voltage drop and run time of the two modules. Actually, the normal mode run for about 58 hours while the one in deep sleep mode run for only 53 hours.

I just want to get idea on what battery will provide me longer run time for my ESP8266 wifi module.

Your suggestions will be of great help. Thank you!

Hey @kayamoyanself!
A five hour difference is a good start. Can you post a schematic? What exact modules are you using? Why does it need to run longer than 2 1/2 days? Can you post your code (in code tags as per the forum rules)?

Hey there! Honestly, I do not have any circuit. Simply, the ESP8266 module connected to the battery shield using a cable. I am using ESP8266 NodeMCU v3 module (the generic one).

I need to at least lengthen the battery life up to 7 days or more. I have been reading posts and other projects in the net and some of those went up to 3 months to 1 year battery life. The code I used is just a copy paste from the internet. The link below is my reference.

[SOLVED] Reconnect ESP8266 NodeMCU to Wi-Fi Network After Lost Connection | Random Nerd Tutorials

dfsdsd

1 Like

You may be able to get it to a maximum of 18 days. What milliamps are each battery that you have?
How frequently must it connect to the WiFi, or must it be on 24/7?
Does the ESP have a LED that is on all the time (a power LED)?
The maximum you can make it run for is 2 years and nine months, providing you have high powered 18650 batteries, an the ESP is in deep sleep.

Something like this would be ideal for maximum life between charges:

Also, is this feild equipment or something? If it will be just sitting aroung your house, you'd be better off having a "bypass" charger like this:

which can charge your battery and power the Arduino at the same time. Than the batterry will act as a minature powerbank in case of power failure.

Another option would be having a small solar panel.

This is the battery and the battery holder I tested with my Wi-Fi module.
18650 3.6V 2850mAH Rechargeable Li-ion batt

dfsdsd
Capture.PNGsdsada

The current program is looped continuously with 30minutes delay for each loop (scan neraby wifi, connect to the wifi and send data to the server over wifi). There are no LEDs.

I already tried deep sleep, but it discharged my battery same as the one with no deep sleep. How can I make it work like it saves my battery charge?

1 Like

Wasn't there a five hour difference? What kind of deep sleep did you perform? Can you share your code?

The one with NO deep sleep lasted longer than the one with deep sleep. I don't know what's happening with the battery when connected to wifi module with deep sleep, but deep sleep is working fine. I'll post my code. Let me just get it from my other pc

1 Like

Can you also send a link to that battery charger? Something about it looks odd from that photo.

One thing you forgot in that code was the Serial timeout.

#include <Arduino.h>
#include <ESP8266WiFi.h> 
#include <ESP8266WebServer.h>
#include <ESP8266HTTPClient.h>

// Replace with your network credentials
const char* ssid     = "SWLAN_L";
const char* password = "";

// Set web server port number to 80
HTTPClient http;    //Declare object of class HTTPClient
WiFiClient client;

IPAddress firstGateway;

IPAddress local_IP(XXX, XXX, XXX, XXX);
IPAddress gateway(XXX, XXX, XXX, X`Preformatted text`);
IPAddress subnet(255, 255, 255, 0);
IPAddress primaryDNS(8, 8, 8, 8);   //optional
IPAddress secondaryDNS(8, 8, 4, 4); //optional

void setup() 
{
  Serial.begin(115200);

  WiFi.mode(WIFI_STA);
  // Configures static IP address
  if (!WiFi.config(local_IP, gateway, subnet, primaryDNS, secondaryDNS)) 
  {
    Serial.println("STA Failed to configure");
  }
  else
  { 
    Serial.print("IP Set");
  }
  
}

void loop() 
{
  //delay(1800000);
  delay(500);
  int n = WiFi.scanNetworks();
  
  if (n == 0) 
  {
    Serial.println("no networks found");
  } 
  else 
  {
    Serial.print(n);
    Serial.println(" networks found");

    for (int i = 0; i < n; ++i) 
    {
      
      if (WiFi.SSID(i) == "SWLAN_L" || WiFi.SSID(i) == "SWLAN_ESP")
      {
        //IF conditions to arrange signal strength 1st 2nd 3rd etc
      }
    }

    WiFi.begin(ssid, password);
    while (WiFi.status() != WL_CONNECTED) 
    {
      delay(500);
      Serial.print(".");
    }
  
    if(WiFi.status() == WL_CONNECTED)
    { 
      Serial.println("");
      Serial.print("Connected to");
      Serial.print(" ");
      Serial.println(ssid);
    }

   //sending data to server codes

    }   
    WiFi.disconnect();

    Serial.println("");
    Serial.println("-----------------------------------------bye----------------------------------------------------");
    Serial.println("");

    Serial.println("SLEEPING");
    ESP.deepSleep(1800e6);
    
}

int dBmValue (int dBm)
{
  int quality;
  quality = 2 * (dBm + 100);
  return quality;
}

What part should I put it?

You need the serial timeout in there.
image

Two things:
Can you post a link for the battery charger
Can you tell me exactly how many mA the ESP draws when it is in deepsleep

@kayamoyanself

It sounds like your ESP is drawing approximately 100mA.

If you really want to get good battery life then you would be much better off with a plain esp8266 module that doesn't have all the other stuff on the board that also uses power, like the FTDI chip, LEDs, voltage regulator, etc.

Like this...

Esp8266 Esp32 Dual 18650 Lithium Battery Shield V8 5v 2.2a 3v 1a Mobile Power Bank Battery Charging Module Micro Usb For Arduino - Integrated Circuits - AliExpress

I haven't measured the current draw

thank you for this. Will add it on my code