WMR 200
- Manufacturer: Oregon Scientific
- Manual: [pdf]
- Some more info: Station meteo amateur
- UV: manual UVN800
Weewx
I run Weewx on a Raspberry Pi 2 (running Raspbian). The weather station (WMR200) is physically connected by USB to the Raspberry Pi 2 (version B). It communicates remotely with its sensors (rain etc).The Raspberry Pi collects the data from the WMR's datalogger, stores them in its database and makes reports and weather graphs.
User group: Google Group
USB connection
You mustn't use usbhid, so it needs to be blacklisted: In /etc/modprobe.d/wmr200.confoptions usbhid quirks=0x0fde:0xca01:0x4Then restart modprobe:
sudo modprobe -r usbhid sudo modprobe usbhid
$ lsusb ... Bus 001 Device 032: ID 0fde:ca01
Installing weewx
You have the choice between:- a setup.py install - which works for 'any' OS
- installation of the Debian package
setup.py install
sudo apt-get install python-configobj sudo apt-get install python-cheetah sudo apt-get install python-serial sudo apt-get install python-imaging # Already present in most systems, but it doesn't # hurt to install again. sudo apt-get install python-usb # Required only for the Oregon Scientific WMR-USBThen modify setup.cfg:
modify setup.cfg ./setup.py build ./setup.py installYou might want to run it in another home directory. Create the user:
$ adduser --home /home/weewx --disable-login weewx $ chown weewx.staff /home/weewxThen do in weewx directory:
./setup.py buildOptionally, ephem might be needed:
sudo python get-pip.py sudo pip install pyephemTo start/stop weewx, use service weewx start/stop. However, it is important that NTP is synchronized before weewx starts. To do so, patch /etc/init.d/weewx:
if [ $NPROC != 0 ]; then return 1 fi + + # Ensure NTP is up + if ! ntp-wait -n 20 -s 3; then + log_daemon_msg "Not starting $DESC: NTP not synchronised" "$NAME" + return 2 + fi +and patch /usr/sbin/ntp-wait:
--- /usr/sbin/ntp-wait.orig 2013-11-30 21:27:55.016819640 +1000 +++ /usr/sbin/ntp-wait 2013-12-02 14:03:20.280256199 +1000 @@ -39,7 +39,7 @@ if (/Connection refused/) { print "\bntpd is not running!\n" if ($opt_v); - exit 1; + last; }To boot weewx at startup:
sudo update-rc.d weewx defaults
Debian package
Retrieve the Debian package from the weewx website (download section). Then follow guidelines from the user documentation. The Debian package comes with start/stop scripts for the weewx daemon. The weewx.conf configuration file will be located in /etc/weewx.Upgrading weewx
See docConfiguration file
weewx.conf
This is important to set to test your configuration and generate debug information:debug = 1The root path of weewx is essential
# Root directory of the weewx data file hierarchy for this station. WEEWX_ROOT = /home/weewx/I am using this version:
version = 3.2.1You can set up some information about your weather station:
[Station] # This section is for information about your station # Description of the station location. location = Bla bla # Latitude, longitude in decimal degrees latitude = 41.10 longitude = 7.07611 # Altitude of the station, with unit it is in. This is downloaded from # from the station if the hardware supports it. altitude = 100, meter # Choose 'foot' or 'meter' for unitThe location, latitude, longitude, altitude will then be available in HTML templates as $station.location, $station.latitude, $station.longitude and $station.altitude.
You can also specify the URL for your weather station website:
# If you have a website, you may optionally specify an URL for # its HTML server. #station_url = http://www.example.comThen it is essential to set up the type of weather station:
# Set to type of station hardware. Supported stations include: # Vantage FineOffsetUSB Ultimeter # WMR100 WS28xx WS1 # WMR200 WS23xx CC3000 # WMR9x8 TE923 Simulator station_type = WMR200 [WMR200] # This section is for the Oregon Scientific WMR200 # The station model, e.g., WMR200, WMR200A, Radio Shack W200 model = WMR200 # The driver to use: driver = weewx.drivers.wmr200 archive_interval = 300Information can be sent to external websites that use RESTful protocols.
[StdRESTful] # This section is for uploading data to sites using RESTful protocols. [[StationRegistry]] # To register this weather station, set this to True: register_this_station = FalseThis is to register the station on weewx station maps. Also, if your weather station is not published on websites such as AWEKAS, CWOP, you can disable those services:
[[AWEKAS]] enable = false ...Websites are known as 'reports'. You can set up several websites.
[StdReport] # This section specifies what reports, using which skins, to generate. # Where the skins reside, relative to WEEWX_ROOT: SKIN_ROOT = skins # Where the generated reports should go, relative to WEEWX_ROOT: HTML_ROOT = public_html # Each subsection represents a report you wish to run: [[StandardReport]] # What skin this report should be based on: skin = Standard [[External]] skin = External HTML_ROOT = external_html [[[ImageGenerator]]] image_width = 600 image_height = 360In the configuration above, I am creating two websites. One goes in public_html. And the other one, with bigger images, goes in external_html.
Uploading generated pages and images can be done via FTP, and this is yet another 'special' report.
[[FTP]] skin = Ftp # FTP'ing the results to a webserver is treated as just another report, # albeit one with an unusual report generator! # # If you wish to use FTP, uncomment and fill out the next four lines: #user = replace with your username #password = replace with your password #server = replace with your server name, e.g, www.threefools.org #path = replace with the destination directory (e.g., /weather) # If you wish to upload files from something other than what HTML_ROOT # is set to above, then reset it here: #HTML_ROOT = public_html # Most FTP servers use port 21, but if yours is different, you can # change it here port = 21 # Set to 1 to use passive mode, zero for active mode: passive = 1 # How many times to try to transfer a file before giving up: max_tries = 2 # Set to True for a secure FTP (SFTP) connection. Not all servers # support this. secure_ftp = FalseI am located in Europe and want metric units everywhere including in my database.
[StdConvert] # should use US since that is what the wview database contains. # DO NOT MODIFY THIS VALUE UNLESS YOU KNOW WHAT YOU ARE DOING! target_unit = METRIC # Options are 'US', 'METRICWX', or 'METRIC'
skin.conf
[Extras] radar_img = http://www.infoclimat.fr/api/AH4EMQcrAzhVYQQtVWdXNFw2BXhQOAEpDm0PZAc1AC8AYQIzVGcHNFFlVWIFNAdjAW9RM1EzBzNWNg5n/radar/sud_est?c6efb45b781de49d57c2c0aa20e8057c storm_img = http://www.meteorologic.net/map/radar/your_radar.php?lat=43.37 radar_url = http://www.infoclimat.frI select units I like
[Units] # This section is for managing the selection and formatting of units. [[Groups]] ... group_rain = mm # Options are 'inch', 'cm', or ' mm' group_rainrate = mm_per_hour # Options are 'inch_per_hour', ' cm_per_hour', or 'mm_per_hour' group_speed = km_per_hour # Options are 'mile_per_hour', 'Labels can be translated:
[[Generic]] # Generic labels, keyed by an observation type. barometer = Barometre dewpoint = Point de rosee heatindex = Humidex inHumidity = Humidite interieur inTemp = Temperature interieure outHumidity = Humidite exterieure outTemp = Temperature exterieure radiation = Radiation rain = Precipitations rainRate = Taux de precipitation rxCheckPercent = ISS Signal Quality windDir = Direction du vent windGust = Rafales windGustDir = Direction rafales windSpeed = Vitesse du vent windchill = Temperature ressentie windgustvec = Vecteur rafales windvec = Vecteur vent ... [[Labels]] ... foot = " pieds" ... [Almanac] # The labels to be used for the phases of the moon: moon_phases = Nouvelle, Premier croissant, Premier quartier, Gibbeuse croissante, Pleine, Gibbeuse decroissante, Dernier quartier, Dernier croissantThe HTML files to generate are listed in:
[[ToDate]] # Reports that show statistics "to date", such as day-to-date, # week-to-date, month-to-date, etc. [[[about]]] template = about.html.tmpl [[[almanac]]] template = almanac.html.tmpl ...I want a humidity chart to be generated. This is specified in the ImageGenerator section:
[[[dayhumidity]]] [[[[outHumidity]]]]Be sure to put the appropriate number of brackets. To optimize uploads to an external website, some resources need not be copied at each upload. This is handled by the copy_once directive in skin.conf:
copy_once = backgrounds/*, weewx.css, mobile.css, favicon.ico, smartphone/i\ cons/*, smartphone/custom.js
Customizing the time format
The customization of time formats to display in graphs or pages, is in skin.conf, section [[TimeFormats]]Adding a UV sensor
To display UV index, in index.html.tmpl:#if $day.UV.has_data <tr> <td>UV</td> <td>$current.UV</td> </tr> #end ifTo generate a UV graph,
- in skin.conf:
[[day_images]] [[[dayuv]]] yscale = 0, 16, 1 [[[[UV]]]]
- in the template index.html.tmpl:
<a href="dayuv.png"><img src="dayuv.png" alt="UV idx" title="Index UV" width="30%"/></a>
Adding a new graph
In skin.conf:[[[dayinouttemp]]] [[[[outTemp]]]] [[[[inTemp]]]]Then, in the html template (index.html.tmpl):
<img src="dayinouttemp.png" alt="temperatures" />
Commands
To generate a report (useful to test your skins):./bin/wee_reportsTo reload the configuration:
service weewx reloadTo test your configuration:
sudo ./bin/weewxd weewx.conf
Redirecting the logs
By default, weewx logs are in /var/log/syslog. To redirect to another location, create a file in /etc/rsyslog.d, for example weewxlog.conf.:programname,isequal,"weewx" /var/tmp/log/weewx.log :programname,isequal,"weewx" ~You need to restart rsyslog: service rsyslog restart.
Sending data to a twitter account
Download the extension from here and follow the configuration steps. In particular,sudo apt-get install python-setuptools sudo easy_install pip sudo pip install twython sudo setup.py install --extension weewx-twitter.x.y.tgzSee https://github.com/weewx/weewx/wiki/twitter In WEEWX_ROOT/bin/usr/twitter.py, modify to only send tweets at given time:
ts = time.localtime() if (ts.tm_hour != 7 and ts.tm_hour != 14 and ts.tm_hour != 18): logdbg("This is not hour to tweet: %d" % ts.tm_hour) returnIn weewx.conf,
- configure Twitter service:
[StdRESTful] # This section is for uploading data to sites using RESTful protocols. [[Twitter]] app_key = to put here app_key_secret = to put here oauth_token = to put here oauth_token_secret = to put here format = {dateTime:%X} Temp: {outTemp:%.1f} C; Humidite: {outHumidity:%.1f}%; Pression: {barometer:%.1f} hPa; Pluie: {dayRain:%.1f} mm; Vent: {windSpeed:%.1f} km/h; Dir: {windDir:%03.0f}; {windGust:%03.0f} unit_system = METRIC post_interval = 3600
- add twitter as a RESTful service:
[Engines] # This section configures the internal weewx engines. # It is for advanced customization. [[WxEngine]] restful_services = weewx.restx.StdStationRegistry, weewx.restx.StdWunderground, weewx.restx.StdPWSweather, weewx.restx.StdCWOP, weewx.restx.StdWOW, weewx.restx.StdAWEKAS, user.twitter.Twitter
Database tweaks
The database that holds data is archive/weewx.sdb (unless you changed the name in the configuration file).To retrieve the current temperature:
- Get the last entry by time: select max(dateTime) from archive;
- Read the inside temperature: select inTemp from archive where dateTime=...;
.schema archive CREATE TABLE archive (`dateTime` INTEGER NOT NULL UNIQUE PRIMARY KEY, `usUnits` INTEGER NOT NULL, `interval` INTEGER NOT NULL, `barometer` REAL, `pressure` REAL, `altimeter` REAL, `inTemp` REAL, `outTemp` REAL, `inHumidity` REAL, `outHumidity` REAL, `windSpeed` REAL, `windDir` REAL, `windGust` REAL, `windGustDir` REAL, `rainRate` REAL, `rain` REAL, `dewpoint` REAL, `windchill` REAL, `heatindex` REAL, `ET` REAL, `radiation` REAL, `UV` REAL, `extraTemp1` REAL, `extraTemp2` REAL, `extraTemp3` REAL, `soilTemp1` REAL, `soilTemp2` REAL, `soilTemp3` REAL, `soilTemp4` REAL, `leafTemp1` REAL, `leafTemp2` REAL, `extraHumid1` REAL, `extraHumid2` REAL, `soilMoist1` REAL, `soilMoist2` REAL, `soilMoist3` REAL, `soilMoist4` REAL, `leafWet1` REAL, `leafWet2` REAL, `rxCheckPercent` REAL, `txBatteryStatus` REAL, `consBatteryVoltage` REAL, `hail` REAL, `hailRate` REAL, `heatingTemp` REAL, `heatingVoltage` REAL, `supplyVoltage` REAL, `referenceVoltage` REAL, `windBatteryStatus` REAL, `rainBatteryStatus` REAL, `outTempBatteryStatus` REAL, `inTempBatteryStatus` REAL); sqlite> .schema archive_day_rain CREATE TABLE archive_day_rain (dateTime INTEGER NOT NULL UNIQUE PRIMARY KEY, min REAL, mintime INTEGER, max REAL, maxtime INTEGER, sum REAL, count INTEGER, wsum REAL, sumtime INTEGER);You can perform queries/commands on the database:
select dateTime, rain, rainRate, rainBatteryStatus from archive where dateTime >= 1439157600 and dateTime < 1439244000 sqlite> select * from archive_day_rain where dateTime >= 1439157600 and dateTime < 1439244000 ...> ;Note that:
- My database uses the Metric system: 16 is for Metric.
sqlite> select dateTime, usUnits, rain, rainRate from archive where rain > 0 and dateTime > 1428271200 and dateTime < 1428357600; 1428316200|16|0.101599999999991|0.0
- The units for rain is CENTIMETERS (not mm)
- stop weewx: sudo service weewx stop
- backup weewx.sdb (just in case, but safe!)
- update the rows as desired:
update archive set rain=0.02 where dateTime=XXX;
- drop the daily summaries:
wee_config_database weewx.conf --drop-daily
- If necessary, delete the NOAA for the affected month and year (in public_html/NOAA/)
- The rows will rebuild correctly when weewx is restarted. If you don't want to wait, you can do it offline:
wee_database weewx.conf --backfill-daily
- restart weewx: sudo service weewx start.
Other software
- WView: complex but works well, and supports WMR200
- Wfrog. It can work on raspberry pi too.
- Oregon Scientific WMR100/WMR200/RMS300A USB protocol client
- Python program to extract data from a WMR200 weather station
- Build your own weather station based on Arduino
- Arduino decoder for weather stations
- Weather Display software (not free)