A Project Report on GSM Based Weather Station
INSTITUTE OF SPACE TECHNOLOGY
Design and Implementation of GSM Based Embedded Weather Station
By
Muhammad Shakil Tariq
Sarmad Tahir
A PROJECT SUBMITTED
IN PARTIAL FULFILLMENT OF THE
REQUIREMENTS FOR THE DEGREE OF
BACHELOR OF SCIENCE
IN ELECTRICAL ENGINEERING
Project Supervisors:
Sir Tariq Mehmood
Sir Abdul Haseeb
Project 1st Supervisor’s Signature:
Project 2nd Supervisor’s Signature:
Islamabad, Pakistan
July 2015
Certificate
This is to certify that the research work described in this thesis is the original work of the
authors and has been carried out under our direct supervision. We have personally gone
through all the data/results/materials reported in the manuscript and certify their
correctness/authenticity. We further certify that the material included in this thesis is not
plagiarized and has not been used in part or full manuscript already submitted or in the
process of submission in partial/complete fulfillment of the award of any other degree
from any institution. We also certify that the thesis has been prepared under our
supervision according to prescribed format and we endorse its evaluation for the award of
Bachelor of Science in Electrical Engineering degree through the official procedures of
the Institute.
(Brig. Tariq Mehmood)
--------------------------------
(Dr. Abdul Haseeb)
----------------------------------------
i
Copyright © 2015
This document is jointly copyrighted by the authors and the institute of space technology
(IST). Both author(s) and IST can use, publish or reproduce this document in any form.
Under the copyright law, no part of this document can be reproduced by anyone, except
copyright holders, without the permission of the author(s).
ii
DEDICATION
TO MY PARENTS, TEACHERS AND FRIENDS
Muhammad Shakil Tariq
TO MY PARENTS, TEACHERS AND FRIENDS
Sarmad Tahir
iii
Abstract
Climate variables play an important role in many domains such as industry, military,
entertainment and agricultural. These variables include air temperature, humidity, air
Pressure, wind speed, wind direction, wind density, amount of rain, dew point,
precipitation etc. This project represents the work on the design and implementation of
GSM based weather data acquisition station. The station consists of three sensors;
temperature, pressure and humidity and three assembles; wind direction, wind speed and
rain gauge. On board processing is done through microcontroller and data is saved in SD
card. Station is situated in a remote area and all the data controlling is done through a
GSM module and reading is displayed on a computer screen.
iv
Acknowledgements
First of all “All praise and thanks to almighty Allah alone, the sustainer of all the worlds
without whom we are nothing”.
We are also very thankful to our supervisors, Sir Tariq Mehmood and Sir Abdul Haseeb
and kind teachers, Sir Moazzam Maqsood and Mam Saima Siddiqui for their constant
support, encouragement and supervision during our complete project. It has been great
honor and privilege for us to work with them.
I (M. Shakil Tariq) would also like to pay my gratitude to Sir Umair and Sir Sajjad who
did a lot of help during my work on hardware in workshop. I learned a lot from them.
Last but not least our sincere thanks to our Parents who made us what we really are
today. Without their support, it was impossible to complete the task. We would also like
to thank all those friends and family members who stood with us and helped us in every
difficult moment.
v
Table of Contents
Certificate ............................................................................................................................. i
Copyright © 2015 ............................................................................................................... ii
DEDICATION ................................................................................................................... iii
Abstract .............................................................................................................................. iv
Acknowledgements ............................................................................................................. v
Table of Contents ............................................................................................................... vi
List of Figures ..................................................................................................................... x
List of Tables .................................................................................................................... xii
1.
Chapter 1: INTRODUCTION................................................................................. - 1 1.1
Problem Statement ........................................................................................... - 1 -
1.2
Objectives ......................................................................................................... - 1 -
1.3
Application ....................................................................................................... - 2 -
1.3.1
Weather Monitoring .................................................................................. - 2 -
1.3.2
Agriculture ................................................................................................ - 2 -
1.3.3
Industry ..................................................................................................... - 2 -
1.3.4
Poultry Farms ............................................................................................ - 2 -
1.3.5
Oceanography ........................................................................................... - 2 -
1.3.6
Transportation ........................................................................................... - 2 -
1.4
Deliverables ...................................................................................................... - 3 vi
1.5
Resources Used ................................................................................................ - 3 -
1.5.1
Hardware ................................................................................................... - 3 -
1.5.2
Workshop Machines ................................................................................. - 4 -
1.5.3
Software .................................................................................................... - 4 -
2.
Chapter 2: Literature Review .................................................................................. - 5 -
3.
Chapter 3: System Block Diagram ......................................................................... - 6 -
4.
Chapter 4: Hardware ............................................................................................... - 8 4.1
PIC 18F4620 Microcontroller .......................................................................... - 9 -
4.1.1
PIC 18F4620 Pin Configuration ............................................................. - 10 -
4.1.2
Specification ........................................................................................... - 11 -
4.1.3
PIC 18F4620 Oscillator Configuration ................................................... - 12 -
4.2
Wind Direction Sensor ................................................................................... - 13 -
4.2.1
Grey Encoder .......................................................................................... - 13 -
4.2.2
Code Assignment .................................................................................... - 14 -
4.2.3
Mechanism Illustration ........................................................................... - 16 -
4.2.4
Circuit Simulation ................................................................................... - 16 -
4.2.5
Hardware Development .......................................................................... - 18 -
4.2.6
Software Development............................................................................ - 19 -
4.2.6.1
Programing of Wind Directions .......................................................... - 20 -
4.2.6.2
Simulation of Wind Directions ........................................................... - 21 vii
4.3
Wind Speed Sensor ........................................................................................ - 22 -
4.3.1
Principle .................................................................................................. - 23 -
4.3.2
Mechanism .............................................................................................. - 23 -
4.3.3
Disc ......................................................................................................... - 24 -
4.3.4
Circuit simulation.................................................................................... - 25 -
4.3.5
Hardware Development .......................................................................... - 27 -
4.3.5.1
Electrical Hardware ............................................................................. - 27 -
4.3.5.2
Mechanical Hardware ......................................................................... - 28 -
4.3.5.3
Finalized Hardware ............................................................................. - 28 -
4.3.6
Mathematical Formulation ...................................................................... - 29 -
4.3.7
Software Development............................................................................ - 30 -
4.3.7.1
Timer-1 Module of PIC 18F4620 ....................................................... - 31 -
4.3.7.2
Programing of Wind Speed ................................................................. - 31 -
4.3.7.3
Simulation of Wind Speed Mechanism ............................................... - 33 -
4.4
Rain Gauge ..................................................................................................... - 34 -
4.4.1
Principle-Tilt Bucket Mechanism ........................................................... - 34 -
4.4.1.1
Function of Cones ............................................................................... - 34 -
4.4.1.2
Function of Buckets ............................................................................ - 35 -
4.4.1.3
Reed Switch......................................................................................... - 36 -
4.4.2
Measurements ......................................................................................... - 37 viii
4.4.3
Finalized Hardware ................................................................................. - 38 -
4.4.4
Software development of Rain Gauge .................................................... - 38 -
4.4.4.1
Coding of Rain Fall ............................................................................. - 39 -
4.4.4.2
Simulation of Rain Fall Mechanism ................................................... - 41 -
4.5
5.
6.
Finalized PCB for All Three Sensors and LCD ............................................. - 41 -
Chapter 5: Structure .............................................................................................. - 43 5.1
Main Tripod.................................................................................................... - 43 -
5.2
Hive for Electronic Circuitry.......................................................................... - 44 -
5.3
Base for Anemometer..................................................................................... - 45 -
5.4
Base for Rain Gauge ...................................................................................... - 45 -
5.5
Finalized structure .......................................................................................... - 46 -
References ............................................................................................................. - 47 -
ix
List of Figures
Figure 1 : System Block Diagram of Ground Station ..................................................... - 7 Figure 2: Hardware Division .......................................................................................... - 9 Figure 3: Pin Configuration of PIC 18F4620 ............................................................... - 10 Figure 4: Crystal Oscillator Circuit............................................................................... - 12 Figure 5: Implementation of Crystal Oscillator ............................................................ - 12 Figure 6: Wind Direction Assembly ............................................................................. - 13 Figure 7: Disc of Grey Encoder .................................................................................... - 14 Figure 8: Angle Illustration ........................................................................................... - 16 Figure 9: Mechanical Illustration .................................................................................. - 16 Figure 10: Multisim Circuit for one IR Pair (Not Transmitting) .................................. - 17 Figure 11: Multisim Circuit for one IR Pair (Transmitting) ......................................... - 17 Figure 12: Simulations of 4 IR Pairs............................................................................. - 18 Figure 13: Hardware Illustration ................................................................................... - 19 Figure 14: Finalized Wind Direction Sensor ................................................................ - 19 Figure 15: LM339 Pin Configuration ........................................................................... - 20 Figure 16: Proteus Simulation for Wind Direction ....................................................... - 22 Figure 17: Anemometer Cups Arrangement ................................................................. - 22 Figure 18: Mechanism of Wind Speed Measurement................................................... - 24 Figure 19: Rotating Disc ............................................................................................... - 24 Figure 20: Multisim Simulation for Anemometer (No Contact between IR) ............... - 25 Figure 21: Multisim Simulation for Anemometer Contacted IR) ................................. - 26 Figure 22: Oscilloscope Results of Simulations ........................................................... - 26 -
x
Figure 23: Circuit Implementation of Anemometer on PCB ........................................ - 27 Figure 24: Mechanical Implementation of Anemometer .............................................. - 28 Figure 25: Finalized Anemometer ................................................................................ - 29 Figure 26: Configuration Register of Timer-1 .............................................................. - 31 Figure 27: Proteus Simulation for Wind Speed Mechanicm ........................................ - 33 Figure 28: Cones of Rain Gauge ................................................................................... - 35 Figure 29: Tilted Buckets.............................................................................................. - 35 Figure 30: Schematic of Tilt Bucket Mechanism ......................................................... - 36 Figure 31: Reed Switch Implementation ...................................................................... - 37 Figure 32: Finalized Rain Gauge .................................................................................. - 38 Figure 33: Proteus Simulation for All three Sensors .................................................... - 41 Figure 34: Finalized PCB of Weather Station .............................................................. - 42 Figure 35: Tripod .......................................................................................................... - 44 Figure 36: Wooden Hive ............................................................................................... - 44 Figure 37: Base of Anemometer ................................................................................... - 45 Figure 38: Finalized Structure ...................................................................................... - 46 -
xi
List of Tables
Table 1
Specification of PIC 18F4620 ....................................................................................... - 11 Table 2
Code Assignment of Grey Encoder .............................................................................. - 15 -
xii
1.
Chapter 1: INTRODUCTION
________________________________________________________________________
Problem Statement
Objectives
Applications
Deliverables
Resources Used
________________________________________________________________________
1.1
Problem Statement
Weather stations are already available in market but problem is that they are
static, huge and expensive so we designed a portable weather station which is cheap as
well as reliable and can give flexible usage depending upon situation and application.
1.2
Objectives
Our main objective was to replace old, static, gigantic, and less efficient weather
station with a new, reliable, fast and smart weather station which takes less power and
gives more accuracy in the readings. Our aim also includes the replacement of expensive
monitoring stations in different industries and agricultures. This system can easily collect,
process, store and transmit the data to ground station.
-1-
1.3
Application
This weather station has following applications.
1.3.1
Weather Monitoring
Its main application is weather forecasting and weather monitoring
Record the temperature and pressure fluctuation.
Record the climatic changes
1.3.2
Agriculture
1.3.3
Temperature and humidity conditions monitoring for crops and plants
Industry
Monitoring of different processes which are sensitive to environment
conditions like temperature and pressure.
1.3.4
Poultry Farms
Poultry farms include the monitoring of environment conditions for proper
growth of chick and animals.
1.3.5
Oceanography
Coastal weather conditions monitoring and marine weather monitoring
require a weather station. For example in Tsunami warning and flood
warning situation we require a weather station.
1.3.6
Transportation
Weather data log for flights
Monitoring the aviation weather
Monitoring the road weather
-2-
1.4
Deliverables
Our project deliverables are listed below.
Development of anemometer which includes the measurement of wind speed
and wind direction
Study and configuration of Rain gauge which uses a tilt bucket mechanism
Development of remote module consisting of temperature, pressure,
humidity, wind speed, wind direction and rain sensor interfaced with PIC
microcontroller and displaying data on 4x16 LCD.
Making log of measurements.
Transfer of data using GSM module.
Reception of data, using GSM module and display on LCD or using mobile
phone and display on mobile screen.
1.5
Resources Used
Resources which are used during our work are listed below.
1.5.1
Hardware
Microcontroller PIC 18F4620
4x16 LCD
IR Transmitter-Receivers
Aluminum Sheets, Plates and rods
Temperature Sensor DS1821
Humidity Sensor HS1101
Pressure Sensor BMP085
-3-
1.5.2
GSM modem SIM908
Workshop Machines
Lath Machine
Milling Machine
Grinding Machine
Drilling Machine
Tappers
Bench Grinders
1.5.3
Software
Proteus ISIS
Proteus Ares
Multisim 11.0
MikroC Compiler
-4-
2.
Chapter 2: Literature Review
We have studied concerning research papers and a thesis of previous research on
this topic. The research papers we have studied give us knowledge about previously made
weather stations. Most of the automatic weather stations were based on the central control
unit more specifically the microcontroller. The system makes more accurate readings and
takes fewer resources to build the station. Traditional weather stations used to be very big
and static. They used to be on a particular place not moveable and they used to need a big
building to perform their full functions. They were slow because they used low speed
processors. Their readings were not very accurate because a huge number of that station
were to be implanted in a particular space to get the more climatic data which can give
accurate results. As building such huge stations in a big number is not so economical so it
was quiet impossible to build the network of such stations. So a low cost, portable, high
speed, accurate and module based weather station was the need of time. In current time
this need is felt by many researchers so they do a lot of work on it. We read their work
and got some knowledge. By using that knowledge we tried to make our hardware which
is summarize in next few pages.
Some good papers are also attached as appendix-A from which we have taken the main
idea of our work. These papers were quiet effective for us to define the methodology of
our work.
-5-
3.
Chapter 3: System Block Diagram
This project consists of collecting, storing and transmitting of data from different
sensors which are placed on a remote location. Basically we had to measure the six
climatic parameters so we needed six different sensors. These variables include air
temperature, air pressure, air humidity, wind speed, wind direction, and rain fall. Three of
the above mentioned variable can be measured from market available sensors, while
other three had to be measured from handmade instruments.
So we bought the temperature sensor (DS1821), Pressure sensor (BMP085), humidity
sensor (HS1101) from the market and made the wind direction sensor, wind speed sensor,
rain fall sensor in the lab. After that we interfaced them with microcontroller and
interfaced them with the microcontroller and showed the value on 4x16 LCD.
After collection of data we had to save the data in some sort of memory stick to make the
log of that data to be used in the future. And at the end we had to send all the data in the
form of an SMS through a GSM module.
At the base station we had two options for collecting data either we dah to receive the
massage data through a GSM module and show it on an LCD or simply receive the SMS
on a mobile.
All of this talk is shown through a block diagram which is shown on next page.
-6-
Figure 1 : System Block Diagram of Ground Station
-7-
4.
Chapter 4: Hardware
________________________________________________________________________
PIC 18F4620 Microcontroller
Wind Direction Sensor
Wind Speed Sensor
Rain Gauge
Temperature sensor
Pressure sensor
Humidity Sensor
Interfacing PIC 18F4620 with 4x16 LCD
________________________________________________________________________
We divided the hardware into different parts and modules so we can do it easily and
properly. As some sensors are to be procured and some of them are to be made and
configured so we divided our total hardware into three sections; one is anemometer 2 nd is
sensors module and 3rd is rain gauge. This is also shown in figure 2 on next page.
Anemometer is further divided into two sensors: one is wind direction sensor and other is
wind speed sensor. These two sensors give their output in the form of pulses to be read by
PIC microcontroller. Rain gauge also gives multiple pulses which are first filtered out and
then given to microcontroller to be counted. Temperature sensor, pressure sensor and
humidity sensor are also interfaced with PIC according to their configuration. At the end
all the readings are shown on LCD.
-8-
Figure 2: Hardware Division
4.1
PIC 18F4620 Microcontroller
Microcontroller is like the brain of whole project. All the processing is to be done
by the microcontroller. We have chosen the PIC18F4620 microcontroller as main
processor of our system. This is 8-bit microcontroller which possesses 40 pins. It has
maximum clock frequency of 40 MHz while we have used only 20 MHz, Program
memory of this microcontroller is 64k bytes and it operates on the voltage range of 4.25v. It has 4 ports A, B, C and D which possess different number of pins.
-9-
4.1.1
PIC 18F4620 Pin Configuration
The diagram given below shows the pin configuration of PIC 18F4620.
Figure 3: Pin Configuration of PIC 18F4620
We have chosen this microcontroller because of following reasons.
It has same price as of 16F but have more computational capability so it is
quiet economical
It has more flash program memory then PIC 16F
We have different sensors which are to be interfaced with different protocols
like I2C, RS232 and i-wire etc. PIC 18F has all these features.
It has more analogue and digital pins.
It has one I2C port, one SPI, one UART and one USART port
- 10 -
4.1.2
Specification
Some of the specifications are given below.
Table 1
Specification of PIC 18F46201
1
Core Processor
PIC
Data width
8-Bit
Speed
40MHz
Connectivity
I²C, SPI, UART/USART
Number of I/O
36
Program Memory Size
64KB
Program Memory Type
FLASH
EEPROM Size
1 Kb
RAM Size
4 Kb
Voltage - Supply (Vcc/Vdd)
4.2 V ~ 5.5 V
Data Converters
10 bit 13 channels A/D
Oscillator Type
Internal
Operating Temperature
-40°C ~ 85°C
Package / Case
40-DIP (0.600", 15.24mm)
Supplier Device Package
40-PDIP
Online Catalog
PIC® 18F
Peripherals
HLVD, POR, PWM, WDT
Microchip, PIC18FXX2 Data Sheet (Microchip Technology Inc.: 2006)
- 11 -
4.1.3
PIC 18F4620 Oscillator Configuration
We have chosen the crystal oscillator mode of PIC 18F4620 to program the
configuration register. As PIC 18F4620 has ten different oscillator modes. We have
selected the 20 MHz crystal along with two 33pF capacitors. Circuit diagram of this
oscillator is given below.
Figure 4: Crystal Oscillator Circuit
And implementation of this circuit with the pins of PIC is shown below.
Figure 5: Implementation of Crystal Oscillator
Exactly the same circuit shown above is implemented on hardware level.
- 12 -
4.2
Wind Direction Sensor
The apparatus used for the measurement of wind direction is called as Weather
Vane. This device is made with a simple disk and an arrow as shown in Figure 6 below.
The arrow will be aligned in the direction of wind. When air strikes at arrow at some
angle it will exert some force which will rotate it. As disc is attached with the blade with
the help of shaft so disc will also rotate with the same speed.
Figure 6: Wind Direction Assembly
4.2.1
Grey Encoder
Wind direction assembly is based on grey encoder technique. A 4 bit gray encoder
is implemented which will give 16 different codes. This grey encoder is implemented
with the help of Infrared transmitter receiver pair. 4 IR pairs are used which operates on
5v DC given with the help of external battery. Its working is quiet simple. When 5v is
given to IR transmitter it emits IR light which can be seen through a mobile camera.
When photons of this light strikes on IR receiver, then the resistance of IR receiver gets
- 13 -
low and it starts conducting. So now if we place a hindrance in the path of IR light then
light will not reach at receiver and it will not conduct and we will get some voltage which
is 0.1-2.5 v in our case and when we remove that hindrance from the path of light then
receiver will get the IR rays and it will conduct so its resistance will be down which is
0.05 v in our case. So we made disc which is shown in Figure 6 given above. This disc is
made such that it generates a 4-bit grey code. This is shown in figure 7 below.
Figure 7: Disc of Grey Encoder
4.2.2
Code Assignment
We have divided the 360 degree space into 16 parts for our own ease. Actually
number of code generation 2n is dependent upon the level n so we can only have 2, 4, 8,
16, 32, 64… and so on number of codes. So if we use 5 levels, means 5 IR transmitter
receiver pairs then we can generate 32 different codes which can specify 32 different
directions in 360 degree of space. But in that case we left with the li erty of just 11.25
whi h means that if arrow hanges its dire tion to 11.25 then ode will e hanged. With
this little liberty we cannot cater the fluctuations and jerks which will be produced by the
wind and in that case arrow will keep oscillating between two directions. So
implementing 5 bit grey encoder is not feasible.
- 14 -
So we decided to go with 4 it grey en oder whi h generates 16 different 4 it odes.
With this 4 it en oder we have 22.5 of li erty for one ode whi h is quiet relia le. Now
each code is specified to a particular direction as shown in below table.
Table 2
Code Assignment of Grey Encoder
0000
North
0010
North of North-East
0011
North East
1011
East of North-East
1010
East
1000
East of South-East
1001
South East
1101
South of South-East
1100
South
1110
South of South-West
1111
South West
0111
West of South-West
0110
West
0100
West of North-West
0101
North West
0001
North of North-West
- 15 -
4.2.3
Mechanism Illustration
The whole mechanism is illustrated in figure 8 and figure 9 shown below. The
disk is pivoted on a shaft and IR transmitter Receivers are placed above and below
respectively.
Capture plate is placed to narrow the beam width of IR light so that one transmitter’s
light should not affect the other one. Shaft rotates with the help of bearings so does the
dis while IR pairs and apture plate remains stati . That’s how the grey ode is
generated. As shown in figure 8 one ode has 22.5 of angle.
22.5̊
Figure 8: Angle Illustration
Figure 9: Mechanical Illustration
4.2.4
Circuit Simulation
Circuit simulation is done on software named as MULTISIM 11.0. Circuit for one
IR Transmitter Receiver pair is shown in figure 10 below. In circuit we made a switch to
simulate the hindrance in the path of IR light due to presence of disk. There are three
- 16 -
probes in this circuit one after IR transmitter, 2nd after IR receiver and 3rd at the collector
of BJT. BJT here is used as a switch.
Figure 10: Multisim Circuit for one IR Pair (Not Transmitting)
When S1 switch is open then transmitter U2 doesn’t transmit any light so receiver U3
doesn’t ondu t any voltage and base of Q1 has biased voltage of 700 mV. Hence due to
this voltage at the base BJT conducts which gives 0 volts at the output.
Figure 11: Multisim Circuit for one IR Pair (Transmitting)
- 17 -
When S1 switch is close then transmitter U2 transmits light so receiver U3 conduct
current and base of Q1 has low voltage of 13 mV. Hence due to this low voltage at the
base BJT stops conducting. This gives us 5 volts at the output.
Now using this principle we made 4 similar circuits to simulate all 4 pairs on Multisim.
This is shown in Figure 12 below.
ON
OFF
ON
1
0
1
OFF
0
Figure 12: Simulations of 4 IR Pairs
Above figure shows the illustration of code 1010 on Multisim on simulation level. Here 1
means output is 5V while 0 means output is 0V.
4.2.5
Hardware Development
PCBs were made for circuit implementation on proteus and then fabricated with
the help of PCB machine. Shaft and cylinders were some mechanical parts which are
made on lathe machine in workshop. After all the making, components are soldered on
PCBs. When all the PCBs were ready then they were joined along with the disc. After
joining them they are tested.
Figure of developed wind direction assembly is shown on next page.
- 18 -
IR Receivers
Disc
Shaft
IR Transmitters
Figure 13: Hardware Illustration
At the end this whole assembly is fitted inside a container as shown in figure 14 to
protect the inner circuits from rain and extensive climatic conditions.
Arrow
Output Main
Wire
Figure 14: Finalized Wind Direction Sensor
4.2.6
Software Development
Now the signal coming from the grey encoder was to be fed to microcontroller to
be programmed. As signal coming from the grey encoder was of almost 3 volts of
amplitude which was not sufficient for microcontroller to read so we done some signal
conditioning. We added an intermediate stage of Quad Differential Comparator LM339.
This is a quad comparator which compares two signal and output 5v or 0 volts depending
upon inputs. Its pin diagram is given on next page.
- 19 -
Figure 15: LM339 Pin Configuration
This IC gave the perfect voltage levels to feed the microcontroller. 4 outputs from
LM339 are given on RC1, RC2, RC3 and RC4 pin of microcontroller's Port C.
4.2.6.1
Programing of Wind Directions
After the signal conditioning programing is done. We did all the
programing in "C" language and to compile it we used the software "mikroC Pro for
PIC". First we created 16 macros for 16 wind directions as shown below.
#define east
0b10100
#define nee
0b10110
#define ne
0b00110
#define nne
0b00100
And so on… This was to make the program more generic.
- 20 -
Now we read only 4 bits of port c (b1, b2, b3 & b4) via bit masking, then stored in char
variable "dirc" for further comparison by using this command.
dirc = portc&0x1E;
After getting the input at "port C" we compared it with predefined 16 directions. When
input code matched to any one of 16 macros, which would be our desired wind direction
as shown in the code lines below.
if(dirc==east)
{
Lcd_Out_CP("
East
");
}
else if(dirc==ne)
{
Lcd_Out_CP(" North-East ");
}
So, first of all code was voltage levels are generated through electronics and then it is fed
to microcontroller which then compared those levels to predefined levels to get the
specific direction and then that direction is shown on LCD.
4.2.6.2
Simulation of Wind Directions
Simulation is done on "Proteus 8.0" software. In Simulation connection of
Microcontroller and LCD are made as per hardware. And to simulate the 4bit grey
encoder we used a 4 button switch panel as shown in the figure 16 on next page.
- 21 -
Generation of code is simulated through positions of switches. Different configuration of
switches gave different codes which simulated different directions.
Figure 16: Proteus Simulation for Wind Direction
4.3
Wind Speed Sensor
The instrument which measures that speed of wind is called as Anemometer. An
anemometer is the assembly of equally spaced cups attached to a shaft as shown in figure
17 below.
Figure 17: Anemometer Cups Arrangement
- 22 -
4.3.1
Principle
Air moves from the area of high pressure to the area of low pressure. The
difference in air pressure is the main reason of the generation of wind. Just looking at the
example of balloon, air pressure is high inside the balloon as compared to outside when
the opening of balloon set loose then air rush from inside to outside creating wind. So
now if we place a rotatable thing in the path of wind then with the pressure of that wind
that thing will rotate. So in case of wind speed measurement we placed three rotatable
cups in the path of wind which rotates with the speed proportional to speed of wind.
Now a ball bearing is placed at the neck of shaft and then this shaft is attached to another
shaft at which a disc is attached. Now when air strikes at the cups, cups rotate and along
them the shaft also rotates. Now as shaft is attached to the second shaft so second shaft
also rotates. Hence the disc attached to the second shaft rotates with the speed of cups.
4.3.2
Mechanism
We are using a microcontroller for main processing. So we had to make every
sensor according to the specifications of PIC 18F. In the case of wind speed measurement
we had to feed the microcontroller with some number of pulses. So we made a simple
arrangement in which we arranged an IR transmitter Receiver pair and a disc with holes
in such configuration that when a hole in the disc and IR pair gets aligned then receiver
conducts and when they are not aligned then receiver does not conduct. So we took the
output at the receiver end which was in the form of pulses. This whole mechanism is
illustrated in the following figure.
- 23 -
Figure 18: Mechanism of Wind Speed Measurement
The pulses which came out of this assembly were not as perfect as there were quiet a lot
of fluctuations in the level of output. So we decided to use a comparator as we used in
wind direction measurement for shaping the pulses. We took the output at the receiver of
IR and give it to the one inverting pin of LM339 IC and on non-inverting pin we gave 1
volt fixed voltage using voltage divider. This technique gave us well-shaped inverted
pulses which have high voltage of 5V and low voltage of 0V. At the end these pulses
were feed to microcontroller to be read and formula were applied.
4.3.3
Disc
This instrument involves the measurement of wind with the help of electronic
pulse so we made a disc which rotates with the speed of rotating cups. Disc has diameter
of 75 mm and have equally spaced 16 holes in it.
75 mm
Figure 19: Rotating Disc
- 24 -
So when this disc is placed in between the IR transmitter receiver pair then it generated
the 16 pulses per revolution.
4.3.4
Circuit simulation
Circuit is quiet similar to the circuit of wind direction assembly. The only
difference is that we have only one IR transmitter Receiver pair in this case and switching
between two levels is quiet fast. We don’t get the pure square wave in this case as we
don’t have the narrow beam width of IR light so voltage keep changing from 0 to 3 volts
as the disk moves. So to cater this problem we used a capacitor of very low value so
when the switch is open and there is some voltage at the output the capacitor, this voltage
keeps the base of BJT forward biased and output remains zero. This is shown in Figure
19 below.
Figure 20: Multisim Simulation for Anemometer (No Contact between IR)
Referring to figure 20 when switch S1 is open then IR is not transmitting which makes
the capacitor C1 charged at 610 mv. So the capacitor makes the base of Q1 BJT forward
biased so output 1 shows the 138mV which specify the voltage low.
- 25 -
Figure 21: Multisim Simulation for Anemometer Contacted IR)
Referring to figure 21 when switch S1 is closed then IR is transmitting which makes the
capacitor C1 discharged and voltage of capacitor is downed to 13.6 mV. So the capacitor
makes the base of Q1 BJT not biased hence output 1 shows the 5 V which specify the
voltage high. This simulation resulted into following graph. This graph shows the
toggling of output in between 0 V and 5 V.
Output Toggles in
Between 0 & 5
Figure 22: Oscilloscope Results of Simulations
- 26 -
4.3.5
Hardware Development
Hardware development included both electrical circuit implementation as well as
mechanical structure. These both are explained in next few paragraphs.
4.3.5.1
Electrical Hardware
IR transmitter receiver circuit is implemented on PCBs. Disc containing
the 16 holes also made from the PCB. After that we soldered the components on the PCB
and then spindle is adjusted in between the PCBs with the help of ball bearings. As holes
in the disc and holes in the PCBs for IR transmitter receiver pair are made in such way
that when they are joined they are perfectly aligned with each other. Two spacers are
made so that the necessary distance between the two PCB remains. This whole is
illustrated in the following diagram.
Spindle
Spacers
IR Pair
Disc
Figure 23: Circuit Implementation of Anemometer on PCB
- 27 -
4.3.5.2
Mechanical Hardware
Its mechanical parts include the rotating cups, shaft and bearing. We have
already provided with the cups so we made the shaft and adjusted the bearing in it. After
this we fixed the shaft with the spindle so when cups rotate then the disc should also
rotate. This is illustrated in following figure 24. There are total three wires which are
coming out of the Anemometer. One is brown wire which is live 5 V wire, second is
black wire which is ground wire and third is blue wire which is our output of
anemometer. This blue wire is then connected to the base of BJT for further circuit
implementation.
Figure 24: Mechanical Implementation of Anemometer
4.3.5.3
Finalized Hardware
This whole hardware is then fixed inside a container to protect the circuit
from the intense weather condition and rain water as this whole weather station is to be
placed somewhere outside. Finalized hardware is shown in following figure.
- 28 -
Output
Rotating Cups
Shaft
Figure 25: Finalized Anemometer
4.3.6
Mathematical Formulation
When wind strikes at the cups it exerts the force with a tangential velocity of V.
This tangential velo ity rotates the up with the angular velo ity of “ω”. Now tangential
velocity and angular velocity is related as follow.
V=r ω
(1)
Where “r” is the distan e of up from the enter, whi h is 0.2 meter in this ase.
Now let's suppose "x" is the number of pulses generated by the hardware in "t" time.
Now angular velocity is related with the time as follow.
ω=
Or,
ω=
Now using unitary method we can find the angle covered by the disc while generating
"x" number of pulses.
- 29 -
Angle overed for 16 pulses= 2π
Angle covered for 1 pulse=
Angle covered for 1 pulse=
So,
Angle covered for "x" pulses= .x
Hence,
ω=
.x
(2)
Where x is the pulses received by the microcontroller in time t. Now using the formula in
1, we have velocity of wind
V= (0.2) ×
V= 0.078 ×
.x
m.sec-1
Or
V= 0.282 ×
Km.h-1
(3)
So here wind velocity depends upon the number of pulses generated by the hardware and
time taken by those pulses to be generated.
4.3.7
Software Development
Software of wind speed calculation involved the timer module. This timer module
was used to measure the timing of incoming pulses. Its detail is given below in next
section.
- 30 -
4.3.7.1
Timer-1 Module of PIC 18F4620
We used timer-1 module to count the incoming pulses of wind speed
mechanism in 16 bit counting mode. In PIC18F4620, Port-C, Pin RC0/T1OSO is the pin
for timer 1. T1CON is the configuration register of timer-1. This is 8 bit register to
configure the timer; this is shown in figure below.
Figure 26: Configuration Register of Timer-1
Bit-0 is for switching the timer on or off, Bit-1 is used to decide the clock source of timer
either internal clock or external pulses as clock, Bit-2 for synchronization of external
clock input while Bit-7 is used to decide whether clock register is used as 8 bit counter or
16 bit counter.
In our application we have to use it as a 16 bit counter so we made bit 7, 1 and 2 high and
all other low. For that we gave the T1CON value equal to "134" whose binary equivalent
is-
Programing of Wind Speed
As shown in equation 3, wind velocity is related with number of pulses, and
Time taken by those pulses,
V= 0.282 ×
- 31 -
Km.h-1
Now these pulses are fed to microcontroller's timer-1 module. As timer-1 is
configured to calculate the incoming pulses, so "x" will come from the counter of timer-1
while we adjusted the timer-1 in a way that it resets after every 1 second. So first we on
the timer to start the counting and then after 1 second delay we make it off and then after
reading its value we reset it to count again. This is shown in code below.
t1con.TMR1ON=1;
delay_ms(1000);
t1con.TMR1ON=0;
t0l=0;
t0h=0;
t0l=tmr1l;
t0h=tmr1h99)
{
rh+=1;
rl=rl-100;
}
return;
}
- 40 -
4.4.4.2
Simulation of Rain Fall Mechanism
Simulation of rain fall was done using a push button whish was connected
to 5v DC. So when that button was pushed 1 time it gave 1 pulse and for second time it
gave 2 pulses and so on just like tilting bucket for one time gave one pulse and for 2 nd
time gave 2 pulses. These pulses are then fed to RB0 pin of PIC and hex file was loaded
into controller and it gave the perfect output. After that it was implemented on hardware
and it worked perfectly on hardware. All three sensors in working simulation are shown
in next figure.
Wind Speed Simulation
Display
Wind Direction
Simulation
Rain Fall Simulation
Figure 33: Proteus Simulation for All three Sensors
4.5
Finalized PCB for All Three Sensors and LCD
At the end all three sensors were implemented on hardware using a PCB.
Comparator ICs, BJTs, PIC and LCD along with other sockets and jumpers were
implemented on that PCB to make the system compact. Outputs coming from the grey
encoder, wind speed mechanism and rain gauge were inserted in the PCB on specific
locations and then connections were made.
- 41 -
PCB layout of proteus is shown below. After making the "JRBR" files this PCB
was made on hardware and then circuit and coding was tested.
Figure 34: Finalized PCB of Weather Station
- 42 -
5.
Chapter 5: Structure
________________________________________________________________________
Main Tripod
Hive for Electronic Circuitry
Base for Anemometer
Base for Rain Gauge
________________________________________________________________________
The whole weather station is a portable system which includes all the six sensors and,
GSM module and power system. Main points which are taken under the considerations
are
Durability
Portability
Sustainability
As weather station has to be put in severe climatic conditions so it has to be durable and
sustainable. So the whole structure is made with a tough material.
All of the above mentioned points are explained below.
5.1
Main Tripod
The whole equipment is mounted on a tripod. This tripod is made up of iron and
dually wielded. This tripod is so durable that it is quiet sufficient for holding all the
weight of components. This tripod is shown in figure on next page.
- 43 -
Figure 35: Tripod
5.2
Hive for Electronic Circuitry
All the electronic components are place in a wooden hive. This hive is made in
such a way that wind does not go inside the hive directly. This hive has specially made
louvers as shown in figure below.
Figure 36: Wooden Hive
- 44 -
Temperature sensor, pressure sensor and humidity sensor has to be placed inside the hive
so that they are protected from direct air and rain water.
5.3
Base for Anemometer
As anemometer is made inside a 5” diameter round ontainer so we made
triangular base whi h has a 5” hole at its enter and pla ed the anemometer in it. This is
shown in figure below.
Figure 37: Base of Anemometer
Fixing the anemometer inside the whole was quiet difficult job so we made small pieces
of chip board and inserted in the whole along the container. After that cups were placed
at the bottom and arrow was placed at the top.
5.4
Base for Rain Gauge
We made a circular disk as the base of rain gauge. That disk is supported by three
rods which is shown in figure 32. After this we placed the rain gauge on it and fixed the
cables and pipes with cables ties.
- 45 -
5.5
Finalized structure
Figure below shows the complete and final structure of weather station.
Rain Gauge
Wind Direction
Wind Speed
Tripod
Wooden Hive
Figure 38: Finalized Structure
- 46 -
6.
References
[1]
X. Guo and Y. Song, “Design of automati weather station ased on GSM
module,” in 2010 International Conference on Computer, Mechatronics, Control
and Electronic Engineering, 2010, vol. 5, pp. 80–82.
N. Burri, P. Von Ri ken a h, and R. Wattenhofer, “Dozer: ultra-low power data
gathering in sensor networks,” in Information Processing in Sensor Networks,
2007. IPSN 2007. 6th International Symposium on, 2007, pp. 450–459.
R. Lajara, J. Al erola, J. Pelegrí, T. Sogor , and J. Vi ente Llario, “Ultra low
power wireless weather station,” in Sensor Technologies and Applications, 2007.
SensorComm 2007. International Conference on, 2007, pp. 469–474.
D. Gaurav, D. Mittal, B. Vaidya, and J. Mathew, “A GSM ased low ost weather
monitoring system for solar and wind energy generation,” in Applications of
Digital Information and Web Technologies (ICADIWT), 2014 Fifth International
Conference on the, 2014, pp. 1–7.
H.-W. Huang, PIC microcontroller: an introduction to software and hardware
interfacing. Cengage Learning, 2005.
D. Ibrahim, Advanced PIC microcontroller projects in C: from USB to RTOS with
the PIC 18F series. Newnes, 2011.
D. Ibrahim, SD card projects using the PIC microcontroller. Newnes, 2010.
“Pin Configuration of PIC.” .
D. Ibrahim, Advanced PIC microcontroller projects in C: from USB to RTOS with
the PIC 18F series. Newnes, 2011.
M. A. Mazidi, J. Mazidi, R. McKinlay, and P. Ingendorf, Pic microcontroller and
embedded systems. Prentice-Hall, Inc., 2005.
M. PIC, 18FXX2 Datasheet. Microchip Technology, Inc, 2002.
J. B. Peatman, Design with PIC microcontrollers. Simon & Schuster Trade, 1997.
Z. R. Piepmeier, A. J. Gasiewski, M. Klein, V. Boehm, and R. C. Lum, “O ean
surface wind direction measurement by scanning polarimetric microwave
radiometry,” in Geoscience and Remote Sensing Symposium Proceedings, 1998.
IGARSS’98. 1998 IEEE International, 1998, vol. 5, pp-.
Y. J. Jung, S. Lee, and N. Park, “All-optical 4-bit gray code to binary coded
de imal onverter,” in Integrated Optoelectronic Devices 2008, 2008, p. 68900S–
68900S.
M. C. Heard, Wind speed measurement. Google Patents, 1982.
D. C. Soares, D. L. Gerloff, N. R. Syme, A. F. Coulson, J. Parkinson, and P. N.
Barlow, “Large-scale modelling as a route to multiple surface comparisons of the
CCP module family,” Protein Eng. Des. Sel., vol. 18, no. 8, pp. 379–388, 2005.
M. Verle, PIC microcontrollers. Mikroelektronika, 2008.
I. Strangeways, “A history of rain gauges,” Weather, vol. 65, no. 5, pp. 133–138,
2010.
P. P. Weyer, Tiltable bucket assembly. Google Patents, 1990.
N. D. Miller and C. V. LaFleur, Multiple reed switch module. Google Patents,
1985.
N. A. Rodgers, Reed switch actuated circuit. Google Patents, 1995.
[2]
[3]
[4]
[5]
[6]
[7]
[8]
[9]
[10]
[11]
[12]
[13]
[14]
[15]
[16]
[17]
[18]
[19]
[20]
[21]
- 47 -