DS1307 Clock not Working
Moderators: adafruit_support_bill, adafruit

DS1307 Clock not Working

by techguy777 on Fri Sep 28, 2012 9:29 pm

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 | TOGGLE FULL SIZE
// 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!
techguy777
 
Posts: 6
Joined: Fri Sep 28, 2012 9:24 pm

Re: DS1307 Clock not Working

by adafruit_support_rick on Fri Sep 28, 2012 9:42 pm

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.

adafruit_support_rick
 
Posts: 12827
Joined: Tue Mar 15, 2011 11:42 am
Location: Buffalo, NY

Re: DS1307 Clock not Working

by techguy777 on Fri Sep 28, 2012 11:16 pm

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 3175 times
phpqCxC70PM.jpg
phpqCxC70PM.jpg (8.17 KiB) Viewed 3175 times
phpN6Gh2oPM.jpg
phpN6Gh2oPM.jpg (7.85 KiB) Viewed 3175 times
techguy777
 
Posts: 6
Joined: Fri Sep 28, 2012 9:24 pm

Re: DS1307 Clock not Working

by adafruit_support_bill on Sat Sep 29, 2012 4:56 am

Those photos are much too small to see any detail. Try sizing them to about 800x600
User avatar
adafruit_support_bill
 
Posts: 30796
Joined: Sat Feb 07, 2009 10:11 am

Re: DS1307 Clock not Working

by techguy777 on Sat Sep 29, 2012 12:21 pm

Here are the enlarged photos. I apologize about the poor quality.
Attachments
63750671fbb4a8f51348935611.jpeg
63750671fbb4a8f51348935611.jpeg (330.94 KiB) Viewed 3158 times
43650671f62ec0be1348935522.jpeg
43650671f62ec0be1348935522.jpeg (326.37 KiB) Viewed 3158 times
32350671f949ed091348935572.jpeg
32350671f949ed091348935572.jpeg (322.65 KiB) Viewed 3158 times
techguy777
 
Posts: 6
Joined: Fri Sep 28, 2012 9:24 pm

Re: DS1307 Clock not Working

by adafruit_support_bill on Sat Sep 29, 2012 9:58 pm

More light usually helps. Try near a window - or even outside.
User avatar
adafruit_support_bill
 
Posts: 30796
Joined: Sat Feb 07, 2009 10:11 am

Re: DS1307 Clock not Working

by techguy777 on Sun Sep 30, 2012 2:56 pm

Updated Pics. Thanks!
Attachments
IMG_0088.JPG
IMG_0088.JPG (320.85 KiB) Viewed 3125 times
IMG_0087.jpg
IMG_0087.jpg (314.77 KiB) Viewed 3125 times
IMG_0086.jpg
IMG_0086.jpg (354.41 KiB) Viewed 3125 times
techguy777
 
Posts: 6
Joined: Fri Sep 28, 2012 9:24 pm

Re: DS1307 Clock not Working

by adafruit_support_bill on Sun Sep 30, 2012 5:25 pm

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
adafruit_support_bill
 
Posts: 30796
Joined: Sat Feb 07, 2009 10:11 am

Re: DS1307 Clock not Working

by g.ragib on Fri Oct 26, 2012 10:50 am

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.
g.ragib
 
Posts: 4
Joined: Fri Oct 26, 2012 10:41 am

Re: DS1307 Clock not Working

by csabee on Sat Feb 23, 2013 5:09 pm

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 | TOGGLE FULL SIZE
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 | TOGGLE FULL SIZE
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!
csabee
 
Posts: 2
Joined: Sat Feb 23, 2013 5:02 pm

Re: DS1307 Clock not Working

by adafruit_support_rick on Sun Feb 24, 2013 11:06 am

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

adafruit_support_rick
 
Posts: 12827
Joined: Tue Mar 15, 2011 11:42 am
Location: Buffalo, NY

Re: DS1307 Clock not Working

by csabee on Tue Feb 26, 2013 6:42 am

No, this one is from ebay, but it has a similar breakout.
csabee
 
Posts: 2
Joined: Sat Feb 23, 2013 5:02 pm

Re: DS1307 Clock not Working

by adafruit_support_rick on Tue Feb 26, 2013 11:13 am

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

adafruit_support_rick
 
Posts: 12827
Joined: Tue Mar 15, 2011 11:42 am
Location: Buffalo, NY

Re: DS1307 Clock not Working

by ockeydockey on Tue May 13, 2014 8:41 pm

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.
ockeydockey
 
Posts: 4
Joined: Sat Jan 26, 2013 10:53 am

Re: DS1307 Clock not Working

by adafruit_support_rick on Wed May 14, 2014 6:42 am

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

adafruit_support_rick
 
Posts: 12827
Joined: Tue Mar 15, 2011 11:42 am
Location: Buffalo, NY