8.13. EXTENDED EXAMPLE 5: WEATHER STATION 307
Weather Station
ADC
LM34
temp sensor
weather
vane
ADC
Initialize
ReadADC
ch for
conv
conv
data
wind
direction
temp
data
74154
4:16 decoder
LED
interface
Wind Direction
Display
wind
direction
Figure 8.33: Weather station structure chart.
8.13.2 STRUCTURE CHART
To begin the design process a structure chart is used to partition the system into definable pieces.
We employ a top-down design/bottom-up implementation approach. The structure chart for the
weather station is provided in Figure 8.33. The main microcontroller subsystem needed for this
project is the ADC system to convert the analog voltage from the LM34 temperature sensor and
weather vane into digital signals, and the wind direction display. This display consists of a 74154,
4-to-16 decoder and 16 individual LEDs to display wind direction. The system is partitioned until
the lowest level of the structure chart contains “doable” pieces of hardware components or software
functions. Data flown is shown on the structure chart as directed arrows.
8.13.3 CIRCUIT DIAGRAM
The circuit diagram for the weather station is provided in Figure 8.34.The weather station is equipped
with two input sensors: the LM34 to measure temperature and the weather vane to measure wind
direction. Both of the sensors provide an analog output that is fed to Analog Input 0 (LM34) and
Analog Input 1 (weather vane) of the Arduino UNO R3. The LM34 provides 10 mV output per
degree Fahrenheit. The weather vane provides 0 to 5 VDC for 360 degrees of vane rotation. The
weather vane must be oriented to a known direction with the output voltage at this direction noted.
We assume that 0 VDC corresponds to North and the voltage increases as the vane rotates clockwise
to the East. The vane output voltage continues to increase until North is again reached at 5 VDC
and then rolls over back to - volts. All other directions are derived from this reference point.
An LCD is connected to digital pins [7:0] (PORTD [7:0] of the ATmega328) for data and
digital pins 8 and 9 for the enable and command/data control lines (PORTB[1:0] of the ATmega328).

Get Arduino Microcontroller, 2nd Edition now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.