Morgan Serial Weather Measurement System

Peter H. Anderson
915 Holland Road
Bel Air, MD 21014
pha@access.digex.net, http://www.access.digex.net/~pha

Note.

A paper copy of this documentation including all of the figures may be purchased for $6.00 postpaid in the United States and Canada. This may aid you in reaching an informed decision as to whether you desire to purchase the system. This $6.00 may be credited against the price of the system if you later do purchase the system.

Return Policy.

This system was designed by undergraduate students at Morgan State University. It is sold on a breakeven basis.

I try to have my students develop useful educational packages and kits which help other hobbyists do things they might not otherwise be able to do.

If you are not satisfied with it's operation, please return it to the above address for a full refund. The idea here is to foster tinkering, not to take someone's money for something that doesn't do the job for them.

Introduction.

The complete Morgan Serial Weather System provides the capability for two temperature measurements, two relative humidity measurements, atmospheric pressure and one user 12-bit analog to digital channel, wind speed and gust, wind direction and rainfall measurement. The packages we offer includes all of the required electronics. The interfacing humidity sensors, anemometer, wind vane and rainfall tipping bucket should be purchased from Fascinating Electronics.

Organization of this Discussion.

In the following, an overview of the theory of operation is presented. The modular nature of the system is presented. This is followed by a detailed discussion of the assembly of the main processor, PC interface and each of the features. Throughout the assembly, I have attempted to provide details on the theory of operation and techniques for testing the circuitry as it is assembled.

This is followed by a discussion of cabling to external sensors and finally a discussion of the meaning of the measured quantities, their accuracy and calibration techniques is presented.

Appendix 1 is a complete listing of all parts in each of the packages. This also includes a schedule of the pricing for obtaining replacement parts. The idea here is that accidents do happen from time to time and one of the greatest frustrations is to take on a project and be unable to complete it for lack of a single part.

Appendix 2 consists of documentation of the interfacing Fascinating hardware.

Overview of Operation.

The Morgan Weather System is designed to be interfaced with any serial RS232 com port on a PC or similar. Only the TxD, RxD and signal ground leads are required. Normally, the PC's TxD is at a logic one (less than -3.0V). To initiate a measurement sequence, the PC sends any character. This causes the TxD output to momentarily go to a logic zero which resets the 16C558 Main Processor initiating the measurement sequence.

The measurement sequence consists of two temperatures, atmospheric pressure, a user A/D input, wind direction, wind speed and wind gust, accumulated rainfall and the results of two relative humidity measurements. The results are then sent to the PC on PC input RxD using RS232 logic levels at 9600 baud, 8 data bits, with no parity as each measurement is completed.

The format is;

   T1 23.4 ' Temperature in degrees C
   T2 28.7
   AT 1011 ' Atmospheric pressure in millibars
   AD 2058 ' User A/D.  Quantity is in the range 0 through 4095
   WD 34  ' Wind direction.  Degrees
   WS 27  ' Current wind speed, kM/hr
   WG 40  ' Wind Gust, greatest wind speed, kM/hr
   RN 8140 ' Rain.  Accumulated count
   H1 202.8 ' Humidity.  Quantity is in picofarads
   H2 223.1

Note that each quantity descriptor consists of two alphanumeric characters followed by a single space followed by the quantity which is in decimal with leading zero suppression. The line is terminated with a line feed and carriage return (ASCII 0DH, 0AH).

If a feature is not present or if an obvious error occurs, the result is reported with the quantity being an asterisk. For example;

   T1 *

At the conclusion of the measurement sequence, the PIC processor does nothing until another character is sent, initiating a new sequence.

The details of the meaning of the various quantities are discussed elsewhere. However, briefly, wind gust is the greatest wind speed over any second since the last measurement sequence. Rain is simply an accumulated count which ranges from 0 to 9999 and then rolls over. The relative humidities are expressed in picofarads to afford the user the option of using two different humidity sensitive capacitors. This is converted to percent relative humidity by the PC using a simple expression.

A more detailed treatment of all quantities, accuracies and calibration techniques are treated in a separate discussion.

Note that the system does not include a standalone display such as an LCD panel or 16 LEDs to show wind direction. Rather, this package is intended for programmers who can take the data from the serial port and tailor the system to meet their specific requirements. This might include periodic measurements with graphics, making the data available on the Internet, data logging, noting trends and triggering alarms. The package is for people who know a great deal more about Windows programming than I do who want to use their creativity to do something useful and take some satisfaction in knowing "I did that".

Modular Growth.

The system has been designed such that you may begin with only the main processor and add the various features as required for a specific installation and as your pocket book and time permits. That is, the PIC includes all of the software to handle all features and automatically detects which features are present. Thus, a user might begin with two temperature sensors, perhaps later add a single humidity sensor and barometric pressure and forego the wind and rain measurements altogether.

Thus, the system is offered as a basic system kit and two add-on packages. A detailed listing of all components in each of the packages in contained in Appendix 1.

The Basic System Kit ($39) consists of the main PIC processor (PIC16C558), RS232 interface, ceramic resonator clock, pull up and series limiting resistors, two Dallas DS1820 temperature sensors, and the circuitry to interface with up to two relative humidity units. It also includes the 555 circuitry to enable testing of the relative humidity feature. You may either construct your own or purchase the interfacing RH sensor unit or units from Fascinating Electronics. The package also includes this documentation.

The Basic System Kit also includes a 7805 +5VDC regulator power supply kit. This enables you to inexpensively power the entire unit with a wall power unit with an output in the range of 8.0 to 12.0 VDC with a minimum current rating of 100 mA.

We offer such other items as a five foot serial cable with a ten terminal wirewrap header to ease the serial connection to a solderless breadboard ($7.00) and a Jameco JE25 solderless breadboard. ($15.95). These may be ordered separately as required.

The Atmospheric Pressure Add-On ($29) consists of a dual channel 12-bit A/D converter and a Motorola MPX4115AP pressure sensor. This adds the capability for measuring atmospheric pressure and it also provides a user 12-bit A/D input. No interfacing hardware from Fascinating is required.

The Wind and Rain Add-on ($25) consists of two peripheral PIC12C508 processors for wind speed and gust and another for rain and a dual channel 12-bit A/D for measuring wind direction. Note that the interfacing anemometer, windvane and rain gauge are available from Fascinating.

Fascinating Electronics.

Please note that we have no financial interest whatever in Fascinating Electronics.

In developing this system we had two goals; to offer the best and yet be the least expensive by far. We are not equipped to directly provide an anemometer, wind vane nor tipping bucket. Thus, we searched. Anemometers, wind vanes and to a lesser extent, tipping buckets vary considerably in their operation from one manufacturer to another and thus it was important to find a manufacturer who had products consistent with our goals of quality at an affordable price.

We were more successful than I could have ever imagined. The Fascinating hardware is very well thought out and it is of very high quality; plastic that will last, anodized aluminum and stainless steel hardware. It was the best we found and yet, the most inexpensive by far. In addition, the Fascinating hardware was unique in that it offered in kit form. We developed this electronics package for people who are not helpless and derive pleasure in doing things themselves. Thus, the Fascinating kits are a logical extension of our "tinkering" philosophy.

Note that our design assumes you are interfacing with Fascinating hardware. It will not work with other anemometers and wind vanes. It will interface with any tipping bucket which provides a dry closure, but the Fascinating tipping bucket is the least expensive. With relative humidity, you may either build your own or buy the Fascinating hardware. This is discussed in greater detail elsewhere.

Fascinating Electronics is at http://www.columbia-center.org/fascinating.

The following is a summary of Fascinating hardware used in our design.

   Anemometer Kit 	WEA-AN-KIT $54.90
   Windvane Kit 	WEA-WV-KIT $47.50

   "T" Mount  		WEA-WT-KIT $ 9.90 See Note 1

   Humidity Kit 	WEA-TH-KIT $24.90 See Note 2

   Rain Gauge Kit 	WEA-RN-KIT $34.90

Note 1. The "Tee" allows you to mount both the anemometer and windvane on a single mast.

Note 2. The WEA-TH-KIT also includes a temperature measurement IC which is not used in our system.

Fascinating also provides flat telephone cable. I don't recommend this. Rather the use of CAT 5 cable with four twisted pairs is strongly suggested. This is discussed in the section titled "Cabling".

Assembly.

Block Diagram.

Please refer to Figure #1 which is a block diagram of the entire system.

In the following discussion, the assembly details are presented for the main processor, the communications interface, the temperature feature, atmospheric pressure, wind direction and wind speed, rainfall and finally relative humidity.

Hopefully we have done a good job in providing a test procedure to verify the circuitry is operational at each step. Clearly, it is important to get the main processor and the PC interface operating before moving on to assembling the various features.

I attempted to do all of the figures such that they are as close to standalone as possible. The text includes additional information and some of the theory of the design. Please note that it is very hard to write to a very general audience where some people do and others don't understand circuit theory. Thus, some of the theory is there for those who do, but, it is not necessary that you understand every last word.

Note that the assembly of the main processor and the communications interface is required for all configurations. After that, you may add features as your time and pocket book permit.

+5VDC Power Supply.

Prior to proceeding, recognize that you will need a well regulated source of +5VDC. A +5V regulator and associated components is provided with the Basic System. Thus, if you do not already have a source of +5 VDC, please assemble this kit somewhere on your solderless breadboard. Note that you will need a source of any voltage in the range of +9 VDC to +12 VDC for the input to the 7805 regulator. You probably have more than a few wall power units laying around the house from long discarded answering machines and toys. Just be certain that the unit indicates DC (not AC) and it is rated somewhere in the range of +8 VDC to +12 VDC with a minimum current rating of 100 mA.

Logic Probe.

Please build the logic probe on your breadboard. This little PIC probe is an incredibly powerful design and it is used throughout the assembly to verify the circuitry is operational.

Please familiarize yourself with its features in recognizing a logic one (greater than 2.4V) (LED on), a logic zero (less than 2.4V) (LED off), open (LED dim) and pulsing (LED flashing).

Note also that the probe provides sources of 1 and 10 pulses per second. This capability will be used in verifying the operation of the wind speed and rain fall PIC12C508s.

Main Processor. (Figure #2).

At first glance, this can appear a bit overwhelming. In fact, this nothing more than four components; the PIC16C558 in an 18 pin DIP, the ceramic resonator in a three terminal single in line package (SIP) and two 10 pin SIP resistor networks.

Place the PIC16C558 on the breadboard.

Locate the 10-pin SIP network with terminals 2 and 6 removed and place it such that terminal 10 of the SIP is aligned with terminal 9 of the PIC.

Note that terminal 1 of the resistor network will overhang the PIC by one horizontal and it is important to take note of where the PICs terminal 1 is located. That is, in future discussions locate PIC terminals by counting from terminal 1 of the PIC, not terminal 1 of the resistor network.

Locate the 10-pin SIP network with terminals 4, 5 and 6 removed and place it such that terminal 10 of the PIC is aligned with terminal 10 of the PIC. Here again, terminal 1 of the resisitor network will overhang the PIC by one horizontal.

Connect terminal 1 of both of the resistor networks to +5VDC.

Install the 4.0 MHz ceramic resonator. Note that this is a symmetrical device. Connect either of the outter terminals to terminal 16 of the PIC and the other to terminal 15. Ground the center terminal of the resonator.

Connect ground to terminal 4 of the PIC and a source of +5 VDC to terminal 14.

Visual Observation.

At this point, you might take a moment to observe that something is connected to all terminals of the PIC except PIC terminal 1.

Test Procedure.

When the processor is reset, it will immediately initiate a measurement sequence which takes about ten seconds and it will then go into an idle state awaiting another reset.

The processor is reset by the momentarily application of a logic zero on the /GO input (term 5). (Note that it is also reset when power is initially applied).

On reset, SEROUT (term 17) will assume a logic one. However, shortly thereafter, the logic probe will flash as the result of the first temperature measurement is sent to the PC. A short time later, the SEROUT lead will flash as the result of the second temperature measurement is sent. And, so on through atmospheric pressure, user A/D, wind direction, wind speed and gust, rainfall count and two relative humidity measurements. When the complete measurement sequence has been completed, the system will again return to the idle state and SEROUT will be high.

Thus, momentarily ground /GO (term 5) and using the logic probe, observe the periodic flashing of SEROUT (term 17) for a complete measurement sequence, nominally ten seconds. Verify the state of SEROUT is then a constant logic one.

Note that each time the processor is reset, the system will attempt to perform each and every measurement. The PIC then uses various criteria to determine if the measurement was successful and if not, it sends an asterisk to the PC. Thus, as no measurement devices are currently connected to the PIC, the data you are observing at SEROUT using the logic probe is of the form;

   T1 *
   T2 *
   AT *
   etc

However at some point in a measurement sequence you should see each of the following leads change state in some manner as the PIC attempts to perform a measurement. This might be a long (one second) term change in state or a few winks of the probe. Thus, connect the probe to each of the following leads and momentarily ground the /GO lead (term 5) and watch for a state change.

Term 	PIC 	Functional  Function
 	Desig 	Desig

6 	RB.0 	T_DQ1   Temperature 1 Data
7 	RB.1 	T_DQ2   Temperature 2 Data
8 	RB.2 	AT_CS   Chip Select for Atmospheric Press
9 	RB.3 	AD_CLK  A/D CLK
10 	RB.4 	AD_DATA A/D Data Lead

11 	RB.5 	WD_CS   Chip Select for Wind Direction

13 	RB.7 	WS_FLOW Flow Control for Wind Speed

1 	RA.2 	RAIN_FLOW  Flow Control for Rainfall Counter
2 	RA.3 	RH_EN   Enable for Relative Humidity Sensors
 

Note that the following are inputs. Verify they are at a logic one and do not change during a measurement sequence.

Term 	PIC 	Functional  Function
	Desig 	Desig

12 	RB.6 	WS_SER      Serial Data from Wind Speed PIC
18 	RA.1 	RAIN_SER    Serial Data from Rain Fall PIC
3 	RA.4 	RH_IN       Input for RH Sensors

Assembly - PC Communications Interface. (Figure #3).

Wire the circuitry as shown in Figure #3.

Note that the pullup resistors identified with an asterisk are part of the SIP resistors networks which you have already installed.

The Dallas DS275 converts RS232 levels (where a logic one is somewhat confusingly defined as less than minus 3 VDC and a logic zero as greater than +3VDC) to TTL levels and from TTL to RS232.

When the PC Com port is in the idle state, the PC's TXD output (Point A) is at a logic one (less than -3 volts) and thus Point B is at a TTL logic one.

Similarly, when idle, the PIC processor SEROUT output (Point D) is at a TTL logic one and thus Point C is at an RS232 logic one (less than -3V).

When the PC sends a character, point B momentarily goes low causing the PIC processor to reset initiating a measurement sequence.

We opted to use the Dallas DS275 over the standard MAX232 as the MAX232 is a 16-pin DIP and requires the wiring of four electrolytic capacitors which are used to generate the RS232 logic levels. Dallas does specify a maximum distance feet of 12 feet between the PC and the DS275 which should be co-located with the PIC processor. I don't view this as a problem and if it is, I assume you can, in fact, stretch that 12 feet quite a bit or use a MAX232.

It is important to note that the DS275 "steals" the negative supply required for generating an RS232 logic one from the PC's TXD output avoiding the need for a charge pump and those four bulky capacitors associated with the MAX232. Thus, the DS275 must be connected to the TXD output of the PC in order to assure proper operation.

The loop back of RTS to CTS and DTR to DSR may not be required if your program does not require flow control. However, there is no harm in doing so.

Testing.

In testing, a terminal emulator package is required. For DOS, I use ProComm Plus. Windows95 includes HyperTerm in the Accessories Menu.

Configure the terminal emulation software for a Direct connection to the appropriate COMM port. Configure the baud rate and other parameters for 9600 baud, 8 data bits, no parity, and either 1 or 2 stop bits. Configure for no flow control.

In the idle state, point A and C should be at an RS232 logic one (less than -3 VDC). When using the logic probe, the LED will be off. Points B and D should be at TTL logic ones (Probe LED on).

Using the terminal emulator, type any character and after about a second, the results of the various measurements will begin to appear on your terminal as;

   T1 *
   T2 *
   AT *
   etc

Note that at the end of each measurement, the PIC sends new line characters as a Linefeed (LF) followed by a Carriage Return (CR). On some systems, the receipt of the CR character may cause an additional linefeed character to appear on the terminal and the output will appear to be double spaced.

If you are not getting this output on your terminal, use the probe. When a character is sent, you showed view an "on wink" at Point A, an "off wink" at Point B and Points D and C should be in transition as the data is sent to the PC.

Assembly - Temperature Measurement.

Again, note that the resistors identified with an asterisk were already installed in Figure #2.

Connect the Dallas DS1820 devices as shown in Figure #4.

Note that these are operated in the "parasite power" mode. That is, the power necessary to operate the remotely located DS1820 is derived from the data lead. The advantage in this approach is that wiring to the remote DS1820s is limited to a single twisted pair; the data lead and ground.

The reason for the series 330 Ohm resistors which are co-located with the PIC is for the protection of the PIC. During the measurement sequence, the PIC brings the data lead a logic one and if the data lead which may run over several hundred feet is accidentally grounded, permanent damage to the PIC could result. I tend to be a very conservative designer and assume that what can go wrong probably will and throughout the design there are many similar series limiting resistors.

Note that the two outer leads of the DS1820 are grounded.

Additional notes on cabling to the temperature sensors are included in the section related to Cabling.

Testing.

Initiate a measurement sequence by sending a character using your terminal emulator software. You should receive data of the form;

   T1 25.3
   T2 23.1
   AT *
   etc

Note that if one of the temperature sensors is not present, the temperature reading will be replaced with an asterisk.

However, if a DS1820 is connected, an asterisk may also indicate a communication between the PIC and the DS1820. The DS1820 includes an innovative feature that computes an error detection code which it transmits after sending temperature data to the PIC. The PIC also computes the code and compares with that sent by the DS1820 and if the two do not match, an asterisk is displayed. Thus, an asterisk may indicate the sensor is not present or not functioning or that there was a transmission error in communication.

There is one case where this does not work. If the data lead is shorted to ground, the PIC will read the error detection code as zero and the nature of the error detection algorithm is such that it will also calculate the code as zero and report the temperature as a ridiculous value of -65.55 degrees. At first, I considered this to be a design deficiency, but on reflection, it might be regarded as a added troubleshooting feature. A reading of -65.55 degrees indicates the data lead to the remotely located DS1820 is grounded.

Assembly - Atmospheric Pressure and User A/D.

Construct the circuitry shown in Figure #5A. Again, the resistors identified with an asterisk were already installed in Figure #2.

Note that the MPX4115AP pressure sensor ($20) and the LTC1298 ($8) are the most expensive components in the system, so please pay close attention to wiring them correctly.

The purpose of the 1K resistor is to protect the PIC and the A/D converter if for some unforeseen reason, both the PIC and the D_OUT lead on the A/D are active outputs and at opposite states. This should never happen, but again, I am a conservative designer.

Note that the AD_DATA and AD_CLK leads are also shared with the A/D associated with wind direction if equipped. The AD_CLK is also shared with the relative humidity circuitry if equipped.

The 100K resistor and 50,000 pFd capacitor are intended to minimize noise.

The theory of operation is that the PIC processor sends four bits to the LTC1298 commanding the A/D to perform an analog to digital reading on Channel 0 relative to ground and a 12-bit result is then read by the PIC. In fact, in order to eliminate some of the effects of the digital noise associated with the PIC, this is repeated 256 times and the results are summed and then the result is divided by 256 so as to obtain an average.

The voltage on Ch0 is then calculated as;

(1) V_CH0 = band / 4096 * V_ref

where band is the 12-bit quantity in the range of 0 through 4095 and V_ref is the nominal +5 VDC supply.

The MPX4115AP sensor outputs a voltage to Channel 0 which is proportional to pressure.

(2) V_CH0 = V_ref * (P * 0.0009 - 0.095)

where P is the pressure in millibars.

Equating expressions (1) and (2)

  V_ref * (P * 0.0009 - 0.095) = band / 4096 * V_ref

Eliminating V_ref and solving for P;

P = (band / 4096 + 0.095) / 0.0009

or

(3) P = 0.27 * band + 105


Thus, the PIC performs 256 A/D measurements, averages them and then computes the atmospheric pressure using expression (3). This is then sent to the PC in the form;

   AT 952

The PIC then turns to performing a measurement of the voltage between Channel 1 and ground. Here again, 256 measurements are performed and the average is calculated and the 12-bit A/D band result is sent to the PC;

   AD 3124

Note that the you may use this depends on your specific application. Note that the voltage at Channel 1 is calculated as;

(4) V_CH1 = band / 4096 * V_ref

where V_ref is the value of the +5 VDC supply.

Additional considerations relating to atmospheric pressure and the user A/D input are treated in the accuracy and calibration section.

Testing.

If you have access to a voltmeter, measure the voltage at the output of the MPX4115. If you are near sea level, the atmospheric pressure is near 1000 millibars and thus, from expression (2), the voltage will be nominally 4.4 VDC. Atmospheric pressure decreases with altitude and thus this voltage will be somewhat less. Figure #5B illustrates the atmospheric pressure and theoretical V_out of the MPX4115 at normal barometric pressure as a function of altitude.

If you find the result is not right on the money, don't panic. A technique for performing a single point calibration is presented in the accuracy and calibration section.

If you don't have a voltmeter, use the logic probe to verify the voltage is at a logic one (LED on). This assures the voltage is above nominally 2.4 VDC. This is not a perfect test, but certainly adequate.

Using your terminal emulator, type a character to initiate a measurement sequence and verify the atmospheric pressure is somewhat close to that shown in Figure #5B for your altitude.

In testing the user A/D channel, use the two 10K test resistors to apply nominally +5 VDC, 2.5 VDC and ground and verify the reported bands are close to 4095, 2048 and zero, respectively.

Assembly - Wind Direction.

Note that operation of this feature requires that you have the Fascinating Wind Vane. For testing it may be useful to use the dual wiper 360 degree potentiometer associated with the Fascinating kit.

However, if you do not yet have the Wind Vane Kit, it is suggested you assemble and test this feature using a substitute technique. Otherwise, if you are like me, you will put the IC away and forget where you put it and your wife will eventually put it away in a special place.

Construct the circuitry shown in Figure #6A.

Note that the wiring is quite like that associated with the LTC1298 associated with the atmospheric pressure feature and in fact, leads AD_DQ and AD_CLK are shared with that A/D.

Note that a 100 Ohm series limiting resistor is included to protect the +5 VDC supply or even the potentiometer in the wind vane in the event the PWR lead or one of the WIPER leads is accidentally grounded.

The general theory of the operation is illustrated in Figure #6B. The windvane is connected to a potentiometer and determining the wind direction is a simple matter of measuring the voltage at the potentiometer's wiper.

Unlike most potentiometers, for example, volume controls, this potentiometer turns a full 360 degrees. Of course, there must be a point of discontinuity in the resistive material and this is commonly termed the "dead zone". Many weather equipment manufacturers "solve" this problem by suggesting you orient the potentiometer such that the wind never comes from that direction.

However, Fascinating has been very clever in using a dual wiper potentiometer where the two wipers are positioned opposite to one another. Thus, if one wiper is in the dead zone, the voltage on the other may be determined and thus the angle of the potentiometer may be calculated.

In this design, we measure the voltage on Wiper #1 and if it does not appear to be in the dead zone, the angle is calculated as;

   Angle = Band / 4096 * 270

If however, the voltage on Wiper #1 is either close to ground or to +5 VDC or open, we assume the wiper is in the dead zone and measure the voltage on Wiper #2 and add 180 degrees.

   Angle = (Band / 4096 * 270) + 180

The final result is adjusted to be in the range of zero to 359 degrees.

Note that when mounting the windvane on the roof or whatever, it really isn't necessary for you to get up on the ladder and have a big fight with your wife because she doesn't know how to use your terminal emulator in order to align the wind vane. Rather, climb up the ladder and orient it any way that is convenient. After all, the 0 to 359 reading that this system porvides is relative. The beauty of this whole system is that you do the programming and it is an easy matter for you to add a constant in your software.

Testing.

If you have the dual wiper potentiometer available, connect it as shown and use your terminal emulator program to initiate a number of sequences, adjusting the potentiometer between sequences. The output will be of the form;

   WD 326

However, if you do not have the special potentiometer available, ground Ch0 (terminal 2) on the LTC1298 and vary the voltage on Ch1 (term 3). One easy voltage point is to simply ground Ch1. You should read something close to 180 degrees.

Assembly - Wind Speed and Gust.

Note that this feature requires the Fascinating Anemometer. However, you are encouraged to wire it now as it may easily be tested using the clock feature of the logic probe.

Connect the Wind PIC12C508 circuitry as shown in Figure #7.

Although the PIC12C508 does have an option for an internal RC oscillator, it is not sufficiently accurate to assure reliable serial transmission to the main processor. Thus, a separate 4.0 MHz resonator is used.

The theory of the design is that the as the anemometer turns, a magnet passes close to a reed switch causing it to momentarily close. Thus, by counting the number of closures over a period of time, the wind speed may be calculated.

When a mechanical switch, in this case a reed contact, closes, it bounces perhaps several hundred times. The series 330 Ohm and shunt 1.0 uFd capacitor is a debounce network to eliminate this bounce.

With the Fascinating anemometer;

   wind_speed_km_per_hour = t_period / 963 ms

The Wind PIC opens a precise 963 ms window and counts the number of events on the COUNT input. It then compares this CURRENT value with the GUST value and updates GUST if CURRENT is greater than GUST.

It then checks the /SEND input and if it is not at a logic zero, the process is repeated.

If /SEND is low, the values of CURRENT and GUST are sent to the main processor and GUST is reset to zero and the Wind PIC resumes with it's 963 ms windows.

Thus, at any given point in time, the Wind PIC holds two values; CURRENT and GUST where CURRENT is the number of events on COUNT over the most recent 963 ms and GUST is the maximum count over any 963 ms period since the last data transmission.

Testing.

Note that the logic probe, in addition to being a probe also provides two clock outputs.

Connect the 10PPS output of the probe to the COUNT input of the Wind PIC (Point A).

Using your terminal emulator, initiate a measurement sequence and verify a reading of the form;

   WS 9
   WG 9

You might leave the probe attached such that wind gust is 9. Then remove the probe and wait for at least a second. In this case, the "wind speed" over the most recent second is zero. But, the "gust" is the maximum which has occurred since the last measurement.

Verify;

   WS 0
   WG 9

Note that in some cases, the count may be 10 rather than 9 as the clock associated with the logic probe is not precise.

Assembly - Rainfall Counter.

Note that this feature requires an external rainfall collector that provides a dry closure when a certain amount of precipitation is received. Usually, a funnel concentrates water that falls into a "bucket" that looks more like a mini coffee scoop. When full, the "bucket" tips, causing a closure of a reed switch and the tipping empties the "bucket" and it's return to position opens the reed switch. Thus, the term "tipping bucket". It's a very clever design marketed by a number of weather equipment manufacturers.

This system will interface with any tipping bucket design which uses a dry closure. You can look around, but chances are good that you will come to the conclusion that the Fascinating Rainfall Collector is the most economical.

In fact, many people are not terribly enchanted with measuring rainfall.

I grew up in Vermont where a good deal of the precipitation was snow and it was mighty cold. I can't imagine how one would heat this external funnel in the winter. Actually, in Vermont, there wasn't that much interest in precipitation, other than, "Oh God. It's snowing again". If the amount was exceptional, a Vermonter would use a trusty Stanley tape measure and multiply the result by 1.5 and this would grow each decade. "128 inches in '69".

This is not to trivialize the importance of measuring rainfall in many parts of the world where 0.1 inches is very important. We are fortunate and perhaps spoiled in the eastern US in having entirely too much rain and 0.1 inches is not likely to even spark a conversation.

Thus, the rainfall counter may be used to count anything; the number of lightning strikes, the number of vehicles going down your street or turning around in your driveway, the number of times your outside motion detector turned on the lights or the number of times the cat jumped through the basement window. That is any process where the sensor is a dry closure.

Connect the Rain PIC as shown in Figure #7.

The Rain PIC operates in a continual loop, constantly monitoring the number of events which occur on input COUNT. Each second, the number occurring over the previous second is added to variable ACCUM.

If input /FLOW is not at a logic zero, the process continues.

However, if input /FLOW is low, the value of ACCUM is sent to the main processor.

Unlike the Wind PIC, this value is not reset to zero. Rather, it is a totalizer which goes from 0 to 9999 and then rolls over. Thus, in your program, you may wish to store the old value so as to calculate the difference between the most current and the previous measurement.

Testing.

Quite like the Wind PIC, connect the logic probe's clock output to input COUNT (Point B).

Using your terminal emulator software, initiate a measurement sequence and verify an output of the form;

   RN 1696

Assembly - Relative Humidity.

Figure #8A illustrates how up to two relative humidity units may be connected to the system. This schematic may be a bit overwhelming when compared with the other features. In fact, the principles are quite simple.

Note that this feature requires one or two remote circuits consisting of a 555 free running clock or pulser where the period is controlled by a humidity sensitive capacitor.

A typical relative humidity unit is illustrated in Figure #8B. Note that the period is;

   T = (R1 + 2 * R2) * C_H

where R1 and R2 are 1.0 Megs.

Note that the period is a function of the humidity sensitive capacitor. Thus, the general idea is for the main processor to measure the number of pulses occurring within one second and calculate and return the value of C_H in picofarads. A full discussion of why we opted to report RH in picofarads and how to convert this to percentage RH is discussed in the accuracy and calibration section.

You have a number of options on the remote 555 circuitry.

You can build your own and we have included all of the circuitry in Figure #8B other than the humidity sensitive capacitor. You can either order a Philips 2322 691 90001 capacitor from Newark at http://www.newark.com for nominally $13.00. Or you can use a somewhat sturdier G CAP 2 capacitor from General Eastern Instruments at http://www.geinet.com for about $20.00.

The simplest option is to purchase an RH kit from Fascinating. This includes all of the circuitry shown in Figure #8B including the Philips capacitor and most importantly, a small printed circuit board, all for nominally $25.00.

Note that the circuitry shown in Figure #8B is the schematic of the Fascinating unit. The Fascinating schematic supplied with the unit is not correct, but the circuit board is.

The theory of operation is that during the measurement sequence, PIC output RH_EN is at a logic zero and thus both relative humidity units are off. The reason for this is to eliminate the pulses associated with the 555 outputs from causing noise during the analog to digital measurements associated with the atmospheric pressure, user A/D and wind direction features.

When relative humidity is to be measured, RH_EN is brought high causing the two 555 circuits to begin operating.

After a brief delay to allow the 555 circuits to reach steady state, output AD_CLK is brought low, gating the output of unit RH_1 to PIC input RH_IN. The PIC counts the number of transitions occurring over a one second period and converts this to a capacitance in picofarads which is sent to the PC.

Output AD_CLK is then brought high and the output of RH_2 is gated to RH_IN and the PIC performs the same operation.

Output RH_EN is then brought low, disabling the two RH units.

Testing.

We have included all of the circuitry illustrated in Figure #8B except that a fixed 150 pFd capacitor is used in place of the humidity sensitive capacitor.

Construct this test circuit and connect the output of the 555 test pulser to I0A (terminal 2) of the 74158. Initiate a measurement sequence and verify the output of the 555 pulses for nominally two seconds. Verify the the signal at RH_IN (terminal 3 of the PIC) pulses for nominally one second. (During the other second, the main processor is attempting to make a measurement on the second RH unit).

Using your terminal emulator package, verify the output is of the form;

   H1 183.2
   H2 *

Remove the output of the 555 test pulser from terminal 2 of the 74158 and connect it to I1A (terminal 3) of the 74158.

Using your terminal emulator package, verify the output is of the form;

H1 *
H2 183.2

Note that the value actually reported, for example 182, is somewhat greater then the actual value, 150 pFd. This is caused by propagation delays in the 555. This is discussed in greater detail in the accuracy and calibration section.

Cabling.

Introduction.

This discussion focuses on the cabling required in interfacing various remote sensors with the serial weather PIC. Suggestions are offered on the type and a source of cable. The cabling requirements of each remotely located sensor is treated.

General Discussion.

External cabling is required when interfacing remotely located DS1820 temperature sensors and with the Fascinating anemometer, wind vane, relative humidity board or boards.

In all cases we have designed the Serial Weather PIC such that no permanent damage will result if any lead if accidentally shorted to another or accidentally grounded. (At least we believe we have. You need not test this!).

CAT 5 Cable.

You might consider CAT 5 unshielded cable in interfacing with remotely located sensors. It provides four twisted pairs, is convenient to work with and it is readily available and relatively inexpensive.

In case you don't have a source, Jameco at http://www.jameco.com sells this;

Jameco  Description     	25 feet  100 feet

118113  Solid, 24 AWG, Grey    $5.00    $15.00
118130  Stranded, 24 AWG, Grey $8.00    $25.00

If you expect a good deal of flexing, the stranded is recommended. But, in most cases, the solid should be more than adequate.

I have no idea of the degradation of this due to ultraviolet radiation. However, I have had some ten amateur radio antennas in the yard for the past 12 years and although they are in various stages of disrepair as at the moment my interest in ham radio has waned, none of the various types of wire I used appears greatly affected. I would be far more concerned about the effects of ultraviolet on 120VAC power distribution wiring where someone might get injured or if I were professionally installing network systems. However, this is a hobby weather system. There are no lethal potentials and five or ten year life is quite adequate.

On the other hand, sun light seems to eat up cable ties. I note that Jameco has weather resistant

(black) cable ties;

   104133 5.8 inch, 40 pound strength 100 / $4.00

Connectors.

Of course, when anyone mentions CAT 5, the first thing that comes to mind is connectors.

The nature of the Fascinating equipment is such that the wires are soldered to a potentiometer (windwave), soldered or twist tied to wires in the anemometer and rain gauge units and soldered directly to a printed circuit board associated with the relative humidity circuitry.

On a remotely located DS1820 temperature sensor, I would solder the two leads, put the whole

assembly in some plastic tubing and use silicon sealant as illustrated in Figure #4. Note that the Basic Package includes a small length of heat shrink tubing to permit you to insulate the center (data) terminal from the outer (ground) terminals.

You might desire to connectorize all of these remote devices, but frankly, I see no big advantage in doing so.

On the processor side, I would start off with a solderless breadboard and directly connect the

interfacing cabling to the breadboard. If you desire to later stabilize the unit by going to a perf board with wirewarp or to a printed board, you might consider connectors. If I did have a printed board I would be more inclined toward screw type connections than modular telephone type connectors.

Twisted Pair Cable.

CAT 5 may seem an overkill and indeed it is. But, the important aspects are that it is twisted pair and it provides 4-pairs in a single jacket. If you decide to go with other cable, be sure it is twisted pair. Flat telephone type cable is really only intended for short runs within a house and use of it in this system is inviting noise. Twisted pair has been used for over a 100 years by the telephone company in transmitting voice communication with signals less than a millivolt and those lines run side by side with power cables, near high power radio transmitters, arc welders and the like. It may not always work, but in the main it does. Twisted will always beat poorly thought out and expensive shielding.

Intermediate Summary.

To summarize the discussion to this point, CAT 5 cable seems attractive. I wouldn't worry about the effects of ultraviolet and for the moment, I would forego connectors. CAT 5 cable provides four twisted pairs in one jacket. If you decide not to use CAT 5 cable, be sure whatever you use is twisted pair.

Remote Sensors.

In the following discussion, the cable interface with each remotely located device is described to help you plan your cable needs.

Dallas DS1820 Digital Thermometer.

Presumably users will locate one of the DS1820 thermometers locally to monitor indoor temperature and the other outside at some distant point. If the inside DS1820 is no more than a few feet from the main processor, no special wiring is required. For remotely located DS1820s, a single twisted pair per device should be used. If four pair CAT-5 cable is used, this will leave three pairs unused. These pairs may be used for a relative humidity unit or simply be left unused.

Atmospheric Pressure.

It is suggested that the MPX4115AP pressure sensor be co-located with the LTC1298 and thus no special wiring is required.

Note that a 100K terminating resistor and a shunt 50,000 pFd capacitor is used to suppress unwanted noise.

User A/D.

It is difficult to speculate on all of the different uses that the user A/D may accommodate. However, it is important to note that the 12-bit A/D provides 4096 quantizing bands over a range of 5.0 volts or about 1.25 mV per band. This is extremely accurate, but may easily be masked by noise on the wiring from the users circuitry to the LTC1298 dual channel A/D. Twisted pair cable is recommended.

Further, it is suggested you terminate the pair on the LTC1298 side with a resistance in the range of 10K to 100K and use a shunt capacitor to also filter unwanted noise, much as was done with the atmospheric pressure sensor.

Fascinating Wind Vane.

The main PIC provides +5VDC through a series 100 Ohm resistor to one side of a dual wiper potentiometer in the wind vane and ground to the other. The two wipers on the pot are brought back to an LTC1298 dual 12-bit A/D. These are all soldered to the dual wiper potentiometer.

Although there are only four metallic connections, it is recommended that you run three pairs to the wind vane as shown in Figure #9;

   +5 VDC though 100 and Ground
   Wiper #1 and Ground - grounded only at the PIC, not at the wind
	 vane
   Wiper #2 and Ground - same

Fascinating Anemometer.

The main PIC provides +5 VDC through 4.7K and ground. The anemometer provides a sealed reed switch that provides a dry closure and the connection may be made to the two leads from this switch using wire nuts.

Thus, only one pair is required. If a user has one of the wind units, I assume they will probably have both. Fascinating provides a "Tee" unit and although I am certain you can probably find all of the parts for the "Tee" in a good hardware store, I'm not certain you would be much ahead as Fascinating charges less than $10.00 for the item.

Thus, the four pair approach works well. Fan three pairs from the "Tee" to the wind vane and the remaining pair to the anemometer.

Fascinating Relative Humidity Board or Equivalent.

The Fascinating board includes the relative humidity circuitry and also a temperature sensor. We have no plans to interface with the temperature sensor as the DS1820's are more accurate and much easier to interface with. However, you may opt to use this sensor in conjunction with the user A/D.

Three pairs are recommended in interfacing with the relative humidity circuitry.

   +5VDC through 100 Ohms and Ground
   555 Enable and Ground - grounded only on the PIC side
   555 Output and Ground - grounded only on the PIC side

The remaining pair may either be used to interface with the temperature sensor on the Fascinating unit or it may be used to interface with a DS1820 which is co-located with the RH unit.

We have designed the weather PIC to interface with a second RH unit, presumably an indoor unit, as well. Twisted pair isn't really necessary for very short runs, but it is hard to beat the ease of making the connections using a short run of CAT 5.

Fascinating Rainfall Collector.

The rainfall collector consists of a funnel and a tipping "bucket". When enough rain accumulates in the "bucket", it tips causing the water to empty. The tipping action causes a sealed reed switch to momentarily close.

Thus, the wiring is quite like the anemometer; a single pair connected via wire nuts.

However, one spare pair may be used to interface with a DS1820 packaged in a small length of tubing.

Summary.

In summary, the cabling for a full system would consist of a CAT 5 run to the anemometer and wind vane, one run to each relative humidity unit and one run to the rainfall collector and possibly one run to a DS1820 if you decide not to co-locate the DS1820 temperature sensor with the relative humidity sensor or rainfall collector.

I would assume that in most installations, the total amount of cable would be in the range of 100 to 200 feet. This is available from Jameco for $15 to $30.

Quantities, Accuracy and Calibration.

This section discusses the interpretation of the quantities passed back to the PC by the main PIC processor, discusses accuracy and offers techniques for calibration for each feature as applicable.

DS1820 Digital Thermometer.

Dallas rates the accuracy of the DS1820 as follows;

   0-70 degrees C  +/- 0.5 degrees C
   -55 to 0 degrees C +1.0, -2.0 degrees C
   70 to 125 degrees C +2.0, -1.0 degrees C

There is no degradation due to the system. That is, a reading is either successful or it isn't. In performing the measurement, we do use a cyclic redundancy algorithm and if there is a CRC error, an asterisk is returned in pace of the reading.

The resolution is 0.1 degree C.

It is somewhat unnerving to have two DS1820 devices side by side at the same temperature and note a 0.8 degree C temperature difference. You may wish to establish a reference and in your software, you may wish to add or subtract constants as shown.

   T1_corrected = T1_reading + 0.3
   T2_corrected = T2_reading - 0.3

In early '98, there was a disturbing thread on a newsgroup concerning moisture working its way into the unit causing inaccurate readings, typically 5 or 10 degrees. Hobbyists were "cooking" the devices in an oven (definitely not a microwave) for a period of time and then sealing the devices in some manner. My reaction to all of this discussion was one of "wonderment" and I just don't know what to think.

Dallas Semiconductor is a quality manufacturer with a wealth of innovative designs and the DS1820 has become the rather much of a standard in temperature measurement and I have my doubts as to whether Dallas could afford such a problem for any extended period of time. We have been selling an 8-channel temperature measurement kit which uses these devices for a year and we have sold more than 1000 DS1820 devices and no one has complained of this behavior.

However, I feel obligated note this point. You can view the discussion by searching old postings on Deja News on the keyword "DS1821". The DS1821 happened to be the original focus of the discussion. It uses the same temperature sensitive counter scheme as the DS1820. However, the protocols are different and the DS1821 is not compatible with this system.

The question always arises as to just how far a distance one can extend these. In testing our temperature measurement system we used 150 feet of twisted pair cable and attempted to induce noise into the line using a 2-meter handheld amateur radio and such notorious noise generators as hair dryers and electric drills so as to cause measurement failures. We were unable to do so and feeling that 150 feet (nominally 50 meters) was not an unduly restrictive limitation we specified the maximum cable distance as 150 feet.

I have read on newsgroups of people extending the range to some 1000 feet. One nice thing about hobby applications where no money or lives are riding on whether the device performs properly is that you can extend the distance as far as you can get away with. When you begin the get asterisks for readings, the CRC is failing and you have gone too far.

Note that the limits of operation are -55.0 to +125 degrees C (corresponding to -67 to 257 degrees F). The low limit may cause some problems at times in Alaska and the northern tier of states in the US.

.Atmospheric Pressure

The Morgan Weather PIC measures atmospheric pressure which is commonly termed station pressure.

The A/D converter used to measure the output has a 12-bit resolution providing 4096 bands over the range of 0.0 to 5.0 Volts. Thus, in theory, we could provide a resolution of 0.25 millibars. However, there is a degree of noise associated with any processor system and in spite of terminating the output of the MPX4115, using a shunt capacitor and performing 256 measurements and then averaging them, there was still too much "bobble" from one measurement to the next when we attempted to display the measured quantity with greater precision greater than 1.0 millibars. Thus, we opted to display atmospheric pressure with one millibar resolution.

But, even now, there is some "bobble". The measurement will be consistent for five minutes and then there will be a one time reading which is 2 millibars above what we continuously saw.

Short of a complete redesign of the entire system, where the processor goes to sleep while the A/D measurement is being performed, we just can't do any better and I am uncertain the situation is hopeless.

In your program, you might note such an inconsistency and on seeing one, make another measurement or you might apply some type of weighting scheme to the current measurement and the last four measurements.

Single Point Calibration.

The following discussion deals with how to perform a one time calibration such that your unit does in fact accurately measure station pressure and how to convert this to sea level pressure.

Of course, in the US, we have one system and just about everyone else has another. The discussion focuses first on the SI system and then with "our" system.

For Most of the World.

Note that station pressure varies with altitude in accordance with the following expression;

(1) P_station = P_sea_level * exp (-z/H)

Where z is the height above sea level in meters and H is 7000.

For example, assume a local radio station announces the barometric or sea level pressure as 1013

millibars (or hectoPascals) and you live in the mountains at 1760 meters. From equation (1), your station pressure is;



    P_station = 1013 * exp(-1760/7000)

              = 788 millibars

Assume you observe that the Morgan Weather PIC is reporting 802 or 14 millibars too high. You then know that;

    P_station = P_measured - 14

Note that this is a one time calibration.

By rearranging equation 1, you have an expression which permits you to then convert your station

pressure to sea level pressure.

(2) P_sea_level = P_station / (exp (-z/H).

In this example;

    P_sea_level = (P_measured - 14) / (exp (-1760/7000))
                = 1.28 * (P_measured - 14)


Thus, in developing your monitoring program, you might consider something of the following form.

#define ALTITUDE 1770.0
#define P_CORRECTION -14

...

float P_measured, P_station, P_sea_level;

   ...

   // get P_measured from the serial weather PIC

   P_station = P_measured + P_CORRECTION;
   P_sea_level = P_station / (exp(-ALTITUDE/7000));

   ...

For the United States.

For those of us more comfortable with inches of mercury, feet above sea level and such, equation (1) may be written as;

(3) P_station_in_Hg = P_sea_level_in_Hg * exp (-z_ft/H_ft)

where z_ft is the number of feet above sea level and H_ft is 22,965.

Assume, you live in Denver at 5200 feet and hear on the radio that the barometric pressure is 30.03 inches of mercury.

    P_station_in_Hg = 30.03 * exp(-5280/22965)

                    = 23.86 inches of mercury

But, alas, the Morgan Weather PIC uses millibars. Converting from millibars to inches of mercury is simply a matter of multiplying by 0.02953.

That is;

    P_meas_in_Hg = 0.02953 * P_meas_millibars

After performing this calculation, assume, the measurement result is 23.76. Clearly, your unit reads 0.1 inches of mercury low.

        P_station_in_Hg = P_meas_in_Hg + 0.10

or

        P_station_in_Hg = (P_meas_millibars * 0.02953) + 0.10


Rearranging equation (3);

(4) P_sea_level_in_Hg = P_station_in_Hg / exp(-5280.0/22965.0)


Thus, in developing your monitoring program, you might consider something of the following form.

#define ALTITUDE 5280.0
#define H_FT 22965.0
#define P_CORRECTION 0.10

...

float P_measured, P_measured_in_Hg, P_station_in_Hg,
      P_sea_level_in_Hg;

   ...

   // get P_measured from the serial weather PIC
   // this is in millibars

   P_measured_in_Hg = 0.02953 * P_measured; 
                           // convert to inches of Hg 


   P_station_in_Hg = P_measured_in_Hg + P_CORRECTION;

   P_sea_level_in_Hg = P_station_in_Hg / (exp(-ALTITUDE/H_FT));

   ...

Summary.

A one time correction term of the measured pressure is required. Configure your system to observe the raw data from the Serial Weather PIC (P_measured). Obtain a good reference barometric pressure (P_sea_level) from your area.

For people working with millibars and meters your station pressure is then;

    P_station = P_sea_level * exp (-z/7000)

where z is your altitude in meters.

Your correction is;

    P_correction = P_station - P_measured

After performing this one time calibration, use the raw data P_measured in your monitoring program.

   P_station = P_measured + P_correction
   P_sea_level = P_station / (exp (-z/7000))

For users in the United States;

   P_station_in_Hg = P_sea_level_in_Hg * exp (-z_ft/22965)
   P_measured_in_Hg = 0.02953 * P_measured

Your correction is then;

   P_correction = P_station_in_Hg - P_measured_in_Hg

After performing the one time calibration, use the raw data P_measured in your monitoring program;

   P_measured_in_Hg = 0.02953 * P_measured
   P_station_in_Hg = P_measured_in_Hg + P_correction
   P_sea_level = P_station_in_Hg / (exp (-z_ft/22965))

Wind Direction.

The resolution is one degree.

Note that the nature of the Fascinating Electronics design in using a dual wiper potentiometer does not impose any orientation limitation on the user. There is no "dead zone" and thus no need to orient such that the wind doesn't blow from that direction.

In fact, there is no need to observe any orientation guidelines. Rather, simply mount it and then structure your program to add a constant.

   WD_corrected = WD_reading + constant
   WD_corrected = WD_corrected % 360

The second statement assures that the result is in the range of 0 through 359. Note that in C, the "%" is the mod operator. This differs from one language to another.

Wind Gust and Wind Speed.

The theory of the anemometer is that the cups turn and the speed is a function of the wind speed; each revolution over a 963 ms period corresponds to one kM/hr. This is a function of the mechanical design of the anemometer and it is difficult for me to believe this will vary all that much from one unit to another.

However, if you do notice a difference between this system's reading and a reference it is suggested that you develop a constant.

For example, assume your system indicates 49 kM/hr and a reference reports 55.

   WS_corrected = 55.0/49.0 * WS_measured

This also extends to wing gust.

Rainfall.

Note that the reading is simply an accumulated count which, unlike wind gust, is not cleared after a measurement is performed.

Thus, if a difference is desired, the prior value must have been saved.

   RN_diff = RN_meas_new - RN_meas_prior
   if (RN_diff < 0)
   {
      RN_diff = RN_diff + 10000
   }

Note that the "if" statement takes care of the case where the accumulator rolls over from 9999.

Fascinating notes that the sensitivity is approximately 0.005 inches (which is approximately 0.02 mm) per tip. Thus;

   RN_diff_inches = 0.005 * RN_diff // inches

or  RN_diff_cm = 0.002 * RN_diff // centimeters

Fascinating offers that this may be calibrated by comparing this with a manual rain gauge after a substantial amount of rain has been collected.

I'm not at all certain, anyone will do this, but in case you do;

   RN_diff_corrected = k1 * RN_diff

Relative Humidity.

Relative humidity is measured by turning on a remotely located 555 clock which uses a capacitor which changes as a function of relative humidity. The main PIC processor measures the frequency by opening 200 five ms intervals to the PIC's on-board counter thus, counting the number of transitions over one second.. The main PIC then calculates the capacitance and returns this value to the PC in picofarads with a resolution of 0.1 pFd. For example;

   H1 187.3

The reason for returning the capacitance is that the uncertainties associated with the circuitry are such that it was impossible to return percentage RH values without passing results that appear ridiculous; say 233 percent RH. The use of capacitance permits the user to perform calibrations and apply a relatively simple expression for calculating RH. Further, it leaves the door open for users who may want to use an alternative capacitive type sensor.

Two such 555 circuits may be accommodated. The PIC uses one of the PIC outputs associated with the A/D measurement circuit to control a 74HC158 quad two input data multiplexer to gate first one and then the other to the on-board counter. If one or the other is not found by the PIC, an asterisk is returned.

   H1 *
   H2 213.9

The 555 clock and associated circuitry including the Philips relative humidity sensitive capacitor and a printed circuit board may be purchased from Fascinating Electronics (WEA-TH $24.95).

The Fascinating unit uses a 555 in an astable arrangement with R1 = R2 = 1.0 Megs and a Philips 2322 691 90001 humidity sensitive capacitor.

(An alternative to the Fascinating unit is to use the 555 circuitry we have provided and simply purchase the Philips 2322 691 90001 humidity sensitive capacitor from Newark Electronics).

Note that the period T is;

(1) T = (R1 + 2*R2) * C * ln(2)

For R1 = R2 = 1.0 MOhm;

   T = 2.07944e6 * C

Thus, knowing the period, the value of C is calculated by the PIC;

   C = T / 2.07944e6
     = 1/(counts_per_sec * 2.07944e6)

or

(2) C_pFd = 4.808987e6 / counts_per_sec

Note that the main PIC processor performs all of these calculations.

The Philips element is nominally 122 pFd at 43 percent humidity with a slope of 2.5 percent RH per pFd.

Thus, in theory, the user may calculate relative humidity;

(3) RH = 2.5 * (C_pFd - 122) + 43

or

   RH = 2.5 * (C_pFd) - 262

Note that the general form of the expression is;

(4) RH = k1 * C_pFd + k2

Unfortunately, theory and reality are not always the same.

In experimenting with the 555 arrangement, we observed that even for an accurately known capacitance, the period was longer than expected and even more unsettling was that this varied from one 555 to another. Thus, the capacitance was being calculated as some 20 to 50 pFd larger than it was.

I assume this is the result of some capacitance on the input of the 555 and propagation delays associated with the 555.

Note that 20 to 50 pFd corresponds to an additional 50 to 125 percent RH. In addition, the Philips device is nominally 122 pFd at 43 percent RH. But, that 122 pFd is plus or minus 15 percent and 15 percent translates to 18 pFd or another 46 percent of unknown RH.

However, all is not lost. We tested 555 circuits up to 100 degrees C and sprayed half a can of Quick Freeze on one 555 and found that the falsely high period associated with the 555 did not change.

And, although the initial tolerance of the Philips sensor is poor, one assumes it is stable for a specific device

Thus equation (4) might be expressed as

(5) RH = k1 * (C_RH_pFd + C_TOL + C_555) + k2

(6) RH = k1 * C_reading + k2


Thus, the user might perform either a single or dual point calibration to accuarately determine K2 or both k1 and k2.

That is, assume k1 is 2.5, and solve for k2 using one reference relative humidity. The reference might be obtained using a local weather report or using another RH meter.

(7) k2 = RH_ref - k1 * C_reading_ref

If you are so inclined, you might perform a two point calibration and solve the two simultaneous equations for k1 and k2.

   RH_ref_1 = k1 * C_reading_ref_1 + k2
   RH_ref_2 = k1 * C_reading_ref_2 + k2  

Then use expression (6) in your monitoring program.

There are any number of obtaining that second point.

Wait around long enough for the humidity to markedly change.

Or put a bowl of water in a microwave and give a small blast (without the electronics in the microwave). Then put a Radio Shack hygrometer along with the 555 circuit in there (without turning on the microwave) and allow time for the whole thing to reach a steady state.

If you are really intent, there are a number of salts which when saturated and kept in a closed container will result in an equilibrium.

	Salt		Equilibrium at 25 degrees C

	Ammonium Sulphate 	 80 percent
	Ammonium Nitrate  	 62
	Potassium Carbonate 	 43
	Potassium Acetate  	 22

I don't happen to have these things around and don't know where to get them. I believe that ammonium nitrate was the prime ingredient in the Oklahoma City bombing which was all I had to note before abandoning this idea for a number of reasons.

G CAP 2.

We spent a considerable amount of time investigating the G CAP 2 manufactured by General Eastern Instruments.

This appears to be a better unit than the Philips unit. It appears far more rugged.

This is rated at 147 pFd at zero percent humidity with a slope of 3 percent RH per pFd. In fact, GEI trims these to within one pFd and rates the slope as being accurate to within 2 percent.

If this were substituted for the Philips unit in the 555 circuitry, the user could, in theory, calculate the humidity as;

(8) RH = 3 * (C_pFd - 147) 

or

   RH = 3 * (C_pFd) - 441

Looking again at expression (5)

(5) RH = k1 * (C_RH_pFd + C_TOL + C_555) + k2

Note that C_TOL is virtually eliminated. However, the C_555 term remains and the bottom line is that a very accurate capacitance in parallel with an unpredictable capacitance doesn't buy one a great deal.

However, some users may wish to substitute the GEI unit in place of the Philips.

Note that if a single point calibration is used, assume K1 is 3.0 and solve for k2;

   k2 = RH_ref - k1 * C_meas

The RH is then calculated as;

   RH = 3 * C_meas + k2

If a dual calibration is used, the procedure is the same as with the Philips unit.

On finding, the G CAP, we were quite excited. However, if a dual calibration technique is used, there really is no advantage over the Philips except that it appears more rugged. Thus, we abandoned it in favor of the Fascinating board which uses the Philips unit.

However, by returning relative humidity as a capacitance we tried to leave the door open for users who opt to use the G CAP.



Appendix I

Content of Basic System and Add-on Packages

In the following all of the parts contained in the basic system kit and the add-on kits are detailed. Please inspect your packages. We try real hard not to make errors, but we do. If you find that anything is missing, please send me e-mail right away as the chances are good that the error is not confined to only you.

The dollar figures indicate the cost of a replacement part. You may note that the sum of the replacement costs is less than we actually charge for the packages. Indeed, there is some markup to cover all of the cost associated with developing this package and putting it together. Clearly, we could correct the disparity by charging a bit more for the replacement parts, but you invested in the package and we really want it to work for you.

Clearly, replacement parts are available only to those who have purchased the system.

Basic System.

1 This Documentation. ($5.00)

1 7805 Regulator Kit consisting of a 7805 with heat sink, two 47 uFd capacitors, 1N004 diode and LED ($2.00)

1 Programmed PIC16C558 Main Processor ($7.00)

1 4.0 MHz Ceramic Resonator ($0.75)

1 DS275 Transceiver ($3.00)

2 Dallas DS1820 Digital Thermometer ($5.50)

1 74XX158 Quad 2-Input Multiplexer ($0.50)

1 Resistor SIP Network (4.7K) with terminals 4, 5, and 6 removed (5/$1.00)

1 Resistor SIP Network with terminals 2 and 6 removed.

1 100 Ohm Resistor (brown - black - brown)

3 330 Ohm Resistor (orange - orange - brown)

2 10K Resistor (brown - black - orange)

1 555 Kit consisting of 555, two 1 Meg resistors, 100 Ohm resistor, 150 pFd capacitor and 0.1 uFd cap. ($1.00)

1 Logic Probe Kit ($5.00)

Short length of heat shrink tubing.

Miscellaneous lengths of 22 AWG solid wire for breadboarding.

Atmospheric Pressure and User A/D Add-On.

1 LTC1298 Dual 12-bit A/D ($8.00)

1 MPX4115AP Pressure Sensor ($20.00)

1 1K Resistor (brown - black - red)

2 10K Resistor (brown - black - orange)

2 100K Resistor (brown - black - yellow)

2 50,000 pFd capacitor

Wind Direction and Speed and Rainfall Add-On.

1 LTC1298 Dual 12-bit A/D ($8.00)

1 PIC12C508 - RAIN ($3.50)

1 PIC12C508 -WIND ($3.50)

2 4.0 MHz Ceramic Resonator ($0.75)

1 1K Resistor (brown - black - red)

1 100 Ohm Resistor (brown - black - brown)

2 330 Ohm Resistor (orange - orange - brown)

2 100K Resistor (brown - black - yellow)

2 50,000 pFd Capacitor (10/$1.00)

2 1.0 uFd Cap - Electrolytic (10/$1.00)