weather station

42
WEATHER STATION USING ZIGBEE ZIGBEE WEATHER STATION

Upload: muhammad-sajeer

Post on 27-Oct-2014

90 views

Category:

Documents


1 download

TRANSCRIPT

Page 1: Weather Station

WEATHER STATION USING ZIGBEE

ZIGBEE WEATHER STATION

Page 2: Weather Station

WEATHER STATION USING ZIGBEE

CHAPTER 1

INTRODUCTION

Weather has been measured since the 14th century. Weather information

is very important for mankind since the knowledge of it helps us in many cases

to survive. In response to the effect that weather has upon humankind, various

forms of technology have been developed to facilitate the analysis of weather

patterns.

Weather can be monitored from remote place is very difficult to monitor

the parameter through wires and analog devices such as transducers. To over-

come this problem we use wireless device to monitor the parameters so that we

can take certain steps even in worst case. Few years back the use of wireless de-

vice was very less, but due the rapid development is technology now-a-days we

use maximum of our data transfer through wireless like Wi-Fi, Bluetooth, Zig-

bee, etc.

The fundamental aim of this project is to develop an embedded system to

design wireless weather monitoring system which enables to monitor the

weather parameter in remote place or anywhere by using Zigbee technology and

display the parameter on the PC’s screen. The system contains two parts. One is

transmitter node and another one is receiver part and both can be any number.

The transmitter part consists of whether sensors, microcontroller and ZigBee

and the receiver part consist of a PC interfaced with Zigbee through PC serial

port. In this project we deal with monitoring the weather related parameters

through wireless Zigbee modules. Here we monitor temperature, light and

humidity with the help of respective sensors. The data from the sensors are

collected by the micro controller and transmitted to the receiver section through

wireless medium. All the parameters are viewed by the pc using program in the

receiver side.

Page 3: Weather Station

WEATHER STATION USING ZIGBEE

In view of all this things, the design of wireless parameter progress helps

in an remote place to monitor the parameter in real time with the use of zigbee,

is an easy installation platform, cost effective method for the low bit rate trans-

mission, so with the help of the ready zigbee platform by using the embedded c

language we interface the module with the pc by the help of visual C-Sharp we

monitor the parameters in the system.

The main use of this module helps in an industry during the worst cases

as the analog device may be damaged may be during the fire accidents, etc. But

with the wireless transmission we have not have an accurate data but when

compared to the analog failure the errors are very minimum so we use wireless

to monitor the parameter in an industry where their no means of human inter-

face to monitor the parameters.

In this project we deal to monitor the parameter through wireless by using

zigbee. The working of this module is simple in principle, the changes in certain

place is monitor in real time process which is very accurate in monitoring and

their no other interface and other disturbance in monitoring the parameter in this

project we monitor temperature and humidity with the help of respective sen-

sors. The change in the temperature, humidity can be monitored like real time as

the change is displayed in respective interval in the visual C-Sharp screen.

CHAPTER 2

BLOCK DIAGRAM

TRANSMITTER SIDE

Page 4: Weather Station

WEATHER STATION USING ZIGBEE

RECEIVER SIDE

Figure 2.1: block diagram

CHAPTER 3

BLOCK DIAGRAM EXPLANATION

Page 5: Weather Station

WEATHER STATION USING ZIGBEE

The system consists of mainly four modules, Zigbee, PIC and LCD. PIC is

programmed according to the working of the system. . The system helps to send

messages, using GSM and to locate the current position of vehicle we use GPS.

The controlling and tracking messages are sent through a cell phone. LCD is

used to display each task performing.

3.1PIC

The microcontroller we make use of is PIC 16F877 controller. PIC 16F877

microcontroller is a 40 pin DIP IC which features high performance RISC CPU

and consist of 35 assembly instructions. The input is obtained from a matrix

keypad which is interfaced with the PIC. To the controller keypad interface is

done using general purpose input output (GPIO) port pins. General Purpose

Input/Output (a.k.a. GPIO) is a generic pin on a chip whose behavior (including

whether it is an input or output pin) can be controlled (programmed) through

software. GPIO pins have no special purpose defined and go unused by default

3.1.1PINOUT

Figure 3.1:pinout

3.1.2USART

The data is sent serially from microcontroller through USART. USART stands

for Universal Synchronous Asynchronous Receiver Transmitter. It is sometimes

called the Serial Communications Interface or SCI. Since there is no clock

Page 6: Weather Station

WEATHER STATION USING ZIGBEE

signal in asynchronous operation, one pin can be used for transmission and

another pin can be used for reception.

The USART is most commonly used in the asynchronous mode. This project

deals exclusively with asynchronous operation. The USART can be configured

to transmit eight or nine data bits by the TX9 bit in the TXSTA register.

The use of a separate transmit shift register allows new data to be written

to the TXREG register while the previous data is still being transmitted. This

allows the maximum throughput to be achieved.

3.2LCD (LIQUID CRYSTAL DISPLAY)

Liquid crystal displays (LCDs) have materials, which combine the

properties of both liquids and crystals. Rather than having a melting point, they

have a temperature range within which the molecules are almost as mobile as

they would be in a liquid, but are grouped together in an ordered form similar to

a crystal.

An LCD consists of two glass panels, with the liquid crystal material sand

witched in between them. The inner surface of the glass plates are coated with

transparent electrodes which define the character, symbols or patterns to be

displayed polymeric layers are present in between the electrodes and the liquid

crystal, which makes the liquid crystal molecules to maintain a defined

orientation angle.

When the LCD is in the off state, light rays are rotated by the two

polarisers and the liquid crystal, such that the light rays come out of the LCD

without any orientation, and hence the LCD appears transparent. When

sufficient voltage is applied to the electrodes, the liquid crystal molecules would

be aligned in a specific direction. The light rays passing through the LCD would

be rotated by the polarisers, which would result in activating/ highlighting the

desired characters.

Page 7: Weather Station

WEATHER STATION USING ZIGBEE

The LCD does don’t generate light and so light is needed to read the

display. By using backlighting, reading is possible in the dark. The LCD’s have

long life and a wide operating temperature range.

3.2.1 PIN DESCRIPTION OF LCD:

VCC, VSS and VEE: While VCC and VSS provide +5V and ground

respectively, VEE is used for controlling LCD contrast. The three control lines

are referred to as EN, RS, and RW.

EN: The EN line is called "Enable". This control line is used to tell the LCD

that you are sending it data. To send data to the LCD, your program should first

set this line high (1) and then set the other two control lines and/or put data on

the data bus.

RS: The RS line is the "Register Select" line. When RS is low (0), the data is to

be treated as a command or special instruction. When RS is high (1), the data

that is sent is a text data which should be displayed on the screen.

RW: The RW line is the "Read/Write" control line. When RW is low (0), the

information on the data bus is being written to the LCD. When RW is high (1),

the program is effectively querying (or reading) the LCD. Only one instruction

Page 8: Weather Station

WEATHER STATION USING ZIGBEE

("Get LCD status") is a read command. All others are write commands, so RW

will almost be low.

3.3ZIGBEE

The data is serially transmitted through zigbee. Zigbee is used for wireless

communication. To the zigbee side we make use of a level converter for voltage

conversion. The operating system voltage of PIC is 5v and zigbee needs

approximately 3.3 v. Inorder to communicate with PIC, zigbee requires 5v but

zigbee operating voltage is just 3.3v. For this purpose we make use of a level

converter to convert 3.3v to 5v as well as 5v to 3.3v

5v (5v to 3.3v) 3.3v

PIC ………level converter……. .Zigbee

Zigbee ………level converter……..PIC

3.3v (3.3v to 5v) 5v

ZigBee is a wireless technology developed as an open global standard to

address the unique needs of low-cost, low-power wireless M2M networks. The

ZigBee standard operates on the IEEE 802.15.4 physical radio specification and

operates in unlicensed bands including 2.4 GHz, 900 MHz and 868 MHz.

The ZigBee protocol was designed to provide an easy-to-use wireless data

solution characterized by secure, reliable wireless network architectures. The

ZigBee protocol is designed to communicate data through hostile RF

environments that are common in commercial and industrial applications. A key

component of the ZigBee protocol is the ability to support mesh networking. In

a mesh network, nodes are interconnected with other nodes so that multiple

pathways connect each node.

3.3.1Modes of Operation

• Transmit Mode (Serial data is received in the DI Buffer)

Page 9: Weather Station

WEATHER STATION USING ZIGBEE

• Receive Mode (Valid RF data is received through the antenna)

• Sleep Mode (Sleep Mode condition is met)

• Command Mode (Command Mode Sequence is issued)

3.4SOFTWARE USED

The embedded C source code of weather station using zigbee is written for

PIC16F877using MPLAB IDE provided by microchip. The code was compiled

using HI-TECH C compiler. The hex file was generated and was loaded to the

PIC using the same hardware board of, weather station using zigbee using Tiny

Boot Loader software.

CHAPTER 4

Page 10: Weather Station

WEATHER STATION USING ZIGBEE

CIRCUIT DIAGRAM

Figure4.1: Circuit diagram

CHAPTER 5

CIRCUIT DIAGRAM EXPLANATION

Page 11: Weather Station

WEATHER STATION USING ZIGBEE

Figure shows the circuit diagram of Remote Weather station using

Zigbee. Here contains a microcontroller (PIC18F6722), LCD module, Zigbee

module, temperature sensor, humidity sensor, light sensor and power supply

module. This proposed project aims to develop a device that monitors the

different weather parameters from remote location. These values are updated to

the main server PC at regular intervals. The administrator/official can monitor

the situation from any centralized location.

5.1 POWER SUPPLY SECTION

Figure 5.1 power supply

In this circuit all devices are working in +5 volt supply. A voltage

regulator is an electronic device that supplies a constant voltage to a circuit or

load. The output voltage of the voltage regulator is regulated by the internal

circuitry of the regulator to the relatively independent of the current drawn by

the load, the supply or line voltage and the ambient temperature.

A voltage regulator may be part of some larger electronic circuit, but

is often a separate unit a module, unusually in the form of an integrated circuit.

It is compressed of three basic parts.

A voltage reference circuit that produces a reference voltage that is

independent of temperature and supply voltage.

An amplifier to compare the reference voltage with the fraction of the

output voltage that is fed back from the voltage regulator output to the

inverting input terminal of the amplifier.

A series pass transistor or combination of transistor to provide an

Page 12: Weather Station

WEATHER STATION USING ZIGBEE

adequate level of output current to the load being driven.

The combination of the amplifier (often called an error amplifier) and

the series pass transistors, together with the resistive voltage divider to tap off a

portion of the output voltage, constitutes a feedback amplifier. The closed loop

amplifier configure act to maintain the traction of the output voltage feed back

to the amplifier inverting input terminal equal to the reference voltage that is

supplied to the non-inverting input terminal.

Three terminal voltage regulators are voltage regulators in which the

output voltage is set at some pre-determined value. They therefore, do not

require any external feedback connections. As a result, only three terminals are

required for this type of generator, input (Vin), output (Vo) and a ground

terminal. Since these regulators operate at a present output voltage, the current

limit resistor Rd is also internal to the generator.

The principle advantage of three terminal regulators is the simplicity of

connection to the external circuit, with a minimum of external components

required. Indeed, in many applications no external components are required.

The simplicity and case of application is evident. The capacitor across the input

terminals is required only when the voltage regulator is located more than about

5cm.

From the power supply filter capacitor such that the lead inductance

between the supply and the regulator may cause stability problems and high

frequency oscillations. A very low Effective Series Resistance (ESR) should

characterize the capacitor. Acceptable values on generally 0.21 geF ceramic

disks, 2mF or greater tantalum, or 25 mF or greater aluminum electrolyte.

A capacitor is generally not needed across the output terminals. The use

of a suitable capacitor will, however, improve the regulator response to transient

changes in the local conditions. And will also reduce the noise present at the

regulator output.

Page 13: Weather Station

WEATHER STATION USING ZIGBEE

The device connected to 15 v DC supply (the input of the regulator IC

always greater than Vout+2). The diode D5 (1N4001) protects circuits from

reveres current. If we connect reveres polarity of the battery then a reveres

current produces and damage the regulator IC. The 15 volt DC passes to the

7812 IC. The output of the IC gives us +12v.A 470 MFD/25v filter capacitor

(C12) is used for smoothing purpose. A 47Mf (C13) and 0.1 MF (C8) capacitors

are used for surge voltage protection.

The output of the LM 7812 gives to the LM7805 IC for producing

+5V dc. . A 47Mf (C14) and 0.1 MF (C9) capacitors are used for surge voltage

protection.

5.2 MICROCONTROLLER SECTION

Fig: 5.2 Microcontroller section

In this circuit contains PIC18f6722 IC , crystal and power supply

section. Here a 5v gives to the Vcc pin. It also contains a RST ( RG5) pin this is

used to reset the controller. If switch is pressed the RST pin goes to low and

controller reset.

Page 14: Weather Station

WEATHER STATION USING ZIGBEE

Figure 5.2.3

In this circuit contains PIC16f877 IC ,crystal and power supply

section. Here a 5v gives to the Vcc pin. It also contains a RST ( mclr) pin this is

used to reset the controller. If switch is pressed the RST pin goes to low and

controller reset.

5.3 LCD INTERFACING

Figure 5.3: LCD Interfacing

PIN SYMBOL DESCRIPTION

1 Vss Ground

2 Vcc +5V power supply

3 VEE Contrast adjust

Page 15: Weather Station

WEATHER STATION USING ZIGBEE

PIN SYMBOL DESCRIPTION

4 RS RS=0 to select command register, RS=1 to select data register

5 R/W R/W=0 for write, R/W=1 for read

6 E Enable

7 DB0 The 8-bit data bus

8 DB0 The 8-bit data bus

9 DB0 The 8-bit data bus

10 DB0 The 8-bit data bus

11 DB0 The 8-bit data bus

12 DB0 The 8-bit data bus

13 DB0 The 8-bit data bus

14 DB0 The 8-bit data bus

15 VLed Supply for back LED

16 VGnd Ground for Back LED

The voltage of the third pin of the lcd used to adjusting contrast. Here

we are connected a variable resistor P1 for adjusting vge of the 3rd pin. The c3

and c7 are used to reject the noise from the supply voltage. The same LCd

works as 4 bit interfacing. Here this LCd work as 4bit lcd. So we can connect

D4-d7 pins of LCd connected to PB4- PB7.

5.4 SENSOR INTERFACING

Page 16: Weather Station

WEATHER STATION USING ZIGBEE

Figure5.4 sensor Figure shows circuit diagram of LM35 ( Temperature Sensor). Temperature

sensor (LM35) sense the temperature of atmosphere and it out corresponding

analog voltage. It made up of semiconductor substances, which property has

negative temperature coefficient. So temperature increases, the output voltage of

sensor is also increases. This analog voltage is gives to the microcontroller.

Figure5.4.2 The above shown is the potentiometer which is used to indicate the oil

level. The microcontroller consist a10 bit ADC, which converts the analog

voltage to corresponding digital values. These values are stores its memories.

5.5 RECEIVER SIDE

At the receiver side the data reach the microcontroller through the

ZIGBEE bus and through USART it is sent to multiplexer. The multiplexer

determines whether it is to be switched to PC. PC is TTL compatible. Hence

their voltage requirements will be different and in order to control that MAX232

level converter is used.

Page 17: Weather Station

WEATHER STATION USING ZIGBEE

CHAPTER 6

PROGRAM

#include<pic.h>

#include"DELAY.c"

void LCD(const char *disp);

void data();

void delay();

void lcd();

void command();

char a[5],b[5],c[5];

int x,z, i,y,j,k;

void main()

{

TRISC=0X00;

TRISD=0X00;

TRISA=0x3F;

SPBRG=0X81;

TXEN=1;

SYNC=0;

BRGH=1;

SPEN=1;

ADCON1=0X80;

Page 18: Weather Station

WEATHER STATION USING ZIGBEE

lcd();

PORTD=0X80;

command();

LCD("ZIGBEE CONTROLED ");

PORTD=0Xc0;

command();

LCD("WEATHER STATION ");

DelayS(1);

PORTD=0X01;

command();

while(1)

{

TXREG='#';

while(TRMT!=1);

TXREG='$';

while(TRMT!=1);

PORTD=0x80;

command();

LCD("Hu:");

ADCON0=0x81;//channel0 humidity//

DelayMs(100);

Page 19: Weather Station

WEATHER STATION USING ZIGBEE

ADGO=1

while(ADGO!=0);

x=ADRESH;

x=x<<8;

x=x|ADRESL;

for(i=0;i<=3;i++)

{

a[i]=x%10;

x=x/10;

}

PORTD=0x83;

command();

for(i=3;i>=0;i--)

{

PORTD=a[i]+'0';

data();

TXREG=a[i]+'0';

while(TRMT!=1);

}

TXREG='$';

while(TRMT!=1);

Page 20: Weather Station

WEATHER STATION USING ZIGBEE

PORTD=0x88;

command();

LCD("Tmp:");

ADCON0=0x89;//channel1 temp//

DelayMs(100);

ADGO=1;

while(ADGO!=0);

y=ADRESH<<8;

y=ADRESL|y;

y=(y*0.48);

for(j=0;j<=3;j++)

{

b[j]=y%10;

y=y/10;

}

PORTD=0X8c;

command();

for(j=3;j>=0;j--)

{

PORTD=b[j]+'0';

Page 21: Weather Station

WEATHER STATION USING ZIGBEE

data();

TXREG=b[j]+'0';

while(TRMT!=1);

}

TXREG='$';

while(TRMT!=1);

PORTD=0xc0;

command();

LCD("Light:");

ADCON0=0x91;//channel2 LDR//

DelayMs(100);

ADGO=1;

while(ADGO!=0);

z=ADRESH<<8;

z=ADRESL|z;

for(k=0;k<=3;k++)

{

c[k]=z%10;

z=z/10;

}

Page 22: Weather Station

WEATHER STATION USING ZIGBEE

PORTD=0Xc6;

command();

for(k=3;k>=0;k--)

{

PORTD=c[k]+'0';

data();

TXREG=c[k]+'0';

while(TRMT!=1);

}

TXREG='$';

while(TRMT!=1);

TXREG='*';

while(TRMT!=1);

DelayS(5);

}

}

void lcd()

{

delay();

PORTD=0X30;

Page 23: Weather Station

WEATHER STATION USING ZIGBEE

command();

delay();

PORTD=0X30;

command();

delay();

PORTD=0X38;

command();

PORTD=0X01;

command();

PORTD=0X06;

command();

PORTD=0X0c;

command();

}

void command()

{

RC5=0;

RC0=0;

RC1=1;

delay();

Page 24: Weather Station

WEATHER STATION USING ZIGBEE

RC1=0;

}

void data()

{

RC5=1;

RC0=0;

RC1=1;

delay();

RC1=0;

}

void delay()

{

int k,j;

for(k=0;k<=255;k++)

{

for(j=0;j<=255;j++);

}

}

void LCD(const char *disp)

{

Page 25: Weather Station

WEATHER STATION USING ZIGBEE

while(*disp!='\0')

{

PORTD=*disp;

data();

disp++;

}

}

CHAPTER 7

PCB LAYOUT

Page 26: Weather Station

WEATHER STATION USING ZIGBEE

Figure7.1: PCB layout

CHAPTER8

PCB FABRICATION

Printed Circuit Board (PCB) is piece of art. The performance of an

electronic circuit depends on the layout and the design of PCB. A PCB

Page 27: Weather Station

WEATHER STATION USING ZIGBEE

mechanically supports and connects components by conductive pathways,

etched from copper sheets laminated on to insulated substrate. PCB ape used to

rotate electrical currents and signals through copper tracts which are firmly

bonded to an insulating base.

PCB Fabrication involves the following steps:

1. Drawing the layout of the PCB in the paper. The track layout of the Elec-

tronic circuit should be made in such manner that the paths are in easy

routes. It is then transferred to a Mylar sheet. The sheet is then touched

with black ink.

2. The solder side of the Mylar sheet is placed on the shiny side of the five-

Star sheet and is placed in a frame. Then it is exposed to sunlight with

Mylar sheet facing the sunlight.

3. The exposed five- star sheet is put in Hydrogen Peroxide solution. Then it

is put in hot water and shook till unexposed region becomes transparent.

4. This is put in cold water and then the rough side is stuck on to the silk

screen. This is then pressed and dried well.

5. The plastic sheet of the five- star sheet is removed leaving the pattern on

the screen.

6. A copper clad sheet is cut to the size and cleaned. This is placed under

screen.

7. As it resistant ink if spread on the screen so that a pattern of tracks and a

pad is obtained on a copper clad sheet. It is then dried.

8. The dried sheet is then etched using Ferric chloride solution (32Baume)

till all the unwanted Copper is etched away. Swish the board to keep the

each fluid moving. Lift up the PCB and check whether all the unwanted

Copper is removed. Etching is done by immersing the marked copper

clad in Ferric Chloride solution. After that the etched sheet is dried.

Page 28: Weather Station

WEATHER STATION USING ZIGBEE

9. The unwanted resist ink is removed using Sodium Hydroxide solution

Holes are them dried.

SOLDERING

Soldering is the process of joining metals by using lower melting point

to weld or alloy with joining surface.

SOLDERING STEPS

1. Make the layout of the component in the circuit. Plug in the chord of

the soldering iron the mains to get heated.

2. Straighten and clean the component leads using a blade or a knife.

3. Mount the components on the PCB by bending the leads of the

components. Use nose pliers.

4. Apply flux on the joints and solder the joints. Soldering must be in

minimum time to avoid dry soldering and heating up of the

components.

5. Wash the residue using water and brush.

6. Solder joins should be inspected when completed to determine if they

have been properly made.

Chapter 9

COMPONENT LAYOUT

Page 29: Weather Station

WEATHER STATION USING ZIGBEE

Figure9.1: component layout

CHAPTER 10

CONCLUSION

We hereby conclude our project “WEATHER STATION USING

ZIGBEE”. This system is meant for Real-time weather monitoring system which

Page 30: Weather Station

WEATHER STATION USING ZIGBEE

continuously monitors the environmental changes and weather conditions. This can

be useful for monitoring the weather conditions in the remote areas. With the

help of this remote weather monitoring station, the master control station

located at another geographical area can constantly receive the weather data.

The remote weather system monitors temperature, humidity, light intensity,

vibration etc. and sends the data to the master control station with at regular

intervals, thus updating the data. Through this project we understand the basic

principle of weather broadcasting system. From this project we also get the

basic idea about the working of sensors. In future this project can be elaborated

using more sensors and alarms.

CHAPTER 11

ADVANTAGES

Weather can be monitored from remote place.

Execution of the System is faster

Detection of the Temperature conditions will help us to avoid damages.

Page 31: Weather Station

WEATHER STATION USING ZIGBEE

CHAPTER 12

SCOPE AND APPLICATIONS OF PROJECT

12.1 SCOPE

This system is developed for monitoring weather reporting application

only. It also can be controlled by using controller at the receiver side.

Page 32: Weather Station

WEATHER STATION USING ZIGBEE

12.2 APPLICATIONS

Weather Reporting System.

Industrial Applications.

CHAPTER 13

BIBLIOGRAPHY

1. PIC microcontroller and embedded systems –Mohammed Ali Mazidi,

Pearson Education (2nd Edition).

2. Wireless communication system by Roodey Coolen- PHI.

3. Communication Electronics by Louis E. Frencel

Page 33: Weather Station

WEATHER STATION USING ZIGBEE

4. Basic for PIC Microcontroller By (By Nebojsa Matic, English

version).

5. www.zig.combeealliance.com

6. www.wikipedia.org

7. www.microchip.com/maps