From Stu2
Jump to navigation Jump to search

Here is my local WX page:

Another station I run in Corbin, VA:


Going for a minimalist approach, I wanted to design something that could be displayed on the wall in a 15" (or less) monitor. The idea is to generate something similar to the 'Weather Picture' from Peet Brothers.

Here are the components I combined to get my web page:

  • Linux computers w/apache, serial ports, etc.
  • Peet Brother's Ultimeter 2000
  • - scripts to produce the data files
  • SOCAT - to remote the serial port. (The Ultimeter connects to a different computer than my web server and scripts.)
  • - Flash gauges that can be dynamically changed.
  • Graphic Artist - Tim produced the dials and graphics
  • Digital Camera - to photograph wood from my coffee table
  • - clear sky clock widget, best visual for understanding upcoming WX



SOCAT - Remote Serial Port

Here's the SOCAT command on the remote side:

socat tcp-l:2525,reuseaddr,fork /dev/ttyS0,raw,b2400,echo=0,ocrnl=1

Here's the remote command on the local side:

socat PTY,link=/home/wx/dev/vs0,raw,echo=0 tcp4:IP_ADDRESS:PORT

Note, I had to create the PTY device, /dev/vs0. I'm sure there's a cleaner way. I'll find it some day. Bottom line, this creates a pseudo TTY device that is connected via TCP to the remote end's COM1 port.

Ultimeter Scripts

The scripts read the ultimeter string and produce two files; u2000.dat and u2000.log. The log file keeps the history. The .dat file exposes values for all the current readings from the Ultimeter. The PHP scripts parse the file, looking for the right string, grabs the value and then provides it to the XML configuration for the gauge.

Here's a part of the u2000.dat file:

LowWindChillYesterdayTime: 11:46
OutdoorHumidity: 38.8
OutdoorTemp: 35.5
RainTotal: 0.00
RainTotalDate: 01/01/2008
RainTotalToday: 0.00
RainTotalYesterday: 0.00
Time: 10:27
WindChill: 35.5
WindDirection: 293
WindPeakDirection5Min: 0
WindPeakSpeed5Min: 0.0
WindSpeed: 0.0

Flash - the Gauges

I used gauge.swf and a php file for each dial. The wx scripts pull the data from the Ultimeter every second. All of the current values are exposed in a single file. The php file parses the data and creates the proper configuration file for the gauge. The php file includes the 'update' tag, so gauge needle updates automatically without refreshing the web page. Very cool.

Here is the php script for the temp gauge. The other files are similar. Essentially, php is used to create the dynamic values and stick them into an XML file. The only semi-tricky part was deriving the formulas for the needles.

$h = 65.0;
$fd = fopen("/usr/local/weather/log/u2000.dat", "r") or die;

while (!feof($fd)) {
	$line = fgets($fd,1024);
	if ( ereg('^OutdoorTemp:', $line)) {
		$temp = substr($line, 13);
	if ( ereg('^OutdoorHumidity:', $line)) {
		$humid = substr($line, 17);

$temp_str = strtok($temp,".") . " F";
$theta = ((180 / 109) * ($temp + 14))/ 57.2978;
$x2= ($h * -cos($theta)) + 103.0;
$y2= ($h * -sin($theta)) + 103.0;


	<image url='./temperature.jpg'
	<line x1='103'
			x2='<?php echo $x2 ?>'
			y2='<?php echo $y2 ?>'
	<text x='82'
			><?php echo "$temp_str" ?></text>
	<update url='temp.php?microtime=<?php echo microtime() ?>'


Other Software

I looked at several other packages. Since I wanted to use Linux and had a Peet Brothers WX station, I was stuck with "Weather Display" ( This package is very extensive and is derived from the Windows version. However, the GUI is horrible and frustrating to use. This led me to look for an alternative. (u2000 scripts.)

At our Corbin, VA station, we have a Davis Vantage Pro and I used wview, ( which is excellent. I was able to use a small dedicated Linux computer to retrieve the data files from the Davis WX station, produce the reports and move them to a web server. The data is fed to the CWOP program. (DW1705) However, it doesn't support Peet Brothers. (drat!)

Here's the WX station in Corbin: - Corbin Weather Page

Resources - Manuals