Problem with Ds1307 and SQW pin to GND

I am trying to work with ds1307 rtc in my project. So first i check my rtc ic is working or no!
that's why i use this circuit diagram below.


And upload a test code

 // Date and time functions using a DS1307 RTC connected via I2C and Wire lib
#include "RTClib.h"

RTC_DS1307 rtc;

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

void setup () {
  while (!Serial); // for Leonardo/Micro/Zero

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

  if (! rtc.isrunning()) {
    Serial.println("RTC is NOT running!");
  }
  // following line sets the RTC to the date & time this sketch was compiled
  // rtc.adjust(DateTime(F(__DATE__), F(__TIME__)));
  // This line sets the RTC with an explicit date & time, for example to set
  // January 21, 2014 at 3am you would call:
  rtc.adjust(DateTime(2014, 1, 21, 3, 0, 0));
}

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);
}

And get unexpected value like:

But when i connect SQW pin to GND, i got the correct time.

What is the problem ?

Is there any problem occur if i connect SQW pin to GND? or what can i do?

N.B: I buy a new ds1307 and this one also same as the previous one.

Hi @muhit114474

You connected the GND of the arduino to the GND of the module with the DS1307.

See this schematic from DS1307 RTC SMD Module - Electronics-Lab.com

or this:

RV mineirin

1 Like

The schematic in the original post is useless, because it does not show any of the connections to the Arduino.

Post the correct, complete schematic. A photo of a carefully labeled pencil and paper drawing is fine.

Get a DS3231 RTC module. They are much more accurate and easier to use.

Is that so?

Yes!
Look at your drawing of Post-1 carefully. You have shown that SDA and SCL lines are being terminated with Arduino, but you have not shown the termination of GND signal with Arduino.

1 Like

Thank you.
I solved my problem.