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.
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 :
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 :
- Enabling The I2C Interface On The Raspberry Pi
- How To Use A MCP23017 I2C Port Expander With The Raspberry Pi – Part 1
- How To Use A MCP23017 I2C Port Expander With The Raspberry Pi – Part 2
- How To Use A MCP23017 I2C Port Expander With The Raspberry Pi – Part 3
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 :
- Enabling The SPI Interface On The Raspberry Pi
- Analogue Sensors On The Raspberry Pi Using An MCP3008
- Using A Joystick On The Raspberry Pi Using An MCP3008
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 :