Hi all!
I am working on boron-enabled devices that use LTE to sync with the Particle cloud and send data to Google sheets via a webhook. That functionality works great (hooray!). The issue I'm having is when the borons are not able to connect to LTE, either because they're deployed in a remote location (e.g. National Park with spotty cell service) or otherwise. In those cases, I still want the borons to do their thing (aka operate the device and store data locally on an SD card, even if they can't send the data to Google sheets and sync time on the cloud).
I've added a condition in the firmware that 'times out' the search for LTE connection before operation at five minutes, such that the device then just does its thing anyway on schedule. However, I'm having a lot of trouble just TELLING it what time zone it's in, and therefore when it needs to be doing so.
(for reference: at minute 45 of every hour, the devices begin looking for service; they time out after 5 mins. At minute 54 of every hour, the devices begin collecting data via onboard sensors, and do so for 6 minutes before going back to sleep. They store (locally) and send (if connected) the data every two minutes.)
Any advice on how to manually set a default timestamp/zone? Adding " Time.zone(-4);" in the setup function didn't seem to do the trick!
The real-time clock on the Boron is really more of a counter that increments when the MCU is powered. Cold boot (removing power) and hibernate sleep mode do not preserve the time. While the time is set upon connecting to the cloud, that doesn't help is situations where do not or cannot connect to the cloud after cold boot.
The only solution in this case is to use an external RTC. One chip that is known to work with Particle devices is the AB1805/AM1805. It's also hardware watchdog chip, and there is information in the watchdog documentation. This chip is also present in the Tracker (including the Monitor One) and the Muon.
1 Like
Ah, good to know; thanks, Rick! This is a bit of a bummer to hear given that we didn't anticipate this issue originally when we set up the devices (so don't currently have the capacity to add an external RTC). Our bad!
Just to confirm, there's no way to 'set.Time' or 'userSuppliedTime' to a specified epoch timestamp and timezone within the firmware for the boron404x?
thanks so much for your time, much appreciated!
My advise is not to set the time zone, you may not need it, unless your product has a customer facing HMI or display.
Just use GMT all the way.
You still need an external RTC, like Rick mentioned above.
Cheers,
1 Like
If you have an external way to input the time, such as a display and buttons, a mobile app, or a USB connected computer you could set the time that way.
1 Like
bingo! that should do the trick for us. inefficient for more than a handful of devices but it's only five, so shouldn't be too hard. Thanks Rick!!