Real-time clock (RTC) tutorial

Want to learn more about real-time clocks on Particle devices?

  • The VBAT pin on Gen 2 devices?
  • HIBERNATE mode on Gen 3 devices?
  • External RTCs?
  • Other methods of time synchronization?

https://docs.particle.io/tutorials/learn-more/real-time-clocks/

4 Likes

@rickkas7 ,

Excellent tutorial, thank you for creating this.

Quick question I have been meaning to ask: Using a 3rd Gen device with the AB1805 RTC / Watchdog. In my code, does it make any difference which of these I use to get the time?

Time.now();
//or
ab1805.getRtcAsTime();

I know these are synced in the main loop using ab1805.loop() but it seems like there is a chance for discontinuities as the device transitions from disconnected to connected which will cause the RTC to be updated as it connects to Particle.

Thanks,

Chip

Thanks! No matter which source you use, there could be a discontinuity, because the AB1805 is synchronized to the cloud when the cloud time is received, and the device time (Time.now) is seeded from the RTC time if the RTC time is valid at setup(), before the cloud time is received. Iā€™d probably always use Time.now().