Go Down

Topic: DS1307 Real time clock on breadboard (Read 52365 times) previous topic - next topic

alm7100

Shiwa, i think the year is only one byte like RTC.set(DS1307_YR,13); = 2013; You also need to set them in order like

Wire.beginTransmission(DS1307_I2C_ADDRESS);
Wire.send(0x00);
Wire.send(decToBcd(second));    // 0 to bit 7 starts the clock
Wire.send(decToBcd(minute));
Wire.send(decToBcd(hour));      // If you want 12 hour am/pm you need to set
                                  // bit 6 (also need to change readDateDs1307)
Wire.send(decToBcd(dayOfWeek));
Wire.send(decToBcd(dayOfMonth));
Wire.send(decToBcd(month));
Wire.send(decToBcd(year));
Wire.endTransmission();

Shiwa

alm 7100 thank you, I will try, if I have some time

GordonEndersby


Sorry, I hadnt seen the updates added to my original post.
I hadnt tried anything higher than 2010 on my setup.

Gordon

Shiwa

I used the next instructions:

 RTC.stop();
 RTC.set(DS1307_SEC,0);
 RTC.set(DS1307_MIN,03);
 RTC.set(DS1307_HR,21);
 RTC.set(DS1307_DOW,7);
 RTC.set(DS1307_DATE,1);
 RTC.set(DS1307_MTH,5);
 RTC.set(DS1307_YR,10);
 RTC.start();

it works fine   ;D , tried again today to be sure..

----------->  BUT if I change :

 RTC.stop();
 RTC.set(DS1307_SEC,0);
 RTC.set(DS1307_MIN,03);
 RTC.set(DS1307_HR,21);
 RTC.set(DS1307_DOW,7);
 RTC.set(DS1307_DATE,1);
 RTC.set(DS1307_MTH,5);
 RTC.set(DS1307_YR,13);   //<--------------- 13 !!
 RTC.start();

I see on the display the year 2000 !!! not 2013... >:(

Perhaps this sort of high level instructions does not work all the way ?

Jeremy1998

#19
Jul 25, 2010, 04:09 am Last Edit: Jul 25, 2010, 04:14 am by Jeremy1998 Reason: 1
From the retail boards that I've seen, there is normally a capacitor (Looks to be 0.1uF.), and two resistors (On the Ladyada version they are 2.2K). What does this do?

From what I understand the resistors are in line with the serial clock and serial data. I also understand that the cap is for power smoothing? I don't know if it's on the battery line, or the regurlar supply... Can someone please confirm or correct this?

EDIT: From what I understand from the datasheet, the resistors are pull up resistors that go from VCC (+5V) to the serial data and the serial clock pins.

GordonEndersby


I havnt used the external pullup resistors. The internal ones seem to do the job.
The capacitor seems to be for smoothing but again I havnt used one as im powering it from the arduino which already has a good power supply.

Gordon

Raavy

Hi All,

I tried to build the same using the DS1307 on a general purpose PCB, but since i did not have the 32.768 crystal, I had to use the little crystal from a kids digital watch.

Everything worked fine, but i do see that there is a offset of ~ +10 min / day in the clock.


Do you think it could be a issue with the crystal I am using ?

Also the refresh rate for the clock read (RTC.read) command is 500ms.

I will try with the correct crystal and update if that worked.

liudr

#22
Sep 05, 2010, 03:38 am Last Edit: Sep 05, 2010, 03:56 am by liuzengqiang Reason: 1
Something is weird. Here is what I got when I connected a 3V coin battery.
36 29 20 1 45 45 2165
37 29 20 1 4 9 2010
38 29 20 1 4 9 2010
0 0 0 0 0 0 2000
0 0 0 0 0 0 2000
41 29 20 1 4 9 2010
42 29 20 1 4 9 2010
0 0 0 0 0 0 2000
0 0 0 0 0 0 2000
45 29 20 1 4 9 2010
46 29 20 1 4 9 2010
0 0 0 0 0 0 2000
48 29 20 1 4 9 2010

If I disconnect the 3V battery I get normal results. Any suggestions? I found the library from a later page on that forum topic and should be a good version.
Thanks.


thegeekway

liudr, I have the same issue, theres a thread a few pages back.  I never did find the cause.

fuh

Isn't that missing two 22pF condenser on the crystal ?
http://creativecommons.org/licenses/by-nc-sa/3.0/

thegeekway

The ds1307 has internal capacitors.

jumpjack

Why isn't the onboard crystal oscillator suitable for a realtime clock?  :-?

Shiwa

Prob, energy consumption. The clcok is always on, thats the reason the freq is low as possible for cristals. Energy consumption is related to freq.

Go Up