Adafruit DS3231 Precision RTC - detecting unset clock

Breakout boards, sensors, other Adafruit kits, etc.

Moderators: adafruit_support_bill, adafruit

Please be positive and constructive with your questions and comments.
Locked
User avatar
ldauton
 
Posts: 21
Joined: Fri Oct 07, 2022 7:57 am

Adafruit DS3231 Precision RTC - detecting unset clock

Post by ldauton »

I have an "Adafruit DS3231 Precision RTC" (ID 5188).

Is there a reliable way to determine whether the device's clock has been set?

For example, suppose the device loses power, is there a status indicator somewhere which would indicate that the clock is no longer valid?

I think that device's clock defaults to sometime "a long time ago" so reading the clock and comparing the result to a known recent time value can work but this seems a bit clumsy.

Thank you,

Larry

User avatar
dastels
 
Posts: 15653
Joined: Tue Oct 20, 2015 3:22 pm

Re: Adafruit DS3231 Precision RTC - detecting unset clock

Post by dastels »

See the ds3231.ino example for the Arduino library. Specifically you use:

Code: Select all

rtc.lostPower()
In CircuitPython you can use

Code: Select all

rtc.lost_power
.
Dave

Locked
Please be positive and constructive with your questions and comments.

Return to “Other Products from Adafruit”