I am using Arduino UNO with a RTC DS3231 module. I have connected SDA & SCL pins of RTC DS3231 with Arduino SDA & SCL pins near AREF pin. RTC module is having attached battery also. My code is as below :

#include <RTClib.h>
#include <Wire.h>
RTC_DS3231 rtc;

char daysOfTheWeek[7][12] = {
  "Sunday", "Monday", "Tuesday", 
  "Wednesday", "Thursday", "Friday", "Saturday"

void setup() {
  if (! rtc.begin()) {
    Serial.println("Couldn't find RTC");
    while (1);
  if (rtc.lostPower()) {
    Serial.println("RTC lost power, lets set the time!");
    rtc.adjust(DateTime(F(__DATE__), F(__TIME__)));
       // Following line sets the RTC with an explicit date & 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("Current Date & Time: ");
    Serial.print(now.year(), DEC);
    Serial.print(now.month(), DEC);
    Serial.print(now.day(), DEC);
    Serial.print(" (");
    Serial.print(") ");
    Serial.print(now.hour(), DEC);
    Serial.print(now.minute(), DEC);
    Serial.print(now.second(), DEC);
    Serial.println("Unix Time: ");
    Serial.print("elapsed ");
    Serial.print(" seconds/");
    Serial.print(now.unixtime() / 86400L);
    Serial.println(" days since 1/1/1970");
    // calculate a date which is 7 days & 30 seconds into the future
    DateTime future (now + TimeSpan(7,0,0,30));
    Serial.println("Future Date & Time (Now + 7days & 30s): ");
    Serial.print(future.year(), DEC);
    Serial.print(future.month(), DEC);
    Serial.print(future.day(), DEC);
    Serial.print(' ');
    Serial.print(future.hour(), DEC);
    Serial.print(future.minute(), DEC);
    Serial.print(future.second(), DEC);


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.

  • Did you connect the DS3231 to VCC and did you connect the DS3231 module's GND to your Arduino's GND? Does the DS3231 module already have pullups on the SDA and SCL lines?
    – StarCat
    Commented Sep 16, 2020 at 6:54
  • Yes, I did connect DS3231 to VCC and GND with Arduino GND. How will I know if DS3231 module have pullups on SDA and SCL lines.
    – Sashi Kant
    Commented Sep 16, 2020 at 7:05
  • That should be in the datasheet or the schematics. Other question: did you run an I2C scan sketch or a different library to see if the DS3231 is visible to your Arduino?
    – StarCat
    Commented Sep 16, 2020 at 7:50
  • 2
    Yes, it worked. Actually the problem was in faulty wire in SDA connection. While checking the I2C scan, it showed no I2C devices, then I checked the connections and found SDA connection faulty. After restoration, the RTC module is working fine. Thanks for the support. Though feeling very silly for such mistakes.
    – Sashi Kant
    Commented Sep 16, 2020 at 8:33
  • 1
    Feel free to post a self-answer, so that others don't need to read the whole comments dialog. Congratulations, btw. Simple problems sometimes are the hardest. Commented Sep 16, 2020 at 9:26

1 Answer 1


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.

  • You can mark you own question as “answered”.
    – StarCat
    Commented Sep 17, 2020 at 18:04

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.