Using DS1307 library with DS3231

I have read that the DS1307 library should work with a DS3231. I seem to have poor accuracy on my DS3231. It's supposed to be 2 mins per year.

Are there any changes I need to make to the DS1307 library to work with the DS3231?

What I learnt over the months reading this forum, cheap DS3231 modules have second or even third grade chips and they can drift quite much.

Are there any changes I need to make to the DS1307 library to work with the DS3231?

No. The library, has nothing to do with the accuracy.

If you look at the DS3231 data sheet there are a couple of registers that can be used to compensate
the chips aging with temperature. The temperature may be the issue but not sure how to go about messing with those registers to give you the stability your looking for.
Bruce

richardtheboffin:
Are there any changes I need to make to the DS1307 library to work with the DS3231?

Why not use a DS3231 library?

Are you seeing the OSF bit being set? This would indicate an oscillator or power/battery issue where time keeping has lost time.

--- bill

bperrybap:
Why not use a DS3231 library?

Are you seeing the OSF bit being set? This would indicate an oscillator or power/battery issue where time keeping has lost time.

--- bill

Hi Bill,

Long story short, I did the software with a DS1307 module but the HW guy put on the DS3231 coz it was more accurate! (except it's not).

Actually I have several boards and a couple are perfect and a couple are not.

I'll check the OSF bit though, thanks.