RTC DS1307 fails to increment

I really don’t like to jump to the conclusion it’s the hardware, so I’m wondering if I’m not initializing something correctly.

This is the Adafruit DS1307 (not the precision one).
Fresh battery installed for the first time.
Battery verified at 3.298 on my Fluke.
Runnning an Arduino Uno.
No shield or other components in place.
SDA jumpered to A4.
SCL jumpered to A5.


Script:

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

RTC_PCF8523 rtc;

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

void setup () {

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

  rtc.adjust(DateTime(F(__DATE__), F(__TIME__)));

  if (! rtc.initialized()) {
    Serial.println("RTC is NOT running!");
    while(1);
  }
}

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();
       
    for(int i = 0; i < 10; i++) {  // 30 second delay
      Serial.print("."); // Print a dot because I'm impatient
      delay(3000);
    }
    Serial.println();
}

Output:

2017/7/30 (Sunday) 13:12:2

2017/7/30 (Sunday) 13:12:2

2017/7/30 (Sunday) 13:12:2

2017/7/30 (Sunday) 13:12:2


What am I missing?


mw

You're using the wrong RTC object, it is for a different IC.

mouse: SDA jumpered to A4. SCL jumpered to A5.

What about GND?

mouse: RTC_PCF8523 rtc;

Why make a RTC_PCF8523 object? The PCF8523 is not the DS1307.... Why not make a RTC_DS1307 object?

That was it. I was using code from the wrong example.

Changed to RTC_DS1307 rtc;

Hand to change .initialized to .begin.

Working fine now.

Thanks guys.

-- mw