I am using ESP-32-WROOM-32 with a RTC DS3231 module. I have connected SDA & SCL pins of RTC DS3231 with ESP32 D22 and D23 pins. Also, the VCC of RTC is connected to 3V3 of ESP32 and the GND of RTC is also connected to GND of ESP32 .RTC module is having attached battery also.

Following is the code:

#include <Wire.h> // for I2C with RTC module
#include "RTClib.h" //to show time

RTC_DS3231 rtc;

void Scanner ()
  Serial.println ();
  Serial.println ("I2C scanner. Scanning ...");
  byte count = 0;

  for (byte i = 8; i < 120; i++)
    Wire.beginTransmission (i);          // Begin I2C transmission Address (i)
    if (Wire.endTransmission () == 0)  // Receive 0 = success (ACK response) 
      Serial.print ("Found address: ");
      Serial.print (i, DEC);
      Serial.print (" (0x");
      Serial.print (i, HEX);     // PCF8574 7 bit address
      Serial.println (")");
  Serial.print ("Found ");      
  Serial.print (count, DEC);        // numbers of devices
  Serial.println (" device(s).");
void setup()
    // put your setup code here, to run once:



    while (!rtc.begin())
        Serial.println("Couldn't find RTC");
        //        while (1)
        //        {
        //                  Serial.println("Couldn't find RTC");
        //        }

    // In setup function, we will call a function rtc.adjust(DateTime(__DATE__, __TIME__)) which will set the time according to our PC time.
    rtc.adjust(DateTime(__DATE__, __TIME__));
void loop()
    DateTime curr_time_obj = rtc.now();
    int day = curr_time_obj.day();
    int month = curr_time_obj.month();
    int year = curr_time_obj.year();
    int week_day = curr_time_obj.dayOfTheWeek();
    int sec = curr_time_obj.second();
    int hr = curr_time_obj.hour();
    int minute = curr_time_obj.minute();

    Serial.print("hour is ");
    Serial.print("min is ");
    Serial.print("secs is ");

Following is the output: enter image description here

Some of the images of the circuit can be found here: https://drive.google.com/drive/folders/1fhM7o_aZCGh88OBDcypVLqhKhizhXnNd?usp=sharing

I would appreciate any help to resolve this issue. Thanks

  • The I²C address of the DS3231 is 0x68, not 0x57. Are you sure that's the chip you have?
    – Mat
    Commented Sep 10, 2021 at 5:32
  • Yes, the chip says DS3231M to be specific.
    – Excalibur
    Commented Sep 10, 2021 at 5:53
  • Please link to the exact module that you are using. It's impossible to make out what it is from those pictures.
    – Majenko
    Commented Sep 10, 2021 at 9:20
  • 1
    That module contains both an RTC and an EEPROM. The device 0x57 looks to be the EEPROM. There is no schematic for the module, but there are two sets of I2C pins. It could be that the two chips are wired separately and you have to choose the right I2C pins for which chip you wish to use. Try switching to the other SCL/SDA pins.
    – Majenko
    Commented Sep 10, 2021 at 10:10
  • 1
    @Majenko I have this module and I use the RTC over the 6 pin header
    – Juraj
    Commented Sep 10, 2021 at 12:57

1 Answer 1



These modules normally come with a 200Ω resistor soldered next to the IN4148 Zener diode, as you can see in the image below.

ds3231 module problem fix The resistor and diode form a simple charging circuit designed for use with LIR2032 rechargeable batteries.

Be aware that some DS3231 modules come with a non-rechargeable CR2032 battery. If this is the case, you must remove the resistor because attempting to charge a non-rechargeable battery can cause serious damage.


enter image description here

  • I resolved the rebooting problem extract the 200 ohms resistor Commented Nov 21, 2023 at 21:32
  • 1
    That battery will not charge with a 3V3 system such as the ESP devices. The diode should isolate it so you need to do nothing. If you power it with 5V then you need to modify it for a non rechargeable battery.
    – Gil
    Commented Nov 23, 2023 at 22:02

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.