Step 3: Install the code

Get dependencies, download the code, and set up your AirPi properly.

« Step 2 Step 4 »

Install required dependencies


To use the code we've written, you need to install several dependencies. These are listed here, and we have detailed instructions on how to download and install them further down on this page (make sure your pi is connected to the internet!) If you've never used your pi before, here are some instructions on how to set it up.

pip Install python modules easily
Git Download code from GitHub really easily
python-dev The latest & greatest version of Python
python-eeml Connect the Pi to Xively
RPi.GPIO Interface with the Pi's GPIO pins
python-smbus Let Python use the Pi's I2C interfaces
[Optional] bcm2835 Required if you want to recompile the C code for the DHT22

Git, python-dev, pip & python-smbus

To install these, open a terminal on your fresh install of Raspbian and run these commands:

sudo apt-get update
sudo apt-get install git-core python-dev python-pip python-smbus

python-eeml

To install python-eeml, run these commands inside a terminal window.

cd
sudo apt-get install libxml2-dev libxslt1-dev python-lxml
git clone https://github.com/petervizi/python-eeml.git
cd python-eeml
sudo python setup.py install

RPi.GPIO

To install RPi.GPIO, run this command (depending on your version of Raspbian, you may already have it installed):

sudo pip install rpi.gpio

bcm2835

This library is not needed to use your AirPi, it is only included in case you want to edit the C code behind the driver for the DHT22. Run these commands to download and install this C library.:

cd
wget http://www.open.com.au/mikem/bcm2835/bcm2835-1.17.tar.gz
tar zxvf bcm2835-1.17.tar.gz
cd bcm2835-1.17
./configure
make
sudo make check
sudo make install

Enabling I2C

I don't like to reinvent the wheel so I shall merely point you towards an excellent blog post by SK Pang on how to enable I2C on your Pi. This is necessary to use the BMP085 sensor. When you run i2cdetect -y 0, if your BMP085 is attached properly you should see it at 0x77.


Install the AirPi code


To download the main program for the AirPi (some of it has been adapted from code written by Adafruit), you need to run these commands.

cd ~
git clone -b non-modular https://github.com/tomhartley/AirPi.git
cd AirPi

If your raspberry pi is version 2 (the newer version) edit AirPi.cfg by typing:

sudo nano AirPi.cfg
and change line 3 (I2CBus = 0) to bus=1. If you don't have an LCD screen, change line 4 to LCD = False. After finishing editing the file, type Ctrl-X followed by Y to save and quit.

You will configure this code and start uploading data in the next step!