Hardware Reference
In-Depth Information
scribed in Hack #22 , you don't need to do anything here. If you're running Pidora or
Occidentalis without a custom kernel, you also have everything you need need pre-
configured.
But if you're running a Raspbian instance running your kernel, you will need some
additional configuration to enable I2C support. Specifically, you need to run the fol-
lowing command:
$ su -c 'modprobe i2c-bcm2708'
To make that persistent, you will also want to edit /etc/modules and add these lines to
the end of the file:
i2c-bcm2708
i2c-dev
On any distro, you'll need to install some software to add a Python module for System
Management Bus (SMBus) support (you can think of SMBus as a stricter version of
I2C), the python-rpi , the I2C utilities, and the python-netifaces module (this is how
you will get the IP address information).
Pidora doesn't have a packaged version of python-smbus in release 18 (the current
release as of this writing), so we've included a RPM package for you in the topic's
GitHub repository.
On Pidora, run:
$ su -c 'yum install i2c-tools python-rpi.gpio python-netifaces -y'
$ su -c 'yum install rpihacks/i2c-tools-python-3.1.0-5.fc18.armv6hl.rpm --
nogpgcheck'
On Raspbian/Occidentalis, run:
$ su -c 'apt-get install python-dev python-rpi.gpio python-smbus i2c-tools
python-netifaces'
Run the Code
With this software installed, you can scan the I2C bus (bus 1) for the LCD Pi Plate:
$ su -c 'i2cdetect -y 1'
0 1 2 3 4 5 6 7 8 9 a b c d e f
00: -- -- -- -- -- -- -- -- -- -- -- -- --
10: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
20: 20 -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
30: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
40: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
50: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
 
Search WWH ::




Custom Search