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


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

sudo apt-get install libxml2-dev libxslt1-dev python-lxml
git clone
cd python-eeml
sudo python install


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

sudo pip install rpi.gpio


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.:

tar zxvf bcm2835-1.17.tar.gz
cd bcm2835-1.17
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
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!