ENVIRONMENTAL SENSING

1-Wire Addressable Digital Instruments
for Environmental Monitoring

Meteorological data on rainfall, wind speed and direction, solar radiation, relative humidity, and barometric pressure can be collected, converted, and transmitted over the same single twisted pair that powers the sensors.

Dan Awtrey, Dallas Semiconductor

figure
Addressable digital instruments make it possible to measure multiple environmental variables over a single twisted-pair cable. The type and number of ADIs deployed determine the system function, or "genome" of the system. The graphic illustrates a weather-specific 1-wire net by way of comparison to a DNA strand.

Several 1-Wire analog-to-digital converters (ADCs) have recently been introduced that make it possible to measure a wide range of environmental properties over a single twisted pair, and which open the way to a new generation of transducers called addressable digital instruments (ADIs). An ADI consists of a sensing element or elements, a 1-Wire chip that converts the input into a digital format, and some peripheral and protection components. A distinct advantage of ADIs is that they all interface to the master in the same manner, regardless of the particular property being measured. Whether the essential sensing element is voltage, current, or resistive based, all communication occurs over the net using half-duplex 1-Wire protocol [1]. (This feature is in contrast to methods that incorporate a variety of signal conditioning circuitry such as instrumentation amplifiers and voltage-to-frequency converters, a design that necessarily makes their outputs different and often requires a separate cable and power source per sensor.) The unique ID address or serial number of each sensor is the key for the bus master to interpret which parameter a particular ADI is measuring. The ID also allows multiple ADIs to be placed on the same cable, reducing installation and maintenance costs.

Since the science of meteorology is a familiar example of an application requiring diverse sensors, several examples of 1-Wire instrumentation designed for use in a weather station will serve to illustrate their design simplicity and versatility. In addition to the temperature and wind speed and direction that a basic weather station may measure, environmental monitors commonly measure rainfall, humidity, barometric pressure, and solar radiation as well. And many systems add several other sensors to determine dew point and detect lightning strikes. The circuits presented here not only show how to transform the specified sensing elements into an ADI, but also illustrate the ease with which the concepts can be extended to other instruments not described.

Note that at the center of every ADI is a chip that converts an input or inputs into a digital format that communicates over the net with a common protocol. For example, the DS2423 counter has inputs that respond to logic level changes or switch closures, and includes a 1-Wire interface front end that makes it suitable for various rate or event sensors.

Measuring Rain
Many events call for measurement of either a total, or a count per unit time (rate). Examples include wind speed and rainfall or the number of times a wheel has rotated, from which rpm and distance can be computed. A magnetically actuated reed switch used as an input
figure
Figure 1. This basic ADI circuit incorporating a DS2423 counter with a reed switch input is used to measure rate such as wind speed and rainfall. It may also be used as a hub-mounted wheel odometer for counting tire rotations.
to a DS2423 counter allows such events to be easily measured. A basic reed switch circuit suitable for a rain gauge or wind speed sensor is shown in Figure 1. The dual diode BAT54S serves to protect the circuit from signals that go below ground, and, with C1, provides a local source of power. While the DS2423 has an internal pull-up resistor to keep the input from floating, its high value (~22 M) can make it susceptible to noise. To avoid generating spurious counts during turn-on and minimize noise pickup, an external 1 M pull-down resistor is substituted. Except for lithium backup (not shown), this is the counter circuit used in the 1-Wire rain gauge [2]. Here, a small permanent magnet moves past the reed switch each time a tipping bucket fills and empties. This momentarily closes the reed switch that increments the counter, indicating that 0.01 in. of rain has fallen. A similar circuit is used in the 1-Wire weather station to measure wind speed [3]. The same circuit (also with lithium backup) has also been used as a hub-mounted wheel odometer. Conveniently, the DS2423 also contains 4096 bits of user-accessible SRAM that can be used for temporary storage, or, where lithium backup is provided, for calibration, location, and routine inspection information.

And Wind
Besides knowing wind speed, the direction from which the wind is blowing is of particular interest and may be measured with an ADI. While the original 1-Wire weather station used a DS2401 silicon serial number to label each of the eight magnetic reed switches in its wind direction sensor, a single DS2450 quad ADC can perform the same functions [3]. As in the DS2423 counter circuit, a dual-diode BAT54S protects the circuit from signals that go below ground, and, with C1, provides a local source of power. Note that C1 has been increased from 0.01 to 10 µF to ensure that the voltage across the resistor network remains relatively constant. As shown in Figure 2 , a single D2450 replaces the eight DS2401s originally used with five fixed resistors.

figure
Figure 2. A wind direction sensor based on the DS2450 quad ADC differs from the previous design in that no initialization is required; each compass point generates a unique digital code.

As the wind rotates the wind vane, a magnet mounted on a rotor that tracks the rotation opens and closes one (or two) of the reed switches. When a reed switch closes, it changes the voltages seen on the input pins of U1, the DS2450. For example, if the magnet is in a position to close S1 (North), the voltage seen on pin 7 changes from Vcc to 1/2 Vcc, or approximately 5・.5 V. Since all 16 positions of the wind vane produce unique 4-bit signals from the ADC, it is an absolute indicator.
TABLE 1
Wind Vane Position vs. Voltage
(seen on the four DS 2450 inputs)
POS. D C B A
1 5 2.5 5 5
2 5 3.3 3.3 5
3 5 5 2.5 5
4 5 5 3.3 3.3
5 5 5 5 2.5
6 0 5 5 2.5
7 0 5 5 5
8 0 0 5 5
9 5 0 5 5
10 5 0 0 5
11 5 5 0 5
12 5 5 0 0
13 5 5 5 0
14 2.5 5 5 0
15 2.5 5 5 5
16 3.3 3.3 5 5
There is accordingly no need to initialize the sensor or store a tagging code on the board as was required by the original 1-Wire weather station. It is necessary only to indicate North, or, equivalently, the direction the wind vane is pointing. Table 1 lists the voltages seen at the ADC inputs for all 16 cardinal points.

Because two reed switches are closed when the magnet is halfway between them, 16 compass points are indicated with just eight reed switches. Referring to the schematic and position 2 in Table 1, observe that when S1 and S2 are closed, 3.3 V is applied to ADC inputs A and B. The reason is that pull-up resistors R2 and R3 are placed in parallel and the pair is connected in series with R1 to form a voltage divider with 0.66 Vcc across R1. Notice that this also occurs twice more at switch positions 4 and 16.

The DS2438, a Versatile Performer
Originally designed to measure the condition of a battery pack, the DS2438 contains two ADCs and a temperature sensor. The main ADC performs 10-bit conversion on a 0・0 V input, or 9-bit conversion on a 0・ V signal with an internal multiplexer that allows it to read the voltage applied to its power supply pin. The other ADC was intended to measure the voltage developed by large battery currents flowing across an external 0.05 resistor with signed 10-bit accuracy at a full-scale reading of ア250 mV. The DS2438 also contains a 13-bit temperature sensor similar to the DS18B20. Among other additional features such as a real-time clock, the part provides 40 bytes of nonvolatile memory that is useful for storing calibration, location, and function information. The introduction of this part simplifies the design of many ADIs, as illustrated by the circuits described below.

And Sun
figure
Figure 3. The photodiode in an ADI solar radiance sensor can be provided with optical filters or selected to be sensitive to a particular portion of the spectrum.
The amount of sunlight and its duration are additional parameters that meteorologists and horticulturists are interested in measuring. The amount is a measure of air and sky conditions; duration is related to the length of the day. Although the mechanics of mounting and filtering tend to be complex, as shown in the following two examples, the electronics can be easily implemented to form a DS2438-based ADI. Figure 3 illustrates a solar radiation sensor using a photodiode; Figure 4 uses a photovoltaic cell. In each case, a dual-diode
figure
Figure 4. In a photovoltaic cell-based solar radiance sensor, R1 and R2 form a voltage divider to keep the voltage seen by U1 within its maximum range.
BAT54S protects the circuitry from signals that go below ground, and with C1, provides a local source of power.

In Figure 3, a sense resistor is connected in series with a photodiode and between the two 田urrent・ADC pins. Light striking the photodiode generates photocurrents that in turn develop a voltage drop across the sense resistor that is read by the ADC. In commercial units, optical filters are typically added to match the wavelength and bandpass to the human eye response (the CIE or photopic curve). More sophisticated units add other desirable features such as a translucent hemisphere that collects light to enable the sensor to view the sky from horizon to horizon. In this case, the sensor actually focuses on the inside of the hemisphere to obtain its reading [4].

An interesting variation of a solar radiation sensor can be constructed using a standard LED in reverse bias mode. An LED is selected that generates acceptable photocurrent levels when exposed to the sun at high noon on a clear day. The resistor is sized to develop 250 mV maximum using the formula:

Rsens = E/I

where:

E = 0.25 V
I = maximum photocurrent generated

One example is the EFA5364X from Stanley (Irvine, CA). This is a super-bright orange AlGaInP LED with a peak response at 609 nm and a narrow (15°) spectral field of view. A 4.7 k sense resistor provides acceptable outdoor performance, which may be increased to 100 k if the circuit is to be used with indoor lighting. LEDs made from other compounds will have their peak response in a different portion of the spectrum, which can prove useful in certain installations.

A solar radiation sensor can also be based on photovoltaic cells, which generate electricity when exposed to light. As shown in Figure 4, a suitable solar cell is connected to the 田urrent・ADC input of the DS2438 through voltage divider R1 and R2. The divider is necessary to limit the typical 0.45 V generated by a single solar cell to the 300 mV absolute maximum allowed across pins 2 and 3 of the DS2438. Resistor values for the divider are chosen such as to avoid unduly loading the cell痴 power capacity. One advantage of this approach is that several cells can be set to face different sectors of the sky for horizon-to-horizon coverage. The cells are connected in parallel and R2 is sized so that maximum sunlight on the sensor(s) develops no more than 0.3 V across it, as described above. If signal filtering is required in a particular application, it may be done in hardware as recommended in the DS2438 datasheet, or by averaging in software.

And Humidity
Not only is humidity an important factor in many processing and manufacturing operations, but it also directly affects our own comfort and well-being. Too low, and we must deal with static electricity and ESD problems; too high, and mold, condensation, and mugginess affect us. With the proper sensing element, humidity can be easily measured with an ADI over the 1-Wire net. The Honeywell capacitive sensing element specified here develops a linear voltage vs. relative humidity (RH) output that is ratiometric to the supply voltage. That is, when the supply voltage varies, the sensor output voltage follows in direct proportion. This necessitates measuring both the voltage across the sensing element and its output voltage. In addition, calculation of true RH requires knowledge of the temperature at the sensing element. Because it contains all the necessary measurement functions to do the calculations, the DS2438 is an excellent choice for an ADI humidity sensor.

figure
Figure 5. In a humidity sensor based on the DS2438, R1/C2 form a low-pass filter that may be omitted if averaging is done in software.
In Figure 5, the analog output of the HIH-3610 humidity-sensing element is converted to digital by the main ADC input of a DS2438. As with other ADIs, a dual-diode BAT54S protects the circuit from signals that go below ground, and, with C1, provides a local source of power. In this case, a value of 0.1 µF for C1 is sufficient to handle the 200 µA operating current required by U2, the HIH-3610. The RC network on the output of U2 is a low-pass filter that removes the low-level clock feed-through from the sensing element痴 signal conditioning circuitry. If averaging is done in software, however, R1 and C2 may be omitted and the sensing element output connected directly to the Vad pin of U1. In operation, the bus master first has U1, the DS2438, report the supply voltage level on its Vdd pin, which is also the voltage across U2, the sensing element. Next, the master has U1 read the output voltage of U2 and report local temperature from its onchip sensor. Finally, the master calculates true RH from the three parameters supplied by U1 [5]. Since the bus master identifies each ADI by its unique serial number, many humidity sensors can be placed on the line. This is particularly convenient in applications such as greenhouses where it is desirable to know the humidity at multiple locations within the enclosure.

figure
Figure 6. A barometric pressure sensing element requires special power management circuitry (not shown), or an external source of power must be provided.
And Barometric Pressure
Atmospheric, or barometric, pressure is a valuable indicator of imminent weather change when a front moves past the instrument. This meteorological parameter can also be measured over a 1-Wire net using an ADI. Selecting a pressure sensor that contains comprehensive onchip signal conditioning makes the circuit in Figure 6 very straightforward. As was the case with the humidity sensing element, the suggested pressure sensing element is ratiometric, which requires that both the output voltage representing atmospheric pressure and the supply voltage across the element be known in order to accurately calculate barometric pressure.

As is typical for an ADI, a dual-diode BAT54S protects the circuitry from signals that go below ground, and, with C1, provides a local source of power. In this case, because U2, the MPXA4115 pressure sensor, may require as much as 10 mA at 5 V, special power management circuitry (not shown) is required, or else an external power source is needed. Notice that the external power is also connected to the power pin of the DS2438, allowing the circuit to measure the supply voltage applied to the pressure-sensing element. In many installations, supplying external power is not a problem because the barometer will be mounted inside near the bus master and a power source. Flexible tubing can then be routed to sample the outside air pressure and avoid unwanted pressure changes (noise) caused by the opening and closing of doors and windows or elevators moving inside the building.

Summary
The introduction of 1-Wire ADIs makes it possible to measure a variety of environmental parameters, convert the signals locally, and transmit the digital data over a common communications link. Multiple ADIs measuring the same or different variables can be placed on the same twisted pair that also supplies power for the sensors. For example, wind speed and rainfall may be measured by an ADI counter; wind direction by a ADI DS2450 ADC; and humidity, barometric pressure, and solar radiation by DS2438-based ADIs. Each ADI can also measure two variables such as humidity and solar radiation. The ability to mount a variety of instruments on a single cable reduces installation and maintenance costs. Each sensor has a unique ID address by which the master keeps track of it and the environmental parameter it is measuring. Sensor-specific or calibration information may be stored in the ADI痴 memory, or, eventually, by downloading from the Web using the sensing element痴 ID address as a URL extention.

1-Wire is a registered trademark of Dallas Semiconductor.

References
1. Dan Awtrey. Feb. 1997. ・A HREF="/articles/0297/onewire/index.htm" TARGET="_top">Transmitting Data and Power over a One-Wire Bus,・Sensors:48-51.

2. Dan Awtrey. Dec. 1999. ・A HREF="/articles/1299/56_1299/index.htm" TARGET="_top">A 1-Wire Rain Gauge,・Sensors:56-59.

3. Dan Awtrey. June 1998. ・A HREF="/articles/0698/wir0698/index.htm" TARGET="_top">The 1-Wire Weather Station,・Sensors:34-40.

4. Walter Butler. June 1999. ・A HREF="/articles/0699/0699_p24/index.htm" TARGET="_top">Integrated Optical Sensing of Changing Environmental Illumination,・Sensors:24-36.

5. Dan Awtrey. Aug. 2000. ・A HREF="/articles/0800/62/index.htm" TARGET="_top">A 1-Wire Humidity Sensor,・Sensors:62-63.



Dan Awtrey is a Staff Engineer, Dallas Semiconductor, 4401 S. Beltwood Pkwy., Dallas, TX 75244-3292; 972-371-6297, fax 972-371-3715, dan.awtrey@dalsemi.com.
For information about available 1-Wire sensors contact John Compton, CEO, Point Six, Inc., 383 Codell Dr., Lexington, KY 40509; 859-266-3606, fax 859-266-0702.