Wireless Weather Station. Part 1

PIC16F873

Jerry Wasinger

I. Introduction

In the Midwest, the main topics of conversation may include the local football team or how the crops are doing. Inevitably though, the conversation always leads to the weather. Most of us take the weather for granted and don’t give it a second thought. But, in states like Kansas, Oklahoma, and Texas, weather is spelled with a capital “W” and is closely monitored by both individuals and the media. Weather is thunderstorms, tropical depressions, tornados, blizzards, squall lines, stationary fronts, cold fronts from Canadian, warm moist Gulf air, and hurricanes. The onset of any one of these events can be detected by monitoring a few basic conditions.

When you check the weather on the television or the radio, it’s always what conditions are like at the airport or some other remote location. But, what are conditions like in my backyard? To address this, I embarked on the design of the Wireless Weather Station. I had meant to do this project many years ago but two bits of technology finally spurred me into action: the first was the development of low-cost, solid state humidity sensors and the second was the availability of small, monolithic RF transceivers

II. The Design

The Wireless Weather Station is composed of a remote station and a base station. The remote station is solar-powered and wakes up once a minute to collect and transfer data. The base station receives and buffers the incoming data and then transfers it via an RS232 connection to a PC for processing. Within each of the stations is a dedicated circuit card as well as a separate, RF circuit card. We’ll start our discussion with the remote station design.


A. Remote Station

The Remote Station consists of four functional sections: the sensors, the PIC16F873 microcontroller, the RF circuit, and the power supply. The schematic, shown in Figure 2, shows the sensor and microprocessor areas.

For humidity sensing, I opted for the Humirel HS1101 capacitive sensor. This device, when combined with a CMOS 555 timer operating as an astable multivibrator, produces a signal with a humidity dependent frequency. To minimize temperature effects, it is important to use the Texas Instruments TLC555 device in this design. Refer to the HS1101 datasheet if another device is used. Also note that care must be taken at the node of the HS1101 and the 555. Stray capacitance values will lead to erroneous and unpredictable measurements. I chose to solder this node above the circuit card.

The relationship between the output frequency of the 555 and the relative humidity can be seen in Figure 1 . A first order equation that relates relative humidity to frequency is:

R.H. = 565.1 – 0.0767 * f

A second order equation can be used for improved accuracy,:

R.H. = -6.4790E-06 * f2 + 1.0047E-02 * f + 2.7567E+02

Relative Humidity vs. Timer Frequency

 Figure 1. Relative Humidity vs. Timer Frequency

Temperature sensing is very straight-forward with the LM335. This output of this device is equal to the absolute temperature in degrees Kelvin divided by 100 or:

Vout=Temperature(K)/100

To determine the temperature in degrees C, use the equation:

ºC = 100 * Vout – 273

To determine the temperature in degrees Fahrenheit, use the equation:

ºF = 1.8 * ºC +32.2

= 1.8 * (100 * Vout – 273) + 32.2

= 180 * Vout - 459.2

At room temperature, this device outputs about 3volts.

Pressure sensing is provided by a Motorola MPX5100A, which operates from 0 to 16 PSI. However, we’re interested in only a very small part of that range. Barometric pressure readings fall between 28 and 32 inches of mercury. This translates to 13.75 to 15.72 PSI. To increase the dynamic range of the output, I added an amplifier circuit (U4), which subtracts about 3.7 volts from the sensor output and then multiplies the difference by 4. Since the MPX5100 can require as much as 10mA, Q1 was added to provide microprocessor-controlled switching.

Microprocessorи and sensors
Click to enlarge


Figure 2. Microprocessorи and sensors

I chose the Microchip PIC16F873 because it had the right mix of program and data memory, a 10-bit A/D, and three timers. Timer2 is used to measure the period of the humidity signal. The A/D is used to measure the temperature and pressure sensors as well as to monitor the battery voltage. To maximize accuracy I used an external 4.096 volt 0.1% reference from National Semiconductor. With the 10-bit A/D, this provides a resolution of 4mV per count.

The interface to the RF link consists of an enable line and a data output. Since the transmitter circuit operates at 3.3 volts, I used analog switches to translate from the five-volt outputs of the microprocessor. Although not shown, pin 14 of the 74HC4066 needs to be connected to +5 volts while pin 7 needs to be grounded. JP1 is a 6-pin header that connects to the RF circuit card.

 

The heart of the remote station's power supply circuit is U2—the boost mode switch mode regulator IC
Figure 3. The heart of the remote station’s power supply circuit is U2—the boost mode switch mode regulator IC

The power supply for the Remote Station is shown in Figure 3 . When the sun is shining on the solar panel (SC1 – part number 980-1045 from RadioShack.com), enough power is generated to drive the 50mA current source formed by Q1, U1, and R1. This current acts as a trickle charger for three AA NiCAD batteries. The batteries power U2 - a switchmode regulator that provides the 5 volts for the microprocessor and sensors. This is followed by U3, which is a linear regulator that provides the 3.3 volts for the RF circuitry. L2 and C5 were added to reduce the switching noise from U3. D2 is used to isolate the solar panel from the rest of the circuit when it is dark. Note that should be 6.3V low ESR capacitors.

electronicdesign.com

To be continued

EMS supplier