Monday, January 7, 2013

My WeatherPi - Weather reports from a Raspberry PI

Ever find yourself pining away at Wuderground and wishing you had one of those really cool weather stations proudly poking its uber-scientific like visage over your neighbors fence? Yes me too, not only that but it runs in the family because my dad also had that goal. Being a sucker for electronics, weather stations and a great gift idea I bought my dad a wh1080 Weather Station for Christmas. We got it all set up and found the software to be a bit.. dated. It doesn’t upload to the internet and though there are programs out there to take care of that for you, Dad really didn’t want want his weather station shackled to a PC via USB.

Now that I have amassed a small army of R-Pis to do my bidding (4 and counting) I figured it was time to start gifting them with useful software to family and friends. So I set up a WeatherPi, the nickname I have assigned this project and the WeatherPi is rocking!  The best part is that setting up a WeatherPi is a great way to get to know a lot of the key features of the Linux/Pi OS and prepare your *nix skills for future projects.

First up, lets look at the stats:

Raspberry Pi - Older 256Ram version.
SD - 8mg
Edimax EW-7811 (Usb WiFi)
Pywws  with Python
TP1080WC ProWeatherStation aka: wh1080 (kinda a must have)


Now I must admit that this is more of an OS based project then electronics build but, if you're just getting started and you really want to master some of the Linux skills you really can’t go wrong with this project. Here’s some of the fun new skills you could pick up while getting your weather station data to Wunderground.com
  1. Basic RPi setup  - I used the Debian wheezy install right of the RaspberryPi site.
  2. Usb-wif and ssh because I like my big monitor and I didn’t want the RPi hooked up to the TV.
  3. Setting a static ip -  I want to know where this guy is on my network so I can connect easily.
  4. Pywws - a great open source tool for uploading to Wunderground and 4 or 5 other sites and more.
  5. Chrontab configuration and shell scripts - used to set up the Pywws to run the LiveLog every 5 minutes and upload WeatherStation data.

References
I would like to go into the details on how each part should be set up and configured but, I think it’s only right to give credit where it is due so I’ll provide links to all the great blogs where I gathered my info.


Overall Project info as well as specific Pywws installation advice:
http://blog.retep.org/2012/07/30/installing-a-usb-weather-station-on-a-raspberry-pi-part-1/

Edimax usb wifi setup: (With notes on a static ip)
http://etchingpathways.blogspot.com/2012/12/raspberry-pi-edimax-ew-7811un-wifi.html

Chrontab (second half covers chrontab)
http://blog.davidsingleton.org/raspberry-pi-webcam-a-gentle-intro-to-crontab/

Weatherstation: (It’s on amazon as well)
http://www.rainmanweather.com/site/catalog/Weather-Stations/Tycon-Power



Wrap-up and Next Steps
I originally picked up this project to help out my Dad with his new Weather Station but after working on the set up for a couple hours at my parents house using my Tablet to ssh into the PI and configure I decided to take the PI back home to finish things off. Of course then I didn’t have a Weather Station to verify all the config and installs... they live half an hour away so only one choice, buy my own weather station!  Really I didn’t plan it this way, honest I didn’t! I wrapped up the Pywws install and all the chrontab stuff at home and then made a copy of the SD card image with all the good configurations already done and poof! 2 WeatherPis ready to go.

Now as any IT pro can tell you, the moment you build, config, install or even look seriously at a device, you own support! With this in mind I have already set up a PI script to call my own REST Web Services to report to me when there are problems. This has led me on to start developing one of my next projects, HomePi, which will allow all my little Pi ‘s t check in with the HomePi and tell me how they are doing and what sort of errors they encounter while doing their thing. It’s pretty basic right now but I am hoping to allow for code updates and other support functions in the future.

I have plans to integrate IFTTT to work to provide Freeze and drought warnings for my Garden and most likely I’ll be logging my weather data over at COSM (formally known as Pachube) just because I can.