Note to the reader: Code blocks beginning with a $ are commands to be run on a RPI Rasbian shell.
- Enable I2C support
- add i2c-dev to the end of /etc/modules
- comment out (with a #) the line that says blacklist i2c-bcm2708 in /etc/modprobe.d/raspi-blacklist.conf
- Enable the current user to access I2C hardware
- install i2c-tools (includes i2cdetect and adds the i2c group) with:
$ sudo apt-get update && sudo apt-get install i2c-tools - add the current user to the i2c group with: $ sudo adduser <USER> i2c where <USER> is the username to add to the i2c group
- install i2c-tools (includes i2cdetect and adds the i2c group) with:
- Get the chip-address on the bus of a connected device
$ i2cdetect -y i2cbusWhere:- i2cbus is the # bus; RPIv2 bus=1; RPIv1 bus=0
- Get the data on the I2C bus:
$ i2cget -y i2cbus chip-address [data-address [mode]]Where:- i2cbus is the # bus, for us it was 1
- chip-address is the value returned from i2cdetect (0x48)
- data-address is the value of the data in the device to read, you'll have to find this value in the datasheet (0x00)