Building a Raspberry Pi Weather Station

 
This article describes briefly how I built a Raspberry Pi Weather Station running Weewx.

The Raspberri Pi will not run Windows or a MacOS due to the processor architecture, so we must use an ARM-based Linux.  Luckily, you can download the image from their website and install it onto an SD flash memory card.    I went for Raspbian.

Weather Underground PWS IVICFRAN3

I scoured the ‘net for software that would talk to my weather station and I also wanted to put this online.  , I found a couple a few good-sounding candidates, narrowing it down to either wview or weewx.

Because there was not a repository for wview, installation became more trouble than it was worth.  I spent a couple of hours trying to make the software work and then I thought I’d better switch gears and check out weewx.  Since weewx is just a few Python scripts, there was no problem getting it to work.  I just followed the instructions and before I knew it my weather station was accessible and what a difference.


One advantage to this approach (before we get to putting the data online) is that these weather stations need to have their clocks updated every so often.  My clock was off by over 20 minutes after setting it about a year ago and not really checking if it was correct.  Weewx automatically grabs the time from the internet and sets your weather station clock.

Weather Underground, which is a global network of weather hobbyists and their weather stations.  The cool thing is that once you get your station working, you are actually helping the community by sharing the local weather and if that doesn’t inspire you, there is also an iPhone app so you can get your station data while you’re on the go.  Setting things up was as as easy as signing up for a free account and then configuring weewx with the station ID details, etc.

Here’s how it’s done:

What you need:

Raspberri Pi

Vantage Pro 2 weather station with USB adapter (you could use the ethernet adapter instead, but it’s not covered here).

Soil moisture / temperature station.

….

Install Weewx (source http://weewx.com/apt/)

Configure apt

 

    1. curl -s http://weewx.com/keys.html | sudo apt-key add -
      curl -s http://weewx.com/apt/weewx.list | sudo tee /etc/apt/sources.list.d/weewx.list
       

      Install and/or Upgrade weeWX

    2. sudo apt-get update
      sudo apt-get install weewx

       

http://www.weewx.com/docs/usersguide.htm

Thanks for your support.  I have it all working now.  

I little write-up for anyone else wanting to use a Leaf and Soil Moisture Station on their VantagePro2:

  1. stop the weewx service (/etc/init.d/weewx stop)
  2. Execute wee_device –info and look for the transmitter channel and type.  

In my case channel 2, type “leaf_soil”:TRANSMITTERS:       Channel 1:                    iss       Channel 2:                    leaf_soil
2. I don’t know if this was necessary in hindsight, but I ran:  wee_device –help to see:–set-transmitter-type=CHANNEL,TYPE,TEMP,HUM                        

Set the transmitter type for CHANNEL (1-8), TYPE                        (0=iss, 1=temp, 2=hum, 3=temp_hum, 4=wind, 5=rain,                        6=leaf, 7=soil, 8=leaf_soil, 9=sensorlink, 10=none),                        as extra TEMP station and extra HUM station (both 1-7,                        if applicable)

Then I ran wee_device –set-transmitter-type=2,8,1,1  (2 for Channel 2, 8 for leaf_soil, 1 & 1 were arbitrarily chosen as my first sensors)

3.  and run weewxd manually (weewxd /etc/weewx/weewxd.conf for me).  Look for your sensors and make a note of the names (e.g. soilMoist1).       (mine looked like this:  soilMoist1: 2.0, soilMoist2: 54.0, soilTemp1: 11.6666666667)         You can restart the weewx service now if you want.. (/etc/init.d/weewx/start)

4. You need to manually add the new sensors to your report templates.  For example, in /etc/weewx/skins/Standard/index.html.tmpl, I added the following under the “Current Weather Conditions” section:<tr>                <td class=”stats_label”>Citrus Soil Moisture 150mm</td>                <td class=”stats_data”>$current.soilMoist1</td>              </tr>              <tr>                <td class=”stats_label”>Citrus Soil Moisture 300mm</td>                <td class=”stats_data”>$current.soilMoist2</td>              </tr>              <tr>                <td class=”stats_label”>Citrus Soil Temperature</td>                <td class=”stats_data”>$current.soilTemp1</td> 5. You can run wee_reports to test it out.

2 comments

  1. Nice to see a post where people can give simple and clear instructions on how to install it…ive spent 2 days trying to do the same and failed…if you can send me some simple instructions on how to install weewx i would be most gratful

  2. Ryan,
    Got it working now. I couldn’t believe WU communications was so simple… simply a typo in stationID, and not knowing how successes or failures were indicated.

    Tnx for your help, happily online at WeatherUnderground,

    David

    [[Wunderground]]

    #
    # This section is for configuring posts to the Weather Underground
    #

    # If you wish to do this, make sure the following two lines are
    # uncommented and filled out with your station and password:
    station = YOURSTATIONID
    password = yourweatherundergroundpassword

    driver = weewx.restful.Ambient

    Hi David

    If you have local logging working okay, then the hardest part is over.

    I checked my config file (see above) and with regards to Weather Underground, it really is just those two lines to get it working. Make sure that you use all caps for the station ID.

    If it’s still not working, may I suggest the following:

    1. Always check the basics first. Make sure name resolution and connectivity to their website is working:
    ping weatherunderground.com and make sure you get a reply
    2. If that works, it is most likely a typo in the configuration file. You can enable debug mode in the configuration file and then look at the logs to see if anything obvious is wrong. (See: http://www.weewx.com/docs/usersguide.htm and do a search for “debug”).

    Please let me know how you go. If you get stuck, I would be happy to help you further.
    >>>Subject: RaspPi WeeWx & Weather underground

    >>>Message Body:
    >>>Hello Ryan,
    >>>Can you tell me more details of how you were able to get WeeWx communicating with Wunderground? I’ve had the account setup for a month, >>>but used Weatherlink on Windows previously. Now WeeWx on RPi generates local reports correctly, but it doesn’t seem to be communicating >>>with Wunderground. My only Wunderground setup was adding station ID and Password to the weewx.conf file.Seems like there should be more!

    >>>Tnx,
    >>>David

Leave a Reply

Your email address will not be published. Required fields are marked *