Why is my rtc ds3231 always inaccurate after 1 day?

my rtc ds3231 always 20-40 minutes late after 1 day

#include <Wire.h>
#include <LiquidCrystal_I2C.h>
#include <RTClib.h>
#include <avr/sleep.h>

LiquidCrystal_I2C lcd(0x27, 16, 2);
RTC_DS3231 rtc;

char daysOfTheWeek[7][12] = { "Min", "Sen", "Sel", "Rab", "Kam", "Jum", "Sab" };
DateTime now;
void setup() {
  rtc.begin();
  rtc.disable32K();
  lcd.init();
  lcd.backlight();
  lcd.clear();
}
void loop() {
  //if (now.hour()%5 == 0){
    //set_sleep_mode(SLEEP_MODE_PWR_DOWN);
    //sleep_enabled();
    //sleep_mode();
  now=rtc.now();
  lcd.setCursor(0,1);
  lcd.print(String(daysOfTheWeek[now.dayOfTheWeek()]) + " " + String(now.day()) + "/" + String(now.month()) + "/" + String(now.year()));
  lcd.setCursor(0,0);
  if (now.hour()<10) lcd.print("0");
  lcd.print(now.hour());
  lcd.print(":");
  if (now.minute()<10) lcd.print("0");
  lcd.print(now.minute());
  lcd.print(":");
  if (now.second()<10) lcd.print("0");
  lcd.print(now.second());
  delay(1000);
}

Where did you buy it from? If it didn't come from a reputable distributer (DigiKey, Mouser, etc.) the first thing that comes to mind is that it's not the real thing.

If the time drifts rapidly, then you either bought a piece of junk or are doing something silly.

But you forgot to post any of the details.

Could be a broken Chip...

Is the temperature reading of the RTC correct?

Possibly there is some corruption on the I2C bus. Check that you have the right pullups.

Otherwise most likely reason is counterfeit DS3231. Basically anything that can be faked eventually will be, especially if it is one of those high-volume commodity type items.

I recently purchased a few DS3231 boards and while researching I discovered there are two versions - the S or SN suffix is the better, more accurate chip with onboard temp controlled crystal and the M suffix parts are less accurate as they use a microelectromechanical oscillator. Still, the worst of those should do better than nearly +/- 30m minutes a day!

I2C data issues might account for a random bad reading, but if there's any kind of linearity to the accuracy error (gets worse over time) then I would think data corruption isn't the problem.

I've heard that virtually all popular silicon gets counterfeited these days, but as far as I read online the big issue with the DS3231 chips is the less accurate version being passed off as the better version - and it still shouldn't be that bad. Perhaps you just have a damaged chip? These are reasons that I tend to purchase from legitimate suppliers like Digikey or Mouser for anything that isn't completely disposable.

Does it have the battery installed? Is it an actual DS3231, or is it the flawed ZS-042?

Shouldn't time be all over the place then?

The DS3231's /EOSC bit (the high bit in the Control register) controls whether the oscillator continues to run when on backup cell power. If that bit is high, the oscillator is stopped, and the time will freeze, when power at the Vcc input is turned off. It doesn't reset, it just freezes the time, and all the register contents. So the RTC will lose time while it's on backup battery. I know that sounds crazy, but I think it's so it won't use up coin cell power during shipping.

However, the bit is cleared when power is first applied to the RTC, so it should be ok. But if the RTC was shipped with a coin cell battery installed, or if your library is messed up as to how the RTC is initialized, the bit could still be high.

That's the only explanation I can think of where the RTC is still good. Well, I guess if the Aging register is set way wrong, it could run slow or fast, but I don't think it could be off enough to produce the results you're seeing.

I make some air flows and everything work correctly