Labels

Tuesday, July 15, 2014

Weather Station Project #4 - Installed weewx on RPi

Whew, after resetting the Vantage Vue console (by pulling the batteries and putting them back in) the USB port came back up.  In addition, the console did not lose any of data that had already been recorded.  I was able to load weewx onto the Raspberry Pi, configure it, and get data.  The steps that I used (from Weewx on Rasp! (Chris Davies-Barnard))were:

(1) used raspi-config on a new SD with Raspbian; set my location (US), keyboard (US), timezone (Eastern), setup SSH, setup expand to full SD size, etc.

(2) added user weewx:
sudo su; adduser weewx; usermod -a -G sudo weewx

(3) added prerequisite packages:
sudo apt-get install python-configobj python-cheetah python-imaging
sudo apt-get install python-serial python-usb
sudo apt-get install mysql-client python-mysqldb
sudo apt-get install python-dev python-pip
sudo pip install pyephem

(4) check to see if ntp was setup correctly

(5) installed weewx:
wget http://downloads.sourceforge.net/project/weewx/weewx-2.6.4.tar.gz
tar -xzvf weewx-2.6.4.tar.gz
cd weewx-2.6.4

(6) modify setup.cfg to add root directory:
home = /home/weewx/system25

(7) build and install weewx
python setup.py build
python setup.py install

(8) configure the weewx.conf:
cd /home/weewx/system25
su -l weewx
mkdir public_html
nano weewx.conf
-->>
#debug = 0
WEEWX_ROOT = /home/weewx/system25/
[Station]
location = xxxxxxxx {set to my  home location}
latitude = xxxxxxxx {set to my home latitude, dec degrees}
longitude = xxxxxxxx {set to my home longitude, dec degrees}
altitude = xxxx, foot {set to the altitude of the ISS placement on my roof}
station_type = Vantage
[Vantage]
type = serial
port = /dev/ttyUSB0 {this is the usb port that came up when the Vantage Vue was plugged in}
[StdRESTful]
[[Wunderground]]
station = xxxxxxxxx {set to my Weather Underground station number}
password = xxxxxxxxxx {set to my Weather Underground password for the station}
rapidfire = True
[[CWOP]]
station = xxxxxxx {set to my Citizens Weather station number}

(9) mod the permissions on the usb port and check the weewxd run
sudo chmod 777 /dev/ttyUSB0
./bin/weewxd weewx.conf

after weewx connects to the console, you should see lots of packets of weather data dumped onto the command line.  stop with a control-c

(10) start the weewxd in the background and check that it is still there
nohup ./bin/weewxd weewx.conf > /dev/null & echo $! > run.pid

this will start weewxd with our configuration file setup and send the command line into a null dev black hole.  We will still be sending packets of weather data to Weather Underground and the Citizens Weather (CWOP) locations.

(11) check the running of weewxd:
ps -e | grep weewxd

Update: I need to setup /etc/rc.local to run weewxd on boot.  I encountered a storm after my weather station was running for several days and the power went out and stopped the data flow.  I discovered this when I went to Weather Underground during the storm to see how it was recording rainfall and I notice it had been off for 20 minutes.