DS1307 Clock not Working

For RTC breakouts, etc., use the Other Products from Adafruit forum

Moderators: adafruit_support_bill, adafruit

Please be positive and constructive with your questions and comments.
techguy777
 
Posts: 6
Joined: Fri Sep 28, 2012 9:24 pm

DS1307 Clock not Working

Post by techguy777 »

Hi.
I am having a problem with my ds1307. It was working fine and then all of a sudden it stopped working correctly. I am running the example code for the rtc library

Code: Select all

// Date and time functions using a DS1307 RTC connected via I2C and Wire lib

#include <Wire.h>
#include "RTClib.h"

RTC_DS1307 RTC;

void setup () {
    Serial.begin(57600);
    Wire.begin();
    RTC.begin();

  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(__DATE__, __TIME__));
  }
}

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(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.unixtime() + 7 * 86400L + 30);
    
    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);
}
When I'm running the problem I get the following response from the Serial Connection.
2165/165/165 165:165:85
since midnight 1/1/1970 = 1402703185s = 16234d
now + 7d + 30s: 2014/6/20 23:46:55

I have checked all the wiring and soldering connections and they all look good.
Thanks in advance!

User avatar
adafruit_support_rick
 
Posts: 35092
Joined: Tue Mar 15, 2011 11:42 am

Re: DS1307 Clock not Working

Post by adafruit_support_rick »

Hard to say, but the symptoms sound very much like an intermittent connection. If you post some detailed pictures of the soldering/wiring, we'll have a look at it.

techguy777
 
Posts: 6
Joined: Fri Sep 28, 2012 9:24 pm

Re: DS1307 Clock not Working

Post by techguy777 »

Thanks. Here is a picture of the soldering and wiring. Sorry about the poor quality. It's hard to see in the picture but I connected SDA to Digital Pin 4 and SCL to Digital Pin 5. Thanks!
Attachments
phpy7M1lEPM.jpg
phpy7M1lEPM.jpg (7.83 KiB) Viewed 6022 times
phpqCxC70PM.jpg
phpqCxC70PM.jpg (8.17 KiB) Viewed 6022 times
phpN6Gh2oPM.jpg
phpN6Gh2oPM.jpg (7.85 KiB) Viewed 6022 times

User avatar
adafruit_support_bill
 
Posts: 88092
Joined: Sat Feb 07, 2009 10:11 am

Re: DS1307 Clock not Working

Post by adafruit_support_bill »

Those photos are much too small to see any detail. Try sizing them to about 800x600

techguy777
 
Posts: 6
Joined: Fri Sep 28, 2012 9:24 pm

Re: DS1307 Clock not Working

Post by techguy777 »

Here are the enlarged photos. I apologize about the poor quality.
Attachments
63750671fbb4a8f51348935611.jpeg
63750671fbb4a8f51348935611.jpeg (330.94 KiB) Viewed 6005 times
43650671f62ec0be1348935522.jpeg
43650671f62ec0be1348935522.jpeg (326.37 KiB) Viewed 6005 times
32350671f949ed091348935572.jpeg
32350671f949ed091348935572.jpeg (322.65 KiB) Viewed 6005 times

User avatar
adafruit_support_bill
 
Posts: 88092
Joined: Sat Feb 07, 2009 10:11 am

Re: DS1307 Clock not Working

Post by adafruit_support_bill »

More light usually helps. Try near a window - or even outside.

techguy777
 
Posts: 6
Joined: Fri Sep 28, 2012 9:24 pm

Re: DS1307 Clock not Working

Post by techguy777 »

Updated Pics. Thanks!
Attachments
IMG_0088.JPG
IMG_0088.JPG (320.85 KiB) Viewed 5972 times
IMG_0087.jpg
IMG_0087.jpg (314.77 KiB) Viewed 5972 times
IMG_0086.jpg
IMG_0086.jpg (354.41 KiB) Viewed 5972 times

User avatar
adafruit_support_bill
 
Posts: 88092
Joined: Sat Feb 07, 2009 10:11 am

Re: DS1307 Clock not Working

Post by adafruit_support_bill »

Still pretty out of focus, but from what I can see the solder doesn't look bad.

If you run the sketch several times, does the time increment appropriately between sketches?

User avatar
gragib
 
Posts: 32
Joined: Fri Oct 26, 2012 10:41 am

Re: DS1307 Clock not Working

Post by gragib »

I have the same problem when I try running the DS1307 with 3.3V instead of 5V.

I would also check 2 other things:
1. Is the coin cell inserted the right way - positive side up?
2. Is the coin cell providing sufficient voltage?

From reading the spec sheet for the DS1307, it seems that a proper coin cell is absolutely necessary for correct operation of the chip.

csabee
 
Posts: 2
Joined: Sat Feb 23, 2013 5:02 pm

Re: DS1307 Clock not Working

Post by csabee »

Hi,

I have a strange problem with a DS1307 chip.
I'm using it with an arduino mega adk r3, wired the sda/scl to digital 20 and 21 pins.

I have started from the adafruit sample code. Managed to adjust the time for 2013/2/23 21:48:58

Code: Select all

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(now.hour(), DEC);
    Serial.print(':');
    Serial.print(now.minute(), DEC);
    Serial.print(':');
    Serial.print(now.second(), DEC);
    Serial.println();
 
    Serial.print(" since 1970 = ");
    Serial.print(now.unixtime());
    Serial.print("s = ");
    Serial.print(now.unixtime() / 86400L);
    Serial.println("d");
    delay(3000);
}
And now I have a problem with the output:

Code: Select all

2013/2/23 21:48:58
 since 1970 = 1361656138s = 15759d
2013/2/23 21:48:58
 since 1970 = 1361656138s = 15759d
2013/2/23 21:48:58
 since 1970 = 1361656138s = 15759d
2013/2/23 21:48:58
 since 1970 = 1361656138s = 15759d
2013/2/23 21:48:58
 since 1970 = 1361656138s = 15759d
2013/2/23 21:48:58
So the problem is that the DS1307 won't tick, it just stores the adjusted time.
Can you help me, what could be the problem?

Thank you!

User avatar
adafruit_support_rick
 
Posts: 35092
Joined: Tue Mar 15, 2011 11:42 am

Re: DS1307 Clock not Working

Post by adafruit_support_rick »

Is this an Adafruit DS1307 breakout board or a bare chip?

csabee
 
Posts: 2
Joined: Sat Feb 23, 2013 5:02 pm

Re: DS1307 Clock not Working

Post by csabee »

No, this one is from ebay, but it has a similar breakout.

User avatar
adafruit_support_rick
 
Posts: 35092
Joined: Tue Mar 15, 2011 11:42 am

Re: DS1307 Clock not Working

Post by adafruit_support_rick »

I'm sorry, but you'll have to contact the seller or manufacturer for technical support.

User avatar
ockeydockey
 
Posts: 4
Joined: Sat Jan 26, 2013 10:53 am

Re: DS1307 Clock not Working

Post by ockeydockey »

I too am having this problem. I have the breakout board from Adafruit for the DS1307. After setting the time with a Raspberry Pi I use it with a Trinket 5v. It keeps perfect time for a good long while, and then stops incrementing. My code recalculate's the display every time it gets a reading, and it keeps repeating the same time. When I hook it back up to the Raspberry Pi (before setting the time again), it starts incrementing again from the time that it was stuck on.

User avatar
adafruit_support_rick
 
Posts: 35092
Joined: Tue Mar 15, 2011 11:42 am

Re: DS1307 Clock not Working

Post by adafruit_support_rick »

Have you tried a fresh backup battery?
Please post clear, detailed pictures of both sides of the board, showing your soldering.

Locked
Please be positive and constructive with your questions and comments.

Return to “Clock Kits (discontinued)”