Enabling The I2C Port
You now use the raspbian config tool:
Select 'Advanced Options' and then select the relevant option.
Enabling The I2C Port On Old Raspbian Distributions
The I2C ports need to be enabled in Raspbian before they can be used.
Edit the modules file
sudo nano /etc/modules
Add these lines:
Exit and save the file
Now edit the modules blacklist file:
sudo nano /etc/modprobe.d/raspi-blacklist.conf
Add a '#' character to this line so it commented out:
Exit and save the file.
Finally install the I2C utilities:
sudo apt-get install python-smbus i2c-tools
Enter "sudo reboot" to restart the pi and now the I2C pins will be available to use.
We benefit hugely from resources on the web so we decided we should try and give back some of our knowledge and resources to the community by opening up many of our company’s internal notes and libraries through mini sites like this. We hope you find the site helpful.
Please feel free to comment if you can add help to this page or point out issues and solutions you have found, but please note that we do not provide support on this site. If you need help with a problem please use one of the many online forums.
7 years ago
If I attach a Sense HAT to the pi, can I still use I2C? Thank you.
6 years ago
With latest Jessie release, the raspi-config menu option is 5 Interfacing Options for enabling I2C, not 7 Advanced options.