November 6, 2010

RTC (Real Time Clock) for Arduino

This is a Real Time Clock (RTC) realization for Arduino, based on Dallas DS1307 common and affordable chip.

References for this implementation are this excellent tutorial from Adafruit, and this excellent DS1307 library.

This is the schematic of the circuit realization on a stripboard:

This is another schema for a minimal realization on a stripboard:

It takes into account the recommendations in the DS1307 datasheet for crystal layout:

And here is the realization sequence on the stripboard:

My battery holder is for CR2016 or CR2032 batteries:

Here's the finished stripboard with the battery in place:

This is how it is intended to be connected directly to the Arduino board (powered directly from Arduino analog pins as suggested by Adafruit tutorial):

Here's the board snapped into the Arduino one:

And here's a detail of the connection:

To configure the RTC board, I've used the following sketch, derived from an example from the RealTimeClockDS1307 library by David H. Brown modified to be compatible with the layout suggested by Adafruit to power the RTC directly from the Arduino Analog pins. Through this example it's easy to configure all RTC values and parameters and to see how it works:
(compiled with Arduino IDE 0022)

This is a test on the SQW/OUT pin of the RTC board, powering the board and connecting a LED+resistor to that pin (it will flash following DS1307 configuration, in my case once per second):

it could be a useful trigger for some project...

UPDATED: here's another (smaller) realization moving the battery holder: