■ SCHEMATIC 2
■ FIGURE 11
Take a look at the source code
for this program and you will see a
function called FEReadDir. This
routine gets the two A-to-D readings
indicating the two wipers on the potentiometer. This wind vane is unique in
the sense that the two wipers in the full
rotation potentiometer overlap so there
■ FIGURE 12
is no dead zone. When one of the
wipers is in its dead area, the other
wiper is used. By using a bit of math,
we can then calculate a full 360
degrees at a one-degree resolution.
One of the problems I did have
was that using parasite power, I could
not get a full 5V voltage across the
wind vane potentiometer. The best I
could do was 3.1V. This was enough to
take readings, but presented a problem.
The routines the manufacturer supplied
are designed for a full 0-5V range. I had
to multiply the reading by 6. 6 so that
the routines would work as-is.
This particular example shows
how you can create various environmental sensors using 1-Wire chips.
The downside is that if you don’t like
working with surface-mount chips,
you may find it difficult to roll your
own sensors. Later in the series, we
will look at using a microcontroller as
our main controller/collector. This
approach will allow us to use both
1-Wire and conventional means for
taking measurements from various sensors. With a microcontroller, we could
have simply tied two A-to-D lines to the
wind vane’s potentiometer.
Let’s take a look at a few more
environment modules. I use the term
module when a 1-Wire chip is
connected to some sort of sensor and
placed on a board, but you may also
see the terms device or instrument.
What would a weather station be
without temperature measurements?
As a minimum, you will need an
indoor sensor and an outdoor sensor.
You have a couple of choices, but I
prefer the DS18S20 chip. I have provided chip libraries for the DS18B20,
DS18S20, and DS1920 temperature
chips. All can be used, but the test routines have been written for the
DS18S20. The DS18S20 also has a
feature where you can access the
internal counter used to calculate the
temperature, and by a bit of math
wizardry, we can obtain a much