Setting up my weather station - Connect with Raspberry Pi -

since:2012-Dec-30
last update:2012-Dec-30
index   previous page



4. Connect with Raspberry Pi

Considering electricity fare etc, I cannot keep WeatherLink always running on my windows PC. Therefore I thought Weather Station should be connected with Raspberry Pi which is ARM base single board computer with low power. And I tried to keep daemon program always running on it.

I ordered Raspberry Pi on Nov. 28, and I received it on Dec. 7.
I installed Raspbian "wheezy" into 4GB SD card memory, and set up basic setting.

Raspberry Pi
Raspberry Pi

In first I thought try to use wview, but binary package for arm-hf did not exist although binary package for arm-el existed. Therefore, I decided to use weewx which is written in Python.

Then, I tried to set up that the output HTML files which is created by weewx are automatically upload to web server on internet.

Figure of connection
Figure of connection

I installed the required packages to use apt-get as installstion manual of weewx.
Then, I configure weewx.conf for my environment.
I finished to set up and run command as following.

 cd /home/weewx
 ./bin/weewxd.py weewx.conf

run weewx from command line
run weewx from command line

If stored data is downloaded and current data is continuously print out to STDOUT, It's working fine.
In addition we should see syslog whether error did not occur.

Next,I tried to output HTML report as below.

./bin/runreports.py weewx.conf

If HTML files are created under public_html directory, it's OK.
We should also see syslog whether error did not occur.

Next I tried to customize HTML template to Japanese.
However, I had a error which caused character encode(UTF-8).
I rewrite sitecustomize.py for Python cheetah to recognize UTF-8.

import sys
sys.setdefaultencoding('utf-8')

When I confirmed HTML files in that time, the barometer value was not.
It caused for QC function of weewx.
In default unit of barometer was set inHg. And value of out of range from 28 to 32.5 was rejected.
I configure that barometer parameter in "[StdQC][[MinMax]] section". And output files which reran was fine.
Next, I tried that weewx works as daemon.
In weewx , startup script is prepared in startup_scripts directory, and I put it for debian into /etc/init.d.
Then, run as following.

/etc/init.d/weewx start

HTML files is automatically generated in every time which is configured in weewx.conf.

Finally I wrote shell script to copy HTML files into web server on internet by scp.
And I set up this crontab.


HTML file is now in following link.

Current weather conditions page (Nishinomiya Hyogo Japan)

It may often stop for experimental running.



previous page