Voting resources, early voting, and poll worker information - VOTE. ... Adafruit is open and shipping.
0

Imprecise DS1307
Moderators: adafruit_support_bill, adafruit

Please be positive and constructive with your questions and comments.

Imprecise DS1307

by igordashaar on Wed May 14, 2014 10:44 am

Hey everyone,
I've bought 3 Adafruit RTC Breakout board kits (http://www.adafruit.com/products/264#te ... ils-anchor). Now I have two questions.
First Question: is it normal that they are pretty imprecise? After just one day I have a difference of 8 seconds in two of them. The time was set via Arduino Micro using the Adafruit example Code and they are store in the same place (meaning equal humidity and temperature)
And my second question: is there a possibility to get rid of the uploading delay when setting the time via Arduino?. My PC needs about 10 seconds to compile and upload an Arduino sketch. So every time I try to set the time using
Code: Select all | TOGGLE FULL SIZE
RTC.adjust(DateTime(__DATE__, "__TIME__"));

I have a delay of 10 seconds. Alternatively I tried doing something like this:
Code: Select all | TOGGLE FULL SIZE
RTC.adjust(DateTime(__DATE__, "19:27:10"));

it works fine (for maybe +- 1 second).

Thanks in advance for your help
igor
igordashaar
 
Posts: 2
Joined: Wed May 14, 2014 10:32 am

Re: Imprecise DS1307

by adafruit_support_rick on Wed May 14, 2014 5:58 pm

How are you reporting the time from the module? Can you post your sketch?

The Time library has a sketch that works with Processing to synchronize your clock with a computer
http://playground.arduino.cc/Code/time

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

Re: Imprecise DS1307

by igordashaar on Mon May 19, 2014 6:41 am

Thanks for your reply,
I didn't know about the Arduino Time library, instead I used the "RTClib.h" suggested here: https://learn.adafruit.com/ds1307-real- ... no-library

the relevant part of the sketch looks like this:

Code: Select all | TOGGLE FULL SIZE
#include "RTClib.h"
void setup() {

  //for RTC, initialise I2C and RTC
  Wire.begin();
  RTC.begin();
}

void loop(){
  now = RTC.now();
  writeDateTime();

}



Code: Select all | TOGGLE FULL SIZE
void writeDateTime() {
  if (now.day() < 10) {
    Serial.print("0");
  }
  Serial.print(now.day(), DEC);
  Serial.print(".");
  if (now.month() < 10) {
    Serial.print("0");
  }
  Serial.print(now.month(), DEC);
  Serial.print(".");
  Serial.print(now.year(), DEC);
  Serial.print(" ");
  if (now.hour() < 10) {
    Serial.print("0");
  }
  Serial.print(now.hour(), DEC);
  Serial.print(":");
  if (now.minute() < 10) {
    Serial.print("0");
  }
  Serial.print(now.minute(), DEC);
  Serial.print(":");
  if (now.second() < 10) {
    Serial.print("0");
  }
  Serial.print(now.second(), DEC);
  Serial.print(" ");

}
igordashaar
 
Posts: 2
Joined: Wed May 14, 2014 10:32 am

Re: Imprecise DS1307

by adafruit_support_rick on Mon May 19, 2014 10:20 am

The DS1307 is not a temperature-compensated RTC, but it should be a lot better than 8 seconds/day.

Is it just one of the three that is off? Do the other two track pretty closely?

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

Please be positive and constructive with your questions and comments.