Reading from a RTC chip with Arduino Uno

Hi
I have connected my arduino Uno to a RTC chip with I2C .
However I am not sure as to how to read the clock time .
Would someone tell me how to go about it ?
The RTC i am using is http://uk.farnell.com/maxim-integrated-products/ds1307z/rtc-serial-64x8-smd-1307-soic8/dp/9726322?Ntt=9726322

http://playground.arduino.cc/Main/InterfacingWithHardware#time

Try a library under DS1307.

Just checking you have the required external 32.768kHz crystal for that RTC?

Hi liudr ,
Thanks for the link .
cheers .

Have you looked in the playground for the DS1307?
http://playground.arduino.cc/Code/time

Alternately, read the datasheet and just send some simple commands yourself, is not hard.

The chip needs a 32.768KHz crstal connected, 3V battery for time maintenance when power is out, and 4.7K pullup resistors on the SCL & SDA lines.

Hi ,
Thanks for the suggestion . I have built the board and can successfully read time , day etc from the RTC chip using the exact code given in this link.
http://combustory.com/wiki/index.php/RTC1307_-_Real_Time_Clock
However I am not able to make the RTC to run with the battery back up alone and the time gets reset when I remove the main power.
How would I go about fixing this ?

Show us in a hi-res picture how you hooked up the battery. Are you sure the battery has charge in it?

Hi liudr ,
Realised I hooked up the battery wrong . Apologies . Thanks for your time .
Regards
Anish

anishh2003:
Hi liudr ,
Realised I hooked up the battery wrong . Apologies . Thanks for your time .
Regards
Anish

That was easy enough fix :slight_smile: