Home     All DIY Kits     All Expansion Boards     Accessories     Web Store     OEM/ODM     Contact
  Using I2C and Raspbian Wheezy on the Raspberry Pi  

This page details how to setup I2C support on the Raspbian “wheezy” image from http://www.raspberrypi.org/downloads

<1> Download the latest Raspbian “wheezy” image and burn to your SD Card following the instructions on http://elinux.org/RPi_Easy_SD_Card_Setup

<2> If you are using Raspian Linux 3.18 or later you need to go into the raspberry pi config utility and enable I2C.
pi@raspberrypi ~ $   sudo raspi-config

Select 8 Advanced Options and then  A7 I2C - Enable/Disable automatic loading. A prompt will appear asking Would you like the ARM I2C interface to be enabled?, select Yes, exit the utility and reboot your raspberry pi.

<3> Setting the Timezone

Select 4 Internationalisation Options and then  I2 - Change Timezone .

Select your geographic area then your country or city

<4> Once you have logged into your Raspberry Pi from the command line, run the following command to install i2c-tools:
pi@raspberrypi ~ $   sudo apt-get install python-smbus
                                          sudo apt-get install i2c-tools

<5> Enable I2C and SPI protocols. I2C and SPI protocols are turned off in the wheezy distro by default, so you will need to enable them by editing the file /etc/modprobe.d/raspi-blacklist.conf :
pi@raspberrypi ~ $   sudo nano /etc/modprobe.d/raspi-blacklist.conf

In the file you will see two lines, you need to disable the blacklisting of these by adding a # character before each line:
#blacklist spi-bcm2708
#blacklist i2c-bcm2708

Save your changes and exit the nano editor.

<6> Set the Raspberry Pi to start I2C automatically at boot by editing /etc/modules :
pi@raspberrypi ~ $   sudo nano /etc/modules

Use your cursor keys to move to the last line and add a new line and then add:

Save your changes by pressing Ctrl-x then Y.

<7> To avoid having to run the I2C tools at root add the ‘pi’ user to the I2C group:
pi@raspberrypi ~ $   sudo adduser pi i2c

<8> Next reboot the Raspberry Pi:
pi@raspberrypi ~ $   sudo reboot

All Rights Reserved