pic wireless weather station

56
PIC Wireless Weather Station Eoghan O’Sullivan ELX3 Page 1 PIC Wireless Weather Station By: Eoghan O’Sullivan Department of Electronic Engineering, Cork Institute of Technology, Bishopstown, Cork. Supervisor: Dr. Oliver Gough Date: 30/5/2009

Upload: p217a2

Post on 06-Apr-2015

211 views

Category:

Documents


3 download

TRANSCRIPT

Page 1: PIC Wireless Weather Station

PIC Wireless Weather Station

Eoghan O’Sullivan ELX3 Page 1

PIC Wireless Weather Station

By:

Eoghan O’Sullivan

Department of Electronic Engineering,

Cork Institute of Technology,

Bishopstown,

Cork.

Supervisor:

Dr. Oliver Gough

Date:

30/5/2009

Page 2: PIC Wireless Weather Station

PIC Wireless Weather Station

Eoghan O’Sullivan ELX3 Page ii

Abstract

The main purpose of this project was to design and build a wireless weather station that

logged the humidity and temperature values on a remote PC. The PIC was the

fundamental point in the project as it held the code that helped extract the information

from the sensor and send it wirelessly using the Zigbee protocol to a remote PC.

Page 3: PIC Wireless Weather Station

PIC Wireless Weather Station

Eoghan O’Sullivan ELX3 Page iii

Acknowledgement

Firstly I would like to thank my project supervisor Dr. Oliver Gough for his guidance and

assistance which were a great benefit to the project overall.

Most of the work carried out for the project was done so in the senior lab and I would like

to thank the technicians in the lab for their assistance and providing me with anything I

needed.

I would also like to thank my classmates who were a great help to me during the year and

offered their help when they could.

Lastly I would like to thank my family and friends for their continued support throughout

the year.

Page 4: PIC Wireless Weather Station

PIC Wireless Weather Station

Eoghan O’Sullivan ELX3 Page iv

Table of Contents

ABSTRACT II

ACKNOWLEDGEMENT III

TABLE OF CONTENTS IV

1: INTRODUCTION 5

OBJECTIVE: 5

2: COMPONENTS 7

APPENDIX 1: MINUTES OF MEETINGS 22

APPENDIX 2: PIC CODE 27

APPENDIX 3: REQUIREMENT SPECIFICATION 41

APPENDIX 4: PROJECT PLAN 48

Page 5: PIC Wireless Weather Station

PIC Wireless Weather Station

Eoghan O’Sullivan ELX3 Page 5

1: Introduction

The reason for choosing this project was out of the other twenty projects that were shown

to us at the beginning of the year, this project appealed to me. It is interesting to monitor

the weather conditions outside and have the data sent to a PC using wireless technology

and graphing the data to see the changing conditions.

This device will be placed in an outdoor environment to monitor the weather conditions.

It will read in data from a sensor and then send it wirelessly to a receiver which will then

log the data into the PC. This process will happen once a min and give an accurate picture

of the conditions outside. Below is a block diagram of the overall system.

Fig 1.1

Objective:

My initial objectives are as follows,

Setup wireless link between PC and data logger

Test

Interface the sensor to the TX module

Display results on PC using VB language

The monitoring of temperature and humidity in industry as it is very important to keep

these under controlled as best as possible. Humidity is the concentration of water in the

Radio

Transmitter

Receiver

Display

PIC

Microcontroller

Temperature Sensor

Humidity Sensor

Page 6: PIC Wireless Weather Station

PIC Wireless Weather Station

Eoghan O’Sullivan ELX3 Page 6

air and the relative humidity is ratio that compares the amount of water vapour in the air

compared to the amount of water vapour that would be present in the air at saturation.

The relativity humidity is described in percentage, if there was 10 grams of water vapour

in each kilogram of air and the saturation of the air was 50 grams of water vapour per

kilogram then the relative humidity would then be 50/10 = 25%.

The device used to measure humidity is called a hydrometer, it works by measuring the

moisture content in the air at a given time.

Page 7: PIC Wireless Weather Station

PIC Wireless Weather Station

Eoghan O’Sullivan ELX3 Page 7

2: Components

Humidity & Temperature Sensor

Fig 2.1

This is the Sensirion SHT-75 humidity and temperature sensor. This sensor was the best

fit for the job as it was small, easy to use and did both measurements. The humidity

sensor is capacitive type which has a distinct advantage over it resistive type sensors

which don’t work at relative humidity levels below 20% and they also can only be used

in a non-condensing type environment. This sensor also comprises of a calibrated digital

output which was a factor in choosing it as it avoided A/D conversion in the PIC. The

sensor contains a 14bit analog to digital converter and a serial interface circuit on the

same chip. This results in superior signal quality, a fast response time and insensitivity to

external disturbances. The 2-wire serial interface and internal voltage regulation allows

for easy and fast system integration. The small size and low power consumption makes

this sensor the ideal choice.

Fig 2.2

This is how the sensor is wired up to the PIC, there are two wire on the sensor which each

have a specific job.

Pin 1 – This is the serial clock input(SCK), this is used to synchronize

communication between the PIC and the sensor, since the interface consists of

fully static logic there is no minimum clock frequency, this was useful to the

project because a bit could then be toggled in the PIC to generate a manual clock

pulse.

Pin 4 – This is the data line from the sensor to the PIC, it is bi-directional. DATA

is valid on the rising edge of the SCK pulse and after the falling edge of the SCK

pulse the DATA may then be changed, DATA must remain stable while SCK is

Page 8: PIC Wireless Weather Station

PIC Wireless Weather Station

Eoghan O’Sullivan ELX3 Page 8

high. To avoid signal contention the microcontroller must only drive DATA low.

An external pull-up resistor (e.g. 10 k Ω) is required to pull the signal high.

The senor requires a voltage in the range of 2.4V to 5.5V, the VDD and GND are

decoupled by a 100nF capacitor that is built into the sensor.

Communication with Sensor

Once the VDD voltage has been supplied to the sensor it needs 11ms to reach sleep state,

no commands must be sent to the sensor before this time.

To initiate a transmission, a Transmission Start sequence has to be issued. It consists of a

lowering of the DATA line while SCK is high, followed by a low pulse on SCK and

raising DATA again while SCK is still high.

Fig 2.3

The subsequent command consists of three address bits (only ‘000’ is currently

supported) and five command bits. The SHT71 indicates the proper reception of a

command by pulling the DATA pin low (ACK bit) after the falling edge of the 8th

SCK

clock. The DATA line is released (and goes high) after the falling edge of the 9th

SCK

clock.

Measurement Sequence After the transmission start sequence the next step is to tell the sensor what measurement

is required, this is done by sending a code from the PIC to the sensor through the DATA

line, if the relative humidity is required then the code ‘00000101’ is used, for temperature

measurement the code ‘00000011’ is used. The PIC then has to wait while the

measurement is been taken and these times which takes approximately 11/55/210 ms for

a 8/12/14bit measurement. To signal the completion of a measurement, the SHT-75 pulls

data line low and enters Idle Mode. The controller must wait for this Data Ready signal

before restarting SCK to readout the data. Measurement data is stored until readout,

therefore the controller can continue with other tasks and readout at its convenience.

Shown here is the measurement sequence, the first diagram shows the measurement type

being selected, this is followed by the sensor sending data back to the PIC, the PIC sends

Page 9: PIC Wireless Weather Station

PIC Wireless Weather Station

Eoghan O’Sullivan ELX3 Page 9

an acknowledgement pulse to the sensor after each byte of data that has been received, it

does this by pulling the DATA line low. For this project CRC(check sum calculation)

was not used as it was not necessary.

Fig 2.4

Fig 2.5

Reset Sequence If it is the case that the connection is lost between the PIC and the sensor there is a reset

sequence which in turn resets the serial interface, this is achieved by leaving the DATA

line high and toggling the SCK nine times or more, this must be directly followed by a

transmission start sequence.

Fig 2.6

Piczee Rx & Tx

Fig 2.7

Page 10: PIC Wireless Weather Station

PIC Wireless Weather Station

Eoghan O’Sullivan ELX3 Page 10

This is a PIC Microcontroller with 2,4GHz IEEE 802.15.4 transceiver and ZigBee stack.

It’s range is 100meters and it has its own built in antenna. Like all PIC chips it operates

between 2.1V and 3.6V. This next diagram is a list of the pin i/o on the chip and below

that is the schematic diagram of the circuit.

Page 11: PIC Wireless Weather Station

PIC Wireless Weather Station

Eoghan O’Sullivan ELX3 Page 11

Fig 2.8

ZigBee’s primary aim is to make low data rate, battery power communications feasible.

Primarily it does this by using mesh networks of adjacent devices rather than point-to-

point communications over long distances. It does this by setting one of the chips as

coordinator and the other as an end point, this allows one chip to control the other which

makes the system more efficient. Below are the most common types of networks used.

Fig 2.9

For this project there are only two transceivers needed so the star network was choosen.

Page 12: PIC Wireless Weather Station

PIC Wireless Weather Station

Eoghan O’Sullivan ELX3 Page 12

For the transceivers to work correctly a protocol stack was needed. The application

source code must include the header file, zAPL.h , to access the ZigBee protocol

functions.

#include “zAPL.h”

A ZigBee protocol coordinator application will need to have one support variable to keep

track of the current primitive being executed by the Stack.

ZIGBEE_PRIMITIVE currentPrimitive;

A ZigBee protocol router or end device will also need to keep track of the current

primitive; but in addition, it will need two other support variables to assist in network

discovery and joining.

NETWORK_DESCRIPTOR * currentNetworkDescriptor;

ZIGBEE_PRIMITIVE currentPrimitive;

NETWORK_DESCRIPTOR * NetworkDescriptor;

Next, the application must configure all pins required to interface with the transceiver.

Before the Stack can be used, it must be initialized. Interrupts must then be enabled.

ZigBeeInit();

RCONbits.IPEN = 1;

INTCONbits.GIEH = 1;

Here is an example of the basic structure of the application.

while (1)

{

CLRWDT();

ZigBeeTasks( &currentPrimitive );

switch (currentPrimitive)

{

// Include cases for each required primitive.

// Be sure to update currentPrimitive!

default:

currentPrimitive = NO_PRIMITIVE;

break;

}

}

To receive messages the Stack notifies the application of received messages through the

APSDE_DATA_indication primitive. When this primitive is returned, the

APSDE_DATA_indication primitive parameters are populated with information about

the message and the received message resides in a buffer. The function, APLGet(), is

used to extract each byte of the message from the buffer.

Here is an example of how to receive messages using the protocol.

Page 13: PIC Wireless Weather Station

PIC Wireless Weather Station

Eoghan O’Sullivan ELX3 Page 13

case APSDE_DATA_indication:

{

// Declare variables used by this primitive.

currentPrimitive = NO_PRIMITIVE; // This may change during processing.

frameHeader = APLGet();

switch (params.APSDE_DATA_indication.DstEndpoint)

{

case EP_ZDO:

// Handle all ZDO responses to requests we sent.

break;

// Include cases for all application endpoints.

}

APLDiscard();

}

break;

The Microchip Stack for the ZigBee protocol allows one outgoing message in the

application layer at a time. Messages are sent by implementing the following:

Verify that the application layer is ready for a new outgoing message by

confirming that ZigBeeReady() is TRUE.

Lock the system with ZigBeeBlockTx() so subsequent calls to ZigBeeReady()

will return FALSE.

Load the message payload into the array TxBuffer, using TxData to index through

the array. When complete, TxData must point to the first location after the

message.

Load the APSDE_DATA_request primitive parameters.

Set currentPrimitive to APSDE_DATA_request and call ZigBeeTasks().

Here is an example of how to send an outgoing message.

if (ZigBeeReady())

{

if (bLightSwitchToggled)

{

bLightSwitchToggled = FALSE;

ZigBeeBlockTx();

TxBuffer[TxData++] = APL_FRAME_TYPE_KVP | 1; // KVP, 1 transaction

TxBuffer[TxData++] = APLGetTransId();

Page 14: PIC Wireless Weather Station

PIC Wireless Weather Station

Eoghan O’Sullivan ELX3 Page 14

TxBuffer[TxData++] = APL_FRAME_COMMAND_SET |

(APL_FRAME_DATA_TYPE_UINT8<< 4);

TxBuffer[TxData++] = OnOffSRC_OnOff & 0xFF; // Attribute ID LSB

TxBuffer[TxData++] = (OnOffSRC_OnOff >> 8) & 0xFF; // Attribute ID MSB

TxBuffer[TxData++] = LIGHT_TOGGLE;

params.APSDE_DATA_request.DstAddrMode = APS_ADDRESS_16_BIT;

params.APSDE_DATA_request.DstEndpoint = destinationEndpoint;

params.APSDE_DATA_request.DstAddress.ShortAddr = destinationAddress;

params.APSDE_DATA_request.ProfileId.Val = MY_PROFILE_ID;

params.APSDE_DATA_request.RadiusCounter = DEFAULT_RADIUS;

params.APSDE_DATA_request.DiscoverRoute =

ROUTE_DISCOVERY_ENABLE;

params.APSDE_DATA_request.TxOptions.Val = 0;

params.APSDE_DATA_request.SrcEndpoint = EP_SWITCH;

params.APSDE_DATA_request.ClusterId = OnOffSRC_CLUSTER;

currentPrimitive = APSDE_DATA_request;

}

}

PIC 16F877A

This is the microcontroller that was used in the project, this microcontroller can be

programmed using MPLAB to carry out the tasks required.

Fig 2.10

Page 15: PIC Wireless Weather Station

PIC Wireless Weather Station

Eoghan O’Sullivan ELX3 Page 15

Fig 2.11

Maxim 232

Fig 2.12

Page 16: PIC Wireless Weather Station

PIC Wireless Weather Station

Eoghan O’Sullivan ELX3 Page 16

This is the Maxim 232 driver and receiver chip, this chip is used to send data from the

PIC chip through an RS232 cable into the remote PC. The transmitter uses pins 12 and 13

to send data out through the RS232 port and this converts voltage into high and low

pulses for a computer to recognize. Pins 11 and 14 are used by the receiver part of the

chip, this takes data coming from the RS232 cable and converts the high and low pulses

into a voltage.

Fig 2.13

Page 17: PIC Wireless Weather Station

PIC Wireless Weather Station

Eoghan O’Sullivan ELX3 Page 17

3: Procedure & Results

Firstly the Tx and Rx boards were built using vero board to mount on the components.

The code was put together to read the data from the sensor using MPlab to write and

debug the code.

To test the code first a simplier circuit was made, it consisted of the PICdem board with

the sensor directly wired into the ports on the PIC.

Fig 3.1

An incircuit debugger was used to program the chip on the PICdem board which was the

16F877a. Once the chip was programmed then using an oscilloscope the results could be

tracked to verify that the sensor was working correctly.

Fig 3.2

Unfortunitily the system didn’t work out as the Data line was not being pulled to ground.

Due to this the information could not be extracted from the sensor correctly because the

Data line needs to go low and not idle between 1 and 0. A reason for this error was due to

a faulty sensor, the Data pin on the sensor had been broken off the sensor during set up,

this may have caused a bad connection which lead to the Data line not going to 0. This

Page 18: PIC Wireless Weather Station

PIC Wireless Weather Station

Eoghan O’Sullivan ELX3 Page 18

was a major setback, had the sensor worked perfectly it would have been possible to

exact the data fom the sensor and take an accurate reading from it.

Page 19: PIC Wireless Weather Station

PIC Wireless Weather Station

Eoghan O’Sullivan ELX3 Page 19

4: Problems

Many obstacles were encountered during the second semester which backlogged the

project significantly. Firstly due to bad planning on my part I didn’t get my objectives

completled on the time schedual that I had set out at the start of the project. Secondly the

sensor failed to work correctly which hampered any chance of reading in data correctly

from the sensor. Thirdly the Zigbee protocol was very difficult to understand at the

beginning, it took up a large sum of time researching this area which I now have an

understanding of, but due to the lack of time near the end of the semister this part of the

project was never completed fully

Page 20: PIC Wireless Weather Station

PIC Wireless Weather Station

Eoghan O’Sullivan ELX3 Page 20

5 : Conclusion

This project has been a great learning experience for me, altought I didn’t get the system

working like I had hoped at the beginning of the year I still have gained a vast amount of

knowledge and a better insight into projects. They seem easy to look at but this project is

a challenging task which requires you to put a lot of time, effort and pre-thought in. I

underestimated the work involved and didn’t start on time but like all humans we learn

from our mistakes in a positive way. From this project I will take with me an

understanding of work involved in projects in the future and I hope this experience will

stand to me again and again.

Also my skills using MPlab have increased; I started out at the beginning of the semester

with very little knowledge of how to use it correctly but with help from my supervisor,

classmates and John O’Sullivan I feel like I have learnt a huge amount about it.

Page 21: PIC Wireless Weather Station

PIC Wireless Weather Station

Eoghan O’Sullivan ELX3 Page 21

6: References

www.howstuffworks.com

www.google.com

www.farnell.com

www.microchip.com

www.sensirion.com

W2003svr wireless humidity and temperature system 2005

Page 22: PIC Wireless Weather Station

Wireless Weather Station

ELX3

Eoghan O’Sullivan [email protected] Page 22

Appendix 1: Minutes of Meetings

Wireless Weather Station

Minutes Date 3/10/2008 Time 11:00am location PF 46

ATTENDEES Dr. Oliver Gough and Eoghan O’Sullivan

Agenda topics

DISCUSSION Sensors

CONCLUSIONS Research

ACTION ITEMS PERSON RESPONSIBLE DEADLINE

What types are out there, how much they cost and how

they could be Eoghan

Report due

for

Integrated into the project. Next

meeting

DISCUSSION PIC and Zigbee

CONCLUSIONS Research

ACTION ITEMS PERSON RESPONSIBLE DEADLINE

Research Microchip website, look up protocol stack, in

circuit debugger Eoghan n\a

DISCUSSION Frame a project objective

ACTION ITEMS PERSON RESPONSIBLE DEADLINE

Outline the timescale on a Gantt chart Eoghan 7/11/2008

SIGNED

Page 23: PIC Wireless Weather Station

Project Title

ELX3

Eoghan O’Sullivan [email protected]

Wireless Weather Station

Minutes Date

10/10/2008 Time 11:00am location PF 46

ATTENDEES Dr. Oliver Gough and Eoghan O’Sullivan

Agenda topics

DISCUSSION Minutes of last meeting

CONCLUSIONS Need to do further research on sensors

ACTION ITEMS PERSON RESPONSIBLE DEADLINE

Narrowed down to a couple of sensors, pick the most

suitable Eoghan

Report due

for

One for the project Next

meeting

DISCUSSION PIC and Zigbee

CONCLUSIONS Research

ACTION ITEMS PERSON RESPONSIBLE DEADLINE

Find out how to communicate with the PIC Eoghan n\a

SIGNED Dr. Oliver Gough

Wireless Weather Station

Time 11:00am location PF 46

Page 24: PIC Wireless Weather Station

Project Title

ELX3

Eoghan O’Sullivan [email protected]

Dr. Oliver Gough and Eoghan O’Sullivan

Agenda topics

Minutes of last meeting

Confirmed sensors

ACTION ITEMS PERSON RESPONSIBLE DEADLINE

Eoghan will order the Sensirion SHT-75 humidity and

temperature Eoghan

Need this

for

sensor from ie.farnell.com February

2009

PICZee chip

Located one for the projected

ACTION ITEMS PERSON RESPONSIBLE DEADLINE

Oliver had two chips which I could use on the project n/a n\a

Dr. Oliver Gough

Wireless Weather Station

Minutes Date

14/11/2008 Time 11:10am location PF 46

ATTENDEES Dr. Oliver Gough and Eoghan O’Sullivan

Page 25: PIC Wireless Weather Station

Project Title

ELX3

Eoghan O’Sullivan [email protected]

Agenda topics

DISCUSSION Minutes of last meeting

CONCLUSIONS Sensor has arrived

ACTION ITEMS PERSON RESPONSIBLE DEADLINE

Talked more about integrating the sensor into the

project using the PIC n/a n/a

and how the and the need for software

DISCUSSION Project Plan

CONCLUSIONS Needs to be edited

ACTION ITEMS PERSON RESPONSIBLE DEADLINE

Changes to be made to the toll gates, milestones and

Gantt chart Eoghan 18/11/2008

SIGNED Dr. Oliver Gough

Wireless Weather Station

Minutes Date

28/11/2008 Time 11:10am location PF 46

ATTENDEES Dr. Oliver Gough and Eoghan O’Sullivan

Agenda topics

DISCUSSION Minutes of last meeting

CONCLUSIONS Download PIC 18f462 datasheet

ACTION ITEMS PERSON RESPONSIBLE DEADLINE

Look at the datasheet and read up on the different Eoghan February

Page 26: PIC Wireless Weather Station

Project Title

ELX3

Eoghan O’Sullivan [email protected]

functions of the 2009

PIC chip and how to send and receive data.

DISCUSSION Background research

CONCLUSIONS n/a

ACTION ITEMS PERSON RESPONSIBLE DEADLINE

Send it to Olive to be reviewed Eoghan 28/11/2008

SIGNED Dr. Oliver Gough

Page 27: PIC Wireless Weather Station

Project Title

ELX3

Eoghan O’Sullivan [email protected]

Appendix 2: PIC Code

list p=16f877A

include <p16f877A.inc>

DelayCount1 equ 0x20

DelayCount2 equ 0x21

Temp equ 0x22

Temp1 equ 0x23

Temp2 equ 0x24

Temp3 equ 0x25

Temp4 equ 0x26

Temp5 equ 0x27

Temp6 equ 0x28

Temp7 equ 0x29

Temp8 equ 0x30

Temp9 equ 0x31

org 0x00

goto start

org 0x04

goto ISR

org 0x10

start: clrf PORTB

bsf STATUS,RP0

clrf TRISB

bcf STATUS,RP0

clrf TXREG

call TXsetup

clrf Temp

clrf Temp1

clrf Temp2

clrf Temp3

clrf Temp4

clrf Temp8

clrf Temp9

bsf PORTB,0 ;CLK high (start up, while data is high toggle

bsf PORTB,1 ;DATA high (clk 9 or more times,reset)

call softdelay

bcf PORTB,0 ;CLK low

bsf PORTB,1 ;DATA high

call softdelay

bsf PORTB,0 ;CLK high

bsf PORTB,1 ;DATA high

call softdelay

bcf PORTB,0 ;CLK low

bsf PORTB,1 ;DATA high

Page 28: PIC Wireless Weather Station

Project Title

ELX3

Eoghan O’Sullivan [email protected]

call softdelay

bsf PORTB,0 ;CLK high

bsf PORTB,1 ;DATA high

call softdelay

bcf PORTB,0 ;CLK low

bsf PORTB,1 ;DATA high

call softdelay

bsf PORTB,0 ;CLK high

bsf PORTB,1 ;DATA high

call softdelay

bcf PORTB,0 ;CLK low

bsf PORTB,1 ;DATA high

call softdelay

bsf PORTB,0 ;CLK high

bsf PORTB,1 ;DATA high

call softdelay

bcf PORTB,0 ;CLK low ******9th time

bsf PORTB,1 ;DATA high

call softdelay

bcf PORTB,1 ;DATA low, before clock change******

bsf PORTB,0 ;CLK high, now clock changes

call softdelay

bsf PORTB,0 ;CLK high ;transmission start

bsf PORTB,1 ;DATA high

call softdelay

bsf PORTB,0 ;CLK high

bcf PORTB,1 ;DATA low

call softdelay

bcf PORTB,0 ;CLK low

bcf PORTB,1 ;DATA low

call softdelay

bsf PORTB,0 ;CLK high

bcf PORTB,1 ;DATA low

call softdelay

bsf PORTB,0 ;CLK high

bsf PORTB,1 ;DATA high

call softdelay

bcf PORTB,0 ;CLK low

bsf PORTB,1 ;DATA high

call softdelay

bcf PORTB,1 ;DATA low, before clock change******

bsf PORTB,0 ;CLK high, now clock changes

call softdelay

bcf PORTB,0 ;CLK low

bcf PORTB,1 ;DATA low

call softdelay

bsf PORTB,0 ;CLK high

bcf PORTB,1 ;DATA low

call softdelay

bcf PORTB,0 ;CLK low

bcf PORTB,1 ;DATA low

Page 29: PIC Wireless Weather Station

Project Title

ELX3

Eoghan O’Sullivan [email protected]

call softdelay

bsf PORTB,0 ;CLK high

bcf PORTB,1 ;DATA low

call softdelay

bcf PORTB,0 ;CLK low

bcf PORTB,1 ;DATA low

call softdelay

bsf PORTB,0 ;CLK high

bcf PORTB,1 ;DATA low

call softdelay

bcf PORTB,0 ;CLK low

bcf PORTB,1 ;DATA low

call softdelay

bsf PORTB,0 ;CLK high

bcf PORTB,1 ;DATA low

call softdelay

bcf PORTB,0 ;CLK low

bsf PORTB,1 ;DATA high humidity '000001..'

call softdelay

bsf PORTB,0 ;CLK high

bsf PORTB,1 ;DATA high

call softdelay

bcf PORTB,0 ;CLK low

bcf PORTB,1 ;DATA low humidity '0000010.'

call softdelay

bsf PORTB,0 ;CLK high

bcf PORTB,1 ;DATA low

call softdelay

bcf PORTB,0 ;CLK low

bsf PORTB,1 ;DATA high humidity '00000101'

call softdelay

bsf PORTB,0 ;CLK high

bsf PORTB,1 ;DATA high

call softdelay

bsf STATUS,RP0 ;PORTB set for input

movlw 0x02 ;*******************

movwf TRISB ;*******************

bcf STATUS,RP0 ;*******************

bcf PORTB,0 ;CLK low

call softdelay

bsf PORTB,0 ;CLK high

call softdelay

bcf PORTB,0 ;CLK low

call softdelay

bcf PORTB,0 ;CLK low \\\\changed here 4clock off////

call softdelay

bcf PORTB,0 ;CLK low

call softdelay

bcf PORTB,0 ;CLK low

call softdelay

bcf PORTB,0 ;CLK low

call softdelay

Page 30: PIC Wireless Weather Station

Project Title

ELX3

Eoghan O’Sullivan [email protected]

bcf PORTB,0 ;CLK low

call softdelay

bcf PORTB,0 ;CLK low

call softdelay

bcf PORTB,0 ;CLK low

call softdelay

bcf PORTB,0 ;CLK low \\\\\\\\resume clock/////////

call softdelay

movlw 0x08

movwf Temp3

clrw

bsf PORTB,0 ;CLK high

call Loop

call softdelay

bcf PORTB,0 ;CLK low

call softdelay

bsf PORTB,0 ;CLK

call Loop

call softdelay

bcf PORTB,0 ;CLK low

call softdelay

bsf PORTB,0 ;CLK high

call Loop

call softdelay

bcf PORTB,0 ;CLK low

call softdelay

bsf PORTB,0 ;CLK high

call Loop

call softdelay

bcf PORTB,0 ;CLK low

call softdelay

bsf PORTB,0 ;CLK high

call Loop

call softdelay

bcf PORTB,0 ;CLK low

call softdelay

bsf PORTB,0 ;CLK high

call Loop

call softdelay

bcf PORTB,0 ;CLK low

call softdelay

bsf PORTB,0 ;CLK high

call Loop

call softdelay

bcf PORTB,0 ;CLK low

call softdelay

bsf PORTB,0 ;CLK high

call Loop

call softdelay

bcf PORTB,0 ;CLK low

clrf PORTB ;******************

bsf STATUS,RP0 ; SET PORTB

Page 31: PIC Wireless Weather Station

Project Title

ELX3

Eoghan O’Sullivan [email protected]

clrf TRISB ; FOR OUTPUT

bcf STATUS,RP0 ;*****************

call softdelay

bcf PORTB,1 ;pull data line low for acknowledge

bsf PORTB,0 ;CLK high*** acknowledge pulse (9th)

call softdelay

bcf PORTB,0 ;CLK low

bsf STATUS,RP0 ;*******************

movlw 0x02 ; SET PORTB

movwf TRISB ; FOR INPUT

bcf STATUS,RP0 ;*******************

clrf Temp

clrf Temp1

clrf Temp3

movlw 0x08

movwf Temp3

call softdelay

bsf PORTB,0 ;CLK high

call Loop2

call softdelay

bcf PORTB,0 ;CLK low

call softdelay

bsf PORTB,0 ;CLK high

call Loop2

call softdelay

bcf PORTB,0 ;CLK low

call softdelay

bsf PORTB,0 ;CLK high

call Loop2

call softdelay

bcf PORTB,0 ;CLK low

call softdelay

bsf PORTB,0 ;CLK high

call Loop2

call softdelay

bcf PORTB,0 ;CLK low

call softdelay

bsf PORTB,0 ;CLK high

call Loop2

call softdelay

bcf PORTB,0 ;CLK low

call softdelay

bsf PORTB,0 ;CLK high

call Loop

call softdelay

bcf PORTB,0 ;CLK low

call softdelay

bsf PORTB,0 ;CLK high

call Loop2

call softdelay

bcf PORTB,0 ;CLK low

Page 32: PIC Wireless Weather Station

Project Title

ELX3

Eoghan O’Sullivan [email protected]

call softdelay

bsf PORTB,0 ;CLK high

call Loop2

call softdelay

bcf PORTB,0 ;CLK low

clrf PORTB ;******************

bsf STATUS,RP0 ; SET PORTB

clrf TRISB ; FOR OUTPUT

bcf STATUS,RP0 ;*****************

bcf PORTB,1 ;pull data line low for acknowledge

call softdelay

bsf PORTB,0 ;CLK high*** acknowledge pulse (9th)

call softdelay

bcf PORTB,0 ;CLK low

bsf STATUS,RP0 ;*******************

movlw 0x02 ; SET PORTB

movwf TRISB ; FOR INPUT

bcf STATUS,RP0 ;*******************

call softdelay

movlw 0x48

movwf Temp8

movlw 0x6d

movwf Temp9

call sendout1

; call sendout

call sendout ;send last 8bits to TX

bsf PORTB,0 ;CLK high.........check sum first pulse

call softdelay

bcf PORTB,0 ;CLK low

call softdelay

bsf PORTB,0 ;CLK high

call softdelay

bcf PORTB,0 ;CLK low

call softdelay

bsf PORTB,0 ;CLK high

call softdelay

bcf PORTB,0 ;CLK low

call softdelay

bsf PORTB,0 ;CLK high

call softdelay

bcf PORTB,0 ;CLK low

call softdelay

bsf PORTB,0 ;CLK high

call softdelay

bcf PORTB,0 ;CLK low

call softdelay

bsf PORTB,0 ;CLK high

call softdelay

bcf PORTB,0 ;CLK low

call softdelay

Page 33: PIC Wireless Weather Station

Project Title

ELX3

Eoghan O’Sullivan [email protected]

bsf PORTB,0 ;CLK high

call softdelay

bcf PORTB,0 ;CLK low

call softdelay

bsf PORTB,0 ;CLK high..end of check sum (8th pulse)

call softdelay

bcf PORTB,0 ;CLK low

call softdelay

bsf PORTB,0 ;CLK high

call softdelay

bcf PORTB,0 ;CLK low

goto readtemp

Loop: btfss PORTB,0 ;store the first 8 bits

bcf STATUS,C ;***************************

movfw PORTB ;***************************

andlw 0x02 ;***************************

movwf Temp ;***************************

rrf Temp,0 ;***************************

andlw 0x0F ;***************************

iorwf Temp2,1 ;***************************

decf Temp3 ;***************************

btfss STATUS,Z ;***************************

rlf Temp2,1 ;***************************

return

Loop2: btfss PORTB,0 ;store the second 8 bits

bcf STATUS,C ;***************************

movfw PORTB ;***************************

andlw 0x02 ;***************************

movwf Temp ;***************************

rrf Temp,0 ;**********************

andlw 0x01 ;***************************

iorwf Temp4,1 ;***************************

decf Temp3 ;***************************

btfss STATUS,Z ;***************************

rlf Temp4,1 ;*************************

return

softdelay: clrf DelayCount1

movlw 0xC0

movwf DelayCount2

Delayloop: decfsz DelayCount1,F

goto smalldelay

goto exitdelay

smalldelay: decfsz DelayCount2,F

goto smalldelay

goto Delayloop

exitdelay: Return

TXsetup: bsf STATUS,RP0

movlw .207 ;1200 baud rate

Page 34: PIC Wireless Weather Station

Project Title

ELX3

Eoghan O’Sullivan [email protected]

movwf SPBRG ;load value into SPBRG

movlw b'10100100' ;async high baud rate

movwf TXSTA ;transmit config register

bcf STATUS,RP0

movlw b'10000000' ;Enable serial port open

movwf RCSTA

return

sendout: bcf STATUS,RP0

movfw Temp2 ;move temp2 to w-reg

movwf TXREG ;move w-reg to tx nop

nop

bsf STATUS,RP0 ;switch to bank1

bsf TXSTA,TXEN ;enable transmission

nop

bcf STATUS,RP0 ;switch to bank0

btfss PIR1,TXIF ;check tx empty

goto $-1

nop

movfw Temp4 ;Same code again

movwf TXREG ;only this time its for

nop ;sending second byte

nop

bsf STATUS,RP0

bsf TXSTA,TXEN

nop

bcf STATUS,RP0

btfss PIR1,TXIF

goto $-1

movlw 'X' ; character sent out to make up 8 bits

movwf TXREG

nop

nop

movlw 'X' ; character sent out to make up 8 bits

movwf TXREG

nop

nop

movlw 'X' ; character sent out to make up 8 bits

movwf TXREG

nop

nop

movlw 'X' ; character sent out to make up 8 bits

movwf TXREG

nop

nop

return

sendout1: bcf STATUS,RP0

movfw Temp8 ;move temp2 to w-reg

movwf TXREG ;move w-reg to tx

nop

nop

Page 35: PIC Wireless Weather Station

Project Title

ELX3

Eoghan O’Sullivan [email protected]

bsf STATUS,RP0 ;switch to bank1

bsf TXSTA,TXEN ;enable transmission

nop

bcf STATUS,RP0 ;swictch to bank0

btfss PIR1,TXIF ;check tx empty

goto $-1

nop

movfw Temp9 ;Same code again

movwf TXREG ;only this time its for

nop ;sending second byte

nop

bsf STATUS,RP0

bsf TXSTA,TXEN

nop

bcf STATUS,RP0

btfss PIR1,TXIF

goto $-1

return

readtemp: clrf PORTB

bsf STATUS,RP0

clrf TRISB

bcf STATUS,RP0

clrf Temp

clrf Temp1

clrf Temp2

clrf Temp3

clrf Temp4

clrf Temp8

clrf Temp9

bsf PORTB,0 ;CLK high ;transmission start

bsf PORTB,1 ;DATA high

call softdelay

bsf PORTB,0 ;CLK high

bcf PORTB,1 ;DATA low

call softdelay

bcf PORTB,0 ;CLK low

bcf PORTB,1 ;DATA low

call softdelay

bsf PORTB,0 ;CLK high

bcf PORTB,1 ;DATA low

call softdelay

bsf PORTB,0 ;CLK high

bsf PORTB,1 ;DATA high

call softdelay

bcf PORTB,0 ;CLK low

bsf PORTB,1 ;DATA high

Page 36: PIC Wireless Weather Station

Project Title

ELX3

Eoghan O’Sullivan [email protected]

call softdelay

bcf PORTB,1 ;DATA low, before clock change******

bsf PORTB,0 ;CLK high, now clock changes

call softdelay

bcf PORTB,0 ;CLK low

bcf PORTB,1 ;DATA low

call softdelay

bsf PORTB,0 ;CLK high

bcf PORTB,1 ;DATA low

call softdelay

bcf PORTB,0 ;CLK low

bcf PORTB,1 ;DATA low

call softdelay

bsf PORTB,0 ;CLK high

bcf PORTB,1 ;DATA low

call softdelay

bcf PORTB,0 ;CLK low

bcf PORTB,1 ;DATA low

call softdelay

bsf PORTB,0 ;CLK high

bcf PORTB,1 ;DATA low

call softdelay

bcf PORTB,0 ;CLK low

bcf PORTB,1 ;DATA low

call softdelay

bsf PORTB,0 ;CLK high

bcf PORTB,1 ;DATA low

call softdelay

bcf PORTB,0 ;CLK low

bsf PORTB,1 ;DATA High Temperature command

call softdelay

bsf PORTB,0 ;CLK high

bsf PORTB,1 ;DATA low temperature command bit high

call softdelay

bcf PORTB,0 ;CLK low

bsf PORTB,1 ;DATA high temperature command line stays high

call softdelay

bsf PORTB,0 ;CLK high

bsf PORTB,1 ;DATA high temprature line still high (final bit)

call softdelay

bsf STATUS,RP0 ;PORTB set for input

movlw 0x02 ;*******************

movwf TRISB ;*******************

bcf STATUS,RP0 ;*******************

bcf PORTB,0 ;CLK low

bsf PORTB,0 ;CLK high

call softdelay

bcf PORTB,0 ;CLK low

call softdelay

bcf PORTB,0 ;CLK lo \\\\\\changed here 4clock off////

call softdelay

bcf PORTB,0 ;CLK low

Page 37: PIC Wireless Weather Station

Project Title

ELX3

Eoghan O’Sullivan [email protected]

call softdelay

bcf PORTB,0 ;CLK lo

call softdelay

bcf PORTB,0 ;CLK low

call softdelay

bcf PORTB,0 ;CLK lo

call softdelay

bcf PORTB,0 ;CLK low

call softdelay

bcf PORTB,0 ;CLK lo

call softdelay

bcf PORTB,0 ;CLK low \\\\\\\\resume clock/////////

call softdelay

movlw 0x08 ;move 8 into w-reg

movwf Temp3 ;move w-reg to Temp3 to count number of bits saved

clrw

bsf PORTB,0 ;CLK high

call Loop

call softdelay

bcf PORTB,0 ;CLK low

call softdelay

bsf PORTB,0 ;CLK high

call Loop

call softdelay

bcf PORTB,0 ;CLK low

call softdelay

bsf PORTB,0 ;CLK high

call Loop

call softdelay

bcf PORTB,0 ;CLK low

call softdelay

bsf PORTB,0 ;CLK high

call Loop

call softdelay

bcf PORTB,0 ;CLK low

call softdelay

bsf PORTB,0 ;CLK high

call Loop

call softdelay

bcf PORTB,0 ;CLK low

call softdelay

bsf PORTB,0 ;CLK high

call Loop

call softdelay

bcf PORTB,0 ;CLK low

call softdelay

bsf PORTB,0 ;CLK high

call Loop

call softdelay

bcf PORTB,0 ;CLK low

call softdelay

bsf PORTB,0 ;CLK high

Page 38: PIC Wireless Weather Station

Project Title

ELX3

Eoghan O’Sullivan [email protected]

call Loop

call softdelay

bcf PORTB,0 ;CLK low

clrf PORTB ;******************

bsf STATUS,RP0 ; SET PORTB

clrf TRISB ; FOR OUTPUT

bcf STATUS,RP0 ;*****************

call softdelay

bcf PORTB,1 ;pull data line low for acknowledge

bsf PORTB,0 ;CLK high********** acknowledge pulse (9th)

call softdelay

bcf PORTB,0 ;CLK low

bsf STATUS,RP0 ;*******************

movlw 0x02 ; SET PORTB

movwf TRISB ; FOR INPUT

bcf STATUS,RP0 ;*******************

clrf Temp

clrf Temp1

clrf Temp3

movlw 0x08

movwf Temp3

call softdelay

bsf PORTB,0 ;CLK high

call Loop2

call softdelay

bcf PORTB,0 ;CLK low

call softdelay

bsf PORTB,0 ;CLK high

call Loop2

call softdelay

bcf PORTB,0 ;CLK low

call softdelay

bsf PORTB,0 ;CLK high

call Loop2

call softdelay

bcf PORTB,0 ;CLK low

call softdelay

bsf PORTB,0 ;CLK high

call Loop2

call softdelay

bcf PORTB,0 ;CLK low

call softdelay

bsf PORTB,0 ;CLK high

call Loop2

call softdelay

bcf PORTB,0 ;CLK low

call softdelay

bsf PORTB,0 ;CLK high

call Loop2

call softdelay

bcf PORTB,0 ;CLK low

call softdelay

Page 39: PIC Wireless Weather Station

Project Title

ELX3

Eoghan O’Sullivan [email protected]

bsf PORTB,0 ;CLK high

call Loop2

call softdelay

bcf PORTB,0 ;CLK low

call softdelay

bsf PORTB,0 ;CLK high

call Loop2

call softdelay

bcf PORTB,0 ;CLK low

clrf PORTB ;******************

bsf STATUS,RP0 ; SET PORTB

clrf TRISB ; FOR OUTPUT

bcf STATUS,RP0 ;*****************

bcf PORTB,1 ;pull data line low for acknowledge

call softdelay

bsf PORTB,0 ;CLK high********** acknowledge pulse (9th)

call softdelay

bcf PORTB,0 ;CLK low

bsf STATUS,RP0 ;*******************

movlw 0x02 ; SET PORTB

movwf TRISB ; FOR INPUT

bcf STATUS,RP0 ;*******************

call softdelay

movlw 0x54

movwf Temp8

movlw 0x70

movwf Temp9

call sendout1

call sendout ;send bits to TX

bsf PORTB,0 ;CLK high.........check sum first pulse

call softdelay

bcf PORTB,0 ;CLK low

call softdelay

bsf PORTB,0 ;CLK high

call softdelay

bcf PORTB,0 ;CLK low

call softdelay

bsf PORTB,0 ;CLK high

call softdelay

bcf PORTB,0 ;CLK low

call softdelay

bsf PORTB,0 ;CLK high

call softdelay

bcf PORTB,0 ;CLK low

call softdelay

bsf PORTB,0 ;CLK high

call softdelay

bcf PORTB,0 ;CLK low

call softdelay

bsf PORTB,0 ;CLK high

call softdelay

bcf PORTB,0 ;CLK low

Page 40: PIC Wireless Weather Station

Project Title

ELX3

Eoghan O’Sullivan [email protected]

call softdelay

bsf PORTB,0 ;CLK high

call softdelay

bcf PORTB,0 ;CLK low

call softdelay

bsf PORTB,0 ;CLK high............end of check sum (8th pulse)

call softdelay

bcf PORTB,0 ;CLK low

call softdelay

bsf PORTB,0 ;CLK high

call softdelay

bcf PORTB,0 ;CLK low

goto start ;Loop back to start

ISR: retfie ;Dummy interruptservice routine

End

Page 41: PIC Wireless Weather Station

Project Title

ELX3

Eoghan O’Sullivan [email protected]

Appendix 3: Requirement Specification

Requirement Specification Eoghan O’Sullivan

Version 1.2

Status

Reviewed

Approved

Page 42: PIC Wireless Weather Station

Project Title

ELX3

Eoghan O’Sullivan [email protected]

Contents

STATUS ............................................................................................................................................... 41

1. INTRODUCTION ...................................................................................................................... 44

1.1. WHAT IS THE AIM OF THE PRODUCT? ............................................................................... 44 1.2. GOALS ................................................................................................................................. 44 1.3. USAGE .................................................................................................................................. 45 1.4. BACKGROUND INFORMATION ............................................................................................ 45 1.5. DEFINITION OF TERMS ....................................................................................................... 45

2. OVERVIEW OF THE SYSTEM .............................................................................................. 45

............................................................................................................................................................... 45

2.1. PRODUCT COMPONENTS ..................................................................................................... 45 2.2. DESIGN PHILOSOPHY .......................................................................................................... 45

3. DELIVERY ................................................................................................................................. 46

4. DOCUMENTATION ................................................................................................................. 47

Page 43: PIC Wireless Weather Station

Wireless Weather Station

ELX3

Eoghan O’Sullivan [email protected] Page 43

Document history

Version Date Changes Sign Reviewed

0.1 10th

Oct 08 First draft eos

Page 44: PIC Wireless Weather Station

2009-06-01

Wireless Weather Station

ELX3

Eoghan O’Sullivan [email protected] 44

Introduction This project consists of the design of sensor system to record weather data and

transmit this data back to a PC.

What is the aim of the product?

To accurately measure the weather conditions and display the results on a

4 Original To transmit data from the PIC back to the PC. 2

Figure 1. A wireless weather station with a transmitter built in to transmit data.

Goals

To design a working weather station that transmits data back to a PC and fully

program a PIC chip.

Req.No Original/

Changed

Description of requirement Priority

1 Original To record temperature, humidity and wind speed on to the

PIC.

1

2 Original Write a formal report documenting the project to include

graphs and tables demonstrating the success of the project.

1

3 Original Make a project presentation and hopefully to demonstrate

a working prototype.

1

Page 45: PIC Wireless Weather Station

2009-06-01

Wireless Weather Station

ELX3

Eoghan O’Sullivan [email protected] 45

Usage

This system could be used to measure the climatic conditions of a region, each

sub-station would transmit back its data to a main hub and a better picture of the

regions climate could be shown.

Background information

Form research on the C.I.T server I found past reports on this project, I also

researched in the internet and found other reports with useful information.

www.web-ee.com/schematics/instumentations/wireless-weather-station/

Definition of terms

www = World Wide Web

Overview of the system

Figure 2. An overview of the system.

Product components

Ill be using sensors to measure the weather conditions and a PIC to read the data. I

will be using the zigbee standard to transmit the data in packets.

I will use farnell to locate the sensors for the weather station and microchip to

source my zigbee transmitter.

Design philosophy

Air Speed Sensor

Temperature

Sensor

Humidity Sensor

Pressure Sensor

Radio

Transmitter

Receiver

Display

PIC

Microcontroller

Page 46: PIC Wireless Weather Station

2009-06-01

Wireless Weather Station

ELX3

Eoghan O’Sullivan [email protected] 46

Study some similar projects on this topic in order to understand my project more.

Delivery Date Assessment Criteria

Fri 10th

October

Submit first draft of Project Specification with Minutes

of Meetings for comments and feedback.

Fri 17th

October

Submit final draft of Project Specification signed by

supervisor.

Fri 24th

October

Submit first draft of project Plan with Minutes of

Meetings for comments and feedback.

Fri 7th

November

Submit final draft of Project Plan signed by supervisor.

Fri 21st

November

Submit Background Research/Information Chapter of

Project Report.

Fri 28th

November

Prepare 10minute Project Presentation.

Mon 1st –

Wed 3rd

December

Present Project Presentation and receive feedback.

Mon 8th

Thur 11th

December

Present Project Presentation with 5 minute Q&A session

to Departmental Staff.

Fri 12th

December

Submit Written Report containing title page, table of

contents, Chapter 1 Introduction, Chapter 2 Background

Research, Appendix 1 Minutes of Meetings, Appendix 2

Project Specification and Appendix 3 Project Plan.

Fri 27th

February

I hope to have the software for the PIC completed and

communicating with the Zigbee.

Fri 27th

March

I hope to have the portfolio well under way and the

project almost complete.

Thur 29th

April

Around this date I will be giving my presentation on my

project and have a question and answers session.

Fri 1st

May

I will had in my project plan book and prototype up to be

corrected and assessed

Page 47: PIC Wireless Weather Station

2009-06-01

Wireless Weather Station

ELX3

Eoghan O’Sullivan [email protected] 47

Documentation The word processor I will use for this project is Microsoft Word. The templates

for the documents are from the LIPS project model, created by Christian

Krysander and Thomas Svensson.

.

Page 48: PIC Wireless Weather Station

2009-06-01

Wireless Weather Station

ELX3

Eoghan O’Sullivan [email protected] 48

Appendix 4: Project Plan

Project Plan Eoghan O’Sullivan

Version 1.1

Status

Name of Reviewer Date

Reviewed

Approved

Page 49: PIC Wireless Weather Station

2009-06-01

Wireless Weather Station

ELX3

Eoghan O’Sullivan [email protected] 49

Contents

STATUS ............................................................................................................................................... 48

DOCUMENT HISTORY .................................................................................................................... 51

AN OVERVIEW OF THE SYSTEM ................................................................................................ 52

............................................................................................................................................................... 52

1.1. PURPOSE AND GOAL............................................................................................................ 52 1.2. DELIVERABLES ................................................................................................................... 52

2. DELIVERY ................................................................................................................................. 52

2.1. WHAT IS NOT INCLUDED .................................................................................................... 53

WORK BREAKDOWN STRUCTURE ............................................................................................ 53

THIS IS A LIST OF HOW LONG APPROXIMATELY IT WILL TAKE TO COMPLETE

THE FOLLOWING TASKS. ............................................................................................................. 53

2.2. BEFORE START .................................................................................................................... 53 2.3. DURING THE PROJECT ........................................................................................................ 53 2.4. AFTER THE PROJECT .......................................................................................................... 54

MEETING PLAN ................................................................................................................................ 54

RESOURCE PLAN ............................................................................................................................. 54

2.5. PERSONS .............................................................................................................................. 54 2.6. COMPONENTS AND EQUIPMENT ........................................................................................ 54 2.7. WORK ROOMS ..................................................................................................................... 54 2.8. ECONOMY ............................................................................................................................ 54

MILESTONES AND TOLLGATES ................................................................................................. 54

2.9. MILESTONES ....................................................................................................................... 54 2.10. TOLLGATES ......................................................................................................................... 55

SCHEDULE ......................................................................................................................................... 55

RISK ANALYSIS ................................................................................................................................ 55

Page 50: PIC Wireless Weather Station

2009-06-01

Wireless Weather Station

ELX3

Eoghan O’Sullivan [email protected] 50

REFERENCES .................................................................................................................................... 56

Page 51: PIC Wireless Weather Station

2009-06-01

Wireless Weather Station

ELX3

Eoghan O’Sullivan [email protected] 51

Document history

Versio

n

Date Changes sign Reviewed

0.1 21st October 2008 First draft Eos

1.1 5th November 2008 Second draft Eos

Page 52: PIC Wireless Weather Station

LiTH

Projektuppgiftstitel 2006-09-14

Projektkursens namn Projektgrup LIPs

Dokumentansvarig ev. e-postadress till projektgr

project report 52

An overview of the system

Purpose and goal

This system has various sensors which measure the weather conditions, a microcontroller then

sends them to a transmitter where data is sent via a wireless to a receiver and the data is

displayed on a display.

Deliverables

Delivery Date Assessment Criteria

Fri 10th

October

Submit first draft of Project Specification with Minutes of

Meetings for comments and feedback.

Fri 17th

October

Submit final draft of Project Specification signed by

supervisor.

Fri 24th

October

Submit first draft of project Plan with Minutes of

Meetings for comments and feedback.

Fri 7th

November

Submit final draft of Project Plan signed by supervisor.

Fri 21st

November

Submit Background Research/Information Chapter of

Project Report.

Air Speed Sensor

Temperature

Sensor

Humidity Sensor

Pressure Sensor

Radio

Transmitter

Receiver

Display

PIC

Microcontroller

Page 53: PIC Wireless Weather Station

2009-06-01

Wireless Weather Station

ELX3

Eoghan O’Sullivan [email protected] 53

Fri 28th

November

Prepare 10minute Project Presentation.

Mon 1st –

Wed 3rd

December

Present Project Presentation and receive feedback.

Mon 8th

Thur 11th

December

Present Project Presentation with 5 minute Q&A session

to Departmental Staff.

Fri 12th

December

Submit Written Report containing title page, table of

contents, Chapter 1 Introduction, Chapter 2 Background

Research, Appendix 1 Minutes of Meetings, Appendix 2

Project Specification and Appendix 3 Project Plan.

Fri 27th

February

I hope to have the software for the PIC completed and

communicating with the Zigbee.

Fri 27th

March

I hope to have the portfolio well under way and the

project almost complete.

Thur 29th

April

Around this date I will be giving my presentation on my

project and have a question and answers session.

Fri 1st

May

I will had in my project plan book and prototype up to be

corrected and assessed

What is not included

This system does not have the capabilities to transmit over long distances so it would not be

the most practical weather station to be made.

Work Breakdown Structure

This is a list of how long approximately it will take to complete the following tasks.

Before start

No Activity Description Est. Time

1. Project Specification Write project specification 2 days

2. Project Plan Research project and produce project plan 2.3days

3. Backgroung Research and

Information Chapter

Research what exaclty the project is about and an

information chapter for the project book

2 days

4. Order Components Order the sensors for the project 1 day

During the project

Page 54: PIC Wireless Weather Station

2009-06-01

Wireless Weather Station

ELX3

Eoghan O’Sullivan [email protected] 54

No Activity Description Est. Time

5. Get the sensors working To read in data onto the PIC 3 weeks

6. Set up transmitter Set up the Zigbee protocol to send data 2 weeks

7. Write software To take the variables and put them in a program

to and display the result on the screen

3 weeks

8. Test it as a whole unit and

tidy up the appearance

Make sure its working and to make a housing for

the board and transmitter

2 weeks

After the project

No Activity Description Est. Time

9. Final Report A detailed written report on the project 1 weeks

10. Final Presentation A 15minute presentation on the project where i

show a working prototype

2 weeks

Meeting plan My supervisor Dr.Oliver Gough and I meet once a week in PF46. The time varies week to

week due to status of the project.

Resource plan

Persons

Dr. Oliver Gough and Eoghan O’Sullivan

Components and Equipment

I will need to order sensors for the weather station, included in the list are: Temperature

sensor, Humidity sensor and a Wind speed sensor.

I also need to order a PIC board and a zigbee standard system to transmit my data.

For the software I will be using MatLab to write up code for the PIC.

Work rooms

Most of the work I can do in the senior lab B176a, I can also do work at home as I have tools

to assist me.

Economy

I am hoping to source all the components for under 60eur. This is subject to change as I have

not confirmed what exactly I need yet.

Milestones and tollgates

Milestones

Page 55: PIC Wireless Weather Station

2009-06-01

Wireless Weather Station

ELX3

Eoghan O’Sullivan [email protected] 55

No Description Date

1. Requirement specification ready 24/10/2008

2. Project Plan ready 7/11/2008

3. Background Research/Information Chapter of Project Report ready. 21/11/2008

4. Order Components 11/11/2008

5. Sensors working 20/02/2009

6. T Transmitter working 6/03/2009

7. Get software fully written and working 27/03/2009

8. Fully working and testing underway 10/04/2009

9. W Final written report 17/04/2009

10. F Final Presentation 30/04/2009

Tollgates

No Description Date

1 Approval of project specification 24/10/2008

2 Approval of project plan 7/11/2008

3 Approval of Chapter one of project report 21/11/2008

4 Sensors working and reading on the PIC 20/02/2009

5 Sending data to a PC 27/03/2009

6 Working fully with software implemented 10/04/2009

7 Final Presentation 30/04/2009

Schedule

Risk analysis Programming is my weakness, I hope to have the sensors connected to the PIC and reading

the data with no flaws. If I get bogged down in programming I might lose time that I could

use in doing something else to the project.

Page 56: PIC Wireless Weather Station

2009-06-01

Wireless Weather Station

ELX3

Eoghan O’Sullivan [email protected] 56

References Farnell.com is where I sourced components.

From research on the CIT server I found past projects that I got some ideas from and found an

interesting document of a similar project in the U.S:

www.web-ee.com/schematics/instumentations/wireless-weather-station