DS1037 10 minutes late

Hello !

I’m actually posting for 2 reasons about my I2C DS1307 module :

  • I take the ds1307 example, transfered it to my nano, and have a problem with it, the hour displayed is 10 minutes late… Here’s my sketch :
// Date and time functions using a DS1307 RTC connected via I2C and Wire lib
#include <Wire.h>
#include "RTClib.h"

RTC_DS1307 rtc;

char daysOfTheWeek[7][12] = {"Dimanche", "Lundi", "Mardi", "Mercredi", "Jeudi", "Vendredi", "Samedi"};

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

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

And as you can see, “rtc.adjust(DateTime(F(DATE), F(TIME)));” is uncommented…

  • Finally, the default Analog pins to make the rtc works, are SCL : A5; SDA : A4. but those pins are already in use (in my case) by an other module, is there a way to change those pins ?

Thank you !

You are not explaining the problem well, it might be because you aren’t setting the time properly.
I use bildr Do You Have The Time? DS1307 RT Clock + Arduino - bildr
SCL and SDA are the I2C bus. Several devices can share the pins

Once the RTC is set, incorrectly or not, the sketch will not run the "rtc.adjust(DateTime(F(DATE), F(TIME)));" statement. Try removing and re-inserting the coin cell battery so the RTC loses the time. The next time you upload the sketch it is should set the date/time.