Karl Uppiano

1-Wire Weather Service for Java

Home
The Weather Station
Java Weather Software
Software Tech Notes
Reliable Wind Speed Data
Science vs. Religion
My Resume

Weather Service and Real-Time Monitoring

Overview
The 1-Wire Weather Service for Java collects data from the Dallas 1-Wire weather instrument and related 1-Wire sensors using the Dallas 1-Wire API for Java SDK. The WxMonitor allows you to view and control the 1-Wire Weather Service for Java. It displays wind speed and direction, temperature, dew point, humidity, air pressure and rainfall.

splash.jpg
The WxMonitor Splash Screen

Since this software is written in the cross-platform Java language, it should run on any platform for which 1-Wire drivers are available. It is known to run on Windows XP, Windows Vista and Linux. Please contact me if you would be interested in testing on other platforms (please include the string "WxService" in the subject line).
 
I have been working on this project as a hobby in my spare time over the past couple of years. I have been interested in the weather ever since I built my first weather station for a science fair in the seventh grade. This project integrates my interest in weather with my interests in electronics and software.

Download
This software is provided for free, as-is, no warranty. Please refer to the specifications below for compatibility requirements before you download the latest version, or select a previous version (zip file).
 
To install on Windows systems, extract the file into the Program Files directory. On non-Windows systems, extract the file into the directory you want to use as the root for the application. After extracting the software, please refer to the readme.html file contained in the wxservice directory for detailed setup and operating instructions.
 
On Windows Vista, you might have problems unpacking with zero length files using Windows compressed folders. You might try WinZip. Furthermore, you might wish to avoid the Program Files directory. I haven't decided yet how I want to deal with the Vista Program Files restrictions.

Latest Updates
I post update notices on the site blog along with the latest news and tech notes about the 1-Wire Weather Service for Java. You can subscribe to the RSS feed for automatic update notifications.

Specifications
The 1-Wire Weather Service for Java works with the following sensors, technologies and platforms:

Weather Instrument Cluster
Hygrometer & Thermometer
Barometer & Thermometer
Rain Gauge
Technology
Platform
Any platform supporting Java 1.6 or higher with Dallas 1-Wire TMEX drivers
Publishing Weather History
Graphical User Interface
WxMonitor, local or remote real-time display (see below)

The WxService
The 1-Wire Weather Service for Java collects data from the Dallas 1-Wire weather instrument and related 1-Wire sensors using the Dallas 1-Wire API for Java SDK. WxService can run in two modes: As a Windows service or Unix daemon, or embedded in an application.
 
In addition to the main class, there are three primary types of classes: Device tasks, whose job it is to read their device on a configurable schedule and post the data to a data exchange class; device data classes, whose job it is to listen for data update events from the data exchange and process the raw device data into actual weather data in the desired units; and formatters, whose job it is to format the data for other applications (web pages, log files, etc.).
 
I have developed device tasks to support a variety of devices, including anemometer, wind vane, thermometer, barometer, hygrometer and rain gauge. Each device task presents its own interesting challenges (except for the temperature sensor, which just reads the value and converts to Fahrenheit if necessary).
 
The wind vane swings a magnet over a ring of eight magnetic reed switches. Each switch is wired to a resistor network that can present a low, medium or high voltage to one of four channels of an A/D converter, depending upon which switches are on or off. Adjacent switches can be turned on simultaneously, so 8 switches correspond to 16 compass points. The wind vane task rounds the double precision floating point values to an array of integer voltage levels: low (0 to 1 volts), medium (2 to 3 volts) and high (4 to 5 volts). An A/D converter is overkill for this application. An 8-bit parallel I/O chip would have been much easier to design with in hardware and software. Anyway, these voltage levels are further mapped into the 16 compass points like this:

Compass Heading
 
D/A Channels

00

01

02

03

04

05

06

07

08

09

10

11

12

13

14

15

Channel A
-
-
-
M
M
M
-
-
-
-
-
L
L
L
-
-
Channel B
-
M
M
M
-
-
-
-
-
L
L
L
-
-
-
-
Channel C
M
M
-
-
-
-
-
L
L
L
-
-
-
-
-
M
Channel D
-
-
-
-
-
L
L
L
-
-
-
-
-
M
M
M

A high voltage indicates a switch is turned off, so we can ignore it. The task looks up the voltage pattern in a table, presents the table index (0 - 15) to the wind vane data class. The data class then performs consensus averaging which, due to the continuous motion of the wind vane, increases the resolution from 16 points to nearly 360 degrees. I am extremely pleased with the quality of the directional data.
 
The hygrometer task reads humidity and temperature and calculates the dew point, and posts the data to any of three data classes that handle raw humidity, temperature or dew point.
 
The anemometer task counts the number of revolutions and divides that by the number of milliseconds since the last sample and multiplies that by a constant that relates device RPM to actual wind speed. It posts the raw data to the anemometer data class, which keeps a rolling average, along with gust and lull information. I devote an entire page to the problem of getting reliable wind speed data.
 
The barometer task implementation is for the TAI8570 Pressure Sensor. The TAI8570 contains a pair of DS2406 dual addressable switches to clock data into and out of the Intersema MS5534A Barometer Module serial interface. The task must send and receive every data bit as a separate MicroLan transaction. Both switches are independent devices on the MicroLan. A file on one switch contains the address of the other associated switch. The write switch has VCC power supplied, whereas the read switch does not (however, they both use parasitic power). This power scheme is how TAI chose to identify the switch function.
 
The rain gauge device task counts each event from the tipping bucket rain gauge. You can configure the task to record rainfall in English or metric units, at whatever resolution a bucket tip event for your particular rain gauge represents.
 
I developed formatters for posting weather data to comma-delimited log files, Weather Underground Data Exchange and the APRS Citizen Weather Observer Program (CWOP), each on their own individual schedule. Each formatter has its own data classes for each sensor type. This allows me to configure the data classes for each formatter, so one formatter can post to Weather Underground in US/English units, while another formatter can post in metric units, and they can be on their own schedules. In fact, every device and every formatter can run on its own independent schedule. For example, I have my temperature sensors and humidity sensors running every minute, while the wind is sampled every five seconds, but the formatters post every 10 minutes.
 
Fault tolerance includes checking for CRC errors on the network, catching communication exceptions, as well as detecting various timing limits and sanity checks on returned data.
 
I log critical operations and errors to disk. I can set the log verbosity to seven different levels for detailed information from finest (the lowest level), all the way up to severe (the highest level). Those of you who are familiar with the java.util.logging package know what I'm talking about.

The WxMonitor
The monitor allows you to view and control the 1-Wire Weather Service for Java. It displays wind speed and direction, temperature, dew point, humidity, air pressure and rainfall.

Monitor for the 1-Wire Weather Service for Java
Click to Display Actual Size
WxMonitor Application Screen Shot

The Wind Vector display, instead of the usual dials, dominates this program's user interface. There is a lot of information at a glance here. The outer ring shows wind direction, the line emanating from the center of the chart graphically indicates current speed and direction. The longer the line, the higher the wind. The grey lines represent the 10-minute average wind speed (configurable). They remain on the chart for 24 hours (configurable), so by default you can see a 1-day history of the wind activity.
 
I plot the wind speed on a logarithmic scale, so that it isn't necessary to rescale the chart when the wind changes. The logarithmic characteristic magnifies light air, but has enough dynamic range to show strong winds in excess of 200 mph. Why 200? Well, because I can. And because I heard that hurricane Katrina had winds in excess of 200 mph. Furthermore, I can use the same scale for kph, since 200 kph = 125 mph. Not that anybody's weather instruments would survive a storm like that.
 
Below the wind vector chart, I placed a table containing miscellaneous wind data, including average speed in numerical format, gust and lull since the last reset, Beaufort wind index, the direction in degrees and the compass heading. The reset button at the bottom sets the gust and lull values to the current value.
 
The rest of the indicators are standard linear sliders, calibrated to show the full range of data, like a "real" thermometer. The table at the bottom contains a summary of the data in numerical format. The reset button at the bottom sets the maximum and minimum data to the current value for each associated sensor.

WxService Operational Configurations
WxService can run in two modes:

WxMonitor Operational Configurations
WxMonitor can run in two modes:
  • A web service client of WxService - Connect to WxService via the web service anywhere on your local network or on the Internet.
  • A stand-alone application - WxMonitor can directly instantiate WxService without remoting, but requires local access to the 1-Wire MicroLan and TMEX drivers.

Software Status
The software is code complete. I make occasional improvements and publish them to the FTP site. Check the blog on the main page for breaking news of updates.

If you have comments, questions, or suggestions about this site, please e-mail me and tell me what you think.
To avoid landing in the killfile, be sure to include "WxService" in the subject line.