Installing a USB Weather Station on a Raspberry PI Part 1

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.

The external components of the Weather Station

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 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
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 install

That will take a while…

Next is libusb:

pi$kell ~/work/Cython-0.16 $ cd ~/work
pi$kell ~/work $ wget
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
pi$kell ~/work $ cd cython-hidapi
pi$kell ~/work/cython-hidapi $ vi

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 install

Now finally pywws:

pi$kell ~/work/cython-hidapi $ cd ~/work
pi$kell ~/work $ wget
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

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.

Author: petermount1

Prolific Open Source developer who also works in the online gaming industry during the day. Develops in Java, Go, Python & any other language as necessary. Still develops on retro machines like BBC Micro & Amiga A1200

68 thoughts on “Installing a USB Weather Station on a Raspberry PI Part 1”

  1. Thanks for this article Peter – I’ve only just discovered WeatherUnderground and my immediate thought was how to get the Pi to upload data. A visit to Maplins is in order 🙂

    1. I’ve not had chance to write the second part yet which covers the config but for weather underground its really simple.

      In fact when I did the upgrade to the pi the newer versions of pywws actually supports thee Met Office WOW system as well which I’ll also cover.

      Twitter is slightly trickier but once done works well also.

      The only thing not working right is uploading to a website, it works ok hourly but it should also be working every 15 minutes but it’s not.

      Hopefully I’ll get that next part done next week.

  2. Excellent article – managed to install and get working upto the point of data coming into pi with the command testweathersation– Data comes in but when I try to move to data it creates a weather.ini not a dat file – so no Data yet….

  3. tried this on my pi (model B with 256mB & the 2012-09-18 rasbian wheezy image.) No matter what I do, I get an error when I do the following:

    ‘sudo python’ install from the ~/work/cython-hidapi directory.

    it appears to go well until building hid.o when I get a warning that a variable ânum_devâ is set but not used.
    Then when it is working with, I get:

    /usr/bin/ld cannot find -ludev
    collect2: ld returned 1 exit status
    error: command ‘gcc’ failed with exit status 1

    Any help appreciated

    1. There is an incorrect path in the file. When changing the libusb path with “vi”, you will also need to change the library path from ‘i386-linux-gnu’ to ‘arm-linux-gnueabihf’.

      You’ll also need to move the file from /lib/arm-linux-gnueabihf/ to /usr/lib/arm-linux-gnueabihf/


      $ sudo cp /lib/arm-linux-gnueabihf/ /usr/lib/arm-linux-gnueabihf/

      I had the exact same issue and this got it going.

      1. I’ve been meaning to look at udev as I knew that was behind the permissions problem but not got round to it. I’ll give that a go here as I’ve been doing some tweaking to the setup.

        I’ve now got it posting live (every few minutes) but twitter seems to have broken overnight . Once I’ve got that fixed I’ll finally post those changes.

    2. There is an incorrect path in the file. When changing the libusb path with “vi”, you will also need to change the library path from ‘i386-linux-gnu’ to ‘arm-linux-gnueabihf’.

      You’ll also need to move the file from /lib/arm-linux-gnueabihf/ to /usr/lib/arm-linux-gnueabihf/


      $ sudo cp /lib/arm-linux-gnueabihf/ /usr/lib/arm-linux-gnueabihf/

      I had the exact same issue and this got it going.

  4. I got it working earlier this morning using additional instructions given here They gave a few extra steps to be done if there was an error at the stage I mentioned earlier.

    Is this essentially the same as you guys did? I’m a total newbie at linux stuff. I also had tried the cython 0.17 rather than 0.16, but that did not help. I finally got the TestWeatherStation module to work.

    No w to do battle with getting it operational as a weather station. Have any of you gotten jQuery to run on a pi? I’m currently running my station from my desktop & have a set of webpages that I’d like to offload to the pi. They use jQuery to do the plots & I’d rather not re do the site if possible.

    1. Personally I’ve not seen that site so need to take a look.

      As for jQuery, that runs in the browser (unless there’s a server version I’ve not known) so it should be useable on the pi as all it’ll be doing is serving it to the browser.

    1. Yes I’ve just spotted that the website doesn’t list them anymore, although I did see some in my local store just last week.

      The maplin units are a branded wh1081 unit so any which are based on that for the wh1080 would work – if pywws supports it then it should work.

      A quick search came up with amazon as another source:

      I’ve also seen similar units on eBay as well.

  5. Thank you. I’m in the States so I don’t have access to a local store. Amazon though is global 🙂

    Thank you again. Nice little project i can work on with my son. weather station and some Raspberry Pi.

  6. Hello
    Please can you help.
    First I should say that I am a complete novice with Linux.
    I have got as far as cython hidapi.When I type vi it seems to hang.
    I have noted comments above but I don’t know how to follow the solutions given.
    How do I change the library path as mentioned by Jordan and Jay R
    Also how to change the path to libusb.
    Step by step instruction on the section before the PYWWS section would be most helpful.

    With this help I will put my weather station on my web site.

    Thank you


    1. In this instance over USB. The control panel exposes all of the recorded data which pywws and other software then reads periodically.

      At some point I’m going to look at linking the pi direct to the outside hardware. Someone has already done that using a radio receiver attached to gpio bypassing the console.

  7. As someone mentioned above, i also have one of the Maplin setups, but the TX unit failed. has anyone thought of connecting the sensors directly to gpio ? (it’s on my list of jobs, but swmbo keeps moving things above it !)
    Thanks Greg

    1. Someone did post a link earlier where with a circuit which does exactly that. It consists of a suitable radio receiver which picks up the signal from the external sensors. As each transmitter has a unique I’d you could then add additional stations.

      I have also thought about looking at 1-wire as most of the sensors use that and you can easily get them.

  8. When I connect the weather station to the raspberry via usb, it looses Connection to the sensors. Anyone else having this problem?

    1. I’ve not had that problem.

      How close is your pi to the receiver? If is close our between it and the sensors it could cause interference.

      The distance of the sensors & what’s between them and the receiver could also be a factor.

      Does the problem happen if you put both close to the sensors?

  9. what kinda of information should I be seeing when I run sudo python /usr/local/weather/

    it seems to me like it just hangs.

    When I unplug and plug back in my weather station it crashes the program.

  10. Hello,

    I installed successfully pywws on my Rasp. All is connected with Wifi dongle to my website

    Also, I had a solarcamera wifi (or GSM) to get regular picture.

    Now, I must admit the visual of the pywws on the website is not very attractive.
    Any idea to improve the graphic page and more visual ?



    1. Yes the graphs are pretty basic.

      You could look at the templates but I’d doubt you’ll get anything looking much better.

      As part of another project I’m looking at generating html5 graph’s of various data so when I’ve done that I’m gong to look at replacing them with something better looking.

    2. I’m trying to the do the same thing, connect my Rasp Pi to my weather station. I’ve dabbled in linux and pyuthon the past but I consider myself a newbie at it. Please forgive my simple question.

      My question is, can I just install pywws on the Pi and get it work without compiling Cython and the Dev environment that you outline at the beginning of your article?

      For the record, I’m running the B version of Pi and the latest Raspbian distro (NOOBs V1.1)

      1. The problem I have is my pi weatherperson is so old it’s pre-raspian.

        When twitter failed last week I was going to rebuild it from scratch but in the end just updating tweetie was enough.

        I’m not certain if you can bypass cython. I suppose if the current raspian has cython & it’s version is high enough then you should be OK.

        I really need to find the time to do the rebuild. Then not only will I get an up to date os but also IPv6, it’s the only pi I have that’s not got a global ip address.

  11. thank you verry much for this nice tutorial.
    i’m thinking about installing a windturbine at home to generate my own electrical energy, so it is usefull to log the wind data and analyze it.
    For this usage it is usefull to get one file with all the data in. Never programmed python before, but i was able to edit the to do this job. The generated File could be analyzed there:

    here tho code i’ve added to the python file:

    def main(argv=None):
    txtFiles = []
    for root, dirnames, filenames in os.walk(“/usr/local/weather/data/raw”, topdown=True):
    for filename in filenames:
    if filename.endswith(‘.txt’):
    outfileName = os.path.join(root, filename)
    txtFiles.append (outfilename)
    outputFile = open(“/var/www/combined.txt”, “w”)
    for data in sorted(txtFiles):
    readFile = open(data, “r+”)
    fileData =;
    print data

  12. Hi, I followed your tutorial step by step and everything is ok until cython-hidapi instal.

    I have changed the libusb-1.0 path and when I run the code “~/work/cython-hidapi $ sudo python install” I get this.

    >Traceback (most recent call last):
    > File “”, line 3, in
    > from Cython.Distutils import build_ext
    >ImportError: No module named Cython.Distutils

    What can I do to overcome this step? I don’t know much of programming… sorry

    I am installing this in a raspberry pi b+


    1. This tutorial is now a few years old, so my only advice is to research how the Cython package has changed over time.

      The error implies that Cython.Distutils has been renamed or moved.

      1. Yes it is but also how usb is supported in pywws had changed as well since then, mainly making usb more stable.

        My best advice is to go to the pywws site for the latest instructions or alternatively ask on the pywws Google group which is linked from there.

  13. Hello Peter and thanks so much for making this tutorial… I am a rookie with raspberry and linux, but following your tutorial I am trying to connect the same weather station (mine is named PCE-FWSS20) with the Raspberry PI3… all fine until this point :

    “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.”

    I have not the command prompt, so I don’ understand how to go further.. can you help me ? Thanks in forward ! Gianpi

Leave a Reply to Greg Cancel reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: