Set up I2C on your Pi

You'll also need to set up i2c on your Pi, to do so, run sudo raspi-config and under Advanced select I2C and turn it on.

For more details, 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 apt-get install python-smbus i2c-tools

to install the helper software and then sudo i2cdetect -y 1 at the command line, you should see ID #68 show up - that's the address of the DS1307, PCF8523 or DS3231!

If you have a much 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!

This guide was first published on Aug 31, 2012. It was last updated on Aug 31, 2012.

This page (Set Up & Test I2C) was last updated on Oct 14, 2016.

Text editor powered by tinymce.