What is wrong with my project? (battery not lasting as long as expected)

I think I was having a blonde moment when I wrote that because Blynk indicates the 10s I was looking for doesn’t include a X3 multiplier in the libraires.

There is though a library hack for faster connections. I’ll see if I can find it but the text of the thread referred to “5 seconds” from memory.

Here you go Blynk takes 3-4 seconds to connect to server

Hmmm … so what I did right now is I found where this values is. I found:
c:\Users\admin\Documents\Arduino\libraries\blynk-library-master\src\Blynk\BlynkProtocol.h
and I changed 5000UL to 10000UL, now the mentioned code part looks like:

#ifdef BLYNK_USE_DIRECT_CONNECT
        if (!tconn)
            conn.connect();
#else
        if (tconn && (t - lastLogin > BLYNK_TIMEOUT_MS)) {
            BLYNK_LOG1(BLYNK_F("Login timeout"));
            conn.disconnect();
            state = CONNECTING;
            return false;
        } else if (!tconn && (t - lastLogin > 10000UL)) {
            conn.disconnect();
            if (!conn.connect()) {
                lastLogin = t;
                return false;
            }

after this change I updatet the ESP code again to the dev board but still it seems connection time is the same. Around 6 secs from reboot and most waiting time is between “blynk picture” and [5001] connecting …
Does this hack works also when connecting to the Blynk cloud? Because in the refered topic I have seen a lot about home blynk server (what is not my case)

OMG, now I see I have one additional zero probably here. I am going to test with 1000 instead of 10000UL

\ OK, I am on 3 seconds now :heart_eyes::heart_eyes:

1 Like

I spotted it straight away. Blynk server is cloud unless the term “local” is mentioned.

Much better but still seems high.
Paste Serial Monitor.

you mean to paste what I see int he Serial monitor?

I cannot copy/paste, so just attaching printscreen

OK so the 3 seconds you referred to includes reading the temperature sensor. Not too bad. You should be able to cut another 500ms by dropping the 1000L library hack to 500L. From memory you can’t go much below this.

You should also upgrade to the latest Blynk version, 0.4.8, and then do the hack again.

Yes, I referenced 3 seconds to total time from reboot to 1st reading. Sounds great to me.
not sure if there is chance to save a few miliseconds by removing something from the code, but anyway there is a huge improvement (but we will see what will be the real battery lasting :slight_smile: )
I will try with 500UL as well.
So another task for me is to prepare small board with this sensor and try to solder tiny wire to ESP8266-01 to allow deepsleep - that will be again challenging :slight_smile:

Btw will be the connection faster in case I build my own Blynk server on Raspberry home? Maybe in the future I can imagine I will build also this setup with own Blynk. So no data outside the LAN (I am not sure if in case of home Blynk server I am paying for widgets or not)

It will be a little faster with a local server but it doesn’t make a huge difference.

You allocate the Energy yourself on a local server.

many thanks all there participating, especiall Costas.
I will keed you updated what progress I did and how long I was able to power the project on the one battery charge

hello!

i’m glad you’ve figured out the ds18 hookup. i know i’ve promised to help you with this stuff, but this week i was quite busy with lots of work to do.

your code seems much better than the old one.
maybe you could make bit faster by setting a lower resolution for the ds18. also, you could try the api method. and in final version for max speed of course remove all serial prints.

i will send you some code tomorrow for api, to test.

Hi gents,
just short status update.
These are measured voltage values on my 18650 battery

17.10 - 4,11V
28.10 - 4,08V
5.11 - 4,07V

2 Likes

Looking good @helpfinder

Hi,
in the meantime waiting for battery lasting results :slight_smile:
has somebody experience with bme280 and its reading speed?
I see it has also humidity function, but not sure if this is suitable for project like this (as also dth22 was obviously not this kind of project friendly)

Thanks

i have experience with bme280, it is good quality sensor. i already used for wake up time by time and read values. the speed is comparable with ds18

1 Like

@helpfinder from the datasheet, page 51, typically 11.5ms for temperature and pressure but without humidity reading. https://ae-bst.resource.bosch.com/media/_tech/media/datasheets/BST-BME280_DS001-11.pdf

Another small status update. Afrer almost 5 weeks I am (or battery is :slight_smile:) on 4,04V

2 Likes

that is something! :wink:
how frequently wakes up to read the sensors?