Weather Station Notes

This page discusses the hardware and software used to set up and operate an amateur weather station serving live sensor data on an independent webpage.1


This weather station consists of several low-cost sensors connected to a Maxim 1-Wire network. The sensors measure temperature, humidity, barometric pressure, and rainfall.

The 1-wire network is connected to a miniITX board using its serial port and the sensor data made available through use of OWFS (One Wire File System) drivers. The miniITX board is running Linux (Debian 5)A simple C++ program reads the current sensor values from individual text files and appends them to aggregate log files. This program is scheduled to run periodically every few minutes by a background job scheduling daemon (cron).

Data from the logs is selected, conditioned and plotted on the fly whenever the weather station webpage calls for it – when it is revisited, refreshed or the time scale is changed.

All software required to operate this weather station is available either public domain or under open-source agreements. Software written by this author is available at this website. Software dependencies are identified and links provided.

Figure 1. The 1-wire network is wired with CAT-5, but only two of the wires of the eight wires are actually used. (Image modified from one found on

The Sensors


Temperature measurements are based on a Maxim DS18S20 sensor2, which has a rated accuracy of +/-0.5 degrees C.

The temperature sensor can be seen mounted on the board in figure Figure 2, just to the left of the round gold solar irradiance sensor in the upper left corner. This picture comes from the website – the author's board does not include the solar sensor.

(2) Here is the datasheet for the Maxim DS18S20 temperature sensor. Go to for other data sheets and application notes.

Figure 2. This temperature/humidity/solar board comes from where it can be obtained as a bare board, a kit, or a finished product. I bought the bare board and built it up from parts but wouldn't recommend this procedure unless you are comfortable working with surface mount components.

There are actually two temperature sensors present on this board – there is a second, embedded temperature sensor inside the A/D chip which is used to measure both the humidity and solar sensors. This embedded temperature sensor is not as accurate as the DS18S20 though; it is only rated +/-2 degrees C.


The humidity sensor is made by Honeywell.3 Not itself a 1-wire device, it puts out an analog voltage in a range which can be sampled by a 1-wire analog-to-digital converter4.

(3) Here is a datasheet on the Honeywell HIH-4000-001 humidity sensor.

(4) Here is the datasheet for the Maxim DS2438 A/D device.

Figure 4. Relative humidity is plotted in blue as a percentage. The temperature is plotted in black using the same numbers, but units in degrees Fahrenheit.

Dew Point

Dew point is calculated from the relative humidity and the temperature. 5. As mentioned above, the 1-wire A/D converter used for measuring the humidity sensor also has an embedded temperature sensor – less accurate than the standalone temperature sensor – but as it is sampled synchronously with the relative humidity voltage, it is easier to use in the dewpoint calculation, requiring no interpolation and consideration of 'corner conditions'. In any event observed temperature differences between the two sensors have been very slight.

(5) See, for example, the Magnus-Tetens approximation in Calculating the dew point at

Figure 5. Dewpoint is computed from relative humidity and temperature. Both are plotted for comparison.

Barometric Pressure

The barometric pressure sensor is a Motorola MPXA4115A6, which is not a 1-wire device. It puts out a voltage, but unlike the humidity sensor, it is not in a voltage range that can be used, so it must be adjusted and amplified to get it into the range of the 1-wire A/D converter such as is employed with the humidity sensor.

The sensor can be seen on the board in Figure

Figure 6 — the large chip in the the upper-right quadrant.

The sensor is sensitive to pressure changes over a much wider range than is employed for atmospheric measurements near ground level, so the portion of its output range being used is rather small. Because of this, it is fairly important to get input range to the instrumentation amplifier adjusted so the output of the amplifier neither underflows or saturates the A/D for the range of barometric pressures expected.7

Calibration consisted of mapping the measured voltage levels back through the transfer inverse transfer function given by Motorola to the driving pressure.

Note: this sensor is located indoors, which shouldn't matter as pressure doesn't change indoors.

(6) Here is thedatasheet for the Motorola MPXA4115A barometric pressure sensor.

Figure 6. This barometer board also comes from It was designed by Tim Bitson who is also the author of Weather Toys.

(7) The author downloaded several years of barometric measurments from the local university and generated histograms to determine the range encounted in this area, discovering the curiousity that the Puget Sound seems to be peculiar for experiencing low pressure as norm. A nearby NOAA weather station was also used for a calibration reference on days of relatively stable pressure.

Figure 7. Pressure is measured as a voltage which must be converted to a pressure by way of the inverse of the transfer function of the sensor and two calibration points.

Rain Gauge

A rain gauge was added to the network on November 27th, 2008. This rain gauge is a tipper, built by Rainwise but modified by to include a 1-wire counter. It operates by tipping a tiny thimbull to empty it each time it fills, thus counting 0.01 inches of rain accumulation. The counter has a long-life lithium battery so it holds onto its counts through power failures. Rain accumulations over a given interval of time is calculated by taking the difference in counts and multiplying by 0.01. 8

Rain gauges don't work when it snows.9 Siting can also be a problem.10

(8) Rainwise builds an excellent rain gauge that has been modified for 1-wire operation by

(9) This article describes a method of measuring the depth of snow.

(10) The placement shown below is temporary. It needs to be elevated off the ground to avoid splash (and damage) and it needs to be further away from walls and objects that might deflect rain coming in at strong slant angles. It will need to have a wind shield to avoid the undercatchment problem from strong horizontal wind components. There are a variety of methods for shielding a catch basin to reduce wind effects – all of them large and ugly – which will usually involve delicate negotiations with other domestic inhabitants. See examples in CWOP Guide.

Figure 8. Rain is plotted as two cumulative distributions. The faster – per hour – is plotted in red on top of the slower – per day.

Sensor siting

The initial site for the temperature and humidity sensors was under the eves of an unheated garage (see Figure Figure 9). This was not an optimal location. The concern is that summer heating of the composition roof shingles might bias midday temperatures. It has also been noticed that when temperatures are unusually cold, opening the garage door can cause the flow of warm air to waft up into the eves and flow around the corner to where the sensor is, briefly raising the measurement.11

On Friday, Nov 27th, 2008 the temperature and humidity sensors were moved down from under the eves to a location about five feet off the ground nearby (see Figure Figure 10). This is the elevation recommended by the CWOP Guide12, and as frost had been observed several mornings without observing freezing temperatures it was thought that the elevation of the sensors might be affecting the measurements.

Noticable immediately was a striking reduction in the temperature variance and a loss of lower temperature measurements at night. These phenomena were attributed to thermal ballast provided by the mass of the building materials on two sides of the sensors.

A shielded enclosure is currently being designed which will permit the sensors to be located at about five feet off the ground, away from any buildings that will not absorb heat from the sun.

Pressure is the same inside or outside (unless your building is pressurized), which permits barometric pressure sensors to be deployed indoors. One note about barometric sensors is that the sensor itself wants an environment of dry air or sensor inaccuracy and deterioration will result. One way to insure this is to pack the sensor in a collection of dissicant packets.

Figure 9. This was the initial location and location subsequent to the week in the week described in the next figure below.

(11) See, for example, temperature graph around 11am 13 Dec 2008)

Figure 10. I tried locating the sensor about midway up the corner between the stone and the inner garage wall for about a week, but it smoothed the temperatures – particularly the low ones – even though the garage was unheated.

(12) The Citizens Weather Observer Program (CWOP) Resources website at contains an abundance of information, not least of which is the CWOP Guide. This document discusses causes of measurement error, sensor placement, shielding, including data from comparitive studies.

The Network

The 1-wire network at its most basic actually consists of two wires: a signal wire and its return. The name comes from the fact that no additional wires are necessary for power, as every 1-wire device must be capable of parasitically getting its power from the signal line by charging up an internal capacitor on the 5 volt signal line.

In practice, circuits like the barometric pressure board and the humidity board require a source of higher voltage, so even though the 1-wire devices on them can work parasitically, the other parts cannot and additional wires carrying 12 to 15 volts are required.

The 1-wire serial protocol must be converted into something useful – meaning, something a desktop computer can understand. The easiest and most cost-effective thing to do is convert it into standard serial communications or a USB interface using one of Maxim's conversion chips.13

The 1-wire boards from and AAG Electronica come with RJ45 (ethernet) connectors, which allows cheap network wire to be used. Most of the sensor boards have two connectors per board so they can easily be daisy-chained. The rain gauge seems to be an exception, probably because they are using the existing twin-lead wire provided by that manufacturer rather than CAT-5.

(13) The author uses a 6-channel Hub which employs a DS2480B 1-wire-to-serial converter and a MAX232 RS-232 converter.

The Software


"OWFS is an easy way to use the powerful 1-wire system"14. What it does is mount the network so each 1-wire line shows up as a directory, and every 1-wire device connected to it a unique subdirectory full of device-specific parameter and value files. These files are all plain ascii text files containing strings representing the current value named by the file. The OWFS daemon updates all the files in the device tree15 at a rate determined by its configuration.

Here is what which is an easy way to interact with a 1-wire network, as it mounts the sensors and all their attributes as a virtual file system with simple parameter trees of ascii text files, so all one has to do is read values as text from files which are continuously updated in a device tree

(14) The OWFS project website at contains detailed descriptions, tutorials, examples and links to the code itself.

(15) Here is a sample listing of a device tree. The directories with the hexadecimal names are the unique lasered addresses of 1-wire devices. The files beneath these are ascii text files containing one or several values, making it trivial to write programs and scripts which read them. The OWFS drivers keep the values up to date by sampling the devices regularly, the period of which is controllable by configuration.

Data logging

A simple C++ program16 reads the current values of sensors of interest and logs the values to log files. These logs are flat text files of sequential data, one record per line. The program can easily be modified to accomodate other sensors and must be edited to the correct sensor id's for any given device tree in any event (which are unique).

This data collection process is triggered by a cron command,17 set to sample the sensors at regular intervals.

(16) The source code for the C++ program which polls the OWFS device tree and updates the device logs can be found poll-owire.cpp. A discussion with complete code can be found on this page.

(17) The process is hosted on a mini-ITX board computer running Debian 2.6.18-5-686 #1 SMP Mon Dec 24 16:41:07 UTC 2007 i686 GNU/Linux. The cron command actually calls a BASH script which not only runs the C++ program but rsyncs the updated logs to a computer hosting a webserver, thus providing data redundancy as well.

Graphic display software

Selected intervals of raw18 sensor data can be processed and viewed graphically on webpages. This software was all written in Common Lisp,19 making use of the gd graphics library. Sample graphs have been included in the figures above.

(18) Storing only raw data has more than once allowed graceful recovery from calibration errors. Raw data is sacred.

(19) This package depends on several other Common Lisp packages, most notably: cl-gd, cl-who,cl-fad andcl-ppcre, all written by Edi Weitz. All codes are publically available. Codes written by the author are available here.

Hunchentoot Webserver

The sensor data is made available by plotting time histories graphically and displaying the plots on webpages. The webpages are generated dynamically each they are requested. The webserver which serves them is a Hunchentoot webserver which interfaces nicely with the graphic display software, as it is also written in Common Lisp.

Figure 11. "Hunchentoot is a web server written in Common Lisp and at the same time a toolkit for building dynamic websites." (See