Weather Station Set-up

This page describes how I set up the Maplin USB Weather station to automatically upload weather data to a dedicated website using Jim Easterbrook’s  pywws software.

There are excellent instructions on the pywws and dragontail sites but in both cases there are some odd details that have been missed. This is how I got it working, really as a shortcut for me if I have create a new installation. I do not attempt provide much in the way of background explanation, this is much better explained on the pywws site than I can do. If you are having problems I would strongly suggest you check out the  pywws Google group, I have found Jim Easterbrook author of the core pywws code is really helpful and responsive.

Point to note – there are ‘old’ versions of both pywws and Dragontail sites, make sure you are looking at the current maintained version as quite of lot of sites still link to the old versions.

These instructions assume you are starting from a clean Rasbian installation, I have tried them with a Pi2 and Pi3. unless otherwise stated execute all instructions from ‘pi@raspberry’

Setup and configure the weather station as described in the instruction manual,

Pressure reading, for pywws to display correctly the pressure reading must be set to ‘relative’ and ‘hpa’. Additionally you need to set the relative pressure as described below, this will work best if done on a calm [ high pressure ] day

Select the relative pressure setup [ 3rd press on pressure setting]

look up an existing local weather station on the web

set the reading to match the local station

Setting up the Pi

Make sure your Rasbian is upto date  with usual apt-get process

Install some 3rd party apps you will need

sudo apt-get install python-pip
sudo apt-get install python-dev
sudo apt-get install python-usb
sudo pip install python-twitter
sudo pip install oauth2
sudo apt-get install gnuplot
sudo apt-get install python-paramiko
sudo apt-get install python-pycryptopp

Install the current version of the pywws software


sudo pip install pywws


Connect the weather station to the pi using a USB lead and test the link, you should see a biggish block of hex characters if all is well


sudo python -m pywws.TestWeatherStation


[ As this point the original instructions run through a setup process to allow the pywws application to run without I have not bothered with this – yes I know it is bad  …]


Now create the working directories 

mkdir ~/weather
mkdir ~/weather/data
mkdir ~/webdata
mkdir /home/pi/weather/temp

The next instruction creates a copy of the templates so you can always go back to the originals if needed  – you point at these from weather.ini later in the instuctions

cp -R /usr/local/lib/python2.7/dist-packages/pywws/examples/* ~/weather

Setting up pywws.Hourly, Hourly needs a temporary folder to be created each time the Pi is restarted, this is a relatively new requirement so often missed in other instructions. I did it by inducing it a script which I run each time at startup – you can find the instructions for this on the System S/W page of this site

Weather station setup, change the update rate to 5 minutes [ from 30 min default ], note it can take a while for this instruction to run

sudo pywws-setweatherstation -r 5

Creating weather.ini, run the following line, it will create a file call weather.ini then stop asking you to confirm the type of weather station you are using

sudo python -m pywws.LogData -vvv ~/weather/data
  •  Look for weather.ini in the home/pi/weather/data folder
  • Open weather.ini with nano and replace unknown with 1080  [ assuming you are using the Maplin USB kit, then save / close nano  – you may need to do this as sudo
  • Run the following line again, this will take sometime to run
sudo python -m pywws.LogData -vvv ~/weather/data

Next check to see if some data has been down loaded to confirm all is well, copy the following line, edit it to reflect to-days day and run

more ~/weather/data/raw/2016/2016-11/2016-11-11.txt

process some raw data, run the following line to build some processes data, this will be placed in the /weather/data/calib folder. The main point to check is that the barometric pressure reading matches the weather station base unit display

sudo python -m pywws.Process ~/weather/data

setting up ‘hourly’ logging , hourly from the command line with the instruction below – this could take 5 minutes to run

sudo pywws-hourly -vvv ~/weather/data

If this runs ok we just need to sort out weather.ini, open is with nano and makesure

  • day and hour is set to 9
  • templates points to /home/pi/weather/templates
  • graph_templates points to /home/pi/weather/graph_templates
  • local_files points to /home/pi/weather/results

Also make the following change to [ftp] so we can run a local test

  • local site = True
  • directory = /home/pi/webdata

Then under logged change the plot line to read

  • plot = [“7days.png.xml”]

Now run the following command again

sudo pywws-hourly -vvv ~/weather/data

If you look in /pi/webdata  you should see a plot of 7 days of data


Next we need to get hourly to run automatically so set it up as cron job to run it every 10 minutes by adding the following line to cron,

crontab -e

*/10 * * * * sudo python -m pywws.Hourly ~/weather/data

Detailed Set-up of weather.ini,   to send data to website, the description on the pywws site worked fine for me so I have not repeated it here  see – 

If you are having problems you can find an activity log in /var/mail/