Pi GPIO Hardware Interfaces Update Feb 2015


The Pi has always supported 1-wire, I2C and SPI interfaces via the GPIO header. These allow various devices to be connected to the Pi and controlled via software. In the recent update to Raspbian some major changes were introduced which changed the way these interfaces are enabled.

The exact details of the change are discussed in the “I2C, SPI, I2S, LIRC, PPS, stopped working? Read this.” forum post over at the official site.

A number of my tutorials used these interfaces and the changes rendered them out of date. Luckily I still had the breadboards I used to develop most of these so I decided to update my posts while testing against a Pi Model B+ and Pi 2 Model B.

1-wire, i2c and SPI testing

DS18B20 Temperature Sensor1-wire Interface

This interface is useful for connecting DS18B20 temperature sensors. Enabling it requires a minor edit to the “/boot/config.txt” file and two modprobe commands.

Here are the posts that refer to the 1-wire interface :

MCP23017 IO Expander ExampleI2C Interface

Enabling I2C requires an edit to the “/boot/config.txt” file (or use raspi-config to do it for you) as well as an edit to the “/etc/modules” file.

Here are the posts that refer to the I2C interface :

MCP3008 and Joystick CircuitSPI Interface

Enabling SPI just requires an edit to the “/boot/config.txt” file (or use raspi-config to do it for you).

Here are the posts that refer to the SPI interface :

General GPIO

I use the excellent RPi.GPIO library for all my other GPIO inputs and outputs. Currently this doesn’t work on the latest Raspbian. In order to fix this while we wait for an updated Raspbian release you can manually update the library to v0.5.10 from the command line using my Install RPi.GPIO Python Library guide.

wget https://pypi.python.org/packages/source/R/RPi.GPIO/RPi.GPIO-0.5.10.tar.gz
tar -xvf RPi.GPIO-0.5.10.tar.gz
cd RPi.GPIO-0.5.10
sudo python setup.py install
cd ~
sudo rm -rf RPi.GPIO-0.*

This should get your Python scripts back on track.

Still To Do

When I get the chance I will be taking a look at the PiFace Control and Display board to check it still works ok :


Leave A Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.