Using a Real Time Clock with an Arduino

A Real Time Clock, or RTC, is a small computer chip that uses a crystal to keep time. It can output that time as a string of numbers. This post will explain how you can use a RTC with the Arduino, and implement this data into your sketches.

The RTC I use in this article is produced by sparkfun. To wire it up, connect the SDA pin to analogue pin 4 on the Arduino, the SCL pin to analogue pin 5, the gnd pin to the ground pin on the Arduino, and the 5v pin to the 5v supply from your Arduino. Whilst it is possible to use this clock without a library, it is much simpler to use the RTC library produced by JeeLabs.

Using the example code in the library, you can take readings from the clock, and reset its’ time based on your computer time.

*This post comes as part of a series of posts, which will lead to the creation of an LED ring clock.