Search This Blog

Thursday, April 7, 2016

Getting I2C to work on Rapsberry Pi

Recently been trying to get an I2C sensor to work on a Raspberry Pi.. found these articles very useful.

Two parts

Part 1) Turn on in BIOS

http://www.raspberrypi-spy.co.uk/2014/11/enabling-the-i2c-interface-on-the-raspberry-pi/

sudo raspi-config


In the advanced settings turn on I2C

Now complete the following steps :
  • Select “8 Advanced Options”
  • Select “A7 I2C”
  • Select “Yes”
The screen will ask if you want the interface to be enabled :
  • Select “Yes”
  • Select “Ok”
The screen will ask if you want the module to be loaded by default :
  • Select “Yes”
The screen will state the module will be loaded by default :
  • Select “Ok”
  • Select “Finish” to return to the command line
When you next reboot the I2C module will be loaded.

_______


Part TWO  - setup software

https://www.raspberrypi.org/forums/viewtopic.php?t=74763


Add this to /etc/modules and reboot

i2c-bcm2708
i2c-dev



sudo apt-get install python-smbus
sudo apt-get install i2c-tools



sudo i2cdetect -y 1