WEATHER WIZARD
FORCAST THE WEATHER WITH YOUR ATARI
Program by RICHARD STAERZLArticle by CHARLES JACKSON
You and your Atari can now forecast the weather without checking the newspaper or watching an obnoxious TV weatherman. Weather Wizard is a BASIC program which works on all 8-bit Atari computers of any memory size.
Would you like to see more up-to-the-minute weather predictions than what's printed in your morning newspaper? Are you sick of your local TV weatherman's silly hats and awful jokes? Be your own weather forecaster. Just type in the latest wind direction, sky condition and two barometric readings. Weather Wizard and your Atari will do the rest, giving you a delightful audio-visual reading. (If you don't own a barometer, you can obtain barometric data from your daily newspaper or a weather broadcast.)
Type in Listing 1, WEATHER.BAS, checking it with TYPO II, and SAVE a copy before you RUN it.
Weather Wizard asks you for the previous barometer reading, then the current barometer reading. It uses a pair of readings to determine whether the barometric pressure is rising or falling. The program accepts barometer readings between 28 and 31 inches of mercury. If you enter pressures which do not fall within this range, Weather Wizard will buzz, give you a BAD DATA message, and let you try again. Otherwise, the program issues a mild "beep" and proceeds with the next question.
Now, type in the elapsed time, in hours, between the two readings. If the last reading occurred a half hour ago, for example, you'd enter 0.5 as the elapsed time. Weather Wizard will not accept an elapsed time of zero hours. If you entered a zero, the program will ask you again for the elapsed time.
Next, Weather Wizard will ask you for the current wind direction. Weather Wizard wants to know the direction the wind is coming from. In other words, if the wind blows your hat off, and the hat sails east, it's a west wind.
No need to convert the wind direction into degrees. Weather Wizard accepts the standard N, S, E, W, NE, NW, SE and SW abbreviations. Just like an adventure game.
Now, peek out the window and tell Weather Wizard the current sky conditions. You may choose between Clear, Partly cloudy, Mostly cloudy, Overcast and Rain. Type the appropriate letter and press [RETURN].
The hard part's over. Sit back, and Weather Wizard will present the forecast in a colorful graphic display, followed by a written forecast. At the top left of your screen, you'll see a drawing of a thermometer. Its color represents the temperature trend. A blue thermometer indicates a cooling trend, and a red thermometer represents a warming trend.
Off to the right, you'll see a colorful icon representing the present forecast. The sun stands for fair weather, and a cloud foreshadows rain or snow.
The bar graph in the center of the screen indicates the probability of precipitation. Finally, Weather Wizard prints a short forecast beneath the graphics display.
If you have a printer connected and turned on, Weather Wizard will automatically make a hard copy of the graphics display and the forecast. Weather Wizard will work with any printer, even producing the graphics on daisy wheel models.
HOW IT WORKS
Weather Wizard bases its predictions on several simple forecasting
"rules" which are fairly accurate for locations in the Northern hemisphere.
For example, winds coming from the South indicate a warming trend, while
North winds usually precede a cooling trend. The forecasting algorithms
are in lines 230-430.
EXPANDING THE PROGRAM
For a few dollars and a spare set of paddle controllers, you can turn
your Atari and Weather Wizard into an automated weather station that senses
the temperature and humidity.
You'll need a thermistor (Fenwal Model GA45P2) to measure the temperature, and a particle sensor (Devry Industries Hygropak Model HA) to measure the humidity. These parts are available for a few dollars from most electronics supply houses.
We will connect the thermistor to paddle controller 0, and the particle sensor to paddle controller 1. Since both paddle controllers go through the same joystick port, it's easy to get them confused with each other. To tell PADDLE(0) from PADDLE(1), type in this short BASIC line and type RUN.
10 ? PADDLE(0),PADDLE(1):GOTO 10
Plug your paddle controllers into joystick port 1. Twist one of the paddle controllers while watching the two columns of numbers on the screen. The left column shows the values returned from PADDLE(0), and the right column shows the values returned from PADDLE(1). In other words, if the controller you're twisting is changing the values in the left column, you're twisting PADDLE(0). Otherwise, you're using PADDLE(1).
Remove the two screws from the back of a paddle controller, and remove the plastic cover. Find the potentiometer (the round metal component in the center of the controller) and carefully cut and strip the two wires leading to it. Repeat this procedure with the other paddle controller.
Connect the thermistor to the wires you cut on paddle (0), and connect the particle sensor to the wires you cut on paddle (1). Do not replace the plastic paddle covers. Finally, plug the paddle controllers into joystick port 1.
It's easy to use your new weather sensors with Weather Wizard. Just change line 15 from SENSORS = 0 to SENSORS = 1, and hang your sensors out of the window.
If you find that your temperature or humidity readings are not quite right, feel free to change the values of MTEMP, BTEMP, MHUM and BHUM in lines 16 and 17. MTEMP and BTEMP are used for changing the values from the thermistor into temperature readings. MHUM and BHUM are used for changing the values from the particle sensor into humidity readings. You'll need two accurate temperature and humidity readings to recalculate values for the constants in lines 16 and 17.
Let's recalculate our temperature constants, MTEMP and BTEMP (lines 16 and 571). For those familiar with mathematics, we're using the slope/intercept method to derive our formulas.
We'll call our two temperature readings (as taken from
a thermometer) TCOLD and TWARM. The formula for MTEMP is:
and the formula for BTEMP is:
BTEMP = TCOLD-MTEMP * PEEK(624)cold + 0.5
You may use the same method to find the humidity constants MHUM and BHUM (lines 17 and 572). (But make sure you use PEEK(625) instead of PEEK(624)!)
Industrious programmers may want to use the actual conversion formulas (lines 571 and 572) in their own programs to build computerized thermographs, thermostats and systems to monitor and regulate plant growth.
Weather Wizard will help you accurately predict the weather while you learn about meteorology.
Richard Staerzl is an Atari programmer from Fond du Lac, Wisconsin.
Listing 1 WEATHER.BAS Download