Raspberry Pi

These installation instructions are based on the latest 2012-09-18-wheezy-raspbian.zip image. Alternatively you can use Occidentalis, which has already the drivers activated.

I2C installation

The 2012-09-18 image contains already a Linux kernel version and the required I2C driver module, but it is not loaded as default when booting the Raspberry Pi, because it will reserve the GPIO0 und GPIO1 pins for I2C usage (see this page for the positions of the pins), which then can't be used for normal GPIO anymore after loading the driver (but you can unload it to revert it). For manual adding the driver after boot, you can execute these commands as root:

modprobe i2c-bcm2708
modprobe i2c-dev

If you want to load the driver automaticly each time the Raspberry Pi starts, edit the file /etc/modprobe.d/raspi-blacklist.conf as root and comment out the i2c-bcm2708 blacklist entry by adding a "#" in front of it (or delete the line), e.g. like this:

sudo nano /etc/modprobe.d/raspi-blacklist.conf 
#blacklist i2c-bcm2708

Then edit the file "/etc/modules" and add a new line "i2c-dev" (without the quotes). After reboot the driver is automaticly loaded and there will be the two device files /dev/i2c-0 and /dev/i2c-1. You can detect attached I2C devices with "i2cdetect -l" (you need to install the I2C tools for it once: "sudo apt-get install i2c-tools". If you want to use it from Python scripts, you need the I2C Python library: "sudo apt-get install python-smbus".

W1 driver installation for one-wire bus support

To load the driver manually, use "modprobe w1-gpio". To load it automaticly at startup, add a new line "w1-gpio" (without the quotes) to the file "/etc/modules". Your attached one-wire devices will be at visible at "/sys/bus/w1/devices/", e.g. use "cat /sys/bus/w1/devices/22-0000001d84f2/w1_slave" to show the temperature of an attached DS18B20 device (the "22-0000001d84f2" part is the unique address of the device and is different for your device). The one-wire pin is GPIO4.


11. November 2012, Frank Buß