Table of Contents

Setting up a cheap but professional weather station


Station used : LaCrosse WS2355

Clean raspbian system

http://www.cnx-software.com/2012/07/31/84-mb-minimal-raspbian-armhf-image-for-raspberry-pi/

Install Weewx

sudo apt-get install python-configobj python-cheetah python-imaging python-serial python-usb
sudo adduser weewx
sudo apt-get install ntpdate
sudo usermod -aG dialout weewx
su weewx
tar xvzf weewx-2.6.3.tar.gz 
cd weewx-2.6.3/
vim weewx.conf 
# Root directory of the weewx data file hierarchy for this station.
WEEWX_ROOT = /home/weewx/system25
vim setup.cfg 
# Configuration file for weewx installer. The syntax is from module
# ConfigParser. See http://docs.python.org/library/configparser.html

[install]

# Set the following to the root directory where weewx should be installed
home = /home/weewx/system25

# Given the value of 'home' above, the following are reasonable values
prefix =
exec-prefix =
install_lib = %(home)s/bin
install_scripts = %(home)s/bin
python setup.py build
python setup.py install
cd ../
cd system25/
vim weewx.conf 

Check :

# Root directory of the weewx data file hierarchy for this station.
WEEWX_ROOT = /home/weewx/system25/

Edit :

[Station]
    # Set to type of station hardware.  Supported stations include:
    #  Vantage
    #  WMR100
    #  WMR200
    #  WMR9x8
    #  FineOffsetUSB
    #  WS28xx
    #  WS23xx
    #  TE923
    #  Simulator
    station_type = WS23xx


[WS23xx]
    # This section is for the La Crosse WS-2300 series of weather stations.

    # Serial port such as /dev/ttyS0, /dev/ttyUSB0, or /dev/cuaU0
    port = /dev/ttyUSB0

    # The station model, e.g., 'LaCrosse WS2317' or 'TFA Primus'
    model = LaCrosse WS2355

    # The pressure calibration offset, in hPa (millibars)
    pressure_offset = 0

    # The driver to use
    driver = weewx.drivers.ws23xx

Check the configuration by calling the weather station :

./bin/wee_config_ws23xx /home/weewx/system25/weewx.conf --info
...
wind direction alarm set: 0
wind speed: 1.5
wind speed max: 219.6
wind speed max alarm: 0.0
wind speed max alarm active: 0
wind speed max alarm set: 0
wind speed max when: 978382320.0
wind speed min: 0.0
wind speed min alarm: 1.6
wind speed min alarm active: 0
wind speed min alarm set: 0
wind speed min when: 978386340.0
wind speed overflow: 0
wind speed units: 3
wind speed validity: 0
wind velocity: (1.5, 22.5)

Change resolution, I choosed 15 minutes, sufficient for data, and do not make SD card suffer too much :

./bin/wee_config_ws23xx /home/weewx/system25/weewx.conf --set-interval=15

Exit weewx user and get root. Then, install apache 2 and add weewx :

cd /etc/apache2/sites-available/
Alias /weewx /home/weewx/system25/public_html
<Directory /home/weewx/system25/public_html>
  Options FollowSymlinks
  AllowOverride None
  Order allow,deny
  Allow from all
</Directory>

Add it and restart apache:

sudo a2ensite weewx 
sudo service apache2 reload

Web site can be reach at http://myraspberrypi-ip/weevx (wait 1 hour so enough data get stored and html generated).

Now to make it start automaticaly :

cd /etc/init.d 
vim weewx
#! /bin/sh
# /etc/init.d/blah
#

# Some things that run always
touch /var/lock/blah

# Carry out specific functions when asked to by the system
case "$1" in
  start)
    su weewx -c '/home/weewx/system25/bin/./weewxd /home/weewx/system25/weewx.conf &'
    ;;
  stop)
    killall weewxd
    ;;
  *)
    echo "Usage: /etc/init.d/blah {start|stop}"
    exit 1
    ;;
esac

exit 0
sudo chmod 755 weewx
sudo update-rc.d weewx defaults 
sudo reboot