DS3231 rtc.begin() always returning false I am using Arduino UNO with a RTC DS3231 module.
I have connected SDA &amp; SCL pins of RTC DS3231 with Arduino SDA &amp; SCL pins near AREF pin.
RTC module is having attached battery also.
My code is as below :
#include &lt;RTClib.h&gt;
#include &lt;Wire.h&gt;
RTC_DS3231 rtc;

char daysOfTheWeek[7][12] = {
  &quot;Sunday&quot;, &quot;Monday&quot;, &quot;Tuesday&quot;, 
  &quot;Wednesday&quot;, &quot;Thursday&quot;, &quot;Friday&quot;, &quot;Saturday&quot;
};

void setup() {
  Serial.begin(9600);
  Wire.begin();
  delay(3000);
  //rtc.begin();
  if (! rtc.begin()) {
    Serial.println(&quot;Couldn't find RTC&quot;);
    while (1);
  }
  if (rtc.lostPower()) {
    Serial.println(&quot;RTC lost power, lets set the time!&quot;);
    rtc.adjust(DateTime(F(__DATE__), F(__TIME__)));
       // Following line sets the RTC with an explicit date &amp; time
    // for example to set January 27 2017 at 12:56 you would call:
    // rtc.adjust(DateTime(2017, 1, 27, 12, 56, 0));
  }
}

void loop() {
  DateTime now = rtc.now();
  Serial.println(&quot;Current Date &amp; Time: &quot;);
    Serial.print(now.year(), DEC);
    Serial.print('/');
    Serial.print(now.month(), DEC);
    Serial.print('/');
    Serial.print(now.day(), DEC);
    Serial.print(&quot; (&quot;);
    Serial.print(daysOfTheWeek[now.dayOfTheWeek()]);
    Serial.print(&quot;) &quot;);
    Serial.print(now.hour(), DEC);
    Serial.print(':');
    Serial.print(now.minute(), DEC);
    Serial.print(':');
    Serial.print(now.second(), DEC);
    Serial.println();
    
    Serial.println(&quot;Unix Time: &quot;);
    Serial.print(&quot;elapsed &quot;);
    Serial.print(now.unixtime());
    Serial.print(&quot; seconds/&quot;);
    Serial.print(now.unixtime() / 86400L);
    Serial.println(&quot; days since 1/1/1970&quot;);
    
    // calculate a date which is 7 days &amp; 30 seconds into the future
    DateTime future (now + TimeSpan(7,0,0,30));
    
    Serial.println(&quot;Future Date &amp; Time (Now + 7days &amp; 30s): &quot;);
    Serial.print(future.year(), DEC);
    Serial.print('/');
    Serial.print(future.month(), DEC);
    Serial.print('/');
    Serial.print(future.day(), DEC);
    Serial.print(' ');
    Serial.print(future.hour(), DEC);
    Serial.print(':');
    Serial.print(future.minute(), DEC);
    Serial.print(':');
    Serial.print(future.second(), DEC);
    Serial.println();
    
    Serial.println();
    delay(1000);

}

While running the above command and opening the Serial Monitor, I always get following output:
Couldn't find RTC

Can anyone help me to correct this problem.
No fault is there in code. Rather, it was an faulty connection which prevented RTC module from working. Now, after restoration, the RTC module is working fine.