DS1307 Date and Time Will Not Reset

For Adafruit customers who seek help with microcontrollers

Moderators: adafruit_support_bill, adafruit

Please be positive and constructive with your questions and comments.
Locked
Maxxim
 
Posts: 3
Joined: Fri May 04, 2012 9:28 am

DS1307 Date and Time Will Not Reset

Post by Maxxim »

I purchased and assembled the “DS1307 Real Time Clock breakout board kit”. The kit worked beautifully for about a week and then it started returning a very strange time and date (see exhibit #1). I pulled the battery for about 1 min hoping that it would return to the beginning time and date but instead it is returning the time and date in exhibit #2. It is also no longer incrementing time. Does anyone have a clue how to reset the clock?


Exhibit #1
2165/165/165 165:165:85
since 1970 = 1396050385s = 16157d
now + 7d + 30s: 2014/4/4 23:46:55


Exhibit #2 (notice that the time is not incrementing).
RTC is NOT running!
2165/165/165 165:165:85
since 1970 = 1396050385s = 16157d
now + 7d + 30s: 2014/4/4 23:46:55

2165/165/165 165:165:85
since 1970 = 1396050385s = 16157d
now + 7d + 30s: 2014/4/4 23:46:55

I did un-remark the time setting command "RTC.adjust(DateTime(__DATE__, __TIME__));" to set the clock to compile time. No luck.

Code used to set the clock:

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

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

Re: DS1307 Date and Time Will Not Reset

Post by adafruit_support_bill »

Post photos of your soldering and connections. This is a symptom of a bad connection somewhere.

Maxxim
 
Posts: 3
Joined: Fri May 04, 2012 9:28 am

Re: DS1307 Date and Time Will Not Reset

Post by Maxxim »

I have two pictures ready. One of the bottom and one of the top. I can't upload them here (invalid file error) so the links below will take you to them.

https://picasaweb.google.com/1057769545 ... directlink

This was my first soldering job but it did work for about 1 week before the problem developed.

Thanks in advance for your help.

John

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

Re: DS1307 Date and Time Will Not Reset

Post by adafruit_support_bill »

The 5v and SDA pins on top need a bit more solder. The back-side photo is a little too dark to see well, but look closely at the joints and re-touch any that are not smooth and shiny. A 'frosted' appearance indicates a cold joint and they can become intermittent over time.

Also, did you remember to put a blob of solder under the battery clip? It is needed to assure good contact with the battery.

Maxxim
 
Posts: 3
Joined: Fri May 04, 2012 9:28 am

Re: DS1307 Date and Time Will Not Reset

Post by Maxxim »

I will touch them up and take new pictures and post them. I did add the solder to the battery area as well. I will include a picture of that as well.

buckidge
 
Posts: 1
Joined: Fri Oct 12, 2012 12:49 pm

Re: DS1307 Date and Time Will Not Reset

Post by buckidge »

I second this as a solution to the problem. I just got done re-soldering my connections and this fixed the exact same problem as the original post described.

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

Return to “Microcontrollers”