-->
Page 1 of 3

Battery optimisations

PostPosted: Thu Sep 05, 2019 8:50 am
by SenneS
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!

Re: Battery optimisations

PostPosted: Fri Sep 06, 2019 4:34 am
by schufti
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.

Re: Battery optimisations

PostPosted: Fri Sep 06, 2019 5:23 am
by btidey
Possible schematic is
https://cdn.sparkfun.com/datasheets/Wir ... _Thing.pdf

I don't think there is a USB serial, but the power LED looks pretty hungry (~8mA). However, if 2000maH only lasts 2 days then average draw ids 40mA so something else must be going on.

Re: Battery optimisations

PostPosted: Wed Sep 11, 2019 2:38 pm
by SenneS
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.