One of the reasons for having multiple PI’s was to have one take over duties from an aging ITX based Linux box of reading from a USB Weather station and uploading the data to both it’s website and WeatherUnderground.
Unfortunately this project got pushed forward when, last Thursday morning, the ITX box decided to die on me. I think it’s power supply finally gave out after 9 years of service.
So this is the first part of a series on setting up a USB weather station onto a Raspberry PI.
Part 1 – The Weather Station
The weather station that I’ve been using since November 2010 is one I bought from Maplin. They usually sell for about £125 but a couple of times a year they reduce them down to between £50-£70. N96FY USB Wireless Weather Forecaster. At the time of writing this they’ve got it reduced to £69.
It consists of the external sensors and an internal touch screen unit. All that’s needed is a USB A-A cable to connect the touch screen to the PI.
Configuring the Raspberry PI
First I started with a blank copy of raspian on a 4Gb SD Card. Booted the pi up and configured it to use the entire card. With raspian this is easy as you get prompted on the first boot to do it. At the same time I enabled the ssh server from that same menu.
Installing the software
Now this is based on the instructions over on dragontail.co.uk who got a Raspberry PI working with one of these weather stations. Those instructions are for the Debian based image. I’ve taken them and modified them to get working with raspian so there are a few minor changes.
First we need to install some dependencies:
pi@kell ~ $ sudo apt-get install git python-dev pi@kell ~ $ sudo apt-get install gnuplot python-simplejson python-tweepy python-paramiko
Next we need to download and compile the latest versions of a few dependencies as the versions in the repos are not up to date.
First is Cython:
pi@kell ~ $ mkdir work pi@kell ~ $ cd work pi$kell ~/work $ wget http://pypi.python.org/packages/source/C/Cython/Cython-0.16.tar.gz pi$kell ~/work $ tar xzf Cython-0.16.tar.gz pi$kell ~/work $ cd Cython-0.16 pi$kell ~/work/Cython-0.16 $ sudo python setup.py install
That will take a while…
Next is libusb:
pi$kell ~/work/Cython-0.16 $ cd ~/work pi$kell ~/work $ wget http://sourceforge.net/projects/libusb/files/libusb-1.0/libusb-1.0.9/libusb-1.0.9.tar.bz2 pi$kell ~/work $ tar xjf libusb-1.0.9.tar.bz2 pi$kell ~/work $ cd libusb-1.0.9 pi$kell ~/work/libusb-1.0.9 $ ./configure pi$kell ~/work/libusb-1.0.9 $ make pi$kell ~/work/libusb-1.0.9 $ sudo make install
Next is cython hidapi:
pi$kell ~/work/libusb-1.0.9 $ cd ~/work pi$kell ~/work $ git clone https://github.com/gbishop/cython-hidapi.git pi$kell ~/work $ cd cython-hidapi pi$kell ~/work/cython-hidapi $ vi setup.py
Now we need to change the path to libusb from /usr/include/libusb-1.0 to /usr/local/include/libusb-1.0. Make that change then save.
pi$kell ~/work/cython-hidapi $ sudo python setup.py install
Now finally pywws:
pi$kell ~/work/cython-hidapi $ cd ~/work pi$kell ~/work $ wget http://pywws.googlecode.com/files/pywws-12.05_r521.tar.gz pi$kell ~/work $ tar xvzf pywws-12.05_r521.tar.gz pi$kell ~/work $ cd pywws-12.05_r521 pi$kell ~/work/pywws-12.05_r521 $ sudo python TestWeatherStation.py
Thats the basic installation, for the rest I’d suggest reading the pywws documentation.
The one thing I’d suggest is moving the installation out of your home directory, for me thats:
pi$kell ~/work/pywws-12.05_r521 $ cd ~/work pi$kell ~/work $ sudo mv pywws-12.05_r521 /usr/local/weather
In the next article I’ll cover configuring it to upload to Twitter, Weather Undergound, The Met Office & to a website.