user28389: My board.

I think I have it wired correctly (the lights aren't, but the board is). 
I've read through the first few Google results to no avail.
My sample code to test the chip:
// 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] = {"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();

Serial.print(" since midnight 1/1/1970 = ");
Serial.print(now.unixtime());
Serial.print("s = ");
Serial.print(now.unixtime() / 86400L);
Serial.println("d");

// calculate a date which is 7 days and 30 seconds into the future
DateTime future (now + TimeSpan(7,12,30,6));

Serial.print(" now + 7d + 30s: ");
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(3000);
}

Serial output:
`RTC is NOT running!
2165/165/165 (Tuesday) 165:165:85
 since midnight 1/1/1970 = 1551138385s = 17952d
 now + 7d + 30s: 2019/3/5 12:16:31

2165/165/165 (Tuesday) 165:165:85    
 since midnight 1/1/1970 = 1551138385s = 17952d
 now + 7d + 30s: 2019/3/5 12:16:31

2165/165/165 (Tuesday) 165:165:85
 since midnight 1/1/1970 = 1551138385s = 17952d
 now + 7d + 30s: 2019/3/5 12:16:31

2165/165/165 (Tuesday) 165:165:85
 since midnight 1/1/1970 = 1551138385s = 17952d
 now + 7d + 30s: 2019/3/5 12:16:31

2165/165/165 (Tuesday) 165:165:85
 since midnight 1/1/1970 = 1551138385s = 17952d
 now + 7d + 30s: 2019/3/5 12:16:31

2165/165/165 (Tuesday) 165:165:85
 since midnight 1/1/1970 = 1551138385s = 17952d
 now + 7d + 30s: 2019/3/5 12:16:31

2165/165/165 (Tuesday) 165:165:85
 since midnight 1/1/1970 = 1551138385s = 17952d
 now + 7d + 30s: 2019/3/5 12:16:31

2165/165/165 (Tuesday) 165:165:85
 since midnight 1/1/1970 = 1551138385s = 17952d
 now + 7d + 30s: 2019/3/5 12:16:31

2165/165/165 (Tuesday) 165:165:85
 since midnight 1/1/1970 = 1551138385s = 17952d
 now + 7d + 30s: 2019/3/5 12:16:31

2165/165/165 (Tuesday) 165:165:85
 since midnight 1/1/1970 = 1551138385s = 17952d
 now + 7d + 30s: 2019/3/5 12:16:31

2165/165/165 (Tuesday) 165:165:85
 since midnight 1/1/1970 = 1551138385s = 17952d
 now + 7d + 30s: 2019/3/5 12:16:31


user84847: With the Arduino Due, the 165 problem came up intermittently with a knock off DS3231 (compatible with 1307 supposedly).  Tried switching to a different RTC but it didn't help.  Switching to an Arduino Mega 2560 seems to have resolved it.  The Mega 2560 is a lot slower so maybe it was a clock speed issue?  In any case, it was useful for resolving the intermittent issue.
That said, if you always get 165:165 it means your Arduino is not communicating with your RTC.  This is a different problem and won't be solved by switching Arduinos.

user31043: Your picure shows also another device on the bread board. Remove that and ensure that:
Uno Ground --> 1307 Ground
Uno 5Volt --> 1307 +5v
Uno A4 --> 1307 Data
Uno A5 --> 1307 Clock
If the 1307 has a power led indicator, it should be lit.
If that still does not work, then in the code, comment this line out:
rtc.adjust(DateTime(F(__DATE__), F(__TIME__)));

and uncomment this line to set the 1307 with a specific time stamp:
// rtc.adjust(DateTime(2014, 1, 21, 3, 0, 0));


user37802: Put in the following line in void setup():
Wire.begin();

(Assuming Wire library has been included.)
This will set up the I2C connection between the Master (Arduino) and the Slave (RTC).
For more generic use, the syntax is: Wire.begin(address);
The complete code is:
void setup () {
  Wire.begin();
  Serial.begin(9600);
  //rtc.adjust(DateTime(F(__DATE__), F(__TIME__))); // UNCOMMENT TO SET TIME & DATE TO THAT AT COMPILATION.
  //rtc.adjust(DateTime(2017, 8, 31, 14, 45, 14 )); // UNCOMMENT TO SET TIME & DATE MANUALLY. (YEAR, MONTH, DAY, 24-HOUR, MINUTE, SECOND) 

}


user30307: On the DS3231 seems like the device can get unsynchronized with the microcontroller. Not sure if the same problem with DS1307 I think worth trying.
My complete solution on stackoverflow for the same question

The I2C interface is accessible whenever either VCC or VBAT is at a
  valid level. If a microcontroller connected to the DS3231 resets
  because of a loss of VCC or other event, it is possible that the
  microcontroller and DS3231 I2C communications could become
  unsynchronized, e.g., the microcontroller resets while reading data
  from the DS3231. When the microcontroller resets, the DS3231 I2C
  interface may be placed into a known state by toggling SCL until SDA
  is observed to be at a high level. At that point the microcontroller
  should pull SDA low while SCL is high, generating a START condition.


user41731: I had the same "165" problem.  Very intermittent.  Turns out that I was drawing too much power from the Arduino rails for the circuit I was controlling.  I was being lazy by not powering it independently when I started.  Nick Gannon on arduino.cc showed where the 165 came from and solved my problem.  He included the bcd math.
https://forum.arduino.cc/index.php?topic=184908.0

user35229: Had the same issue, however, my RTC was 1302 (not 1307) and yours seems to be as well, please check.
If it's 1302, use this library:
https://github.com/msparks/arduino-ds1302
Also, make sure you connect pins like this:

Arduino Pin 7 goes to CLK
Arduino Pin 6 goes to DAT
Arduino Pin 5 goes to RST
Arduino 5+ goes to VCC
Arduino GND goes to GND


28389: <p>My board.</p>

<p><img src="https://i.imgur.com/vE5XN0X.jpg" alt="Arduino Board"></p>

<p>I think I have it wired correctly (the lights aren't, but the board is). </p>

<p>I've read through the first few Google results to no avail.</p>

<p>My sample code to test the chip:</p>

<pre><code>// Date and time functions using a DS1307 RTC connected via I2C and Wire lib
#include &lt;Wire.h&gt;
#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 &amp; time this sketch was compiled
     rtc.adjust(DateTime(F(__DATE__), F(__TIME__)));
    // This line sets the RTC with an explicit date &amp; 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();

Serial.print(" since midnight 1/1/1970 = ");
Serial.print(now.unixtime());
Serial.print("s = ");
Serial.print(now.unixtime() / 86400L);
Serial.println("d");

// calculate a date which is 7 days and 30 seconds into the future
DateTime future (now + TimeSpan(7,12,30,6));

Serial.print(" now + 7d + 30s: ");
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(3000);
}
</code></pre>

<p>Serial output:</p>

<pre><code>`RTC is NOT running!
2165/165/165 (Tuesday) 165:165:85
 since midnight 1/1/1970 = 1551138385s = 17952d
 now + 7d + 30s: 2019/3/5 12:16:31

2165/165/165 (Tuesday) 165:165:85    
 since midnight 1/1/1970 = 1551138385s = 17952d
 now + 7d + 30s: 2019/3/5 12:16:31

2165/165/165 (Tuesday) 165:165:85
 since midnight 1/1/1970 = 1551138385s = 17952d
 now + 7d + 30s: 2019/3/5 12:16:31

2165/165/165 (Tuesday) 165:165:85
 since midnight 1/1/1970 = 1551138385s = 17952d
 now + 7d + 30s: 2019/3/5 12:16:31

2165/165/165 (Tuesday) 165:165:85
 since midnight 1/1/1970 = 1551138385s = 17952d
 now + 7d + 30s: 2019/3/5 12:16:31

2165/165/165 (Tuesday) 165:165:85
 since midnight 1/1/1970 = 1551138385s = 17952d
 now + 7d + 30s: 2019/3/5 12:16:31

2165/165/165 (Tuesday) 165:165:85
 since midnight 1/1/1970 = 1551138385s = 17952d
 now + 7d + 30s: 2019/3/5 12:16:31

2165/165/165 (Tuesday) 165:165:85
 since midnight 1/1/1970 = 1551138385s = 17952d
 now + 7d + 30s: 2019/3/5 12:16:31

2165/165/165 (Tuesday) 165:165:85
 since midnight 1/1/1970 = 1551138385s = 17952d
 now + 7d + 30s: 2019/3/5 12:16:31

2165/165/165 (Tuesday) 165:165:85
 since midnight 1/1/1970 = 1551138385s = 17952d
 now + 7d + 30s: 2019/3/5 12:16:31

2165/165/165 (Tuesday) 165:165:85
 since midnight 1/1/1970 = 1551138385s = 17952d
 now + 7d + 30s: 2019/3/5 12:16:31
</code></pre>
 84847: <p>With the Arduino Due, the 165 problem came up intermittently with a knock off DS3231 (compatible with 1307 supposedly).  Tried switching to a different RTC but it didn't help.  Switching to an Arduino Mega 2560 seems to have resolved it.  The Mega 2560 is a lot slower so maybe it was a clock speed issue?  In any case, it was useful for resolving the intermittent issue.</p>
<p>That said, if you always get 165:165 it means your Arduino is not communicating with your RTC.  This is a different problem and won't be solved by switching Arduinos.</p>
 31043: <p>Your picure shows also another device on the bread board. Remove that and ensure that:</p>

<p>Uno Ground --> 1307 Ground</p>

<p>Uno 5Volt --> 1307 +5v</p>

<p>Uno A4 --> 1307 Data</p>

<p>Uno A5 --> 1307 Clock</p>

<p>If the 1307 has a power led indicator, it should be lit.</p>

<p>If that still does not work, then in the code, comment this line out:</p>

<pre><code>rtc.adjust(DateTime(F(__DATE__), F(__TIME__)));
</code></pre>

<p>and uncomment this line to set the 1307 with a specific time stamp:</p>

<pre><code>// rtc.adjust(DateTime(2014, 1, 21, 3, 0, 0));
</code></pre>
 37802: <p>Put in the following line in void setup():</p>

<pre><code>Wire.begin();
</code></pre>

<p>(Assuming Wire library has been included.)
This will set up the I2C connection between the Master (Arduino) and the Slave (RTC).</p>

<p>For more generic use, the syntax is: Wire.begin(address);</p>

<p>The complete code is:</p>

<pre><code>void setup () {
  Wire.begin();
  Serial.begin(9600);
  //rtc.adjust(DateTime(F(__DATE__), F(__TIME__))); // UNCOMMENT TO SET TIME &amp; DATE TO THAT AT COMPILATION.
  //rtc.adjust(DateTime(2017, 8, 31, 14, 45, 14 )); // UNCOMMENT TO SET TIME &amp; DATE MANUALLY. (YEAR, MONTH, DAY, 24-HOUR, MINUTE, SECOND) 

}
</code></pre>
 30307: <p>On the DS3231 seems like the device can get unsynchronized with the microcontroller. Not sure if the same problem with DS1307 I think worth trying.
My <a href="https://stackoverflow.com/a/47027763/1976512">complete solution</a> on stackoverflow for the same question</p>

<blockquote>
  <p>The I2C interface is accessible whenever either VCC or VBAT is at a
  valid level. If a microcontroller connected to the DS3231 resets
  because of a loss of VCC or other event, it is possible that the
  microcontroller and DS3231 I2C communications could become
  unsynchronized, e.g., the microcontroller resets while reading data
  from the DS3231. When the microcontroller resets, the DS3231 I2C
  interface may be placed into a known state by toggling SCL until SDA
  is observed to be at a high level. At that point the microcontroller
  should pull SDA low while SCL is high, generating a START condition.</p>
</blockquote>
 41731: <p>I had the same "165" problem.  Very intermittent.  Turns out that I was drawing too much power from the Arduino rails for the circuit I was controlling.  I was being lazy by not powering it independently when I started.  Nick Gannon on arduino.cc showed where the 165 came from and solved my problem.  He included the bcd math.<br>
<a href="https://forum.arduino.cc/index.php?topic=184908.0" rel="nofollow noreferrer">https://forum.arduino.cc/index.php?topic=184908.0</a></p>
 35229: <p>Had the same issue, however, my RTC was 1302 (not 1307) and yours seems to be as well, please check.
If it's 1302, use this library:
<a href="https://github.com/msparks/arduino-ds1302" rel="nofollow noreferrer">https://github.com/msparks/arduino-ds1302</a></p>

<p>Also, make sure you connect pins like this:</p>

<ol>
<li>Arduino Pin 7 goes to CLK</li>
<li>Arduino Pin 6 goes to DAT</li>
<li>Arduino Pin 5 goes to RST</li>
<li>Arduino 5+ goes to VCC</li>
<li>Arduino GND goes to GND</li>
</ol>
