Your new topic does not fit any of the above??? Check first. Then post here. Thanks.

Moderator: igrr

User avatar
By SenneS
#83672 Hi,

I've read alot about deep sleep and powersavings and tried many optimalisations to my code but my battery still lasts only for a day of 2.

I have a Sparkfun Thing powered by a Li-Po Accu 3.7V 2000mAh. There are only 2 DS18B20 onewire temperature sensors connected.
It connects every 5min to my wifi connects to a MQTT broker sends the new values and goes in to deep sleep. When I read about deep sleep and powersavings they all say it should last for weeks but I'm only getting 2 days (3days max).

Here's the code I've written https://gist.github.com/Sennevds/b2ab91 ... 0b4f67a40c
Hopefully someone can help me to optimize this!
User avatar
By schufti
#83680 if it is going into deep sleep (gpio16 high) the sketch should be ok.
Sometimes a delay(100) after the ESP.deepsleep() is needed.

With DS18B20s and the battery it would be helpful to see some schematic ...
e.g if the USB-serial converter is powered all the time, the battery drainage would be immense.
User avatar
By SenneS
#83759 sorry for the late response was a busy weekend.
It hasn't have a usb serial so that's no problem.
The weird thing is I changed a part of the sketch to remember the wifi channel and mac and write that to the internal memory(I read somewhere it stops a part of the wifi scanning) but since then I only get 2 days. Before this I got something around the 3 a 4 days.

I know of the led and i'm going to disable that. But still if you read about the esp8266 and deepsleep you find that people can power it for weeks when I only get to power it for under a week.