How to configure I2C on Raspbian Wheezy

1First install the i2c-tools:
apt-get install i2c-tools
2Next SPI and I2C is blacklisted from modprobe by default. Edit /etc/modprobe.d/raspi-blacklist.conf with vi or nano and comment out (place # as first character on line):
blacklist i2c-bcm2708
3To insure modules are loaded at boot add the following lines to /etc/modules:
4Optional: If you are going to access the I2C from users other then root create a file called /etc/udev/rules.d/99-i2c.rules with the following line:
SUBSYSTEM=="i2c-dev", MODE="0666"
This will allow access from every user. To allow access only from a specific group:
SUBSYSTEM=="i2c-dev", GROUP="input", MODE="0666"
5Reboot the pi by issuing:
6Verify device files are available:
ls /dev/i2c*
7Optional: If you are using I2C with Python,  you will need the smbus python library as it is not installed by default:
apt-get install python-smbus
8Once you have the I2C device attached, you can determine the address by running:
i2cdetect -y <port>
Replace <port> with 0 for the first version of the Raspberry Pi board and 1 for the second.
Posted in Peripherals, Raspberry Pi

Have a Question? I read and respond.

Your email address will not be published. Required fields are marked *


* Copy This Password *

* Type Or Paste Password Here *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code class="" title="" data-url=""> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong> <pre class="" title="" data-url=""> <span class="" title="" data-url="">