The Software

There is a common quote about ships which may help explain why recording weather readings in a computer is not enough: In our case, what is the point of collecting information if we don't do something useful with it? Web pages allow us to share this information.

To complete the process, web page files need to be created and then placed where people can get at them.

To keeping it all running sometimes takes some extra effort:

In the end, just like Ross Perot used to say . . .

Programs & Files

Up to this point you may have read about how we measure and record what the various sensors are sensing. Now, how do we make that information useful?

This program, written in the ANSI "C" language, was created to build the web pages from scratch. It creates the page you see as "".

You may know how to edit a web page in raw HTML. Imagine writing a program which automatically writes HTML files.

"current" is executed every four minutes under control of the "cron" program.

"current" first reads the raw data files to get all of the data for the last forty-eight hours. It then summarizes each hour's data for each sensor. Finally, the web page is composed, sensor by sensor. The current reading is given, and the historical (hourly) trends are graphed.

Before completing the web page there are a few more lines to add, ones which do not change often. The last of these come from a "footer" which is appended to the file. This allows changes to be made (like "Notes") without having to re-compile the program.

Getting files to the ISP

A file in a computer may be interesting, but it needs to be accessible if it is to be useful. This is the final link in the making of a web page.

How we do it now

The ski area's web site (where this weather station's web pages are located) is connected to the area's internal LAN (Local Area Network). The computer which builds the weather summary web pages is also connected to this network.

The "cron" program runs a batch file several times per hour, which uses FTP on the network to send new files to the web server.

This "miracle" of communication was made possible by the installation of a high-speed "T1" line to the ski area.

How we used to do it

For several years we used a dial-up modem connection to upload to a commercial ISP account.

The "cron" program ran a batch file once or twice an hour, which called the ISP, logged-on, established an FTP session, changed directories and "put" updated files onto the server.

Modems can be slow and unreliable if the phone lines are noisy. The computer would occasionally lock-up when the connection had trouble.

"..\ftp\to_website.bat" is the batch file used to FTP files to the internet site. It looks like:

"..\ftp\to_website.txt" is a script file fed to the FTP function. It looks like:

FTP Lock-up Watchdog

The FTP transfer of files to the ISP (Internet Service Provider) has at times been unreliable.

The symptom of this problem is an FTP session that never gets done. The result is that all subsequent activities never happen. The machine is effectively "locked-up".

Since the weather computer runs unattended, there is no one around to see the problem and "kill" the offending process.

The actual cause of this problem might be due to any of several reasons, like the ISP server is "down", or the network connection to the ISP is slow or broken.

The fix is the "FTP Watchdog" program. This program is started just before an FTP session starts. The watchdog first "sleeps" for a time period much longer that it should take for the FTP session to complete. When the watchdog "wakes up" it searches for and kills the FTP session if it is still running. Under normal circumstances the FTP session has long-since completed and terminated itself.

A log file of the watchdog's operation makes for dull reading. On the other hand, every incident handled by this watchdog is another example of the system being able to detect and overcome an otherwise "fatal" problem.

Thanks to Ken Keeling for the program.

Power Lock-up Watchdog

This is all about a "fade to black" problem the weather computer has.

The symptom of this problem is that the monitor screen suddenly goes all black. The computer does not respond to the keyboard or mouse. There is no recovery short of cycling the power.

The actual cause of this problem is unknown. It might be an intermittent open circuit somewhere in the computer: On the processor, on a hard disc connection, or somewhere else. It sometimes occurs while the user is typing, opening new web pages, or when some action occurs which might result in an access to the hard disc. A user banging on the keyboard or mouse seems to make the problem happen more often.

An easy fix would be to put a relay on the "reset" button, except this computer doesn't seem to have a reset button, so . . .

The fix is to have a "watchdog" timer which must be periodically reset by the computer. If the computer stays operational, the timer never has the opportunity to time-out. If the computer locks-up, the timer will time-out, which results in a relay opening and dropping power to the computer. The relay closes a few seconds later, the computer re-boots, and it resumes normal operation.

The boot process proceeds fast enough that the timer does not time-out before the computer is back on line.

To get a WinXP computer to re-boot after a power cycle requires a change to the CMOS. To set this option:

  Re-boot the machine
    Press "F1" early in the boot process
      Find the "Do what when AC power returns?"
        Use the "Page Up" and "Page Down" keys to select the "Power up" option
          Hit "F10" and/or "OK" and/or Whatever to gracefully exit & save this change
WARNING: The above procedure is written from memory of watching someone else do this. It needs to be verified and corrected.

The hardware used to implement this fix is connected the computer like a printer, but what it does is control power provided to an outlet, into which the computer is plugged. You could probably reverse engineer it from this:

The software is mainly responsible for sending a few characters to the LPT1 port every minute. It executes a one-line "Pwr_Watchdog.bat" script which looks like:

The toggling data bits reset the timer, so it doesn't time-out and activate the 1-shot and power relay.

The software also maintains a log file which keeps track of how long the computer has been operating normally. Relatively dull reading, but every incident handled by the watchdog is another example of the system being able to detect and overcome an otherwise "fatal" problem.

Ken Keeling helped with this watchdog as well.

"It's just that simple"

Well, that's the story of how one weather station's web pages get made. It's a long chain of hardware and software, working together, to get the information to you.

If you want to make your own weather station and put it on the web, be ready to learn a lot. It can be an interesting hobby, and you can (or will) learn about things like:

Installing your station can be a good introduction to many of these topics. Keeping it running can be a continuing education.

Murphy's Law may be stated as: Anything that can go wrong will go wrong. Beyond the humor is the lesson that well designed things require anticipating what can go wrong, and then finding ways to make sure that they do not.

To the extent that you understand the nuts and bolts, bits and bytes, or Volts and Ohms, you will be able to investigate & fix what breaks and to make improvements. You may find these skills useful for more than just an interesting hobby.