TEMPERATURE MONITORING SYSTEM

advertisement
TEMPERATURE MONITORING SYSTEM
SITI ZAHAMIMAH BINTI KASIM @ MANSOR
UNIVERSITI TEKNOLOGI MALAYSIA
iii
Specially Dedicated to
My beloved family
Mak ( Che Faridah Othman )
Ayah ( Kasim @ Mansor Ismail )
Siblings and friends
For their supports, blessings, encouragements
and inspirations throughout my journey of education
iv
ACKNOWLEDGMENT
First of all, I am greatly indebted to Allah SWT on His blessing in completed
my Final Year for Bachelor Degree of Electrical Engineering (Telecommunication).
I would like to express my gratitude to honourable Professor Dr. Norsheila
Bt. Fisal, my project supervisor for inspired me with motivation, guidance,
encouragement and assistance which finally led me to the completion of this project.
Most importantly, a special thanks to my parents and family for their love,
encouragement and support throughout my journey of life. A very big appreciation
goes to Mr. Arif, Mr. Ajis, Mr Adib, friends and all individuals who have directly or
indirectly offered help, support and suggestions, contributing towards the successful
completion of Temperature Monitoring System. Not forgetting, Yayasan TM and
Universiti Teknologi Malaysia for supporting this project financially.
Guidance, co-operation and encouragement from all people above are
appreciated by me in sincere.
v
ABSTRACT
Wireless monitoring of temperature is becoming an essential requirement for
many industries. Food safety and quality have become particular areas of concern to
the public. In fact, the electronic temperature monitoring system is now a standard
specification item for temperature controlled transport as the used for monitoring
areas that are difficult to access or situation where cables simply cannot be used.
The key requirements for remote temperature monitoring system include easy
interrogation at any time, accurate temperature measurement and low power
consumption to ensure long operation lifetime. This temperature monitoring system
require the system to let the sensors and software do all the monitoring work,
continuous monitoring and complete management reporting for temperature
surrounding condition. Sound alarm notification ensured the unsafe environment or
high temperature so an immediate action can be taken. Such a temperature
monitoring system consists of two parts: the transmitter base and the receiver base.
In this project, a temperature monitor was implemented using PIC16F877
microcontrollers and RF module allowed wireless communication operated at 433.92
MHz. The transmitter base consists of a sensor to sense temperature condition,
processed, modulated and broadcast continuously to receiver. Then receiver will
capture the signal, demodulate, process data, display data on LCD panel and the
levels by differences colour LEDs.
The time interval between transmitter and
receiver is very small within a second. However the data received is unstable and
more effective by wired communication.
vi
ABSTRAK
Pemerhati suhu tanpa wayar kini menjadi semakin penting dalam bidang
perindustrian.
Terutamanya dalam pengawasan kualiti dan keselamatan produk
pemakanan yang sangat dititikberatkan oleh masyarakat hari ini. Kini sistem
pemerhati suhu elektronik menjadi spesifikasi piawai bagi pegawal suhu yang
digunakan untuk mengawasi kawasan yang sukar untuk dicapai atau situasi dimana
kabel tidak dapat digunakan. Keperluan asas sistem pemerhati suhu jarak jauh ini
termasuklah kemudahan pengawasan pada sebarang masa, pengukuran suhu yang
tepat dan penggunaan kuasa yang minimum untuk operasi jangkamasa panjang.
Sistem ini membenarkan pengesan dan pengaturacaan menjalankan kesemua proses
pemerhatian
dan merekodkan suhu sekeliling dengan lengkap. Penggera bunyi
memastikan pada keadaan tidak selamat dan suhu yang tinggi, tindakan segera dapat
dilakukan.. Sistem ini mengandungi dua bahagian iaitu tapak penghantar dan
penerima yang menggunakan
microcontroller PIC16F877 dan RF modul yang
membenarkan komunikasi tanpa wayar pada frekuensi 433.92 MHz. Penghantar
mengandungi satu pengesan suhu dan melibatkan kerja-kerja pemprosesan,
pemodulatan dan penghantaran isyarat
yang berterusan. Manakala penerima
melibatkan pengesanan isyarat, penyahmodulatan, pemperosesan data dan paparan
pada skrin LCD dimana tahap suhu tertentu dipaparkan pada lima LED berlainan
warna. Masa yang diambil antara penghantar dan penerima sangat kecil iaitu sekitar
satu saat. Bagaimanapun data yang diterima kurang stabil dan sistem ini lebih
berkesan bagi penyambungan secara wayar.
vii
TABLE OF CONTENTS
SUBJECT
CHAPTER 1
PAGE
TITLE
i
DECLARATION
ii
DEDICATION
iii
ACKNOWLEDGEMENT
iv
ABSTRACT
v
ABSTRAK
vi
TABLE OF CONTENTS
vii
LIST OF TABLE
ix
LIST OF FIGURES
x
LIST OF ABBREVIATIONS
xii
LIST OF APPENDICES
xiii
OVERVIEW
1.1 Introduction
1
1.2 Objective
2
1.3 Scope of Work
2
1.4 Problem Statement
3
1.5 Project Background
4
1.6 Literature Review
6
1.6.1 Manual Data Collection
6
1.6.2 Chart Recorders
7
1.6.3 Centralized Monitoring Systems
8
1.7 Thesis Outline
9
viii
CHAPTER 2
MONITORING SYSTEM DESIGN
2.1 Methodology
10
2.2 Software Tools
14
2.2.1 Proteus-VDM ISIS
2.3 Hardware Design
21
2.3.2 Transmitter
22
2.3.3 Receiver
23
2.3.4 Temperature Sensor
23
2.3.5 Calibration LEDs
26
2.3.6 Analog to Digital Converter
26
2.3.7 LCD Display
27
2.3.8 Buzzer
27
2.3.9 9V DC Power Supply
27
2.3.10 Reset Button
28
2.4.1 Assembly Language
CHAPTER 4
17
2.3.1 Microcontroller Unit
2.4 Software Development
CHAPTER 3
14
28
32
RESULT AND DISCUSSION
3.1 Sensor Nodes on Transmitter Base
34
3.2 The Calculation (Calibration Result)
36
3.3 Data Display in Wired Communication
38
3.4 Data Display in Wireless Communication
39
CONCLUSION AND SUGGESTION
4.0
Conclusion
4.1 Suggestion for Future Work
42
43
REFERENCES
44
APPENDICES
46
ix
LIST OF TABLE
TABLE NO.
3.1
TITLE
The calibration result
PAGE
36
x
LIST OF FIGURES
FIGURE NO.
TITLE
PAGE
1.1
General block diagram of the Transmitter Base
5
1.2
Temperature Levels Indicator LEDs
5
1.3
General block diagram of the Receiver Base
6
2.1
System Design flowchart
12
2.2
System Design flowchart (continue)
13
2.3
Proteus VSM-ISIS user interface and design tools
15
2.4
ISIS Devices Libraries Manager
15
2.5
Edit Component and upload program
16
2.6
Schematic design field
16
2.7
Transmitter Base schematic
18
2.8
LEDs Temperature Level Indicator
19
2.9
Receiver Base schematic
19
2.10
Voltage regulator circuit
20
2.11
Crystal oscillator circuit
20
2.12
Transmitter
22
2.13
Receiver
23
2.14
LM35DZ pins configuration
24
2.15
Temperature sensor, LM35DZ
25
2.16
Calibration LEDs
26
2.17
Transmitter Base program flow
30
2.18
Receiver Base program flow
31
3.1
Analog and digital data obtained in 28 degrees Celsius
34
xi
3.2
Calibration LEDs and Temperature Level LEDs in
35
o
normal condition for 28 C
3.3
Calibration LEDs on 50 oC
35
3.4
The wired communication between the both bases
38
3.5
The result on Receiver Base (wired)
39
3.6
The transmitted data (wireless)
40
3.7
The received data (wireless)
41
xii
LIST OF ABBREVIATIONS
A/D
-
Analog to Digital Converter
ADC
-
Analog to Digital Converter
ADCON
-
Analog Digital Control
ADRESL
-
Analog Digital
AM
-
Amplitude Modulation
BOR
-
Brown Out Reset
CCP
-
Capture/Compare/PWM
CM
-
Centralized Monitoring
CPU
-
Centre Programmable Unit
dec
-
Decimal
EEPROM
-
Electrically Erasable Programmable Read Only Memory
hex
-
Hexadecimal
LSB
-
Lowest Significant Bit
MCLR
-
Master Clear
MCU
-
Micro Controller Unit
MHz
-
Mega Hertz
MSB
-
Most Significant Bit
PWM
-
Pulse Width M
RAM
-
Random Access Memory
RF
-
Radio Frequency
SAW
-
Surface Acoustic Wave
UART
-
Universal A Receiver Transmitter
uip
-
Micro-IP
USART
-
Universal Synchronous Asynchronous Receiver Transmitter
VSM
-
Virtual System Modeling
xiii
LIST OF APPENDICES
APPENDIX A : Transmitter and Receiver Node Source Code
APPENDIX B : Block Diagram and Pin Configuration
CHAPTER 1
PROJECT OVERVIEW
1.1
Introduction
Wireless communication is expected to be a key technology for remote
sensing system, especially in remote monitoring multiple devices. The use of RFsignal is extremely desirable due to the ability to penetrate walls and ceilings. The
purpose of a remote monitoring system is to collect data at a place that is
inconvenient and to relay the data to a point where the data may be evaluated. The
project deal with the design of wireless temperature monitoring system that monitors
its surrounding temperature condition and display it on a LCD screen panel by using
RF as a remote communication medium. The focus of this project is to design and
build a wireless monitoring retrieval communication system that effectively
communicates between the transmitter and receiver bases. The rationale behind this
is to provide the user with the information regarding the temperature condition that
allows a smart remote monitoring.
2
1.2
Objective
The prime objective is to develop temperature sensor node for remote
monitoring application.
Secondly is to monitor the temperature conditions by
indicate the levels of temperature and display the data reading to help create a more
stable environment. So an immediate action can be taken if there is any critical
situation happens. Thirdly is to apply wireless monitoring system that utilizes of RF
transmitter and receiver, microcontrollers and the use of small antenna to allow
wireless temperature sensing devices to operate over an RF link.
1.3
Scope of Work
This project is divided into two main parts: transmitter base (sensor devices)
and the receiver base (collection and display devices). The transmitter and receiver
are implemented by preliminary studies on relevant subject regarding environment
monitoring fundamentals, knowledge on C Assembler Language and compiler,
circuit design and program loader, software tool, microcontroller etc.
Then an
analog temperature sensor LM35DZ, microcontroller PIC16F877, RF Transmitter
433.92 MHz (baud rate 4800, data rate 4.8kbit/sec), five LEDs for temperature
levels indicator and sound buzzer alarm is developed for sensor node (transmission
part). An equation is obtained from calibration works to match the actual and obtain
data by using eight LEDs for digital reading of ADC. Receiving part is developed by
RF Receiver 433.92MHz, LCD display panel, five LEDs indicate the temperature
level and a sound buzzer (alarm). The temperature result is displayed on LCD panel.
Programming works is conducted including ADC, USART and processing
part. Wired communication path is applied to compare the reliable data of applying
RF wireless. Then circuit is designed and implemented on board.
3
1.4
Problem Statement
Temperature monitoring system is designed to overcome any risk problem
involved inconvenient surrounding temperature.
Moreover, if there is many
locations needs to be monitored. These locations such as factory and equipment
room usually contain environmentally sensitive and expensive materials. Imagine if
a temperature monitoring system is developed to overcome all these situations, how
many advantages can be achieve? Especially sensitive and poisoned environment
such as room that contains poisoned gas can safe human life. Then for industry and
equipment that contain expensive materials, can reduce thousand dollars even
millions.
Furthermore a wireless temperature monitoring system is used for monitoring
areas that are difficult to access or situation where cables simply cannot be use. This
temperature monitoring system require the system to let the sensors and software do
all the monitoring work , continuous monitoring and complete management reporting
for temperature surrounding condition.
Sound alarm notification ensured the unsafe environment or high temperature
if happened and an immediate action can be taken to safe human life.
4
1.5
Project Background
This project consists of two major components, the transmitter base (contain
sensor devices) and the receiving base (collection and display devices). The wireless
monitoring system was designed as a stand-alone system consisting devices that can
be attached by surrounding temperature.
The transmitter base as shown in figure 1.1 consists of a microcontroller and
a temperature sensor mounted approximate to the base to obtain current temperature
in surrounding condition. The information which is the temperature parameter then
encoded using a microcontroller and sent through a transmitter at 433MHz. The
temperature levels will indicate the five ranges of current temperature in different
colours LEDs. In high level, buzzer provide as alarm notification as shown in figure
1.2.
While at receiver base, shown in figure 1.3 another microcontroller is used to
decode the received data and its parameter display on LCD panel. As transmitter,
receiver base also contains of temperature level with the same characteristic as in
figure below. The details of hardware design are explained in the next section.
5
8 LEDs for
calibration
process
Temperature
Sensor
5 LEDs as
different
temperature
level
indicator
PIC16F877
MCU
RF
Transmitter
433.92MHz
Buzzer
Alarm
Figure 1.1
Normal
Good
Green1
0°
General block diagram of the Transmitter Base
Precaution
Green 2
20°
Figure 1.2
Yellow
40°
Danger
Alert
Red1
60°
Red 2
80°
Temperature Levels Indicator LEDs
100°
6
LCD panel
display
RF Receiver
433.92MHz
PIC16F877
MCU
5 LEDs as
different
temperature
level
indicator
Buzzer
Figure 1.3
General block diagram of the Receiver Base
1.6
Literature Review
1.6.1
Manual Data Collection
Manual monitoring and data collection methods are still in wide use today.
Such methods usually involve one or more operators recording initialed readings on
a regular basis from a fixed read-out device (such as a digital thermometer or
hygrometer). These reading are usually entered on a prominently displayed chart
next to the area of interest, such as a refrigerator, freezer, or chamber.
7
Recording temperature readings in this method has some obvious advantages:
there is minimal equipment to purchase, there is next to nothing to maintain, and
everything is very quick and easy to set up.
Manual systems, though, can be very expensive to operate and are often
unreliable. For example, one hospital estimated labor costs of 3,000 hours per year of
valuable nursing time was taken up performing routine checks. Even so, the hospital
frequently had to deal with missing data that posed a risk to accreditation status. This
risk of missed readings increases even more during off-hours, when limited resources
can result in temperature checks simply not being made. In such cases, serious
problems can go undetected for days, resulting in serious damage. For the above
reasons, many facility managers can easily cost-justify a move from manual methods
to some sort of automated systems.
1.6.2
Chart Recorders
Chart recorders are one of the most popular ways to automatically collect and
locally display data. Such systems work by automatically recording and displaying
operating data on circular paper charts which are then changed regularly and
archived, usually on a weekly basis.
Chart recorders are relatively easy to deploy and are often included as a builtin feature of various pieces of equipment. Although often expensive, it is also simple
to operate and provide a prominent local display of real-time and short-term
historical data.
For all these advantages, chart recorders are still dependent on manual
processes to function properly. Charts must be changed regularly or else valuable
information can be lost. Chart recorders are also mechanical devices and often do not
8
provide sufficient accuracy, are prone to periodic mechanical failures, and tend to
require frequent calibration. In addition, in today's increasingly "connected" world,
chart recorders are now recognized as isolated devices that cannot be monitored,
alarmed, or otherwise accessed on a centralized or remote basis. This serves to make
data retrieval, such as required when auditors arrive, a time-consuming and tedious
process.
1.6.3
Centralized Monitoring Systems
Centralized monitoring (CM) systems consist of a network of remote sensors
that are wired back to distributed or centralized input panels. A CM system is an
auxiliary system adapted to the specific monitoring and reporting requirements of a
particular industry.
CM systems offer many advantages including remote monitoring, alarming,
and reporting. By avoiding the need for manual data collection and chart
replacement, such systems are a significant time-saving alternative to chart recorders
and manual methods.
The main disadvantage to CM systems is that they are costly, prone to
system-wide failures, and are insufficient in their ability to display localized
information. A typical CM system requires expensive data acquisition equipment as
well as a proprietary hard-wired network. Installation and wiring costs can often be
unaffordable, particularly in older buildings. The large capital expense of such
systems can also lead to an expanded budget approval process.
9
1.7
Thesis Outlines
This thesis comprises of five chapters. The first chapter briefly overviews the
background of wireless temperature monitoring system, sensor node developments,
objectives, problem statements and scope of this project.
Chapter 2 deals with the previous research and development of sensor node,
design architecture, software development and hardware design. This chapter
described those resources used and the development steps of both transmitter and
receiver node (base), such as hardware parts used and schematic circuits.
Chapter 3 discusses the results, including the calibration calculation and data
display by wired and wireless communication. The performance of data transmission
between transmitter node and receiver node as seen in the oscilloscope for both wired
and wireless is compared. For the comparison purposes, data observed at several
temperature values has been captured and analyzed.
Finally, Chapter 5 summarizes the works undertaken. Recommendations for
future work of this project are presented at the end of the chapter.
CHAPTER 2
MONITORING SYSTEM DESIGN
2.1
Methodology
Temperature Monitoring System is developed into two part that are
transmitting base part and receiving base part contains hardware and software design.
Hardware design is developed to build a smart temperature sensing that can sense,
transmit, receive and display a real data reading while software design consist
program to control the whole process of microcontroller regarding analysis, and
communication between devices. However this project will be implemented in five
stages. First thing is conducted preliminary studies on relevant subject regarding to
the project such as telemetry system fundamentals, knowledge on C Assembly
Language and compiler and circuit design. Upon completing this stage, the second
stage is interfaced the hardware.
Circuits are designed and simulated using
PROTEUS- ISIS to ensure they are all free of error.
Next stage is all about
programming woks using Micro-C compiler. There are a few important steps in
programming. Each time a segment of a new code is completed, it is to be simulated
to check for any error.
11
The fourth stage is integrated both software and hardware together to test the
whole system. Test system is done on software by using PROTEUS-ISIS before
implemented into hardware. Debugging work is implemented to identify and solve
problem. Next stage is to embed the software (programme) into PIC microcontroller
and circuit design is implemented into proto board. Then calibration works is done
to match the actual data and the obtain data.
Finally the whole system is
implemented into board. The overall project flow is shown in figure 2.1 and figure
2.2 as below.
12
Start
Literature Review
Design hardware circuit on software
( Proteus ISIS). Source from internet
and based on datasheets.
Debug or
redesign
circuit if
need to and
retest
Simulate
No
Successful?
Ok
Write a program for MCU using
Micro-C compiler
Run simulation
Revise the
source code.
Successful?
No
Ok
A
Figure 2.1
System Design flowchart
13
A
Combine program and hardware
circuit to test the whole system
using Proteus-ISIS
Simulate
No
Recheck and
reprogramme
No
Successful?
Ok
Success?
ok
Embed into MCU and
implement the circuit on
proto board
Test
Success?
Ok
Calibration works
No
Check for any
broken wire or
wrong connection.
Reprogram MCU
if necessary
Implement on board
Done
Figure 2.2
System Design flowchart (continue)
14
2.2
Software Tools
Software tools used for this project as mentioned in methodology part
including Proteus VSM-ISIS, Micro-C Compiler and WinPIC800. The software
exactly direct and easy user. It is basically used for design circuit, simulation,
compiling, and embedding programming to microcontroller.
2.2.1
Proteus-VDM ISIS
The software is used to create graphical model which is associated with
circuit simulation.
The model is created by drawing a circuit that mimics the
behavior of the real devices or schematic model as shown in. The components used
in the model circuit is drew from a library if primitives which are built into the
simulator itself. Proteus Virtual System Modeling (VSM) combines mixed mode
SPICE circuit simulation, animated components and microprocessor models with
loaded program in hex file to facilitate co-simulation of complete microcontroller
based designs. It is possible to develop and test such designs before a physical
prototype is constructed.
Figure 2.3 shows the interface and the design tool of Proteus VSM-ISIS
where the devices are chose from Devices Libraries Manager such as a mimic of
PIC16F877 microcontroller as shown in figure 2.4. While figure 2.5 shows the Edit
Component window to fill the selected microcontroller and clock cycle and to upload
the program in hex file. The whole of a mimic circuit is showed in schematic design
field as figure 2.6.
15
Figure 2.3
Proteus VSM-ISIS user interface and design tools
Figure 2.4
ISIS Devices Libraries Manager
16
Figure 2.5
Edit Component and upload program
Figure 2.6
Schematic design field
17
2.3 Hardware Design
The transmitting base unit is the main part of this project. It is consists of an
analog precision temperature sensor to gather data from surrounding environment. A
microcontroller chip used to process the gathered data, which is then encoded into
appropriate data packets and sent via the radio wave (RF) wireless transmitter at
433.92MHz and baud rate is 4800. Transmitting base also contains of eight LEDs
for analog data reading and five LEDs as temperature levels indicator.
Based on figure 2.7 below, a low power microcontroller, PIC16F877 is used
to control input and output of this system where output from temperature sensor is
connected to analog to digital converter (ADC) (port A analog channel AN0 ) that
already exist in the microcontroller. The temperature sensor output is an analog
voltage input to microcontroller which converts to digital data reading.
Once
conversion process is done, digital data is displayed by eight LEDs in two bytes
binary value on Port B with LSB bit is pin RB0 and MSB bit is pin RB7 (refers to
pin connection on Figure). The aim of this is important for calibration process, to
match between actual and obtained data. Then the range of temperature reading data
is indicated by LEDs indicator as temperature level as showed in figure 2.8. The
LEDs indicators level consists of five LEDs in different colours and have their own
meaning. This LEDs is connected to pin RD1 (Green1-good), pin RD0 (Green 2normal), pin RC3 (Yellow-precaution), pin RC2 (Red 1-alert), RC1 (Red 2-danger).
However when actual data is in high range or classified as in alert and danger mode,
a sound buzzer (pin RD2) ringing to realize user for action taken. At the same time
the two bytes digital data gathered is send via RF transmitter continuously.
While at the receiver part showed in figure 2.9, the receiver at the same
frequency (433.92 MHz) and baud rate (4800) as transmitter is expected to receive
the data sent and decoded using another microcontroller (PIC16F877 as used in
transmitting base). The actual data gathered then will be displayed on LCD panel
and the range of data will be indicated on LEDs. The temperature level has the same
18
characteristic as in transmitting base including a sound buzzer. LCD display is
connected to Port D (RD0-RD7) and pin E, RW and RS are connected to pin RB0,
RB1 and RB2.
Figure 2.10 shows the voltage regulator circuit, a LM7805 with 7V input and
5V output is connected to VDD pin of microcontroller. A 1N4007 diode and two
LEDs is used as a protector and indicator if short circuit happened. While figure
2.11 shows the circuit crystal oscillator with a 20MHz crystal and two 27 pF
capacitor.
Figure 2.7
Transmitter Base schematic
19
Good
Normal
Green1
0°
Precaution
Green 2
Danger
Alert
Yellow
Red1
20°
40°
Figure 2.8
LEDs Temperature Level Indicator
Figure 2.9
60°
Red 2
Receiver Base schematic
80°
100°
20
Figure 2.10
Voltage regulator circuit
Figure 2.11
Crystal oscillator circuit
21
2.3.1
Microcontroller Unit
The microcontrollers might look a bit difficult at first thought. The reason is
that there are lots of microcontrollers to choose from, each with its own instruction
set, architecture and programming tools. The PIC16F877A is a better choice to
develop a telemetry system like temperature remote sensing and monitoring because
of low cost and its special features.
The PIC16F877 is a high-performance FLASH microcontroller provides
users with the highest design flexibility possible. In addition up to 8K x14 words of
FLASH program memory, 256x 8 bytes EEPROM data memory, and 368x8 bytes of
user RAM. PIC16F877 also features an integrated 8-multi channel 10-bit Analogueto-Digital converter.
Peripherals include two 8-bit timers, one 16-bit timer, a
Watchdog timer, Brown-Out-Reset (BOR), In-Circuit-Serial Programming™, UART
for multi-drop data acquisition applications, and I2C™ or SPI™ communications
capability for peripheral expansion. Precision timing interfaces are accommodated
through two CCP modules and two PWM modules. The PIC16F877A is a lowpower consumption which is less than 0.6mA at 3V and 4MHz, low power and high
speed 8-bit CMOS Flash and EEPROM technology based on high performance RISC
CPU architecture with wide operating voltage range that is 2.0V to 5.5V and 20 MHz
clock input. The block diagram and pin configuration is showed in appendix.
22
2.3.2
Transmitter (RCT-433-AS)
The RCT-433-AS is ideal for RF remote control and alarm applications
where it low cost and longer ranges are required. The transmitter as showed in figure
2.12 is accurate at frequency 433.92 MHz is a small size surface mount module.
Operation from 1.5V to 12V supply power is suitable since this project was a battery
powered applications.
The power supply is bypass using a two 4.7uF ceramic
capacitor. This capacitor is placed close to power pins as possible. Its special
feature employs a SAW-stabilized oscillator, designed to provide accurate frequency
control for best range performance. SAW (Surface Acoustic Wave) resonators are
fundamental frequency devices that resonate at frequency much higher than crystals.
Figure 2.12
Transmitter
23
2.3.3
Receiver
The receiver, RCR-433-HP as showed in figure 2.13 is ideal for RF remote
control and alarm application where it low cost and longer ranges are required. The
receiver module requires no external RF components except for the antenna. The
super heterodyne design exhibits exceptional sensitivity and selectivity. The receiver
accurate at frequency 433.92 MHz and operate at 5V supply power is suitable since
this project was a battery powered applications. RCR-433-HP is a super-heterodyne
AM receiver.
Figure 2.13
Receiver
2.3.4 Temperature Sensor
Temperature is one of most common real world characteristics that system
needs to measure. An integral part of home automation systems centers around
temperature sensing. In this project temperature sensor is used in measuring external
data of surrounding environment. However the analog data collected need to convert
into a digital form.
24
In this project, a commonly utilized analog temperature sensor LM35DZ in
TO-92 package, which is readily available to perform ADC is used. The LM35DZ
operates from 0o C to 100oC. The temperature sensor is easy to use, cost-effective
sensor with decent accuracy (around +/- 2o C calibrated). It produces an output of
10mV per degree Celsius. The sensor is essentially a zener diode which reverse
breakdown voltage is proportional to absolute temperature. The sensors high
sensitivity allows it to be used with 10 bit or 12 bit analog. Figure 2.14 shows the
pin configuration of LM35DZ.
Figure 2.14
LM35DZ pins configuration
The temperature sensor’s voltage output is related to absolute temperature by
the following equation:
Vout = VoutTo * T/To
To: the known reference temperature where VoutTo was measured.
The nominal Vout To is equal to To*10mV/oC. So at 25oC, Vout To is
nominally 298K*10mV/oC = 2.98V (to be really accurate, it needs a reference
temperature and a voltmeter, but nominal values are o C for this purpose).
25
As the LM35 functions as a zener diode, no load impedance is required. The
schematic of the temperature sensor circuit is shown is figure 2.15. This schematic
shows how an LM35 was connected to operate appropriately. The resulting output of
temperature voltage was directly fed to the analog to digital converter for
measurement.
However for this project, temperature sensor is connected directly to pin AN0
of the microcontroller and the other way is used to get the actual data reading.
Sometimes this sensor become non linear or cannot be function properly but still can
able to sense. So, solution has been taken by using mercury thermometer to match
between the actual data and the obtain data. Its has be done by placing thermometer
approximately to sensor and analog data that was appears on LEDs in transmitting
base is used to conduct calibration that will be discuss later on calibration part.
Figure 2.15
Temperature sensor, LM35DZ
26
2.3.5
Calibration LEDs
Calibration works is done by increasing hairdryer volume to heat sensor to
obtain different temperature values and eight LEDs as indicators for eight bits digital
data value after ADC conversion finish. It is done to match between actual and
obtained data which detected using mercury thermometer. This calibration LEDs as
shown in figure 2.16 where LEDs are connected to port B and LSB bit is pin B0
while MSB bit is pinB7. Data appears while the LEDs is on, and recorded to get
equation with different temperature value.
Figure 2.16
2.3.6
Calibration LEDs
Analog to Digital Converter (ADC)
The module of an analog-to-digital converter (ADC) is an electronic device
that converts continuous signals to discrete digital numbers. Typically, an ADC
converts an input analog voltage to a digital number. However this project used
PIC16F877 integrated with 10 bit ADC to achieve the conversion. Conversion
happens when analog input charges a sample and hold capacitor. The output of the
sample and hold capacitor is the input into the converter.
The converter then
generates a digital result of this analog level via successive approximation. The A/D
conversion of the analog input signal results in a corresponding 10-bit digital
27
number. The A/D module has high and low voltage reference input that is software
selectable to some combination of VDD, VSS, RA2, or RA3.
2.3.7
LCD Display
LCD display panel is a 16 character x 2 lines display format with 5V single
power input. The LCD is reliability to operate in low and high range temperature
(-20 degrees Celsius to 80 degrees Celsius) that make it suitable to use.
2.3.8
Buzzer
In alarm system, buzzer is another way to fast notification of unneeded
condition happened to our system environment. In this project a sound buzzer
conducts as a warning action that temperature condition is in alert and danger
situation.
2.3.9 9V DC Power Supply
A 9V battery is used to supply a power to the CPU board (on
microcontroller). The reason is because the both base CPU are placed depend on
room situation and condition. So it is more practical to supply a power using a
portable battery. Because there are so many components on the base CPU board that
draw too much current. It is used a suitable voltage regulator to ensure that a
constant voltage of five volts (5V) would be supplied to all the components. In this
project LM7085 is most suitable because it gave a stable 5 volt voltage output from
range 7 volt to 10 volt input.
28
2.3.10 Reset Button
An external reset circuit is added by connecting a reset pushbutton to the
reset pin of the microcontroller. The reset button is connected to microcontroller on
MCLR pin.
2.4
Software Development
The software development for the Transmitter Base is relatively simple since
it involves in gathering the data, processing and transmitting. PIC16F877 able
programming in C Language and makes it easy to design and develop. Program
began with defined ports for LEDs temperature level and port is initialized before
starting the analog to digital converter (ADC). However these steps have been
followed for doing an ADC.
1.
2.
Configured the analog to digital A/D module:
•
Configure analog pin (ADCON1=10001110)
•
Select A/D input channel (ADCON0=00000001)
•
Select A/D conversion clock (ADCON0)
•
Turn on A/D module (ADCON0)
Start Conversion:
•
3.
Wait for A/D to complete
•
4.
Set GO/DONE bit (ADCON0)
Polling for the GO/DONE bit to be cleared
Read A/D result register ADRESL
29
Once the A/D conversion is finished, then the value is dumped in the
appropriate place in the ADRESL register and data is appears in temperature level
LEDs depends on it range as level indication. On the other hands two byte data,
number 44 and data gathered, is transmitted through the USART port to the
transmitter. The number 44 is able for filtering process. Once this is complete, the
state machine waits till the next 1000ms tick to continue sending. Figure 2.18 and
figure 2.19 show the flowchart of program development.
30
start
Defined Port
Initialized Variable
Start analog to digital conversion
Finish
conversion
No
Yes
Get the conversion result
Temperature value in specified
ranges indicate as temperature level
2 byte data send via transmitter
Delay 1000ms
Do forever
Figure 2.17 Transmitter Base program flow
While the receiver base program totally more difficult than transmitter base
by involved a few steps.
31
Start
Initialize port
Initialize Usart
Initialize LCD
Data ready
N
Y
Read Data
Condition = USART_read
Temp = USART_read
Temp=0
Data = 44?
N
Y
Condition = 0
Usart send Temp to port D
Display temp range as temp
level on LEDs and buzz if
alert condition
Convert Temp to Desimal
Display on LCD in ASCII
Done
Figure2.18
Receiver Base program flow
32
2.4.1
Assembly Language (C Language)
Assembly language is a mnemonic form of machine language.
It is a
medium-level language. In this project, the assembly language program is typed into
notepad and source code is saved as file *.asm C compiler is used to compile the
file.
Then assembler is called to translate the source code. The assembler reads
the source code file and produces an object file. The object code contains the
machine code and other information. But it does not necessarily contain the final
address assignment for each instruction. The assembler also produces a listing file.
The list file is a text file that cross reference source code instruction to hex. Then the
linker combines one or more object code files to produce hex file. The hex fail
contain the final machine code, including final address assignments.
A loader
converts the hex file into an executable form called binary file. For microcontroller,
the assembler and linker program are executed on a computer, not on the
microcontroller itself. These programs produce the machine code that can be loaded
into the microcontroller’s memory and hence the microcontroller can execute. The
machine code is the actual sequence of bytes shown in hex (stored in hardware in
binary).
This data sheet of PIC16F877 microcontroller contains simple code examples
that briefly show how to use various parts of the device. However must be aware
that not all C Compiler vendors include bit definitions in the header files and
interrupt handling in C is compiler dependent.
CHAPTER 3
RESULT AND DISCUSSION
This chapter discussed all of the verification of sensor nodes and the results
obtained. The application code was successfully compiled using Micro-C Compiler
determined in Chapter 2. The result is obtained for both wired and wireless to ensure
the data collected at receiver base is as same as what was transmitted. Result then is
analyzed in term of how temperature data is converted into digital form and bits
observed during transmit- receive process.
3.1
Sensor Nodes on Transmitter Base
Sensor nodes verification involved microcontroller obtained data from analog
temperature sensor, converted to digital form and displayed by bits on LEDs turn on.
This process is repeated and calibrated to attain a few data. The differences data is
compared with the actual data that measured by thermometer mercury to present an
equation. The equation presented is filled in source code (programming code) to
determine the new data. This data is sent through transmitter and at the same time
appeared in specified ranges as temperature level indicated by specified LED.
34
Figure 3.1 shows the obtained data, 28 oC in analog form that directly take
from sensor output pin (channel 2) and digital form on microcontroller transmit pin.
Here, data in analog voltage is converted to digital by verifying the change occurred.
Bits in digital signal change according to the changes of the analog signal. However
how it is verified 28 oC will be discuss later in result calculation.
Data changes
Figure 3.1
Analog and digital data obtained in 28 degrees Celsius
Figure 3.2 shows the eight bit ADC result indicated in eight LEDs that shows
3F (hexadecimal form) and temperature level was in normal condition. This result is
used in calibration process to obtain 28 oC as actual data which is discuss in result
calculation. Figure 3.3 shows the Calibration LEDs indicated the different value of
the obtain data when sensor is heated using hairdryer and temperature level was in
precaution condition.
35
Temperature
Level LEDs
Calibration Leds
Figure 3.2 Calibration LEDs and Temperature Level LEDs
in normal condition for 28 oC
Figure 3.3
Calibration LEDs on 50 oC
36
3.2
The Calculation (Calibration Result)
For the calibration result, the two bytes data is indicated by eight Calibration
LEDs . The ON LED is read as “1” and the OFF LEDs read as “0”. Table 3.1 below
shows the calibration result. The actual data (T) is data measured by mercury
thermometer and obtain data is data appears in the eight calibration LEDs.
Obtained Temperature
Actual
Calibration LEDs
Calibration LEDs
Temperature, (T)
(in Hex)
(in Decimal), (X)
29 °C
$3F
63
90 °C
$E0
224
Table 3.1
The calibration result
Actual temperature, T = m x + C ; where x is obtained data in Decimal and C is
constant.
29= m 63 + C
---------------equation (1)
90= m 224 + C ---------------equation (2)
Therefore,
m = 0.378= 1/2.64
C = 5.13 = 5
The equation obtained is,
T=0.378x +5 °C
37
To show the equation is exactly correct, example in figure 3.2 and figure 3.3,
which the actual temperature for 3F and 78 in hexadecimal is, 63 and 120 in
Decimal. Therefore,
$3F = 63 (dec)
$78 = 120 (dec)
The equation obtained is T = 0.378 x + 5 °C
So for $3F,
T = 0.378 (63) + 5 °C
= 28.814 °C
= 28 °C
And for $78, T = 0.378 (120) + 5 °C
= 50.36 °C
= 50°C
Based on above equation is true and LCD display the right data.
38
3.3
Data Display in Wired Communication
On receiver base data is obtained as same as what is transmitted and
temperature level LED showed as same as appeared in transmitter base. By wired
communication as showed the figure 3.4 below, the data on calibration LEDs is 3F
hex and was displayed 28 °C on receiver base. Figure 3.5 shows the data received
were true as discuss in calculation part above.
Figure 3.4
The wired communication between the both bases
39
Figure 3.5
3.4
The result on Receiver Base (wired)
Data Display in Wireless Communication
While on wireless communication, figure 3.6 shows the transmitted data 44
28 at 28 degrees Celsius is exactly correct. However, figure 3.7 shows the received
data is not stabled and muddled with the rubbish data. The correct data, 44 28
(circled) has been obtained at the receiver base.
40
Figure 3.6
The transmitted data (wireless)
41
The correct data
received at
Receiver Base:
44 28
Figure 3.7
The received data (wireless)
CHAPTER 4
CONCLUSION AND SUGGESTION
4.0
Conclusion
The project conclusion can be assessed using successful and unsuccessful
outcomes according to the original requirements that were expected from the finished
system. In this thesis, the development of temperature monitoring system using
sensor nodes for both transmitter and receiver has been presented. Although the
wireless development of sensor nodes is unsuccessful but using wired connection
between the both transmitter base and receiver base , the sensor nodes can do
sensing, processing and display the data receive has been successfully develop.
The source code for all the system were written in C Language and simulated
and compile using Micro-C Compiler which is an easy tool to provide an easy
environment and reliability for PIC microcontroller in designing system.
43
4.1
Suggestion for Future Work
The work carried out in this project emphasized on the development of
monitoring system, which constrain on sensing the temperature data, processing to
provide an easy uses design system and test the data transmission as well. For future
work it is strongly suggested to enhance this project by using any embedded protocol
such as uIP and TinyOS that very popular in remote monitoring and sensing devices
today.
Nowadays, the application for remote sensing system is not only for
monitoring devices but also controlling. By applying control process, the system
become more easy to user since immediate action can be take as fast as possible.
REFERENCES
1. Dr. K.V.K.K Prasad, V. Gupta, A.Dass, A.Verma, Dreamtech software Team
(2002). Programming for Embedded System: Cracking The Code. Wiley
Publishing, Inc.
2. D. Culler, D. Estrin and M. Srivastava (August 2004). Overview of Sensor
Networks. IEEE Computer.
3. Bruce Reynolds (2001). Using the LM34 Precision Fahrenheit Temperature
Sensor. Reynolds Electronics Web Site, URL: http://www.rentron.com/Pic
Basic/LM34.html.
4. James Cameron (2004). Quozl’s Temperature Sensor Project: Circuit Design.
Web Page, URL: http://quoal.us.netrek.org/ts/.
5. Bruce Reynolds (2002). PicBasic Experiment With The PIC16F877.
Reynolds Electronics Web Site, URL: http://www.rentron.com/PICX.html.
6. M. Tubaishat, S. Madria (2003). Sensor Network: An Overview. IEEE
Potentials.
7. J. Blumenthal, M. Handy, F. Golatoski, M. Haase, D. Timmermann (2002).
Wireless sensor networks - New Challenges in Software engineering.
University of Rostock, Germany.
8. Microchip Technology Inc (2001). PIC16F877 Data Sheet. Web Site, URL:
http://www.microchip.com.
45
9. Ampire Co. LTD, Jameco Electronics. LCD Display Panel 16x2 Data Sheet.
Web Site, URL: http://www.Jameco.com.
10. Radiotronix Inc (2005). Transmitter Module RCT-433-AS/ASB and RCRXXX-HP Data Sheets. Web Site, URL: http://www.radiotronix.com
11. National Semiconductor Corporation (November 2000). LM35 Precision
Centigrade Temperature Sensors. Web Site, URL: http://www.national.com.
APPENDIX A
TRANSMITTER AND RECEIVER NODE SOURCE CODES
47
**********************************************************************************
Code for Transmitter base (node)
Code Program: transmitter.c
Application: to transmit ADC value, display the temp ranges on LEDs
and calibration equation
********************************************************************
#define
BUZZ PORTD.F2
#define
GRN2 PORTD.F1
#define
GRN1 PORTD.F0
#define
YELW PORTC.F3
#define
RED1 PORTC.F2
#define
RED2 PORTC.F1
unsigned char TEMP, chksum, data;
void main(void)
{
temp=0;
usart_init(2400);
PORTC=0XFF;
TRISC.F3=0;
TRISC.F2=0;
TRISC.F1=0;
TRISA=0XFF;
TRISB=0;
TRISD=0;
PORTA=0;
PORTB=0;
PORTD=0;
ADCON0=0B00000001;
//ON ADCON0 USING AN0
ADCON1=0B10001110;
//
48
while(1)
{
if (ADCON0.GO==0)
//IF CONVERT FINISHED,
{ADCON0.GO=1;}
//DO NEW CONVERTION.
TEMP=ADRESL;
//29DEGREE=0X3F
//90 DEGREE=0XE0
TEMP=TEMP/2.64+5;
USART_WRITE(44);
//FILTER
USART_WRITE(TEMP);
DELAY_MS(1000);
// }
PORTB=ADRESL ;
If (TEMP>0&&TEMP<20)
//GREEN CONDITION
{BUZZ=0;RED2=0;RED1=0;YELW=0;GRN1=0;GRN2=1;}
else if (TEMP>19&&TEMP<40)
//GREEN TWO CONDITION
{BUZZ=0;RED2=0;RED1=0;YELW=0;GRN1=1;GRN2=0;}
else if (TEMP>39&&TEMP<60)
//PRECAUTION CONDITION
{BUZZ=0;RED2=0;RED1=0;YELW=1;GRN1=0;GRN2=0;}
else if (TEMP>59&&TEMP<70)
//ALERT 1 CONDITION
{BUZZ=1;RED2=0;RED1=1;YELW=0;GRN1=0;GRN2=0;}
else if (TEMP>69&&TEMP<255) //WARNING CONDITION
{BUZZ=1;RED2=1;RED1=0;YELW=0;GRN1=0;GRN2=0;}
}
}
49
********************************************************************
Code for receiver base (node)
Code Program: receiver.c
Application: to receive ADC value, usart, display data on LCD and
temp ranges on LEDs and calibration equation
********************************************************************
#define E
PORTB.F0
#define RW
PORTB.F2
#define RS
PORTB.F1
void E_PULSE();
void LCD_INT();
void LCD_PR(unsigned char data);
void LCD_UPDATE(unsigned char newer);
unsigned char TEMP,condition;
unsigned char sa,puluh,ratus;
unsigned char ctr, chksum, chksum_;
unsigned char hdr[2];
void main(void)
{ TEMP=0;
TRISB=0;
TRISD=0;
TRISE=0;
PORTD=0;
PORTB=0;
TRISC.F3=0;
USART_INIT(2400);
LCD_INT();
DELAY_MS(100);
LCD_PR('T');
LCD_PR('E');
LCD_PR('M');
LCD_PR('P');
LCD_PR(':');
RS=0;RW=0;
PORTD=0B11001010;//
E_PULSE();
LCD_PR('b');
50
LCD_PR('y');
LCD_PR(':');
LCD_PR('I');
LCD_PR('M');
LCD_PR('A');
while(1){
if (Usart_Data_Ready()) {
condition=Usart_read();temp=usart_read();
if (condition==44) {
condition=0;Usart_Write(temp);
} else {
temp=0;
}
}
LCD_UPDATE(TEMP);
if(TEMP>0&&TEMP<20)
//GREEN CONDITION
{BUZZ=0;RED2=1;RED1=1;YELW=1;GRN1=1;GRN2=0;}
else if(TEMP>19&&TEMP<40)
//GREEN TWO CONDITION
{BUZZ=0;RED2=1;RED1=1;YELW=1;GRN1=0;GRN2=1;}
else if(TEMP>39&&TEMP<60)
//PRECAUTION CONDITION
{BUZZ=0;RED2=1;RED1=1;YELW=0;GRN1=1;GRN2=1;}
else if(TEMP>59&&TEMP<70)
//ALERT 1 CONDITION
{BUZZ=1;RED2=1;RED1=0;YELW=1;GRN1=1;GRN2=1;}
else if(TEMP>69&&TEMP<255)
//WARNING CONDITION
{BUZZ=1;RED2=0;RED1=1;YELW=1;GRN1=1;GRN2=1;}
//}
}
}
51
void LCD_UPDATE(unsigned char newer)
{
RS=0;RW=0;
PORTD=0B10000110;//TEMPRETURE ADDRESS
E_PULSE();
ratus=newer/100;
//CONVERT HEX TO DEC
puluh=(newer%100)/10;
sa=newer%10;
LCD_PR(ratus+0x30);
//DISPLAY DEC+0X30 TO BE ASCII
LCD_PR(puluh+0x30);
LCD_PR(sa+0x30);
LCD_PR(0xdf);
LCD_PR('C');
}
void E_PULSE()
{
E=0;
DELAY_MS(20);
E=1;
DELAY_MS(20);
E=0;
DELAY_MS(20);
}
void LCD_INT()
{
RS=0;RW=0;
PORTD=0B00111100;
E_PULSE();
DELAY_MS(100);
PORTD=0B00001100;
E_PULSE();
DELAY_MS(100);
PORTD=0B00000001;
E_PULSE();
DElAY_MS(100);
/* PORTD=0B00000111;
E_PULSE();*/
}
void LCD_PR(unsigned char data)
52
{
RS=1;
PORTD=data;
E_PULSE();
}
APPENDIX B
HARDWARE BLOCK DIAGRAM AND PINS CONFIGURATION
54
Block Diagram of microcontroller PIC16F877
55
Pins Configuration of PIC16F877A
56
Pins Description
57
58
Block Diagram of LCD display panel
59
Pin Configuration Table
Download