If you already have a working Raspberry Pi Linux installation, you can skip ahead.
Boot your Raspberry Pi up with a monitor and keyboard and your newly-written SD card. You should be greeted with the raspi-config screen.
Run expand_rootfs, change the overscan if there are black bars around the edge of the display, and make sure the ssh server is running by default then hit finish and reboot. Changing your password is also recommended, and you may find it useful to enable “Boot to Desktop”.
You can do the rest via ssh if you wish: the IP address will be shown at bootup.
Log in (username: pi, password: raspberry). First let’s do an update of the system with:
sudo apt-get update && sudo apt-get upgrade
Installing extra packages
Now let’s install some of the software packages we need to access external devices. In a terminal (Start > Accessories > LXTerminal):
sudo apt-get install python-smbus ipython bluetooth bluez-utils \ python-cwiid python-scipy python-numpy python-pygame \ python-setuptools libsdl-dev
Installing custom libraries
Download our custom RPi.GPIO, i2c and image processing libraries:
Please note: these libraries were written for the original Raspberry Pi models (Rev 1). There have since been a number of revisions, and the numbering of pins varies from model to model. Please see here for an up-to-date guide.
wget http://www.cl.cam.ac.uk/projects/raspberrypi/tutorials/robot/resources/RPi.GPIO-0.3.1a.zip unzip RPi.GPIO-0.3.1a.zip cd RPi.GPIO-0.3.1a sudo python setup.py install cd .. wget http://www.cl.cam.ac.uk/projects/raspberrypi/tutorials/robot/resources/i2c.py sudo mv i2c.py /usr/local/lib/python2.7/dist-packages/i2c.py wget http://www.cl.cam.ac.uk/projects/raspberrypi/tutorials/robot/resources/imgproc.zip unzip imgproc.zip cd library sudo make install cd ..
We need to have the i2c modules loaded by default so remove them from the blacklist by opening the blacklist file:
sudo nano /etc/modprobe.d/raspi-blacklist.conf
and commenting out (insert
# at the beginning of) the following lines:
blacklist spi-bcm2708 blacklist i2c-bcm2708
Then save and quit and add these lines to the /etc/modules file (
sudo nano /etc/modules):
i2c-bcm2708 spi-bcm2708 i2c-dev
Make the Pi’s Bluetooth discoverable on startup by opening /etc/rc.local and adding the following line before
hciconfig hci0 piscan
To allow us to access i2c from userspace, add ourselves to the i2c group:
sudo adduser $USER i2c