Thanks to visit codestin.com
Credit goes to www.scribd.com

0% found this document useful (0 votes)
11 views9 pages

Journal162 Article08

The document details the design and construction of a low-cost digital weather station that measures key weather elements such as temperature, atmospheric pressure, relative humidity, and wind speed using modern sensors. The system consists of an outdoor module that collects data and transmits it wirelessly to an indoor module, where the data is logged and can be visualized through a MATLAB-based graphical user interface. This project aims to provide accessible weather data for various applications, particularly in regions with limited weather monitoring resources.

Uploaded by

k.a.gebreel
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
11 views9 pages

Journal162 Article08

The document details the design and construction of a low-cost digital weather station that measures key weather elements such as temperature, atmospheric pressure, relative humidity, and wind speed using modern sensors. The system consists of an outdoor module that collects data and transmits it wirelessly to an indoor module, where the data is logged and can be visualized through a MATLAB-based graphical user interface. This project aims to provide accessible weather data for various applications, particularly in regions with limited weather monitoring resources.

Uploaded by

k.a.gebreel
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 9

See discussions, stats, and author profiles for this publication at: https://www.researchgate.

net/publication/276145676

Design and Construction of a Low Cost Digital Weather Station

Article · October 2012

CITATIONS READS

12 4,613

2 authors:

Lanre Olatomiwa Umoru Sam Adikwu


Federal University of Technology Minna 1 PUBLICATION 12 CITATIONS
57 PUBLICATIONS 3,705 CITATIONS
SEE PROFILE
SEE PROFILE

All content following this page was uploaded by Lanre Olatomiwa on 12 May 2015.

The user has requested enhancement of the downloaded file.


AU J.T. 16(2): 125-132 (Oct. 2012)

Design and Construction of a Low Cost Digital Weather Station


Lanre Joseph Olatomiwa and Umoru Sam Adikwu
Department of Electrical and Electronic Engineering
Federal University of Technology, Minna, Niger State, Nigeria
E-mail: <[email protected]; [email protected]>

Abstract

This work is focused on the design and construction of a low cost weather station
which makes weather related data available for different purposes such as agriculture,
aviation weather forecasting, etc. The design is made up of an outdoor module which
measures four weather elements (temperature, atmospheric pressure, relative humidity
and wind speed) through their respective sensors. This module transmits the sampled
data wirelessly through radio frequency (RF) to an indoor module which receives the
data and automatically logs the data to a database. A MATLAB® based graphical user
interface (GUI) was also incorporated to view the logged data and perform some setup
operations on the system.
Keywords: Sensors, microcontroller, wireless, radio frequency, graphical user
interface (GUI).

Table 1. Weather elements and their


1. Introduction measuring instruments.

Weather is the state of the atmosphere of Measuring


S/N Element
Instrument
a given place at a particular time (Yates 1947).
1 Temperature Thermometer
In order to describe the atmospheric conditions,
2 Relative humidity Hygrometer
certain key weather elements must be known
and quantified. Some of those important 3 Precipitation Rain gauge
elements are temperature, relative humidity, 4 Wind speed Anemometer
atmospheric pressure, wind speed, wind 5 Wind direction Wind vane
direction, cloud cover, precipitation, etc. In Atmospheric Mercury
6
meteorology, the data collected on the various pressure barometer
weather elements is used in weather forecasting
(the act of predicting the weather) which is Some of the measuring instruments listed
helpful in one way or the other in the course of in Table 1 are bulky, analogue, expensive and
daily living. difficult to use. As such, newer techniques
The study of weather is as old as man as based on electronics were developed. This was
he has always tried to figure out the causes of made possible by the advances in digital
different weather conditions he finds himself in electronics. Transistor-like sensors have been
and possibly predict what the weather would be developed for measuring temperature, relative
like in a short term. There cannot be a study of humidity and atmospheric pressure (O’Neil and
the weather neither its prediction without the Derrington 1979). These sensors give voltage
knowledge of the prevailing conditions of the or current output that is proportional to the
atmosphere (Yates 1947). For this reason, man magnitude of the measured element of weather.
has always devised means of measuring The earlier versions of these sensors were
different elements of the weather. Table 1 purely analog but recent developments have
shows some weather elements and instruments made their digital counterparts available so
used for measuring them (Wang and Felton they could function in our present world which
1983). is fast becoming digitally inclined.

Technical Report 125


AU J.T. 16(2): 125-132 (Oct. 2012)

The aforementioned development of readily available to small-scale farmers,


weather related electronic components made it institutions and others that may need it without
possible for small and compact weather huge financial implications. Simplicity of
stations (data gathering devices) to be built. operation was also factored into the design and
These sensors respond faster than their earlier as such a very high technical know-how is not
counterparts and the data collected by them necessary to operate the system.
tend to be more accurate.
A weather station is an observation post 2. Materials and Method
where meteorological conditions are observed
and recorded (Jackson 1993). It is a data This design employs modern sensors to
acquisition system which begins with sensing measure four elements of the weather, namely:
of variables (i.e. elements of weather being temperature, relative humidity, atmospheric
monitored), signal conditioning and processing, pressure and wind speed. It would be quite
storage, and finally analysis of the recorded exhausting and a complicated project to build a
data (Jackson 1993). The weather conditions weather station that monitors all elements of
over a considerably vast area vary widely, the weather. However, the measurement of the
hence the need to localize weather stations to a most important elements (temperature, relative
small region. Modern weather stations are built humidity and atmospheric pressure) used in
around relatively high power digital processors forecasting the weather has been incorporated
that continually pool the sensors that serve as into the design of this weather station. The said
their link to the analog world. The primary station is made of three principal parts:
benefit of a weather station is that it keeps the
users abreast of the prevailing conditions of the - outdoor system that measures the
atmosphere. The recorded (logged) data could elements;
also be analyzed by specialized meteorological - indoor system that links the outdoor
software to predict the weather (Jackson 1993). system to a personal computer; and
Weather stations also provide data archives - personal computer (PC) software for the
over a long period of time (Guo and Song visualization and storage of the data.
2010). Such archives could be used by the
academia or research institutions. 2.1 Outdoor Module
The motivation for this work is centered The outdoor module is made up of the
on prevailing shortage of weather related data following sub-systems: power supply, sensors
in Nigeria. The evidence of this fact could be bank, microcontroller unit and radio frequency
seen in poor weather forecasting in the country, (RF) transmitter module (TLP 315). Figure 1
poor response to weather related natural shows the block diagram of the outdoor
disasters because of lack of foreknowledge, and module.
unnecessary disruption of flights and flood
disasters that destroy lives and properties. This
is as a result of the unavailability of a network
Power
of weather stations dedicated for national
Sensors Bank

Supply
weather service and partly due to the high cost Unit
of imported weather stations. Also, operating
and managing imported weather stations
requires much technical expertise making their
use difficult for private users like small-scale
agriculturists, industrialists and schools. Wireless MCU
TX
The design presented in this work was
realized by using moderately inexpensive and
commonly off-the shelf components to reduce
the size, space and cost of running a weather Fig. 1. Block diagram of the outdoor module.
station. This would make weather related data

Technical Report 126


AU J.T. 16(2): 125-132 (Oct. 2012)

2.1.1 Power Supply: This module is anemometer. A mechanical system of three


powered by a dual power source viz. a cups was used to propel the motor (used as a
regulated DC supply and a battery supply. The DC generator). The cups were arranged in such
switching between the two power supplies is a way that the movement of one complements
automatic so that in the event of mains failure that of the other and as such the generator is
the battery takes over immediately without any guaranteed to turn only in one direction,
system interruption. thereby generating an output voltage of
2.1.2 Sensors Bank: This bank is made of consistent polarity. The output voltage of the
four sensors (relative humidity, temperature, generator changes in accordance with the
barometric pressure and wind speed sensors). prevailing wind speed. This voltage was fed
The sensor used for temperature and relative into an ADC input of the microcontroller chip
humidity measure is a four-pin digital sensor, and sampled for further processing.
DHT11. It uses digital-signal-acquisition 2.1.3 Radio Frequency (RF)
techniques and relative humidity/temperature Transmitter: TLP 315 RF transmitter was
sensing technique to ensure reliability and used for data transmission from the outdoor
long-term stability (Measurement Specialties module. It is a compact RF transmitter module
2012). The sensing techniques used are that operates at a frequency of 315 MHz. The
resistive-type for relative humidity and with RF transmitter module is essentially a high
negative temperature coefficient (NTC) for frequency oscillator that modulates a digital
temperature. An 8-bit microcontroller is string of data that appear on its input line. It
embedded in the sensors bank to ensure high utilizes Amplitude Shift Keying (ASK) for data
performance and easy interfacing to external transmission (Horowitz and Hill 1989). The
digital circuits. module generates 315-MHz signal when ‘1’ is
A Motorola MPX4250A sensor present on its data line and generates no output
(Motorola 1997) is used in this design to for ‘0’ on the data line.
measure the atmospheric pressure. It is an 2.1.4 The Microcontroller Unit (MCU):
integrated silicon pressure sensor mainly used The microcontroller utilized in this design is an
in altimeter, barometer and absolute pressure 8-bit controller, i.e. ATtiny48/88 from Atmel
applications. The sensor has an on-chip signal Corporation. It is a Reduced Instruction Set
conditioner and its reading is temperature Computer (RISC) with many onboard
compensated and calibrated. It gives an peripherals and improvements on the
analogue output voltage which is proportional traditional 8051 controller core (Atmel
to the prevailing atmospheric pressure. The Corporation 2011). The MCU was configured
effective operation range is 0 to 250 kPa (0 to to run on its default 1-MHz internal RC
36.3 psi) which corresponds to an output oscillator and as such no external crystal was
voltage range of 0.2 to 4.9 Volts. used in the circuit. The in-built serial peripheral
The transfer function of the barometric transceiver was used in conjunction with the
pressure sensor as given by the manufacturer is RF module for data transmission to the indoor
(Measurement Specialties 2012): module. One of the microcontroller onboard
Vs = Vo×(0.00369×P+0.04) ± Error, (1) timers was used to synchronize all timing
where Vo is the sensor output voltage and P is operations, especially the periodic sampling
the applied pressure. The sensor error is and transmission of weather data. The onboard
negligible when operating within the analogue-to-digital Converter (ADC) was used
temperature range of 0 to 85°C. The output for digitizing the pressure value from the
voltage was fed to an analogue-to-digital input MPX4250 sensor.
of the microcontroller which digitizes it based Beside the normal input/output pins,
on the transfer function encoded into the other onboard facilities used in the MCU are
microcontroller chip. USART (Universal Synchronous and
A 12-V brushless DC motor was Asynchronous Receiver and Transmitter) for
employed as the wind speed sensor. This was the transmission of the measured data and timer
due to the non-availability of a ready-made for periodical data sampling (Atmel

Technical Report 127


AU J.T. 16(2): 125-132 (Oct. 2012)

Corporation 2011). The USART was read data wirelessly. The whole cycle is
configured to work with 8-bit data mode, no repeated after one-minute intervals. The
parity, one stop bit and 4,800 baud rate by flowchart of the outdoor module program is
writing a calculated value to its baud rate shown in Fig. 2.
registers (UBRRL and UBRRH). The value 2.1.5 Indoor Module: The block diagram
written to the registers is calculated as follows of the indoor module is shown in Fig. 3. The
(Atmel Corporation 2011): indoor module has a power supply subsystem
UBRR = 1 + [FCPU/(16 × BAUD)]. (2) which is the same as that of the outdoor
The choice of 1 MHz for FCPU and 4,800 module and as such will not be further
for BAUD in Eq. (2) gives a value of 12.02 for analyzed.
UBRR. Since only integer values can be written
to the baud registers, the integer value was 12
giving an error of 0.17%. This is a very minute
error and has no noticeable effect on the serial
communication.
The timer zero was configured to
generate the time base needed for the
conversion through its interrupt overflow
facility. The 1-MHz system clock is too fast for
the timer operation and as such was pre-scaled
to a much lower value before being applied to
the timer. A pre-scaler factor of 64 was used
resulting in the following clock frequency:
FCLOCK = 1,000,000/64 = 15.625 kHz. (3)
The timer period (the inverse of the
operating frequency) is 64 s. Timer zero is 8-
bit wide, it was configured to count upward
from 0 to 255 and then roll back to zero and
continue repeating the same cycle unless
instructed by the CPU to stop counting (by
writing to the appropriate register). Therefore,
the time taken by the timer to count from zero
to an overflow is:
Toverflow = 64 s × 256 = 16.384 ms, (4)
and as such it would require 61 of such
overflows for a time period of one second. The Fig. 2. Flowchart of the outdoor module
timer was configured to generate an interrupt program.
each time an overflow occurred. The interrupt
service routine (ISR) was used to increment a
variable each time the timer interrupt occurred.
This was in turn used to increment a variable
known as sec (for second). The sec variable
provided the basis for all other timing
operations in the system.
At power on, the MCU configures the
necessary I/O pins, timer zero and USART by
writing to the appropriate registers connected
with the devices. The MCU then reads the Fig. 3. Block diagram of the indoor module.
weather conditions by sending a read command
to the respective sensors and transmitting the

Technical Report 128


AU J.T. 16(2): 125-132 (Oct. 2012)

2.1.6 Indoor Microcontroller Unit: The configures its USART to transmit at a


microcontroller unit of the indoor module predefined baud rate, and SPI as slave. The
contains two ATtiny48/88 microcontrollers. slave unit essentially serves as a data bridge
The use of two microcontrollers was justified between the PC and the master unit of the
by the availability of only one USART per indoor module. The firmware for the
microcontroller and the module utilized two for microcontrollers was developed using C
its effective functioning (one for PC serial language on the AVR® Studio 4 platform. The
communication and the other for flowchart of the program is shown in Fig. 5.
communicating with the outdoor module)
(Silicon Labs 2010). An alternative design
would have been the use of a single
microcontroller with two USART facilities but
none of such microcontrollers was readily
available. The first microcontroller identified
as “indoor_module_master” was set up to use
its onboard USART and Serial Peripheral
Interface (SPI) (Microchip 2007). The USART
configuration (data length, parity, stop bit and
baud rate) is the same as that of the outdoor
module in order to keep them in synchrony
with each other. The USART Receive
Complete Interrupt facility of the
microcontroller was also enabled by writing to
the appropriate register.
At power on, the microcontroller
configures the necessary facilities and waits
indefinitely for the USART to receive data.
The received data is checked to ensure that it
originated from the outdoor module. This was
necessary because the receiver is subject to RF
noise present in the atmosphere. The outdoor Fig. 4. Flowchart of the master unit program of
module sandwiches every data byte in between the indoor module.
two other bytes; an ‘S’ and a checksum which
equals the sum of ‘S’ and the data (ASCII code
binary sum). After receiving three data bytes,
the microcontroller checks the validity of the
data using the above scheme. Invalid data bytes
are discarded while valid ones are stored for
further processing. The microcontroller
transmits the data bytes to a slave indoor
module through SPI. The above cycle is
repeated indefinitely as long as there is power
supply to the microcontroller. The flowchart of
the program is shown in Fig. 4.
A second microcontroller, called the
slave unit, receives the data from the master
unit and transmits it through SPI to the serial
port of the PC. The program flow of the slave
unit is similar to that of the master unit except
that the data direction for the USART and SPI Fig. 5. Flowchart of slave unit of the indoor
were reversed. At power on, the MCU module.

Technical Report 129


AU J.T. 16(2): 125-132 (Oct. 2012)

2.1.7 Voltage Level Converter: The PC its caption changes to “Disconnect” when a
and the microcontroller communicate at connection has been made. The “Refresh”
different voltage levels. The PC uses RS 232 button serves for the real-time update of the
while the MCU uses TTL. The RS 232 protocol data viewed in the table while the “Exit” button
uses voltage levels more positive than +3V to disconnects the indoor module from the PC,
represent logical zero and voltage levels more closes the communication path with the
negative than -3V to represent logical one. The database, and closes the GUI. The screen
MCU, on the other side, uses 0 V to represent capture of the GUI is shown in Fig. 7.
logical zero and 5 V to represent logical one. The database was realized using
Therefore, there is a need for the conversion Microsoft® Excel®. An Excel® worksheet was
from RS 232 to TTL and vice versa. MAX 232 created and named “Weather_Station_
was used for this purpose. It is a level-shifting Database”. The worksheet houses different
IC manufactured by Maxim Integrated, San recording (sheet) for each sampled data. The
Jose, CA, USA. It uses internal active GUI interacts with this database by writing to it
capacitors to do the level conversion (Horowitz and reading from it.
and Hill 1989). The circuit connection of the
voltage level converter is shown in Fig. 6.
4. Test
The following materials were used in
carrying out the test on this digital weather
station:
- a personal computer with terminal testing
software (Tera Term);
- a graphical user interface (GUI)
developed using MATLAB®;
- Microsoft® Excel®; and
Fig. 6. Voltage level converter circuit. - USB-to-serial converter.

The indoor module was powered and


3. Development of Graphical User
attached to the computer through the USB to a
Interface (GUI) and Database serial converter after which the PC resident
terminal software was launched. The terminal
The graphical user interface (GUI) was software (Tera Term) was launched and
developed using MATLAB® platform. The configured to communicate with the indoor
basic functions of the GUI are to: module by selecting the indoor module
- provide a user friendly operation connection port (COM 3) and baud rate of
platform; 4,800 bps. The outdoor module was then
- provide a connection interface with the powered up. The said module was programmed
indoor module hardware; and to send a simple text string “Hello World” to
- establish communication with the PC ensure that a communication link has been
resident database. established between the two modules. The
string was transmitted once every fifteen
The GUI was made of labels, buttons, seconds by the outdoor module. The indoor
menu items and a view table. The labels were module received the text strings and sent them
used for captions. The buttons, on the other to Tera Term through the USB-to-serial
hand, were used to execute specific functions. converter. Successive strings received were
The buttons employed in the GUI were then displayed on the computer screen. Both
“Connect”, “Refresh” and “Exit”. The modules were then powered off to prepare for
“Connect” button was designed to establish a the next testing stage.
serial connection with the outdoor module and

Technical Report 130


AU J.T. 16(2): 125-132 (Oct. 2012)

5. Results and Discussion


The device was used to log weather data
in two different locations, the Mini Campus
and the Main Campus of Federal University of
Technology, Minna, Niger State, Nigeria, on
15 September 2012 and 9 October 2012,
respectively. The obtained test results are
shown in Figs. 8 and 9, respectively.
It can be seen from Figs. 8 and 9 that the
device measures weather data periodically and
logs the data to a database for further
Fig. 7. Screen capture of the GUI development. processing. These results were compared with
results obtained using separate weather
A Microsoft® Excel® worksheet was monitoring instruments and showed a high
created by the name “Weather_Station_ correlation. Standard meters were also used to
Database” holding the different sheets for the check the readings from the weather station and
logged data. The developed GUI was launched the results were in good agreement with those
in the MATLAB® platform, by changing the obtained from the device.
MATLAB® default path to the directory of the
Excel® spreadsheet (database). The GUI
automatically loaded the spread sheet for the 6. Conclusion
day. The connection between the GUI and the
outdoor module was established using the The purpose of this work was to produce
required baud rate and connection port. a simple and cost effective weather station
The modules were powered on, after considering the importance of the availability
which the outdoor module periodically of weather related data. From the results
sampled and transmitted the weather data to the obtained throughout the tests carried out, it can
indoor module. The setup was allowed to run be concluded that the work achieved its aims
for some time with the indoor module logging and objectives.
each received data to the database.

Fig. 8. Logged data display on the GUI at the Mini Campus of Federal University of Technology,
Minna, Niger State, Nigeria.

Technical Report 131


AU J.T. 16(2): 125-132 (Oct. 2012)

Fig. 9. Logged data display on the GUI at the Main Campus of Federal University of Technology,
Minna, Niger State, Nigeria.

<http://www.meas-
7. References spec.com/downloads/HS1101LF.pdf>.
Motorola. 1997. MPX4250 Series. Integrated
Atmel Corporation. 2011. ATtiny48/88. 8-bit Silicon Pressure Sensor Manifold Absolute
AVR® Microcontroller with 4/8K Bytes In- Pressure Sensor On-Chip Signal
System Programmable Flash. Rev. 8008H- Conditioned, Temperature Compensated and
AVR-04/11. Atmel Corporation, San Jose, Calibrated. Motorola, Inc., Denver, CO,
CA, USA. Available: USA. Available:
<http://www.atmel.com/dyn/resources/prod <http://pdf1.alldatasheet.com/datasheet-
_documents/doc8008.pdf>. pdf/view/5181/MOTOROLA/MPX4250A.h
Guo, X.; and Song, Y. 2010. Design of tml>.
automatic weather station based on GSM O’Neil, P.; and Derrington, C. 1979. Transistors
module. Proc. Int. Conf. on Computer, - a hot tip for accurate temperature sensing.
Mechatronics, Control and Electronic Electronics 52(21): 137-41.
Engineering (CMCE), Changchun, China, Silicon Labs. 2010. CP2102. Single-Chip USB
24-26 August 2010, Vol. 5, pp. 80-2. to UART Bridge. Rev. 1.4. Silicon
Horowitz, P.; and Hill, W. 1989. The Art of Laboratories Inc., Austin, TX, USA.
Electronics. 2nd ed. Cambridge University Available:
Press, Cambridge, England, UK. <http://www.silabs.com/Support%20Docum
Jackson, R.M. 1993. Weather station. ents/TechnicalDocs/cp2102.pdf>.
Electronics Now 64(10): 31-8. Wang, J.Y.; and Felton, C.M.M. 1983.
Microchip. 2007. MCP2510. Stand-Alone CAN Instruments for Physical Environmental
Controller with SPI™ Interface. Microchip Measurements, with Special Emphasis on
Technology Inc., Chandler, AZ, USA. Atmospheric Instruments. 2nd ed. Kendall
Available: Hunt Publishing Co., Dubuque, IA, USA.
<http://ww1.microchip.com/downloads/en/ Yates, R.F. 1947. The Weather for a Hobby: A
DeviceDoc/21291F.pdf>. Guide to the Construction and Use of
Measurement Specialties. 2012. HS1101LF - Weather Instruments Intended for Amateurs.
Relative Humidity Sensor. Measurement Dodd, Mead & Co., New York, NY, USA.
Specialties™, Inc., Hampton, VA, USA;
MEAS France, Toulouse, France. Available:

Technical Report 132

View publication stats

You might also like