I made a easy project to measure temp and humidity basen on guide I found on intnernet, and I connected it to Blynk so I can read the values directly on my smartphone anytime - link
Basically I did the exactly same setup, only difference is that I did not use any capacitor.I have connected:
- battery 18650
- voltage regulator 7333
- ESP 8266-01 (with deepsleep, to measure every 5 mins)
My problem is that battery lasts only 21 days what is really sad for me. Based on project I linked I expected at least 2 months.
I did also current measurements and during measuring current was 80mA for a few seconds, in deepsleep 39uA
At the beginning the battery had 4,2V, then after 14 days 3,94V and after 20 days (from beginning) less then 1V.
Do you see any reason why it works only 3 weeks? Comparing to other project I expected much more. Any idea how I could extend the life for 2-3 months (but I want to keep size of the project as small as possible)
Thank you very much
@helpfinder did you modify the code written by @tzapulica to run with Blynk?
I used this code
> * Blynk is a platform with iOS and Android apps to control
> * Arduino, Raspberry Pi and the likes over the Internet.
> * You can easily build graphic interfaces for all your
> * projects by simply dragging and dropping widgets.
> * Downloads, docs, tutorials: http://www.blynk.cc
> * Blynk community: http://community.blynk.cc
> * Social networks: http://www.fb.com/blynkapp
> * http://twitter.com/blynk_app
> * Blynk library is licensed under MIT license
> * WARNING :
> * For this example you'll need SimpleTimer library:
> * https://github.com/jfturcot/SimpleTimer
> * Visit this page for more information:
> * http://playground.arduino.cc/Code/SimpleTimer
> * DHT22 ----gpio12
> #define BLYNK_PRINT Serial // Comment this out to disable prints and save space
> #include <ESP8266WiFi.h>
> #include <BlynkSimpleEsp8266.h>
> #include <SimpleTimer.h>
> #include <DHT.h>
> #define DHTPIN 12 //pin gpio 12 in sensor
> #define DHTTYPE DHT22 // DHT 22 Change this if you have a DHT11
> DHT dht(DHTPIN, DHTTYPE);
> // You should get Auth Token in the Blynk App.
> // Go to the Project Settings (nut icon).
> char auth = "xxxxx"; // Put your Auth Token here. (see Step 3 above)
> SimpleTimer timer;
> void setup()
> Serial.begin(9600); // See the connection status in Serial Monitor
> Blynk.begin(auth, "ssid", "pwd"); //insert here your SSID and password
> // Setup a function to be called every second
> timer.setInterval(1000L, sendUptime);
> void sendUptime()
> // You can send any value at any time.
> // Please don't send more that 10 values per second.
> //Read the Temp and Humidity from DHT
> float h = dht.readHumidity();
> float t = dht.readTemperature();
> Blynk.virtualWrite(12, t); // virtual pin
> Blynk.virtualWrite(13, h); // virtual pin
> void loop()
Are you sure it always went to sleep for 5 minutes because it’s recommended to have
delay(1000) after the deepSleep command.
It’s also possible that your battery isn’t as good as its supposed to be. Lots of very poor quality 18650’s coming out of China at the moment.
Regarding battery I bought - NCR18650B 3400mAh 3.7V 18650 Protected Li-ion Battery from GearBest - based on YouTube tests I have seen it seems to be solid piece (I did not test my particular piece for capacity, I do not have equipment for it)
Regarding deepsleep, always when I check the Blynk I was able see that after a few seconds of Online device went to Offline for 5 mins, so based on this observation I expect it really sleeps properly (what I am experiencing is that not after each measurement I can see measured values in Blynk app, but I assumed it´s maybe because value was not written/read properly before ESP went to sleep (maybe capacitor will solve this issue?))
The original project you linked to has an update saying that deep sleep didn’t work with the DHT22 and that a DS18B20 was used instead to enable deep sleep to work.
You say that you’re using a DHT22, so you may wish to try a DS18B20 instead.
Over discharging an 18650 can be dangerous if not just kill hte battery.
You should always use a TP4056 (version2) module which includes lipo charging, over and under voltage protection.
Good luck charging a lithium cell which is 1V .
@PeteKnight - I know I read it, but in the original project author mentioned DHT stopped after some time sending data, that was not my case, by sensor is sending data whole battery life (just some cycles are not writen, but after another wake up measured data are shown). So I expected I just do not have problem with this.
@Jamin - in the GB page I can see there should be Over-discharging Protection so I expected this is safe to use.
But still not clear for me why I have so short time battery lasts
Is there any calculator I can calculate theoretically how long the battery should live when I know the current and times of Online and deepsleep?
btw I had the same code, with the same DHT22 connected to 4xAA and ESP8266-12e dev board and it was working 30 days - disadvantage of this project was:
- too big and heavy because of 4 AA batteries (and also ESP8266-12E is much bigger than ESP8266-01)
- too many batteries to charge
but on other hand I did not used any regulator because 12E was caúable to work also with 5V input voltage w/o problems
You haven’t shown your wiring setup, however something to consider is that if you are powering the DHT22 directly, then it is effectively running 24/7, even when the ESP is in deep sleep… it may not take much power, but it all adds up.
@helpfinder GB state that over discharge kicks in at 2.5V, which is about right, but it’s obviously not working if it’s down to 1V.
The ESP-01 probably needs at least 2.5V to run, didn’t your system fail at the 2.5V level? Or did you not notice the device wasn’t providing data?
@Costas - I see in Blynk appl that ESP was last time online 20.9. but I was on vacation. When I came home (23.9.) I measured battery voltage below 1V
@Gunner - I am not aware DHT is powered constantly. Project is connected from battery to 7333 voltage regulator and from regulator to power ESP and DHT. Based on DHT22 data sheet I see current consumption 1-1,5 mA and because I measured 39uA I would expect DHT is not powered constantly
It does go into low power standby mode… MIN 40 uA (close enough that it is probably what you are measuring?)… so as I said, not a lot, but it all adds up.
I would recommend powering it up via a GPIO pin upon wakeup (1.5 mA shouldn’t put a strain on a GPIO), wait the prescribed amount of time to boot and get a good read, >2 seconds, then power down everything for a longer period of deapsleep time… 15-30 min?
@Gunner - by “get a good read, >2 seconds” you mean to put delay(2000) after deepsleep?
Is your system back up and running now?
Precisely how many seconds does it take from the MCU LED flash on bootup to the start of deepSleep().
Calcs can be way out, normally much shorter than expected, especially if the 18650’s are not “genuine”.
I mean give it sufficient time, after it wakes, to power up the DHT, get a “good read” of the data (possibly by reading and averaging a few seconds of input? - check the data sheet to determine optimum), sends the data to the server, then goes back to sleep.
I am unsure what having a delay after the sleep command is for, except perhaps as a buffer to keep the main loop from running whilst it nods off.
@Costas - not, it is not running. I can measure the time between led blinks and device is offline, but I am sure it is not longer than 20 secs
I will provide it as soon I measure it, for sure