The famous DS3231 RTC on board ZS-042. Fitted with a CR2032 battery. Though I have not cut the charging track , yet to to explode ![]()
All fine - shows time fine.
Till I removed power and left it to the battery's mercy. The clock stopped updating and next day resumed ( on power ) from where I left yesterday.
Read this forum as this seemed to be a favorite issue for many ( clock stops on battery power) ;
Checked the battery voltage on power : 4.16V and on battery it was about 3.9V;
Time to hit the data sheet ? Yes and I noticed that two entries could halt the clock while on battery :
EOSC bit in Control register 0Eh
OSF bit in Status Register 0Fh
Once I wrote code to set them up for 0x00 in SETUP() , the RTC is working fine.
// START THE I2C INTERFACE
#define DS3231_I2C_ADDRESS 0x68 // 0x68 is the RTC address
Wire.begin();
Wire.beginTransmission(DS3231_I2C_ADDRESS);
Wire.write(0xE); // Address the Control Register
Wire.write(0x00); // Write 0x0 to control Register
Wire.endTransmission();
Wire.beginTransmission(DS3231_I2C_ADDRESS);
Wire.write(0xF); // Address the Status register
Wire.write(0x00); // Write 0x0 to Status Register
Wire.endTransmission();
I hope that was the issue and this the fix !!