Wiring the RTC

To keep costs low, the Raspberry Pi does not include a Real Time Clock module. Instead, users are expected to have it always connected to WiFi or Ethernet and keep time by checking the network. Since we want to include an external module, we'll have to wire one up. We'll go with the easy-to-use and low-cost DS1307. To make the job really easy, we'll use the the Adafruit DS1307 RTC Breakout Board Kit - it comes with all the parts you need, even a coin battery!

The Kit does require a little light soldering. In theory you could use all the parts and build them onto a breadboard, but the coin holder is a little difficult since its not breadboard-friendly, so please go ahead and build the kit.

When building the kit, leave out the 2.2KΩ resistors - by leaving them out, we force the RTC to communicate at 3.3V instead of 5V, which is better for the Pi!
The diagrams below show the 2.2KΩ resistors in place - but please remove them either by not soldering them in or clipping them out if you did solder them in! This way, we'll use the Pi's 1.8K pull-up resistors to 3.3V

Wiring is simple:

  1. Connect VCC on the breakout board to the 5.0V pin of the Pi
  2. Connect GND on the breakout board to the GND pin of the Pi
  3. Connect SDA on the breakout board to the SDA pin of the Pi
  4. Connect SCL on the breakout board to the SCL pin of the Pi


DONT FORGET TO POWER IT FROM 5V - THIS IS FINE AND SAFE FOR THE PI - JUST MAKE SURE TO REMOVE THE 2.2K PULLUPS AS MENTIONED IN THE LARGE RED BOX UP ABOVE TO KEEP THE I2C PINS AT 3.3V LOGIC LEVELS

Set up I2C on your Pi

You'll also need to set up i2c on your Pi, to do so, check out our tutorial on Raspberry Pi i2c setup and testing at http://learn.adafruit.com/adafruits-raspberry-pi-lesson-4-gpio-setup/configuring-i2c

Reboot once you've done that with sudo reboot

Verify Wiring (I2C scan)

Verify your wiring by running sudo i2cdetect -y 1 at the command line, you should see ID #68 show up - that's the address of the DS1307!

If you have an older Pi 1, you will have to run sudo i2cdetect -y 0 as the I2C bus address changed from 0 to 1

Once you have the Kernel driver running, i2cdetect will skip over 0x68 and display UU instead, this means its working!
Last updated on 2016-04-29 at 11.30.16 PM Published on 2012-08-31 at 01.19.59 PM