Besides security packages, some of the main software added to this system include:
|cron||launches applications/scripts at specified time intervals|
|gnuplot||used for creating the plots at www.randomuseless.info|
|kernel-module-usbserial||to allow serial communications over the USB port|
|libpng||allows gnuplot to create png files|
|ntpclient||synchronizes the NSLU2 clock with a time server|
|perl||scripting language (not actually used for the weather data)|
The software used to record and post the weather data is a series of bourne shell scripts and an application that downloads data from the WS-2310. The latter is based on the open2300 software suite. This package includes simple tools written in C for downloading raw data from the weather instrument, resetting min/max data, uploading data to Weather Undeground or the Citizen Weather Observer Program and creating web pages containing the data. The software in this group of tools was modified significantly to output exactly what was wanted. The main code used is from the "log2300" program. When called, the program downloads the current data from the WS-2310, appends it to a file and exits. Modifications included removing unwanted variables, adding others, changing the output format of yet others and including calibration factors.
The complete process of downloading data, creating plots, uploading data to Weather Underground and archiving old data is performed by a bourne shell script called "weather.sh". The functions of the script are:
Normally task scheduling such as this would be handled by cron. To record meaningful wind gust data, however, requires taking action much more often than the 1 minute minimum interval cron uses.
The 10 second data download interval is set by the maximum data rate of the WS-2310. The temperature/humidity unit is hard wired to the base station resulting in the fastest possible data update rate between the two of 8 seconds. Data is downloaded from the base station at a slightly longer 10 second interval to insure new data is always received and averaged.
The package from the open2300 suite is not used for uploading to Weather Underground as this would require downloading the data from the weather instrument a second time. This would take up too much of the 10 seconds available as each download takes roughly 2-8 seconds. Instead the data saved from the modified log2300 program is repackaged into the needed format by the weather.sh script and uploaded using the wget package.
Some explanation of how the data is averaged is in order. For the temperature, humidity, dewpoint, barometric pressure and wind speed the average is the simple average of the scalar quantities over the 5 minute interval. Unfortunately the readings from the instrument do not occur at precise 10 second intervals due to scatter in download times mentioned earlier. Currently each reading is weighted equally as-if the readings were separated by a constant time increment.
The wind direction is averaged in a different manner since there is a problem doing a simple average of winds coming from a northerly direction. For instance, winds coming from 1 degree and 359 degrees are only 2 degrees apart yet the simple average is 180 degrees, an unlikely result. To get around this problem each wind direction reading is converted to a unit vector and the components are averaged separately. The results are converted back to an angle using the atan2 function. This technique of averaging scalar wind speeds and unit vector wind directions is one of the methods used by NOAA. There are other averaging methods, each with its own pros and cons. For most wind conditions it should make little difference which method is used, especially since any "errors" introduced by the method are probably overwhelmed by the inaccuracies in the individual wind measurements described in the "limitations" section.
|Return to Home Page||Latest update: December 1, 2006|