Pages: 1 [2]   Go Down
Author Topic: DS1307 Real time clock on breadboard  (Read 49903 times)
0 Members and 2 Guests are viewing this topic.
Odense
Offline Offline
Jr. Member
**
Karma: 1
Posts: 60
Arduino rocks
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

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();
Logged

0
Offline Offline
Newbie
*
Karma: 0
Posts: 5
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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

London
Offline Offline
Sr. Member
****
Karma: 1
Posts: 330
Arduino rocks
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset


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

Gordon
Logged

0
Offline Offline
Newbie
*
Karma: 0
Posts: 5
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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... >smiley-sad

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

Offline Offline
God Member
*****
Karma: 1
Posts: 733
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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.
« Last Edit: July 24, 2010, 09:14:07 pm by Jeremy1998 » Logged

London
Offline Offline
Sr. Member
****
Karma: 1
Posts: 330
Arduino rocks
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset


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
Logged

0
Offline Offline
Newbie
*
Karma: 0
Posts: 8
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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.
Logged

Central MN, USA
Offline Offline
Tesla Member
***
Karma: 76
Posts: 7307
Phi_prompt, phi_interfaces, phi-2 shields, phi-panels
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

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.
« Last Edit: September 04, 2010, 08:56:30 pm by liuzengqiang » Logged


0
Offline Offline
Newbie
*
Karma: 0
Posts: 9
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

haha
Logged

0
Offline Offline
Sr. Member
****
Karma: 4
Posts: 262
bluesmokelabs.com
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

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

Lisbon, Portugal
Offline Offline
Full Member
***
Karma: 0
Posts: 152
Bow before me for I am root.
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

Isn't that missing two 22pF condenser on the crystal ?
Logged


0
Offline Offline
Sr. Member
****
Karma: 4
Posts: 262
bluesmokelabs.com
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

The ds1307 has internal capacitors.
Logged

Rome
Offline Offline
God Member
*****
Karma: 1
Posts: 993
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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

0
Offline Offline
Newbie
*
Karma: 0
Posts: 5
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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.
Logged

Pages: 1 [2]   Go Up
Jump to: