ESP32 RTC DS3231 reset to 1/1/2000

hello everyone, I have a problem with the RTC DS3231. I use an esp32 microcontroller. I tried to make my own RTC by only using the IC from DS3231. I have attached the schematic and the program too. The problem was when I turned off the power from the PCB, I tried it for 3 hours and it was still safe but after about 1 day, it reset to 1/1/2000. please help me solve this problem. Thank You

#include "RTClib.h"
RTC_DS3231 rtc;
char daysOfTheWeek[7][12] = {"Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday"};

void setup () {
  Serial.begin(57600);

  if (! rtc.begin()) {
    Serial.println("Couldn't find RTC");
    Serial.flush();
    while (1) delay(10);
  }

//  rtc.adjust(DateTime(F(__DATE__), F(__TIME__)));
}

void loop () {
  DateTime now = rtc.now();

  Serial.print(now.year(), DEC);
  Serial.print('/');
  Serial.print(now.month(), DEC);
  Serial.print('/');
  Serial.print(now.day(), DEC);
  Serial.print(" (");
  Serial.print(daysOfTheWeek[now.dayOfTheWeek()]);
  Serial.print(") ");
  Serial.print(now.hour(), DEC);
  Serial.print(':');
  Serial.print(now.minute(), DEC);
  Serial.print(':');
  Serial.print(now.second(), DEC);
  Serial.println();
  delay(1000);
}

The CR2032 is not a rechargeable lithium battery so there should be no connection to VDD. (You probably copied this from the numerous bad designs out there.) Get rid of R26 and D1.

1 Like

Yes, I have removed the resistor and diode for charging. However, the RTC still resets to 1/1/2000 after powering off for 1 day. is there another solution?

Are you using a CR2032, or a rechargeable battery?

i use battery coin CR2032

I noticed that your schematic doesn't show any connections to the DS3231's pins 5-12. While they are shown in the datasheet as N.C. (no connection), the datasheet also specifies that they must all be connected to ground.

starting yesterday I tried to disconnect the VCC, so the RTC only uses power from the battery... until now I checked my RTC is still running normally
If there are any more problems later, I will try this suggestion from you... thank you :+1:

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.