http://www.runeaudio.com/forum/how-to-enable-i2c-t1287.html
Re: How to enable I2C
OK, I finally got it to work, thanks to @hairybiker for his help! So, here are the steps for Raspberry Pi 2:
1) Open /boot/config.txt with:
- CODE: SELECT ALL
nano /boot/config.txt
Find this:
- CODE: SELECT ALL
#device_tree_param=i2c_arm=on
And uncomment it (remove the # in front of this line).
2) Open /boot/cmdline.txt with:
- CODE: SELECT ALL
nano /boot/cmdline.txt
And at the end of the file add this:
- CODE: SELECT ALL
bcm2708.vc_i2c_override=1
3) Open /etc/modules-load.d/raspberrypi.conf with:
- CODE: SELECT ALL
nano /etc/modules-load.d/raspberrypi.conf
And add this at the end:
- CODE: SELECT ALL
i2c-bcm2708
i2c-dev
Install i2c-tools with:
- CODE: SELECT ALL
pacman -S i2c-tools
Turn off your Pi2, connect your I2C device (for example LCD display), turn on your Pi2 and run this:
- CODE: SELECT ALL
i2cdetect -y 1
You should get something like:
- CODE: SELECT ALL
[root@runeaudio ~]# i2cdetect -y 1
0 1 2 3 4 5 6 7 8 9 a b c d e f
00: -- -- -- -- -- -- -- -- -- -- -- -- --
10: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
20: -- -- -- -- -- -- -- 27 -- -- -- -- -- -- -- --
30: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
40: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
50: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
60: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
70: -- -- -- -- -- -- -- --
You can see my LCD at address 27.
sudo adduser www-data i2c
sudo shutdown now –r