Weather Station Display

Display weather on a web page

I wanted to have my own weather station and output the weather on a web page on my VPS server. There are plenty of weather stations available that will output data to a PC and several applications that will display that data on a web page. Most weather stations come with software but it is Windoze based and not Linux. Looking around for weather display software that will run on Linux I found Weather Display this supports a large range of stations , has lots of nice features , runs on Linux ( as well as Mac OSX and Windoze ) but costs around $70.

Looking for free software I found open2300 , this will get data from a La crosse WS2300/WS2305/WS2310/WS2315 Weather Station as well as sending data to Weather Underground and Citizen Weather. There are some very nice web sites using this software as a base for some extra coding. It will also run on a Linksys NSLU2.

Next I found wview , this supports a number of weather stations :-

  • Davis Vantage Pro/Pro2
  • Vaisala WXT510
  • La Crosse WS-2300/2308/2310/2315
  • Oregon Scientific WMR918/968
  • This produces a nice web page as on my server. The software will also run on a Linksys NSLU2 which has been modified to run a full version of Linux which means I don’t have to leave my main PC on all the time to collect the data. I happen to have a NSLU2 which I modifed to run a full version of Linux which I was using as a media streamer ( Firefly ) to stream audio to a Roku Soundbridge and as a backup server  – I have now bought a SqueezeBox Duet and the NSLU2 is a bit too weedy for the SqueezeCenter software so I decided to run wview on this and send the generated HTML over to my VPS server on the net.

    Weather Station choice

    Having decided on wview the supported weather stations currently available in the UK are  the La Crosse WS2300 series and the Davis Vantage Pro, as the Davis Vantage Pro with a PC cable is around four times the price of the La Crosse I decided to buy a La Crosse WS2308. This weather station will also work with the open2300 and WeatherDisplay software mentioned above. It measures indoor/outdoor temperature and humidity ,dew point, wind chill, wind speed and direction, atmospheric pressure and has a rain gauge to measure rain fall. It has a large LCD display unit that can either receive the data from the instruments via cable or wireless – I chose the wireless option as It is the most convenient although it can be less reliable and if you do lose contact with the sensors the PC output will show the outside temperature as 80 degrees C which buggers up your graphs !

    The outside instruments are housed in three units connected together by cable. I mounted the wind anemometer on a TV aerial mast and the rain gauge on a simple L bracket. See the picture below. The TV mast and the bracket to mount it on the wall came from Maplin Electronics.

    WS2308 weather station instruments
    WS2308 weather station instruments

    Prepare the NSLU2 for the Wview software

    As noted above I wanted to install wview on my Linksys NSLU2, the version of Linux I had on there was too old to install wview and so I had to install a new version. To do this the instructions are on the NSLU2 Wiki site. Initially I installed the latest SlugOS ( 5.3 Beta ) but the wview packages ( I decided against compiling the latest version from source as I wanted to get something up and running quickly )  had dependency problems so I installed SlugOS 4.8 Beta as suggested in the manual. As I already had a version of Linux on the NSLU2 ( Unslung ) it was easy to do and it even kept all my data on the USB disk attached. I used sudo upslug2 –image=”slugosbe-4.8-beta-nslu2.bin” from by Ubuntu desktop to flash the new image onto the NSLU2 and once rebooted df showed :-

    root@nslug:~$ df
    Filesystem           1k-blocks      Used Available Use% Mounted on
    /dev/mtdblock4            6528      4948      1580  76% /
    /dev/mtdblock4            6528      4948      1580  76% /dev/.static/dev
    tmpfs                     2048        28      2020   1% /dev
    tmpfs                    15188        20     15168   0% /var/volatile
    tmpfs                    15188         0     15188   0% /dev/shm
    /dev/sda2               116661     18664     91973  17% /media/sda2
    /dev/sda1            240190052  33692576 204057284  14% /media/sda1

    and fdisk /dev/sda :-

    Disk /dev/sda: 250.0 GB, 250059350016 bytes
    255 heads, 63 sectors/track, 30401 cylinders
    Units = cylinders of 16065 * 512 = 8225280 bytes

    Device Boot      Start         End      Blocks  Id System
    /dev/sda1               1       30379   244019286  83 Linux
    /dev/sda2           30380       30394      120487+ 83 Linux
    /dev/sda3           30395       30401       56227+ 82 Linux swap

    /media/sda2 was the Unslung root partition so I made it the SlugOS one :-
    root@nslug:~$  umount /media/sda2
    root@nslug:~$ mkfs.ext3 /dev/sda2
    root@nslug:~$ turnup disk -i /dev/sda2 -t ext3

    Rebooted the NSLU2

    I already had swap on sda3 but it was the wrong version so I remade it :-

    root@nslug:~# mkswap /dev/sda3
    Setting up swapspace version 1, size = 57572864 bytes
    vi /etc/fstab
    /dev/sda3       swap    swap    defaults        0       0
    root@nslug:~# swapon -a

    The NSLU2 does not have an accessible serial port to connect to the weather station. To use a serial connection to the NSLU2 see the Linux NSLU2 Wiki page here.

    I choose the easy option to use a serial to USB converter cable ( from Maplin Electronics code ZP43 ).

    root@nslug:~$ ipkg update
    Downloading http://ipkg.nslu2-linux.org/feeds/slugosbe/cross/4.8-beta/Packages.g
    z
    Inflating http://ipkg.nslu2-linux.org/feeds/slugosbe/cross/4.8-beta/Packages.gz
    Updated list of available packages in /var/lib/ipkg/cross
    Downloading http://ipkg.nslu2-linux.org/feeds/slugosbe/native/4.8-beta/Packages.gz
    Inflating http://ipkg.nslu2-linux.org/feeds/slugosbe/native/4.8-beta/Packages.gz
    Updated list of available packages in /var/lib/ipkg/native
    root@nslug:~$

    root@nslug:~$ ipkg install kernel-module-pl2303
    Installing kernel-module-pl2303 (2.6.21.7+svnr927-r0) to root…
    Downloading http://ipkg.nslu2-linux.org/feeds/slugosbe/cross/4.8-beta/kernel-module-pl2303_2.6.21.7+svnr927-r0_nslu2be.ipk
    Configuring kernel-module-pl2303
    root@nslug:~$ depmod -a
    root@nslug:~$ echo usbserial >> /etc/modutils/modules
    root@nslug:~$ echo pl2303 >> /etc/modutils/modules

    shutdown and plug in the Serial to USB cable

    root@nslug:~$ dmesg
    <6>usbcore: registered new interface driver usbserial
    <6>drivers/usb/serial/usb-serial.c: USB Serial support registered for generic
    <6>usbcore: registered new interface driver usbserial_generic
    <6>drivers/usb/serial/usb-serial.c: USB Serial Driver core
    <6>drivers/usb/serial/usb-serial.c: USB Serial support registered for pl2303
    <6>pl2303 2-1:1.0: pl2303 converter detected
    <6>usb 2-1: pl2303 converter now attached to ttyUSB0
    <6>usbcore: registered new interface driver pl2303

    Set the timezone and date :-

    root@nslug:~$ ipkg install tzdata
    Installing tzdata (2007e-r1) to root…
    Downloading http://ipkg.nslu2-linux.org/feeds/slugosbe/cross/4.8-beta/tzdata_2007e-r1_armv5teb.ipk
    Configuring tzdata
    root@nslug:~$ ln -s /usr/share/zoneinfo/Europe/London   /etc/localtime
    logout and back in again
    Set the date MMDDHHMM

    Installing Wview on the NSLU2

    root@nslug:~$ cd /etc/ipkg
    root@nslug:/etc/ipkg$ wget http://www.wviewweather.com/ipkg/wview.conf
    Connecting to www.wviewweather.com[209.55.119.70]:80
    wview.conf           100% |*****************************|    59    –:–:– ETA
    root@nslug:/etc/ipkg$
    root@nslug:/etc/ipkg$ ipkg update
    Downloading http://ipkg.nslu2-linux.org/feeds/slugosbe/cross/4.8-beta/Packages.gz
    Inflating http://ipkg.nslu2-linux.org/feeds/slugosbe/cross/4.8-beta/Packages.gz
    Updated list of available packages in /var/lib/ipkg/cross
    Downloading http://ipkg.nslu2-linux.org/feeds/slugosbe/native/4.8-beta/Packages.gz
    Inflating http://ipkg.nslu2-linux.org/feeds/slugosbe/native/4.8-beta/Packages.gz
    Updated list of available packages in /var/lib/ipkg/native
    Downloading http://www.scorpiocomputing.com/weather/ipk/Packages.gz
    Inflating http://www.scorpiocomputing.com/weather/ipk/Packages.gz
    Updated list of available packages in /var/lib/ipkg/_wview
    root@nslug:/etc/ipkg$ ipkg list | grep wview

    Look for your weather station model – in my case ws2300 :-

    wview-ws2300-mysql – 4.0.1-r0 – wview is a weather site generator and more for a variety of weather stations

    root@nslug:/etc/ipkg$ ipkg install wview-ws2300-mysql
    Installing wview-ws2300-mysql (4.0.1-r0) to root…
    downloads lots of dependent libraries etc.

    Make the archive directory go to disk rather than in /var ( which is memory on the NSLU2 )

    root@nslug:~$ mkdir /media/sda1/wview
    root@nslug:~$ mkdir /media/sda1/wview/archive
    root@nslug:~$ rmdir /var/wview/archive
    root@nslug:~$ ln -s /media/sda1/wview/archive /var/wview/archive
    root@nslug:~$

    Next run the setup script wviewconfig. In most cases I accepted the defaults except as below

    wviewconfig

    Serial port device – check with dmesg what in is – in my case it is /dev/ttyUSB0

    Use metric measures
    Weather station elevation (feet above sea level ) you can get this information from various sites on the Internet – I used http://www.earthtools.org/

    This site will also give you latitude and longitude

    Local Radar use Google to find a site that you can link to for a radar display or look at other weather sites to see what other people have used.

    Ditto for local forcast

    Run the rsync/ssh daemon wviewsshd?
    1
    As I wanted to use my VPS server on the Internet I use the wviewsshd daemon which does rsync over ssh to get the data to the external server – more about this below.

    After wviewconfig has finished run the script wviewhtmlconfig – I accepted defaults.

    You can always change settings getnerated by the above two scripts at a later date by editing /etc/wview/wview.conf or /etc/wview/htmlgen.conf and restarting wview.

    Setting up rsync to send the data to an external web server

    On the NSLU2

    root@nslug:/etc/ipkg$ ipkg install rsync

    ssh-keygen -t rsa           don’t set a passphrase and accept the defaults

    cat /root/id_rsa.pub

    On your external server

    -bash-3.2# useradd -m -d /home/wview -c “Wview weather” wview
    -bash-3.2# cd ~wview
    -bash-3.2# mkdir .ssh
    -bash-3.2# vi .ssh/authorized_keys

    paste in the output of the cat /root/id_rsa.pub command you ran on the NSLU2 above

    -bash-3.2# chown -R wview:wview /home/wview/.ssh
    -bash-3.2# chmod 700 /home/wview/.ssh
    -bash-3.2# mkdir /var/www/html/weather         (replace /var/www/html with your web server’s document root )

    -bash-3.2# chown wview:wview /var/www/html/weather

    -bash-3.2# ln -s /var/www/html/weather data

    If rsync is not installed then install it :-

    yum install rsync

    On the NSLU2

    Test the ssh connection :-

    root@nslug:-$ ssh -l wview yourextserver.org ls -l /home

    Answer yes to the question about if you want to connect and you should get a listing of the external server’s /home without being prompted for a password.

    root@nslug:-$ vi /root/.ssh/config

    Host yourextserver.org

    User wview

    This means that root will always ssh as user wview when going to your external server.

    Test rsync

    root@nslug:-$ rsync -aqz –rsh=ssh /var/wview/img/ tuqix.org:data
    root@nslug:-$  ssh yourextserver.org ls -l data

    root@nslug:-$  vi /etc/wview/wviewssh.conf
    #Interval Source                        Remote Host               Remote Destination
    #——– —————————–  ————————-         ————–
    1         /var/wview/img                yourextserver.org                                 data

    Plug in the weather station LCD control panel to the serial to USB cable using the serial cable that comes with the weather station.

    Start up wview and monitor the mesages file:-

    root@nslug:-$ /etc/init.d/wview start

    root@nslug:-$ tail -f /var/log/messages

    You should see messages like :-

    Jun 20 16:36:59 (none) user.info wviewd[949]: <1245512219362> : station pollinginterval set to 15 seconds
    Jun 20 16:36:59 (none) user.info wviewd[949]: <1245512219409> : — Station Init
    Start —
    Jun 20 16:36:59 (none) user.info wviewd[949]: <1245512219479> : WS-2300 on /dev/ttyUSB0 opened …
    Jun 20 16:36:59 (none) user.info wviewd[949]: <1245512219555> : station archiveinterval: 5 minutes
    Jun 20 16:37:00 (none) user.info wviewsqld[953]: <1245512220422> : radlib: wview sqld started as a daemon …
    Jun 20 16:37:00 (none) user.warn wviewsqld[953]: <1245512220438> : SQL archiving disabled in wview.conf – exiting…
    Jun 20 16:37:00 (none) user.info htmlgend[956]: <1245512220520> : radlib: htmlgend started as a daemon …
    Jun 20 16:37:00 (none) user.info htmlgend[956]: <1245512220552> : !! configured for metric units/conversion !!
    Jun 20 16:37:00 (none) user.info htmlgend[956]: <1245512220554> : !! Rain units will be mm !!
    Jun 20 16:37:00 (none) user.info htmlgend[956]: <1245512220556> : generating to /var/wview/img
    Jun 20 16:37:00 (none) user.alert wvalarmd[958]: <1245512220579> : /etc/wview/wv alarm.conf does not exist – exiting…
    Jun 20 16:37:00 (none) user.info wviewsshd[963]: <1245512220979> : rsync: updating /var/wview/img ==> yourextserver.org:data every 1 minutes
    Jun 20 16:37:00 (none) user.crit wviewsshd[963]: <1245512220981> : rsync: starting updates in 4 mins 15 secs
    Jun 20 16:40:11 (none) user.info htmlgend[956]: <1245512411515> : Generated: 124
    5Jun 20 16:41:11 (none) user.info htmlgend[956]: <1245512471160> : Generated: 890 ms: 17 images, 14 template files
    Jun 20 16:41:15 (none) user.info wviewsshd[963]: <1245512475271> : Updating: /var/wview/img ==> yourextserver.org:data
    ms: 25 images, 14 template files

    Once you see messages about Generated images and template files followed by wviewsshd updating /var/view/img ==> yourextserver.org then you should get a nice web page at yourextserver.org/weather

    3 thoughts on “Weather Station Display”

    1. Nowadays most of the weather stations allow data log in and it is really useful for those weather enthusiasts like you. I appreciate your concern.

      Thanks

    2. Thanks for the research and the info on running weather software on Linux. I recently got into Linux (Debian + Raspberry Pi) and now I am looking for good free software to put my data on the web. My station is Vantage Pro 2, so I am good to go with wview. Also the rsync tip sound very helpful. Thanks again.

    Leave a Reply

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