The firmware in the NSLU2 has been replaced with the "Unslung" firmware from the NSLU2-Linux Development Group. This open source upgrade allows the device to boot off and external 256MB or larger USB memory stick. The stick contains a Linux distribution from the same group. The default install contains a fairly basic subset of a complete Linux install but a large number of packages are available to install any missing pieces. A development package is also available to allow cross-compiling software for the NSLU2 using a desktop Linux system. All of the software used is open source.

Besides security packages, some of the main software added to this system include:

cronlaunches applications/scripts at specified time intervals
gnuplotused for creating the plots at
kernel-module-usbserialto allow serial communications over the USB port
libpngallows gnuplot to create png files
ntpclientsynchronizes the NSLU2 clock with a time server
perlscripting language (not actually used for the weather data)
sedstream editor

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 "". The functions of the script are:

  • Every 10 seconds download data from the weather station
  • Every 5 minutes, average the 10 second data, calculate max and min wind speed over the interval and upload the data to Weather Underground
  • Every hour create plots using gnuplot and upload these plus the day's raw weather data collected so far to
  • Every day archive the previous day's data on randomuseless, start new data files and reset the daily rain total

    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 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