Weather Station on a Raspberry Pi
This post will describe your Elmer’s adventure into putting his personal weather station onto a Raspberry Pi.
Many moons ago in a city way North of our present location, a very nice Davis Vantage Pro2 weather station was purchased. The Weatherlink and USB adapter accessory gave rise to a nice display on a laptop to supplement the included console. Click forward some 10 years or so and version 3 of the display is still running on a very old Dell D600 laptop attached to a small monitor. The D600’s display went QRT some time ago. This old workhorse, now without it’s case hanging from a wire, started to act up. Time for an upgrade. Version 4 was born, well the idea was anyway. Another used laptop would do nicely, and simply, but what fun is that? How about squeezing this into a Raspberry Pi? Finding the WeeWx software that was reportedly Pi friendly sealed the deal. Weatherlink, the Davis interface software, is only for Windows or a Mac… so off we go; Raspberry Pi, and WeeWX.
Why this post? It took a lot of finagling to get this to work. Lots of notes scribbled on bits of paper. I wanted to capture that so it is not lost and perhaps it will help others to get this working as well.
Here are my ‘build’ notes: W2DENs WX Notes
Other Neat rPi WX Stations
Before you continue perhaps a bit of inspiration. Here are other rPi weather stations found on the web:
- Moss Denmark: A neat custom application worth a good look: (Link)
- The Raspberry Pi Station (another approach): (Link)
- This would not be complete without an instructables: (Link).
- You get the idea…. search raspberry pi weather.
You either need to have at least a basic understanding of Linux (Raspbian, Debian etc.) or be very good at searching out solutions on the web to tackle this project. If subjects like scripting (batch files) and crontab (task scheduler) are completely foreign to you then it is STRONGLY recommended that you find a basic Raspbian, Debian or Linux course on-line and learn some of the basics.
Or, just plow through this and learn as you go. This is how I did it, took two weeks to get this far with minimal prior rPi knowledge. All without destroying any hardware. You can always re-image the SD card and start again!
Please, do NOT contact me for help on basic rPi programming. LYI (Learn Your Self) is the buzz phrase for any Linux project. It may take a while to find the right solution . . . every answer is on the web somewhere.
- Interactive (mouse) display with current, forecast and history weather information.
- Rotating images including NOAA radar, thermal, US map, ‘Today Tonight and Tomorrow local NOAA images. And more??
- Upload data to Weather Underground and CWOP, that feeds APRS (I am a ham after all).
- Make the pages available on our local Meshnet (AREDN software).
- Davis Vantage Pro2 weather station (Link).
- WeeWX works with many weather stations. check the WeeWX website, link below, for alternatives/
- Davis Weatherlink USB (Link).
- You’ll need to find the appropriate interface for your weather station if it is not a Vantage Pro2
- Here is a link to a DIY hardware interface. Not tested here but may be an alternative. (Link)
- Raspberry Pi 3 B (rPi) with power supply. Available from Amazon, Adafruit etc.
- Raspbian GNU/Linux8 (Jessie) based on Debian Wheezy. Pixel 1.1 desktop.
- Micro SD card ( 8, 16 or 32 gb).
- USB Thumb-drive for backups (optional).
- Monitor: must be HDMI. This project uses a Samsung SD300 24″ class 1920 x 1080 LCD monitor. Any less and you will be cramming in the image or you will need to adjust your display accordingly.
- Keyboard, mouse, HDMI cable, Cat 5 (if you plan on hardwire the rPi to a network).
- WeeWX (Link). This is for reference. We’ll install WeeWX directly into the rPi.
The WeeWx guides are fabulous. Following them makes loads of sense. Here is a link to the User’s Guide (Link)
Set up the rPi
- Load the Raspbian image onto the micro SD card:
- Insert the imaged micro SD card into the rPi, plug in the mouse, keyboard, monitor and then the power supply.
- Your Pixel desktop should appear in a minute or two. Welcome to the wonderful world on Raspbian.
- Set up WiFi:
- Click the WiFi icon in the upper right and set up you WiFi
- Click on the Raspberry in the upper left then Preferences then Raspbian Pi Configure.
- System: Boot: To Desktop. Login as user ‘pi’ and Wait for network checked.
- Localisation: Set Locale, Timezone, Keyboard and WiFi Country. Unless you are in the UK where the rPi is made.
- Look around. There are lots of changes you can make from the Raspberry icon. I’ll let you play with those on your own.
Create a Root password
Linux is particular about who gets to use root (admin) privileges. You should learn about su and sudo commands. As is there is now root password and one should be created to continue.
In the terminal type:
Follow the screen prompts. Save this. It is not easy to recover if lost.
Update / Add software etc
Now that you are running, connected to the internet and put the British ettings behind us we can sart to add what is needed for the weather station.
- Update and Upgrade (Link). We need to install all the latest revisions for Raspbian and the installed software.
- Open the terminal and type or cut paste each line followed by the [Enter] key. (both may take a while):
sudo apt-get update sudo apt-get dist-upgrade
- You now have an up to date fully functional rPi.
- If you wish to add and programs this is a good time. I prefer Firefox aka Ice Weasel to Chromium and added a root level file manager. (the Pixel file manager is called pcmanfm.)
- Chromium does have a very nice kiosk mode for displaying a web page without all the menus etc. Something to look into.
- VNC is a very useful tool to allow remote access to your rPi. I had to install VNC on the rPi as it did not seem to be working properly. Lots of good How tos on the web. Then install it on any other computer on your network and you can access the rPi from it. Worth figuring out.
- I’ll leave this up to you.
- No reason to reinvent the wheel. Follow the installation instructions here: (Link)
Connecting Your WX Station
This section is specific for the Vantage Pro2. Some mods may be needed if you are using a different station.
- Plug your weather station’s USB cable into the rPi.
- In terminal enter the following:
ls -l /dev/ttyUSB0
- The l is the lower case letter L and 0 is the number 0. USB must be upper case.
- You should see something like:
- crw-rw—- 1 root dialout 188, 0 Jan 29 08:10 /dev/ttyUSB0
- Each time you enter the command the date / time should update.
- If in doubt that ttyUSB0 is your weather station, unplug the USB and run the command, then plug it in a repeat the command.
- Follow the WeeWX configuration instructions (The configuration file weewx.conf) about half way down the User’s Guide (Link).
- I found it most useful to add a couple of bookmarks to the file manager:
- The configuration file folder: /etc/weewx
- The sub-folder /etc/weewx/skins will be useful if you customize WeeWX
- The ‘home page: /var/www/html
- Everything that is published is in the sub-folder /var/www/html/weewx
- The configuration file folder: /etc/weewx
- You can access WeeWX using the file:///var … address from a browser as mentioned at the end of the installation. I think you can run this way locally, on the computer where WeeWX is installed. If you want to share the WeeWX say over a mesh net etc. you will need to install a web server such as Apache.
- WeeWX has a simple procedure to install the Apache server (Link).
- Follow steps 1 and 3.
- Your WeeWX weather will be here: http://localhost/weewx/index.html
Congratulations! You now have a fully functional rPi weather station.
There is an infinite amount of customization you can do. Perhaps in a later post I’ll go over some.