I have a few borons in the field that rely on Time.now()
to open and close a valve. They also sleep to save power, using the command System.sleep({ A0 }, RISING, SLEEP_NETWORK_STANDBY, 600);
. They do not have RTC’s available in the current configuration.
My problem is that Time.now() seems to drift quickly to unusable values. Over the course of an hour it can drift 5min to 120+min off, which makes the valves open and close at the wrong times.
The simple solution is to check time with Particle cloud every time the device wakes, but this seems wasteful of both data and power.
Is this expected behavior for Gen 3 devices? Do I need to start including an RTC in all Gen 3 related designs? For my applications a somewhat reliable RTC is necessary (but I don’t need super accurate).
I have an almost identical setup running with an Electron where my time drift was only a minute or so a week, so no RTC was OK.
1 Like
The Gen3 device only have real time counters no real time clock and they are known to be rather inaccurate in sleep mode.
The two options you listed (cloud sync vs. ext. RTC) are currently the best you have.
1 Like
OK, I will add an RTC.
I am curious though -- isn't Particle using some sort of time data to keep its cloud connection alive? My Time.now() calls are so wrong that I'm not sure how they would be doing that every 20 minutes if my device has any sleep logic.
Maybe something should be added to the Gen 3 reference pages or datasheet? On Time section, something like:
Time functions are unreliable on Gen 3 hardware due to the lack of a proper RTC. Include an RTC in your design if your firmware either relies on time to perform an action, or you plan to sleep your device.
If no external RTC is available, calling Particle.syncTime() often is a requirement.
A note like that would have saved me a few hours of time and a few hundred $$$ in prototyping expenses.
3 Likes
By default the time should get synced automatically when a cloud connection is established but you can also call Particle.syncTime()
anytime you feel the need to sync.
Yup, and a forum search too
https://community.particle.io/search?q=rtc%20drift%20mesh
OK, so we agree on no documentation additions related to this, since its a known bug in the forum? Cool – I will add this to the list of my undocumented device-os bug workarounds.
Doesn’t mean that there shouldn’t be a “disclaimer” in the docs, but I’d leave that decision to @rickkas7