These are the steps to enable I²C on Raspbian after downloading the new Raspbian “wheezy” image.
Add i2c-dev and i2c-bcm2708 to /etc/modules.
pi@raspberrypi ~ $ cat /etc/modules # /etc/modules: kernel modules to load at boot time. # # This file contains the names of kernel modules that should be loaded # at boot time, one per line. Lines beginning with "#" are ignored. # Parameters can be specified after the module name. # snd-bcm2835 i2c-dev i2c-bcm2708 pi@raspberrypi ~ $
Install i2c-tools
pi@raspberrypi ~ $ sudo apt-get install i2c-tools Reading package lists... Done Building dependency tree Reading state information... Done Suggested packages: libi2c-dev python-smbus The following NEW packages will be installed: i2c-tools 0 upgraded, 1 newly installed, 0 to remove and 0 not upgraded. Need to get 0 B/58.9 kB of archives. After this operation, 223 kB of additional disk space will be used. Selecting previously unselected package i2c-tools. (Reading database ... 56011 files and directories currently installed.) Unpacking i2c-tools (from .../i2c-tools_3.1.0-1_armhf.deb) ... Processing triggers for man-db ... Setting up i2c-tools (3.1.0-1) ... pi@raspberrypi ~ $
Add pi to the group i2c if you want to access i2c without sudo.
pi@raspberrypi ~ $ sudo usermod -a -G i2c pi
Use i2cdetect to see if there are devices connected on the i²C-bus.
pi@raspberrypi ~ $ i2cdetect 0 WARNING! This program can confuse your I2C bus, cause data loss and worse! I will probe file /dev/i2c-0. I will probe address range 0x03-0x77. Continue? [Y/n] y 0 1 2 3 4 5 6 7 8 9 a b c d e f 00: -- -- -- -- -- -- -- -- -- -- -- -- -- 10: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 20: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 30: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 40: -- -- -- -- -- -- -- -- 48 -- -- -- -- -- -- -- 50: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 60: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 70: -- -- -- -- -- -- -- -- pi@raspberrypi ~ $