Sync Time offline - RTC
In my project I need to get the current time, but based on my application the following solutions are not applicable:
- Connecting the FiPy to the internet to sync the RTC with the NTP server.
- Adding an external back up battery.
- Setting the time manually on each power-up.
So, based on these conditions, how can I sync the RTC?
@Miguel-Moreno Thanks a lot!
Indeed currently I am syncing the RTC with the NTP server by connecting the FiPy to the internet. But sometimes I am in places with no coverage (I connected it to my phone's hotspot), and since my application is to scan for WiFi and Bluetooth outside, the internet is not always available. That's why I need to get the current time offline and not to be hard coded.
@jcaron The FiPy is powered by a power bank battery, and it should be active the whole time since I need to scan for a whole day for Bluetooth and WiFi (The FiPy is not fixed, it should be with me wherever I go to scan).
maybe you can use DCF77 signal.
Or one of the many many other radio broadcasts of the current time: https://en.wikipedia.org/wiki/Radio_clock
@Jana-Koteich is your device powered externally (so you can keep it active the whole time) or battery-powered (so you need deep sleep)? What kind of precision do you need?
Hello @Jana-Koteich .
Why would you NOT use the internet to sync the RTC with an NTP server ? ...
If you have a FiPy, then your device is capable ( and sort of intended/expected ) to connect to the Internet.
If definitely you plan to use the FiPy in completely isolated mode ( no external connectivity whatsoever ) then your only choice is to add an external battery-backed standalone RTC module and poll it from the FiPy every time it powers on to update the internal RTC.
There are plenty of choices out there "of-the-shelf" RTC solutions, such as these quick examples:
Simple RTC ( inexpensive, but loses around 2 seconds precision per day ): https://www.adafruit.com/product/3295
High precision RTC ( more costly, but has long term precision - connect-and-forget style): https://www.adafruit.com/product/3013
Both of these samples include MicroPython libraries ( in CircuitPython, to be precise ) ... so it should be almost straightforward to use them with your FiPy.
livius last edited by
I see two possibilities:
- Use GPS module to retrive current time.
- I do not know your location, but maybe you can use DCF77 signal.