Arduino library for reading and setting date and time for the DS1307 Real-Time Clock IC
Java C++ C


DS1307 Arduino Library

If do you need to know date and time in your Arduino project, so you need a Real-Time Clock (or RTC)!

One of the most famous RTC ICs is DS1307, from Dallas Semiconductor. DS1307 uses I²C (or Two-Wire Interface - TWI) to communicate with Arduino. This library is just a layer above Wire library to make RTC easy to use.


Download the tarball, uncompress it and put the directory DS1307 inside your personal library folder (~/sketchbook/libraries/ -- on GNU/Linux) or in the Arduino-system library folder (/usr/share/arduino/libraries on GNU/Linux -- requires root access).


For now that are only 3 examples: SetDateHardcoded, SedDateSerial and ReadDate -- the names autoexplain. :-) Install the library and go to File -> Examples -> DS1307 -> (choose one example).


There is a RTC module with DS1307 sold by SparkFun - this library was tested only with this module.


    DS1307 RTC module (front and back) from SparkFun and Arduino connected to DS1307 RTC module using jumper wires and a breadboard.

Thanks To

The code of this library is based on RTC example and Daniel Gonçalves post at LusoRobótica Forum - thanks, guys!