Boron sync millis

I'm working on a sump pump monitoring project. The current version 1 uses a Boron 402 and is publishing on/off status for the pump and dry contact water levels to Adafruit.io (mqtt). I pull that into my server and process the data for hourly trends and alert on alarms. This definitely isn't scalable. It is quickly eating up data operations and cellular data (8MB in less than a week) since the pumps cycle 60-90 times an hour.

I've been testing a store and forward option using a "cheap" ESP32 over WiFi (I don't want to use up all my sandbox data while I debug the code). I collect the number of pump cycles and total time the pump is running over a 1 hour period using the standard millis formula and then trigger hourly updates.

The part I don't like is that the pump metrics are coming in one minute later every 3-4 hours. If I reset the ESP32 at noon, by 8 PM, the metrics are being sent at 2-3 minutes after the hour. BY midnight, the updates are almost 10 minutes past the hour. I'd like to send the metrics at the same time each hour.

Am I going to have the same problem with "time creep" when I reconfigure the Boron with the "store and forward" code? Is there a way to sync the Boron millis with the cellular network time so the message is always sent at the top of the hour regardless of when the Boron is powered up?

Appreciate any ideas you have,
John

Hey, I've heard that the boron's clock has a slight drift (in the order of 10msec or less per day - but that is from the top of my head).
In case you wanted to get rid of that drift, your code can call the sync function daily or so:

cheers

So once a day (or shorty after boot up) sync the time and when complete, then determine minutes after the hour and update my variables to fire at the top of the next hour.

I’ll give it a try.

Thank you!

no need for that one, please note in red:


Also, don't forget to check that the time is valid:

Best

1 Like

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.