DS1307 RTC problem setting/reading date:time
Moderators: adafruit_support_bill, adafruit

DS1307 RTC problem setting/reading date:time

by sianirose on Fri Dec 31, 2010 7:09 pm

Hi All,

I love my Arduino for controlling servo motors, LEDs, etc. I have used two different Arduinos and two different DS1307s, so believe this is not a hardware problem.

However, I cannot get it to set the date or read the time on a DS1307 RTC. On my mac, I've loaded the RTCLib.h into the right place, open the ds1307 script, which compiles, then loads into the board, and runs. The RTC.isrunning() says it is running, but I get the following back.

2000/0/0 0:0:0

Even when I set the date using RTC.adjust(DateTime(__DATE__, __TIME__)); I get the same:

2000/0/0 0:0:0

Is there some pin that I have to set and turn HIGH or LOW first? Also, is there a different call for setting the time under MacOSX on my Macintosh? Could it be the __DATE__ and __TIME__ are not valid in MacOSX?

Please send me some ideas.

Thank you,
Mike
sianirose
 
Posts: 3
Joined: Fri Dec 31, 2010 6:41 pm

Re: DS1307 RTC problem setting/reading date:time

by sianirose on Fri Dec 31, 2010 9:36 pm

Also, am I being ignorant here, by literally using the strings "__DATE__" and __TIME__"?

Thanks,
Mike
sianirose
 
Posts: 3
Joined: Fri Dec 31, 2010 6:41 pm

Re: DS1307 RTC problem setting/reading date:time

by stephanie on Fri Dec 31, 2010 9:57 pm

Do you have the DS1307 wired up correctly to your Arduino? And do you have a backup battery wired into the DS1307?

In my (admittedly limited) experience, the results you are getting match what I get if I forget to actually hook my RTC up to the arduino. Or if it's not hookedup right, i.e. one wire is loose or that sort of thing.
User avatar
stephanie
 
Posts: 295
Joined: Sat Dec 11, 2010 12:17 am
Location: Canada

Re: DS1307 RTC problem setting/reading date:time

by tronixstuff on Fri Dec 31, 2010 10:35 pm

Hello Mike
If you haven't already seen it, adafruit have a good RTC library tutorial here - http://www.ladyada.net/learn/breakoutplus/ds1307rtc.html
Or if you are interested in another way that doesn't use the library, I have written a short tutorial on how to use the DS1307 with Arduino that may be of interest -http://wp.me/pQmjR-fm
electronics, Arduino and DIY website - http://tronixstuff.com - Order my new book at http://www.arduinoworkshop.com
User avatar
tronixstuff
 
Posts: 49
Joined: Sat Mar 20, 2010 8:59 am
Location: Melbourne, Australia

Re: DS1307 RTC problem setting/reading date:time

by sianirose on Mon Jan 03, 2011 3:06 pm

Thank you all for your direction. You gave me the direction to consult with a real electrical person and I did have the connections incorrectly wired. Software - I can handle, wiring - I have no idea. All is working now and I'm very happy!!

Thanks,
Mike
sianirose
 
Posts: 3
Joined: Fri Dec 31, 2010 6:41 pm