Real Time Clock Module Hookup Guide

Pages
Contributors: jimblom
Favorited Favorite 6

Introduction

The SparkFun Real Time Clock Module is a simple breakout board for the DS1307 real-time clock (RTC). It can accurately keep track of seconds, minutes, hours, days, months, and years for almost a decade, so your microcontroller doesn't have to. It's the perfect component for clocks, calendars, or any other time-keeping project.

SparkFun Real Time Clock Module

SparkFun Real Time Clock Module

BOB-12708
$17.50
18

The IC on the SparkFun RTC Module is the Maxim DS1307. It features a two-wire I2C interface and even includes a square wave output pin. Plus, with a battery backup, the DS1307 can keep time for almost a decade or more (typically 17 years)!

This tutorial serves as a general introduction to the DS1307 and the SparkFun Real Time Clock Module. It covers both the hardware and firmware requirements of the breakout -- documenting both example wiring and Arduino code for the chip.

Suggested Materials

You'll need a handful of extra parts to get the RTC Module up-and-running. Below are the components used in this tutorial, if you want to follow along.

A microcontroller that supports I2C is required to communicate with the DS1307 and relay the RTC's data to the user. The SparkFun RedBoard or Arduino Uno are popular options for this role, but just about any microcontroller development board should work. (The firmware examples use an Arduino library, if that serves as any extra motivation to use an Arduino.)

Arduino Pro Mini 328 - 5V/16MHz

Arduino Pro Mini 328 - 5V/16MHz

DEV-11113
$10.95
140
Pro Micro - 5V/16MHz

Pro Micro - 5V/16MHz

DEV-12640
$19.50
82
Arduino Uno - R3

Arduino Uno - R3

DEV-11021
$27.60
138

SparkFun RedBoard - Programmed with Arduino

DEV-12757
127 Retired
5V Recommended! The DS1307 should nominally be powered at a voltage around 5V. It doesn't support 3.3V. If your development board runs at 3.3V, you may need to do some level-shifting to get the module communicating.

Four or five jumper wires and a breadboard help interface the RTC Module to your Arduino. To insert the breakout into the breadboard, you'll need to solder headers to the pins. (Don't forget a soldering iron and solder!)

Breadboard - Self-Adhesive (White)

Breadboard - Self-Adhesive (White)

PRT-12002
$5.50
48
Break Away Headers - Straight

Break Away Headers - Straight

PRT-00116
$1.75
20
Soldering Iron - 30W (US, 110V)

Soldering Iron - 30W (US, 110V)

TOL-09507
$10.95
7

Jumper Wires Premium 4" M/M - 20 AWG (30 Pack)

PRT-13870
Retired

The RTC Module does include a 12mm Coin Cell Battery. You shouldn't need one for a long while, but if you want to stock up on the lithium batteries, the option is there.

Suggested Reading

The SparkFun RTC Module is a very beginner-friendly breakout board. There are, however, still a few concepts you should be familiar with. If any of the tutorial titles below sound foreign to you, consider giving them a look-through:

How to Solder: Through-Hole Soldering

This tutorial covers everything you need to know about through-hole soldering.

Installing an Arduino Library

How do I install a custom Arduino library? It's easy! This tutorial will go over how to install an Arduino library using the Arduino Library Manager. For libraries not linked with the Arduino IDE, we will also go over manually installing an Arduino library.

What is an Arduino?

What is this 'Arduino' thing anyway? This tutorials dives into what an Arduino is and along with Arduino projects and widgets.

I2C

An introduction to I2C, one of the main embedded communications protocols in use today.