real time clock

hallo everybody! I'd like to build a clock with arduino, but I have some problems: I read online that the chip "ds1307" is commonly used, while someone uses a "PCF8593". could someone explin me what's the difference between these two, and which one should I choose?

(please notice that my knowledge in programming is quite basic, so I'd like to find also some code samples or at least hints for developing the clock)

Thanks a lot to whomever (or "whoever"?) is going to answer my questions Ale

They have different features, and they're from different manufacturers. The differences are probably not terribly important if you just want it to keep time, but it's still a good idea to check their features and figure out what you need or don't need.

As far as I know, they both use the I2C (Or Two-wire interface) that will use analog pins 4 and 5 on the Arduino. Until you know exactly which chip you're going to get, it's a little difficult to give you sample code, as I'd imagine the memory layout for each chip is different.

just google for the datasheets of both, there you will find the diffrences. If its only the clock you wanna build with no extra feautures at all you probably wanna check prices too and go for the one thats cheapest

PCF8593 http://www.nxp.com/acrobat_download/datasheets/PCF8593_3.pdf

DS1307 http://www.emesystems.com/pdfs/parts/DS1307.pdf

regards Bastiaan

thanks a lot guys!
I’ll have a look at the specs :slight_smile:
Ale

For a simple clock (which i building right now), the DS1307 seems to work just fine, there is an excellent library for it: http://www.arduino.cc/cgi-bin/yabb2/YaBB.pl?num=1191209057 literally plug and play,

also, check futurlec's RTC board:

http://www.futurlec.com/Mini_DS1307.shtml it's dirt cheap and worked perfectly.

Note that some extra features you can implement using the arduino (alarms, etc..) so so need to get a fancier RTC anyway, unless the clock is really complicated. Also, you may used the arduino EEPROM library to save some data for power out backup, but dont use it extensively since the number of write cycles is limited.

gilad.

Just glancing at the datasheets, I notice the PCF8593 takes a time base of 32,768 Hz, or 50 Hz. Presumably, the 50Hz is so you can use the electrical grid for timing instead of a crystal, but is there a 60 Hz model for North America?