You are on page 1of 60

Electrical and computer engineering BSC thesis 2014

DUAL APPLICATION OF MICROCONTROLLER

BASED FIRE MONITORING

AND

MOSQUITO REPELLANT SYSTEM

SUBMITTED TO JIMMA UNIVERSITY, JIMMA INSTITUTE OF TECHNOLOGY, DEPARTMENT


OF ELECTRICAL AND COMPUTER ENGINEERING IN PARTIAL FULFILLMENT OF THE
REQUIREMENTS FOR THE DEGREE OF BACHELOR OF SCIENCE IN ELECTRICAL AND
COMPUTER ENGINEERING
Electrical and computer engineering BSC thesis 2014

Declaration
We assure and assert that the work contained in this thesis is the sole endeavor of
ourselves and free of plagiarism and other’s work except where explicitly stated . In
addition this work has not been submitted to obtain another degree or professional
qualification; thereby we are responsible with this regard and confirm it with our sign.

NAME ID SIGN

ASCHALEW ALENE 00149/02

ABDISA GEMECHU 00013/02

MOSISA KITILA 01576/01

TESHALE TESFAYE 00797/02

SOLOMON ASFAW 00736/02

ZEWDE DEMISSIE 00923//02

Advisor’s sign approval

Date

I
Electrical and computer engineering BSC thesis 2014

Acknowledgement
We are very grateful from the very bottom of our hearts for individuals who were in front line in
supporting us whenever their support was essential in doing this thesis. The lion share of our
gratitude goes to our project advisor MR Arun, who was a constant source of inspiration and
motivation throughout the course of the project. His sage advice, insightful criticisms, and
patient encouragement aided the accomplishment of this thesis in innumerable ways.

It is worth mentioning the contribution of head of department of Electrical and Computer


Engineering MR Dawit Leykun for his positive and unconditioned support from rendering us
important circuit chips up to advising us whenever we in touch him.

II
Electrical and computer engineering BSC thesis 2014

Dedication
We dedicate this THESIS to our parents and teachers. Without their patience, understanding,
support, guidance and most of all their affection, the completion of this work would not have been
possible.

III
Electrical and computer engineering BSC thesis 2014

Table of content

Contents
...................................................................................................................................................................... 1
Declaration ..................................................................................................................................................... I
Acknowledgement ........................................................................................................................................ II
Dedication .................................................................................................................................................... III
Table of content ........................................................................................................................................... IV
LIST OF TABLES ...................................................................................................................................... VII
LIST OF FIGURES ......................................................................................................................................... VIII
Abstract ...................................................................................................................................................... VIII
Chapter One .................................................................................................................................................. 1
1. Introduction ........................................................................................................................................... 1
1.1 Background ......................................................................................................................................... 1
1.2 Statement of the problem .................................................................................................................. 3
1.3 Objectives ........................................................................................................................................... 3
1.3.1 General Objective ........................................................................................................................ 3
1.3.2 Specific objective ......................................................................................................................... 3
1.4 Methodology....................................................................................................................................... 4
1.4.1 The software part......................................................................................................................... 4
1.4.2 The hardware part ....................................................................................................................... 4
1.5 Scope ................................................................................................................................................... 4
1.6 Problem Identification ........................................................................................................................ 5
Chapter Two .................................................................................................................................................. 6
2. Literature review ................................................................................................................................... 6
2.1 Introduction ........................................................................................................................................ 6
2.2 Related works ..................................................................................................................................... 6
2.3 Hardware Tools ................................................................................................................................... 7
2.3.1 PIC16F877a Microcontroller ........................................................................................................ 8
2.4 primary sensing units ........................................................................................................................ 11

IV
Electrical and computer engineering BSC thesis 2014

2.4.1 Smoke sensor ............................................................................................................................. 11


2.4.2 LM35 (Temperature Sensor) ...................................................................................................... 12
2.4.3 Light Dependent Resistor ........................................................................................................... 13
2.4.4 Flame sensor .............................................................................................................................. 13
2.5 LCD display (LM016L) ........................................................................................................................ 13
2.5.1 PIN Description .......................................................................................................................... 14
2.6 Triple five timers (NE555) pin description ........................................................................................ 15
2.7 Servo motor ...................................................................................................................................... 15
2.7.1 Using Servomotors with the PIC Microcontroller ...................................................................... 16
2.7.2 Working principle of servo motor .............................................................................................. 16
2.7.3 Servo motor control ................................................................................................................... 17
2.8 GSM Modem ..................................................................................................................................... 17
2.9 Voltage regulator (78L05) ................................................................................................................. 18
2.9.1 Working principle of voltage regulator ...................................................................................... 18
2.10 Piezo speaker .................................................................................................................................. 19
2.11 Capacitor ......................................................................................................................................... 19
2.12 Resistor ........................................................................................................................................... 20
2.13 Crystal oscillator .............................................................................................................................. 21
2.14 Comparator ..................................................................................................................................... 21
Chapter Three ............................................................................................................................................. 23
3. Design and analysis ............................................................................................................................. 23
3.1 Design................................................................................................................................................ 23
3.2 Description of Block Diagram ............................................................................................................ 23
3.3 Flow chart ......................................................................................................................................... 25
3.4 Circuit Design .................................................................................................................................... 26
Chapter Four ............................................................................................................................................... 34
4. Result and Discussion.......................................................................................................................... 34
4.1 Result ................................................................................................................................................ 34
4.1.1 Expected result from the Hardware circuit components .......................................................... 34
Chapter Five ................................................................................................................................................ 38
5. Conclusion and recommendation ........................................................................................................ 38

V
Electrical and computer engineering BSC thesis 2014

5.1 Conclusion ........................................................................................................................................ 38


5.2 Recommendation.............................................................................................................................. 39
Reference .................................................................................................................................................... 40
Appendix A .................................................................................................................................................... A
Appendix B .................................................................................................................................................... C

VI
Electrical and computer engineering BSC thesis 2014

LIST OF TABLES
Table 1 Description of input and output ports with its size .......................................................... 10
Table 2 pin description of LCD display........................................................................................ 14
Table 3 capacitor selection for crystal operation .......................................................................... 27

VII
Electrical and computer engineering BSC thesis 2014

LIST OF FIGURES
Figure 2. 1 smoke sensor ............................................................................................................................ 12
Figure 2.2 temperature sensors ................................................................................................................... 12
Figure 2.3 character LCD type HD44780 PIN diagram ............................................................................. 14
Figure 2.4 voltage regulator(78L05) ........................................................................................................... 18
Figure 2.5 voltage regulator circuit ............................................................................................................. 20
Figure 3.1 general block diagram system ................................................................................................... 23
Figure 3.2 overall flow chart of the system ................................................................................................ 25
Figure 3.3 Circuit design of fire monitoring and mosquito repellent system ............................................. 26
Figure 3.4 power supply of the pic microcontroller .................................................................................... 27
Figure 3.5 XT oscillators ............................................................................................................................ 28
Figure 3.6 analogue temperature sensor of LM35 ...................................................................................... 28
Figure 3.7 Fire detection circuit .................................................................................................................. 29
Figure 3.8 Smoke detection circuits ............................................................................................................ 29
Figure 3.9 Piezo-speaker circuits ................................................................................................................ 30
Figure 3.10 Circuit of LED-RED................................................................................................................ 31
Figure 3.11 Emergency exit door activator of a servo motor ..................................................................... 31
Figure 3.12 Serial port of mobile GSM module ......................................................................................... 32
Figure 3.13 Electronic mosquito repellent systems .................................................................................... 33
Figure 4.1 PIC development board.............................................................................................................. 34
Figure 4.2 an emergency exit door activator motor .................................................................................... 35
Figure 4.3 Alarm circuit activated when high signal comes. ...................................................................... 35
Figure 4.4 GSM circuit when it is interface with the Nokia mobile ........................................................... 36
Figure 4.5 red light circuits ......................................................................................................................... 36
Figure 4.6 LCD display for <50 degree centigrade .................................................................................... 37
Figure 4.7 LCD display for >50 degree centigrade .................................................................................... 37

Abstract
The project deals with the dual application microcontroller based fire monitoring and mosquito
repellant system. It is integrated to solve two basic community problem oriented systems which
is fire monitoring system that endangers different resources and the mosquito repellant system in
which it repels the mosquito from where the system is in act. The developed system controls fire

VIII
Electrical and computer engineering BSC thesis 2014

hazards and minimizing the risk that will be resulted with affordable materials and the mosquito
repellant circuit developed will create sound frequency which disturbs the mosquito to leave the
area. Additionally, the project deals with the general and specific objectives of the project. The
analysis of the overall design components, their working principle and controlling method are
also analyzed. The main purpose of this project is to overcome problem of fire dangers and
mosquito repellant method with integrated embedded system software. Finally, results and
discussion, conclusion and limitation with constructive recommendation are also part of the
project.

IX
Electrical and computer engineering BSC thesis 2014

Chapter One

1. Introduction

1.1 Background
Over the last five year, the constructions of industry, new building and different infrastructure in
Ethiopia become increasing from time to time. As the complexity of technology increasing the
need of human being to safe guard life also increase to sustain the living expectancy of human
being from natural and human made accident caused on to them. Among these accident, fire is
one of the most damaging for both the life of human and wealth. With advances in sensor,
microelectronics and information technologies, as well as greater understanding of fire
monitoring system, many new fire detection technologies and concepts have been developed.

Fire detection and the corresponding safety system are crucial for industry, new building and
different infrastructure. Billions of dollars are spent annually to install and maintain fire
detection systems to assure safety from unwanted fires. Intelligent systems developed in building
offer opportunities to meet this task more effectively, efficiently and economically. New sensors
will produce earlier and more reliable detection.

There are different types of fire controlling methods, but most of them are specific and the
inventions do not have multiple features in which it minimizes the risk and eases the use.

Even though there are many existing fire monitoring system in the market but most of them are
expensive to purchase and require high tech maintenance. Since we are living in under developed
country we need long lasting equipment with affordable price so that it puts off the fire that may
kindle in our home specifically and at industry level in large extent with maximum efficiency
and minimum cost. The project use very simple technology with the nearby available resources,
materials and with simple configuration if the maintenance is necessary.

In the project, microcontroller based fire monitoring system is designed and implemented to
overcome the enormous number of loose of precious human life and property from being lost.
The project consists of different features, which will make distinct from previous related works,
such as power supply buzzer, smoke detector, fire detector, LCD display, GSM module
management control this makes it more attractive and more beneficial.

The other feature which is included into this project is mosquito repellant system. Since the
detection of malaria scientists have been trying their level best to invent a means in controlling
this deadly disease by identifying the root causes, but they were not lucky enough to have an
invention which is free of harm to the surrounding environment and individuals using it.

1
Electrical and computer engineering BSC thesis 2014

It is well known that at different time with different places due to uncertain causes of fire may
blow in different industry, office, home and other working place. However fire may raises from
cigarette, faulty wiring, lighting, flammable liquid, home heating uncontrolled oil gas and other
material which is easily flammable where the weather condition is very hot.

According to the data gained from 2000 to 2006 Ethiopian calendar over 120 million birr and
many lives of citizen [1], was expired due to the uncontrolled fire. As a result finding the
problem is not the only aim for the Jimma university student of electrical and computer
engineering but also as part of the community and community based solution finding is core
value of Jimma university, we come up with this project of not only for the partial fulfillment of
final year for control engineering thesis but the deep interest to fulfill the need and protection of
our community and the environment from being burned and loos of life.

Malaria affects more than 250 million people and can kills more than a million people each year
[2]. Among various types of controlling methods of the malaria, chemical using insecticide, and
biologically by introducing fungi, and letting fish to eat mosquito’s larvae, personal protections
like spray, body lotion, and bed nets can be mentioned. Most of controlling methods listed above
have side effect since we are dealing with different chemical composition so creating safe and
environmental friendly system will be a huge demand for public convenience. Mosquito
repellant system can be considered as a positive response for this public inconvenience.

The mosquito repellant part of the project is highly problem oriented part in that it will have
powerful importance in minimizing the alleged mass killer diseases called malaria. Knowing this
plenty of mechanism to control malaria has been developed. An electronic insect repellent is a
safer alternative compared to toxic insect repellents. These are electronic devices that have either
electromagnetic or ultra sound waves to repel insects like mosquitoes and roaches. The
effectiveness of these devices has not been clearly established but the numerous studies for
experiments have shown that these electrical devices are indeed effective in repelling or
eliminating pests. Some examples of electronic insects repellents are plug in electronic
repellents, ultrasonic transmitters and the electromagnetic lamps.

These electronic pest control devices are very affordable .And despite the fact that they have
been around for more than two decades, they have just recently been acknowledged worldwide
because of their environmentally friendly claims. Apart from this, they have also been proven to
be less noticeable and cumbersome. The absence of stinking spray repellents is truly a blessing
by itself [3].

2
Electrical and computer engineering BSC thesis 2014

1.2 Statement of the problem


Considering deep rooted problems of fire controlling which costs numerous lives and
resources designing a system that can control fire monitoring system with less cost and
greater efficiency.
The project is designed in a way that a nearby user can easily understand what is
happening inside with the integrated LCD display, how much the temperature is, if the
temperature rises above the critical temperatures. The user can easily see a message is
sent to the pre-set phone number (a person who is in charge of the job title) and it will
automatically open emergency exit doors which will be triggered the moment it receives
instruction from microcontroller.
As part of mosquito repellent system due to frequent use of chemicals in the institution to
repel mosquitoes, designing the system effectively avoid pollution of the environment
which may result to respiratory diseases.
The project is designed and created in which the mosquito repellent circuit generates an
ultrasonic sound with a high output frequency that prevent the spreading of mosquitoes
within a wide radius.

1.3 Objectives
1.3.1 General Objective
The main objective of the project is to design and implement dual application of fire monitoring
and mosquito repellent system using Pic microcontroller that can be produced at a low cost,
easily maintainable and highly efficient.

1.3.2 Specific objective


The specific objectives of this project are listed as follows:-

To develop the prototype and low cost microcontroller based fire monitoring system.
To safe guard the environment from being damage with fire.
Creating a living environment free of malaria caused by mosquito.
Introducing a technology with nearby available resources.

Make our country by making the system affordable and accessible at individual level,
least malaria case reported country.

3
Electrical and computer engineering BSC thesis 2014

1.4 Methodology
The method employed for the design and implementation of microcontroller based fire
monitoring and mosquito repellant system is divided into two parts:-

the software part


the hardware part

1.4.1 The software part


The software part consists of programming PIC16F877A microcontroller using micro controller
programming language such as C compiler for microcontroller. The microcontroller is a device
that cannot act on its own, it is devices that can perform a specific function according to the
instruction user embed on it.

1.4.2 The hardware part


The hard ware part of the project consists of the following main parts:

PIC16F877A microcontroller
GSM modem unit
Microcontroller unit
Sensor unit
Alarm module
LCD display unit
Power supply
Electronic mosquito repellent unit

1.5 Scope
Our project is designed considering dual gentle use application of, fire monitoring system in a
place like dwelling home, super market, mall, industries and any place where such treat is
expected, and application of mosquito repellant system to employ in areas malaria infection rate
is sky rocketed.

The scope of the project is, in case of fire monitoring system to put the set off fire under control
with null death report and minimized loose of property. As part of mosquito repellant system the

4
Electrical and computer engineering BSC thesis 2014

project scope goes to the extent of abstain any kind of time loose due to malaria infection and
abstaining medication charge totally using the system as preventive mechanism.

1.6 Problem Identification


The existing fire alarm system in the market nowadays, is too complex in term of its design and
structure. Since the system is to complex, it needs it needs regular preventive maintenance to be
carried out to make sure the system operate well. As a result the cost of maintenance will be
raised. Therefore the proposed project that we will design will improve the existing fire
monitoring system with simple technology and low cost that all level user can have one for a
safety purpose like in home, school and in market place and also for industry in general.

5
Electrical and computer engineering BSC thesis 2014

Chapter Two
2. Literature review

2.1 Introduction
We review different information from different sources. We acquire vital information from them.
There are many papers; reports have done on the fire monitoring system in industrial and home
appliances even if they have different mechanism from our system but we have used them as the
raw data for our purpose.

Most of the existing fires monitoring system are capable of doing only specific purpose and the
preventive maintenance is also very difficult and the cost as well. Thus this project will fully in
charge of addressing the problem we face with different feature which enable the user from extra
maintenance cost and avoid the complexity of the system for operation.

The most amazing part of this project is it comes with different important features with
microcontroller based system which is an ordinary person can set in another word it is simple to
use and maintenance. So to develop this system we have reviewed different research paper,
journals, and other related source which will help for the development of the project.

2.2 Related works


According to M. Brain [4], the purpose of the fire alarm system is to detect a fire at an earlier
stage and then led to give a high reliable judgments result. An important point is that alarm is
there to cause the operator to respond. If the operator doesn’t notice the alarm and make an
appropriate response to it, then in the alarm system has failed.

The alarm system proposed is consists of three sensors smoke sensors, thermistors heat sensor,
infrared sensor. The infrared smoke sensor is designed to identify a fire while in its smoldering
or early flame stage, replicating the human sense of smell. The infrared sensor which detects
abnormal high temperature or rate of temperature rises. Once the fire has been detected it
automatically switches on the water sprinkler. The well-known catalyst for a fire is heat, smoke
and flame but only heat and smoke sensors have been emphasized and applied. Further on when
the real problem occurred, the highly sensitive motion will response to normal environmental
vibration that can be caused by passing of objects.

The alarm system proposed specially designed for the industrial uses. The basic operation of this
alarm system is consists of heat detector, smoke detector and burglar detector. When the heat or
smokes were detected, automatically the PIC receives the signal from the sensors and the PIC
operates the auto redialing telephone that is already programed with specific person’s contact
number.

6
Electrical and computer engineering BSC thesis 2014

The photo electronic sensor is activated when the receiver cannot the light from the transmitter.
On the other hand the inductive proximity switch is a sensor normally used as a metal detector.
The sensor is activated when metal exists in the system. Once any of these sensors activated the
output from PIC will flash the LED and ring the buzzer that is connected to the PIC. The 6
LED’s which are connected with PIC output is to indicate which sensor has been activated. From
here the user can identify easily which can identify easily which has been activated based on the
LED’s.

Electronic mosquito repellents (EMRs) are marketed in response to a huge demand from the
public for convenient, safe, and effective anti-mosquito products. Female Anopheles mosquitoes
transmit malaria by sucking blood from humans, and these small handheld, battery-powered
EMRs are intended to repel them by emitting a high frequency buzz almost in audible to the
human ear. They can be used both indoors and outdoors, and are claimed to repel mosquitoes
within a range of up to 2.5 meters. No adverse effects have been reported in the literature.
Mobile phone companies also market a ring tone that is claimed to repel mosquitoes within a
one-meter radius. Some of the EMRs seem to be based on known aspects of mosquito behavior,
while others have no scientific data to substantiate their claims.

Manufacturers have put forward at least two reasons to explain the alleged repellent action of
sound against mosquitoes. One reason is that the flight sound of males repels females once they
have been inseminated hence, whatever mimics the males’ flight sound may repel females.
However, research has shown that male mosquitoes are actually the ones attracted by the female
flight sound and females normally have a very weak sensitivity for sound compared with the
males Another reason is that mosquitoes avoid the ultrasonic cries of bats .

Although both explanations may be conceivable, there is no published scientific information to


support either idea. Different brands of EMRs have been examined for their efficacy under
laboratory conditions, none of which showed any effects for the devices tested. This is a concern
because it is likely to lead to consumers not using other protective methods that are proven to
work. This could result in an increased risk of infection with mosquito-borne diseases, especially
malaria. Despite the scientific view and research findings, EMRs are still widely promoted and
used by the public [6]. The project therefore tries to review all reliable research about the effects
of high pitched sounds in preventing mosquito bites and, hence, to assess whether there is any
evidence that EMRs have any potential in preventing malaria in the field setting.

2.3 Hardware Tools


The requirement for the project is to design and to create dual application of microcontroller
based fire and mosquito repellent system. If the sensors detect smoke or a high temperature, and
any mosquito available the microcontroller will act upon it according to the instruction fade to it.
Each detector is capable of sounding for different alarms. These components are;

7
Electrical and computer engineering BSC thesis 2014

Pic16f877a microcontroller
Temperature sensor
LCD display
Triple five timers (NE555)
Smoke sensor
Flame sensor
Voltage regulator (78LO5)
Oscillator (XT oscillator)
Servo motor
GSM modem
Piezo sounder
Potentiometer
Capacitor
Crystal oscillations

2.3.1 PIC16F877a Microcontroller


The microcontroller is the heart of the system. It receives inputs signal from the primary sensing
element such as temperature sensor, smoke sensor, and flame sensor and send high signal to the
output device [5].

PIC16F877A features and pin description

PIC 16F877a is one of the most advanced microcontrollers from Microchip. This controller is
widely used for experimental and modern applications because of its low price, wide range of
applications, high quality, and ease of availability. It is ideal for applications such as machine
control applications, measurement devices, study purpose, and so on.

Features of PIC16F877A

The PIC16F87a series has more advanced and developed features when compared to its previous
series. The important features of PIC16F877 series is given below.

General Features

High performance
All single cycle instructions except for program branches which are two cycles.
Operating speed: clock input (200MHz), instruction cycle (200nS).

8
Electrical and computer engineering BSC thesis 2014

Eight level deep hardware stack.


Power on Reset (POR).
Power-Up Timer (PWRT) and oscillator start-up timer.
Low power- high speed EEPROM.
Fully static design.
Wide operating voltage range (2.0 – 5.0)volts
High sink/source current (25mA).
Commercial, industrial and extended temperature ranges.

Key Features

Maximum operating frequency is 20MHz


EEPROM data memory (bytes) is 256
5 input and output ports
3 timers

Special Features

Self-programmable under software control.


In-circuit serial programming and in-circuit debugging capability.
Single 5V,DC supply for circuit serial programming
Programmable code protection.
Power saving sleep modes.
Selectable oscillator options.

Pin Diagrams Description

PIC16F877 chip is available in different types of packages. According to the type of applications
and usage, these packages are differentiated.

Input and output ports

PIC16F877A has 5 basic input and output ports. They are usually denoted by PORT A (RA),
PORT B (RB), PORT C (RC), PORT D (RD), and PORT E (RE). These ports are used for input
and output interfacing. In this controller, PORT A is only 6 bits wide (RA-0 to RA-7), PORT B,

9
Electrical and computer engineering BSC thesis 2014

PORT C, PORT D is only 8 bits wide (RB-0 to RB-7, RC-0 to RC-7, RD-0 to RD-7), PORT E
has only 3 bit wide (RE-0 to RE-7).

Port name Port range Size


PORT-A RA-0 to RA-5 6 bit wide
PORT-B RB-0 to RB-7 8 bit wide
PORT-C RB-0 to RB-7 8 bit wide
PORT-D RB-0 to RB-7 8 bit wide
PORT-E RE-0 to RE-2 3 bit wide

Table 1 Description of input and output ports with its size

All these ports are bi-directional. The direction of the port is controlled by using TRIS(X)
registers. TRIS A used to set the direction of PORT-A, TRIS B used to set the direction of
PORT-B, TRIS C used to set the direction of PORT C, TRIS D used to set the direction of PORT
D and TRIS E used to set the direction of PORT E. Setting a TRIS(X) bit ‘1’ will set the
corresponding PORT(X) bit as input. Clearing a TRIS(X) bit ‘0’ will set the corresponding
PORT(X) bit as output. If we want to set PORT A as an input, just set TRIS(A) bit to logical ‘1’
and want to set PORT B as an output, just set the PORT B bits to logical ‘0’.The rest ports are
described in the following in the form of lists.

Analog input port (AN0 to AN7): these ports are used for interfacing analog inputs.
TX and RX: These are transmission and reception ports.
SCK: these pins are used for giving synchronous serial clock input.
SCL: these pins act as an output for both SPI and I2C modes.
DT: these are synchronous data terminals.
CK: synchronous clock input.
SD0: SPI data output (SPO mode).
SD1: SPI data input (SPI mode).
SDA: data input/output in I2C Mode.
CCP1 and CCP2: these are capture, compare or PWM modules.
OSC1: oscillator input or external clock.

10
Electrical and computer engineering BSC thesis 2014

OSC2: oscillator output or clock out.


MCLR: master clear pin (Active low reset).
Vpp: programming voltage input.
THV: High voltage test mode controlling.
Vref (+/-): reference voltage.
SS: Slave select for the synchronous serial port.
T0CK1: clock input to TIMER 0.
T1OSO: Timer 1 oscillator output.
T1OS1: Timer 1 oscillator input.
T1CK1: clock input to Timer 1.
PGD: Serial programming data.
PGC: serial programming clock.
PGM: Low Voltage Programming input.
INT: external interrupt.
RD: Read control for parallel slave port.
CS: Select control for parallel slave.
PSP0 to PSP7: Parallel slave port.
VDD: positive supply for logic and input pins.
VSS: Ground reference for logic and input/output pins

2.4 primary sensing units


There are different sensors which are used for various applications but for our purpose we select
some of them this are:-

2.4.1 Smoke sensor


Smoke detectors are self-contained devices that can detect fire or smoke and set out an alarm for
the occupants of a building to evacuate its premises. Smoke alarms detect fire at an early stage.
This gives individuals ample time to leave the building that has caught fire. Hence, installing
smoke alarms help to reduce casualties to a large extent and ensures fire safety.

11
Electrical and computer engineering BSC thesis 2014

All smoke detectors consist of two basic parts: a sensor to sense the smoke and a very loud
electronic horn to wake people up. Smoke detectors can run off of a 9-volt battery or 120-volt
house current.

Figure: 2. 1 smoke sensor

Types of Smoke detectors


Photoelectric smoke sensor
Ionization smoke sensor

2.4.2 LM35 (Temperature Sensor)


The LM35 is used as temperature sensor for detection of fire, whose output voltage is linearly
proportional to the Celsius (Centigrade) temperature. The LM35 does not require any external
calibration or trimming to provide typical accuracies of ±1⁄4°C at room temperature and
±3⁄4°cover a full −55 to +150°C temperature range. The LM35’s low output impedance, linear
output, and precise inherent calibration make interfacing to readout or control circuitry especially
easy. As it draws only 60μA from its supply, it has very low self-heating, less than 0.1°C in still
air.

Figure 2.2 temperature sensors

12
Electrical and computer engineering BSC thesis 2014

The LM35 is an integrated circuit sensor that can be used to measure temperature with an
electrical output proportional to the temperature (in C)

Working principle of temperature sensor


It has an output voltage that is proportional to the Celsius temperature.
The LM35 does not require any external calibration or trimming and maintains accuracy
at room temperature.
Another important characteristic of the LM35 is that it draws it’s a low self-heating
capability.

2.4.3 Light Dependent Resistor


Light Dependent Resistors is very useful especially in light/dark sensor circuits. Normally the
resistance of an LDR is very high, sometimes as high as 1Mohms, but when they are illuminated
with light resistance drops dramatically. The smoke sensor provides a mean to detect smoke and
to serve as an early fire warning. The basis of the smoke sensor is a T-shaped chamber with an
infrared LED that emits a beam of light across the horizontal portion of the chamber. The key
advantage of smoke detector is their ability to identify a fire while it is still in its incipient. As
such they provide added opportunity fire emergency personnel to respond and control the
developing fire before severe damage occurs.

2.4.4 Flame sensor


Flame sensors use optical sensors working at specific spectral ranges usually narrow band to
record the incoming radiation at the selected energy radiated from a fire is electromagnetic
radiation that can at various spectral ranges.

2.5 LCD display (LM016L)


The most commonly used Character based LCDs are based on controller or other which are
compatible with HD44580.

13
Electrical and computer engineering BSC thesis 2014

Figure 2. 3 character LCD type HD44780 PIN diagram

2.5.1 PIN Description


The most commonly used LCDs found in the market today are 1 Line, 2 Line or 4 Line LCDs
which have only 1 controller and support at most of 80 characters, whereas LCDs supporting
more than 80 characters make use of 2 HD44780 controllers. Most LCDs with 1 controller has
14 Pins and LCDs with 2 controllers has 16 Pins.

Pin No. Name Description


Pin no.1 VSS Power supply(GND)
Pin no.2 VCC Power supply(+5V)
Pin no.3 VEE Contrast adjust
Pin no.4 RS 0 = Instruction input,1 = Data input
Pin no.5 R/W 0 = Write to LCD Module,1 = Read from LCD module
Pin no.6 EN Enable signal
Pin no.7 D0 Data bus line 0 (LSB)
Pin no.8 D1 Data bus line 1
Pin no.9 D2 Data bus line 2
Pin no.10 D3 Data bus line 3
Pin no.11 D4 Data bus line 4
Pin no.12 D5 Data bus line 5
Pin no.13 D6 Data bus line 6
Pin no.14 D7 Data bus line 0 (MSB)

Table 2 pin description of LCD display

14
Electrical and computer engineering BSC thesis 2014

2.6 Triple five timers (NE555) pin description


Pin 1 (Ground): Connect to the 0v power supply.

Pin 2 (Trigger): Detects 1 or 3 of rail voltage to make output high Pin 2 has control over pin 6.
If pin 2 is low, and pin 6 low, output goes and stays high. If pin 6 high, and pin 2 goes low,
output goes low while pin 2 low.

Pin 3 (Output): Pins 3 and 7 are in phase goes high and low will deliver up to a current of
200mA.

Pin 4 (Reset): Internally connected high via 100k and must be taken below 0.8v to reset the
chip.

Pin 5 (Control): A voltage applied to this pin will vary the timing of the RC network.

Pin 6 (Threshold): Only if pin 2 is high detects 2 or 3 of rail voltage to make output low. This
pin has very high impedance and will trigger with about 0.2uA.

Pin 7 (Discharge): Goes low when pin 6 detects 2/3 rail voltage but pin 2 must be high. If pin 2
is high, pin 6 can be high or low and pin 7 remains low. Goes open (high) and stays high when
pin 2 detects 1/3 rail voltage (even as a low pulse) when pin 6 is low. (Pins 7 and 3 are in phase)
Pin 7 is equal to pin 3 but pin 7 does not go high - it goes open. But it goes low and will sink
about 200mA.

Pin 8 (Supply): It connects to the positive power supply. This can be any voltage between 4.5V
and 15V DC, but is commonly 5V DC when working with digital ICs.

2.7 Servo motor


A servomotor is a rotary actuator that allows for precise control of angular position, velocity and
acceleration. It consists of a suitable motor coupled to a sensor for position feedback. It also
requires a relatively sophisticated controller, often a dedicated module designed specifically for
use with servomotors. Servomotors are not a specific class of motor although the term
servomotor is often used to refer to a motor suitable for use in a closed-loop control system.
They consume power as it rotates to the commanded position but then the servomotor rests.

15
Electrical and computer engineering BSC thesis 2014

Servomotors are generally used as a high performance alternative to the stepper motor. Servo
motors are self-contained electric devices that rotate or push parts of a machine with great
precision. Servos are found in many places: from toys to home electronics to cars and airplanes.
In a model car or aircraft, servos move levers back and forth to control steering or adjust wing
surfaces. By rotating a shaft connected to the engine throttle, a servo regulates the speed of a
fuel-powered car or aircraft.

The position of servo motors can be controlled more precisely than those of standard DC motors,
and they usually have three wires. Power to servo motors is constantly applied, with the servo
control circuit regulating the draw to drive the motor. Servo motors are designed for more
specific tasks where position needs to be defined accurately such as controlling the rudder on a
boat or moving a robotic arm or robot leg within a certain range.

PWM is used for the control signal of servo motors. However, unlike DC motors it’s the duration
of the positive pulse that determines the position, rather than speed, of the servo shaft. A neutral
pulse value dependent on the servo keeps the servo shaft in the center position. Increasing that
pulse value will make the servo turn clockwise, and a shorter pulse will turn the shaft
anticlockwise. The servo control pulse is usually repeated every 20 milliseconds, essentially
telling the servo where to go, even if that means remaining in the same position.

When a servo is commanded to move, it will move to the position and hold that position, even if
external force pushes against it. The servo will resist from moving out of that position, with the
maximum amount of resistive force the servo can exert being the torque rating of that servo.

2.7.1 Using Servomotors with the PIC Microcontroller


Servomotors are basically geared down dc motors with positional feedback control, allowing for
accurate positioning of the rotor, with a range of 90 degrees. They can also be modified to allow
for continuous rotation. Servomotors have three wires; usually red, black and white. The red wire
is for +VDC, the black for ground and the white is for position control.

2.7.2 Working principle of servo motor


The simplicity of a servo is among the features that make them so reliable. The heart of a servo is
a small direct current motor, similar to what we might find in an inexpensive toy. These motors

16
Electrical and computer engineering BSC thesis 2014

run on electricity from a battery and spin at high RPM (rotations per minute) but put out very
low torque. An arrangement of gears takes the high speed of the motor and slows it down while
at the same time increasing the torque. A tiny electric motor does not have much torque, but it
can spin really fast. The gear design inside the servo case converts the output to a much slower
rotation speed but with more torque. The amount of actual work is the same, just more useful.
Gears in an inexpensive servo motor are generally made of plastic to keep it lighter and less
costly. On a servo designed to provide more torque for heavier work, the gears are made of metal
and are harder to damage.

Servo motors are geared DC motors with the closed-loop circuitry incorporated within them. The
basic configuration of a servo motor composed of a DC motor, gearbox, potentiometer and
control circuit. DC motor is used to move a gearbox with a large reduction ratio. The final shaft
imposes a force on the external load and simultaneously acts on the axis of the feedback
potentiometer. So, the potentiometer senses the position of the axis and sends a corresponding
voltage to an operational amplifier. This voltage compared to the input voltage that determines
the desired position of the shaft, producing a voltage in the output of the comparator. This
voltage powers the motor such that the shaft moves in the necessary direction to align with the
angle that corresponds to the voltage applied to the input.

2.7.3 Servo motor control


Servos are controlled by sending an electrical pulse of variable width, or pulse width modulation
(PWM), through the control wire. There is a minimum pulse, a maximum pulse, and a repetition
rate. A servo motor cans usually only turn 90 degrees in either direction for a total of 180 degree
movement. The motor's neutral position is defined as the position where the servo has the same
amount of potential rotation in the both the clockwise or counter-clockwise direction. The PWM
sent to the motor determines position of the shaft, and based on the duration of the pulse sent via
the control wire; the rotor will turn to the desired position

2.8 GSM Modem


A GSM modem is a specialized type of modem which accepts a SIM card, and operates over a
subscription to a mobile operator, just like a mobile phone. From the mobile operator
perspective, a GSM modem looks just like a mobile phone.

17
Electrical and computer engineering BSC thesis 2014

When a GSM modem is connected to a computer, this allows the computer to use the GSM
modem to communicate over the mobile network. While these GSM modems are most
frequently used to provide mobile internet connectivity, many of them can also be used for
sending and receiving SMS.

2.9 Voltage regulator (78L05)


A voltage regulator is a device inside an electronic device to make sure that the device maintains
a consistent voltage level. A voltage regulator can regulate both AC and DC current.

A voltage regulator is used to produce a constant linear output voltage. It is generally used with
DC power supply. It uses a supply of 9V or15V as input and then regulates the supply of 5V
send to pic microcontroller.

Figure 2. 3 voltage regulator (78L05)

Its output voltage is +5V DC that we need. We can supply any voltage in input; the output
voltage will be always regulated +5V. There used two capacitors in this voltage regulator circuit,
they are not mandatory to use. But it will be best if you use them. They helped to produce a
smooth regulated voltage at output.

2.9.1 Working principle of voltage regulator


Voltage regulators work by gauging the actual voltage output of a device against a reference
voltage inside of the device. If there is a difference between the actual voltage and the reference
voltage, that difference is amplified and used to reduce voltage errors. The more stable a voltage
regulator is, the slower it is to respond. This is because of the regulator is either increasing the
gain of the input on the device or lowering the gain of the device at the output level. Some

18
Electrical and computer engineering BSC thesis 2014

regulators will shut down the device they are installed in if the current draw exceeds a certain
level.

All electrical devices have a voltage regulator circuit. The reason for this is that if a device were
to lack a voltage regulator it would constantly be susceptible to damage from receiving too much
voltage or would be underpowered due to a lack of voltage. Voltage regulators keep electrical
devices running efficiently, requiring less maintenance and lasting longer.

Switching regulators require a means to vary their output voltage in response to input and output
voltage changes. One approach is to use PWM that controls the input to the associated power
switch, which controls it’s on and off time. In operation, the regulators filtered output voltage is
fed back to the PWM controller to control the duty cycle. If the filtered output tends to change,
the feedback applied to the PWM controller varies the duty cycle to maintain a constant output
voltage.

2.10 Piezo speaker


A regular loudspeaker exploits the motor effect of a coil of wire suspended in a magnetic field.
When an electric current is passed through the coil a magnetic field is created around it. This
field reacts with the field in which the coil is suspended and a mechanical force is exerted on the
coil which moves.

The coil is attached to the speaker diaphragm. The current through the coil comes from the
amplifier which drives the speaker. The current is varying in magnitude and frequency, so the
coil, and therefore the diaphragm, moves in the same manner, reproducing the amplitude and
frequency of the recorded material. The frequency response of piezoelectric material is not very
good, particularly at the lower end, that's why they are used as high frequency transducers.

2.11 Capacitor
Working on a project and read that decoupling caps should be connected across the VDD and
VSS pins of PIC microcontrollers. Using a 9V battery with a 78L05 voltage regulator as the
source and have two decoupling capacitors connected with the regulator like so:

19
Electrical and computer engineering BSC thesis 2014

Figure 2. 4 voltage regulator circuit

2.12 Resistor
Resistor allows multiplexing of microcontroller input and output lines. There are two keys to this
circuit: the isolation resistor and the software-programmable I/O functionality of the PIC
microcontroller. The I/O pin can be programmed as either an input or as an output driving the pin
high or low. To read the value of the switch, the I/O pin is confirmed as an input. Thus, the value
of the switch is read easily. Ignoring the leakage current of the I/O pin and whatever the output is
attached to, the voltage is given simply as a voltage divider:

Switching an I/O pin from an input to an output, reading the I/O, and writing a value is
extremely simple using microchip reduced-instruction set. The code listing provides software
snippets needed to accomplish these tasks.

With this multiplexing method, the output always overrides the input, allowing the output to be
absolutely defined during critical times. This enables the I/O pin to perform as a data line in a
synchronous communication scheme, or as a driver for an LED to provide a rudimentary user
interface. And, at the same time, it implements non-time critical input, such as a configuration
switch or a request for service button.

With a single resistor, the functionality of an I/O pin on a microcontroller can be vastly increased
to allow for an input from one device and an output to another device. With the built-in
capabilities of the microcontroller, this method is an easy and effective way to increase the
functionality of a product while reducing system cost.

20
Electrical and computer engineering BSC thesis 2014

2.13 Crystal oscillator


Crystal or full name crystal oscillator is an electronic oscillator circuit that uses the mechanical
resonance of a vibrating crystal of piezoelectric material to create an electrical signal with a very
precise frequency. This frequency is commonly used to keep track of time (as in quartz
wristwatches), to provide a stable clock signal for digital integrated circuits, and to stabilize
frequencies for radio transmitters and receivers.

The crystal oscillator circuit sustains oscillation by taking a voltage signal from the
quartz resonator, amplifying it, and feeding it back to the resonator. The rate of expansion and
contraction of the quartz is the resonant frequency, and is determined by the cut and size of the
crystal. When the energy of the generated output frequencies matches the losses in the circuit, an
oscillation can be sustained.

An oscillator crystal has two electrically conductive plates, with a slice or tuning fork of quartz
crystal sandwiched between them. During startup, the controlling circuit places the crystal into
an unstable equilibrium, and due to the positive feedback in the system, any tiny fraction
of noise will start to get amplified, ramping up the oscillation. The crystal resonator can also be
seen as a highly frequency-selective filter in this system: it will only pass a very narrow sub band
of frequencies around the resonant one, attenuating everything else. Eventually, only the
resonant frequency will be active.

Crystal oscillator's role is to provide the basic system clock signal. Usually a system shares a
single crystal, easy to synchronize the various parts. Some of the fundamental frequency
communication systems and using a different crystal and electronic means to adjust the
frequency to keep face. Crystal is usually used in conjunction with the phase-locked loop circuit
to provide the required system clock frequency.

2.14 Comparator
A comparator is a device with two input terminals, inverting and non-inverting, and an output
which swings from rail to rail. So is an op amp. A comparator has low offset, high gain and high
common mode rejection.

21
Electrical and computer engineering BSC thesis 2014

A comparator has a logic output that indicates which of the two inputs is at a higher potential. Its
output is intended always to be at one rail or the other or making a rapid transition between the
two. An op amp has an analog output which is not normally close to the supply rails, but is
somewhere between them. It is designed to be used in closed-loop applications with feedback
from its output to its inverting input.

22
Electrical and computer engineering BSC thesis 2014

Chapter Three
3. Design and analysis

3.1 Design
The block diagram contain the following section

Figure 3.1 general block diagram system

3.2 Description of Block Diagram


The Pic Microcontroller is the computer in a single chip. In another word it is possible to say the
brain of all the system that can execute program which is loaded on to them through it input
output pin. Here the Pic microcontroller is connected to power supply, temperature sensor, flame
sensor and smoke sensor to the input port of the microcontroller and the output side of the

23
Electrical and computer engineering BSC thesis 2014

microcontroller is connected LCD display, alarm module, GSM module, Emergency exit door,
LED-red.

Sensors are the primary sensing element that can report the status of the environment to the
microcontroller. That is it can convert non electrical parameter to the electrical parameter. Types
of sensor used in this project are temperature sensor (LM35), smoke sensor, flame sensor. These
three sensors are interfaced with Pic microcontroller at the input side to convert non electrical
parameter to electrical parameter.

A Triple five timer is used in this circuit is because it can convert an analogue signal input
(voltage) to digital signal output (frequency), which functions as an ADC (Analog to Digital
Converter).thus the construction of the circuit using triple five timer is used to repel the
mosquito. GSM module in our circuit is used to receive a message signal from the
microcontroller when the any of the sensor signal of the microcontroller is high. The LED-RED
is a very glowing light which is used to show the temperature of the working environment is
above the specified value that is 50 degree centigrade.

Emergency Exit door is activated by the motor when the microcontroller is high it send the signal
to the motor to be active and start to open the door. The piezo-sounder is used to inform the
persons at the surrounding area and notify them about the status of the fire hazard generating
frequency. And the piezo-sounder is used to repel mosquito with the frequency of as the
additional features to the system that we have developed.

24
Electrical and computer engineering BSC thesis 2014

3.3 Flow chart

Figure 3.2 overall flow chart of the system

25
Electrical and computer engineering BSC thesis 2014

3.4 Circuit Design


The overall circuit design of dual application of microcontroller based fire monitoring and
mosquito repellent system is shown in figure 3.3. The microcontroller interfaced with the sensors
in order to achieve the desired result.

Figure 3.3 Circuit design of fire monitoring and mosquito repellent system

The pic microcontroller can operate from a power supply voltage in the range of 2 to 6 V. the
standard power supply voltage in digital electronics circuits is +5 V and this voltage with which
the PIC microcontroller are mostly operated. In order to drop the voltage from 9V to 5V is by
using voltage regulator independent of the current drawn from the supply. A basic voltage
regulator circuit consists of a regulator integrated circuit and filter capacitor. Figure 3.4 shows a
low cost voltage regulator integrated 78L05-type voltage regulator IC and two filter capacitors is
a 3-pin IC with the maximum current capacity of 100 mA.

26
Electrical and computer engineering BSC thesis 2014

Figure 3.4 power supply of the pic microcontroller

Thus the power supply unit is connected through the resistor R9 to MCRL port of the
microcontroller. And the microcontroller receives the regulated 5v to be activated.

The other type of circuit used in this system is shown in fig3.5 the operation of an external
crystal and two capacitors are connected to the OSC1 and OSC2 inputs of a microcontroller. The
capacitor should be chosen as from the table3. For example with the crystal frequency of 4MHz,
two capacitors can be used.

Mode Frequency C1,C2


LP 32 kHz 68-100 Pf
LP 200 kHz 15-33 pF
XT 100 kHz 100-150 pF
XT 2 MHz 15-33 pF
XT 4 MHz 15-33 pF
HS 4 MHz 15-33 pF
HS 10 MHz 15-33 pF

Table 3 capacitor selection for crystal operation

After selecting the desire frequency level that is 4 MHz of mode XT the capacitor value would
range from 15-33pF. Thus for our purpose we have selected the capacitor value for both C1, C2
22pF with value the microcontroller.

27
Electrical and computer engineering BSC thesis 2014

Figure 3.5 XT oscillators

After giving the power supply and XT oscillator to the microcontroller the next step is that the
sensor unit will be activated if fire or any flame occurs in the company. Here three sensor are
used which is placed at different position. Thus these sensors are temperature sensor, smoke
sensor and flame sensors. LM35 is used to sense the temperature value when the temperature
increases above the working temperature value at industry that is the working temperature is
above 50 degree centigrade. LM35 have 3-pin the first pin is connected to power source, the
second pin is connected to pic port of RA0 and the third pin of LM35 is grounded. Thus when
the fire occur the temperature value is displayed on the LCD display.

Figure 3.6 analogue temperature sensor of LM35

The output from the LM35 is 0.1V/'C. So, when temperature sensed is 61'C, the output voltage is
0.61V. This analogue voltage is read by the PIC and processed to display the corresponding
temperature on the LCD. The temperature range for this circuit is 0'C to 150'C.

Fire detection unit consist of LDR and LP339 comparator and the output from the comparator is
going to connected to the pic microcontroller port of RE0.as per our requirement we need to send
a high signal to the microcontroller when the temperature is above 40degree Celsius as the
output of the sensor gives 10mV change with the change of 1 degree centigrade in temperature as

28
Electrical and computer engineering BSC thesis 2014

shown in fig: 3.7 of fire detection circuit. So at 50 degree centigrade it will give 0.5 volts as
output has a linear relationship with temperature .so to meet our requirement we have set 0.49
volts on the negative input of comparator so that when the output of sensor will give 0.5 volts
the comparator will pass high signal to microcontroller. So when the temperature of
external environment will be 50 degree centigrade, a high signal will be passed on to the
microcontroller through comparator.

Figure 3.7 Fire detection circuit

The other module of our project is to detect smoke from the environment which is in
evitable outcome of fire. So to fulfill this requirement we have used smoke sensor LDR. The
sensor output is almost zero when there is no smoke in environment .On the contrary when there
is a smoke the sensor will give an output voltage according to the intensity of smoke. Thus the
LDR has two pin one pin is connected to resistor R1 and the output is connected to the port of
RA3 of microcontroller and the second pin is grounded.

Figure 3.8 Smoke detection circuits

As the result of the sensor value gained from each part of sensor unit if one of the three sensor
signal that is signal from smoke sensor, temperature sensor and flame sensor the microcontroller
send the a high signal to LCD, LED, PIEZO SPEAKER, GSM modem and SERVO MOTOR to
perform the desire function in order to prevent the occurrence of fire. Thus each circuit listed

29
Electrical and computer engineering BSC thesis 2014

above shows different indication according to the operation they are intended to perform. As a
result during the fire occur the PIEZO SPEAKER will produce the alarm signal which is
connected as the output of microcontroller. The speaker has two pin and the first pin is connected
to microcontroller port of RC3 and the second pin is connected to the ground as shown in fig3.9

Figure 3.9 Piezo-speaker circuits

In another way the LCD will show the three control lines are referred to as EN, RS, and RW.
The EN line is called “Enable.” This control line is used to tell the LCD that you are sending in
data. To send data to the LCD, your program should make sure this line is low (0) and then set
the other two control lines and/or put data on the data bus. When the other lines are completely
ready, bring EN high (1) and wait for the minimum amount of time required by the LCD (this
varies from LCD to LCD), and end by bringing it low (0) again.
The RS line is the “Register Select” line. When RS is low (0), the data is to be treated as a
command or special instruction (such as clear screen, position cursor, etc.). When RS is high (1),
the data being sent is text data which should be displayed on the screen.

The RW line is the “Read/Write” control line. When RW is low (0), the information on the data
bus is being written to the LCD. When RW is high (1), the program is effectively querying (or
reading) the LCD. Only one instruction (“Get LCD status”) is a read command. All others are
writing commands–so RW will almost always be low.
The data bus consists of 4 or 8 lines (depending on the mode of operation selected by the user).In
the case of an 8-bit data bus, the lines are referred to as D0, D1, D2, D3, D4, D5, D6, and D7.
Thus D4 is connected to the port of RB2, D5 is connected to the port RB3, D6 is connected to
the port RB4, D7 is connected to the port RB5 of the microcontroller and pin RW, D0, D1, D2,

30
Electrical and computer engineering BSC thesis 2014

D3 are connected to the ground. The LCD receive it power supply from pin no 1 and 2 of +5v
and the pin no 3 is used for the contrast of LCD to be shown with desirable contrast.
Another way of showing hazard signal and light is using LED-red. This is a very simple way that
everybody near to the LED can understand the operation. When the LED is glowing is to show
that the temperature of the condition is become maximum that is greater than 50 degree
centigrade. Therefore the LED has two pin the first pin is connected to the microcontroller port
of RC0 and the second pin is grounded.

Figure 3.10 Circuit of LED-RED

During the existence of the fire system the emergency exit door should be opened in order to let
the worker can escape easily and going out. To do this the servo motor is couple to the door
which automatically opens the emergency exit door. The servo motor has three pin the pin
number 1 is connected to the power source of +5v and pin number 2 is connected to the
microcontroller of port RC1 and pin no.3 is grounded.

Figure 3.11 Emergency exit door activator of a servo motor

When a GSM modem is connected to a computer it is possible to communicate over the mobile
network. While these modem frequently used to provide mobile internet connectivity and

31
Electrical and computer engineering BSC thesis 2014

connected to the microcontroller through pin number to interface. The GSM modem port number
2 is connected to the port number RC7 of the microcontroller and the pin number 3 is connected
to the RC6 of the microcontroller. As part of the entire feature listed above the existence of fire
would be sent a message to the person who is in charge to extinguish fire. This is done through
the serial interface of GSM modem from the microcontroller by using the USB cable. Thus
through this serial port the GSM modem is connected from the PC to the mobile network through
the software of HyperTerminal. After installing the Nokia PC suit software through program the
microcontroller can communicate with the mobile network via the HyperTerminal. The fig: 17
shows how the serial port is communicate with the microcontroller

Figure 3.12 Serial port of mobile GSM module

Finally, electronic mosquito repellent circuit will generate an ultrasonic sound with a high output
frequency that allows spreading of mosquitoes within a wide radius. The main components
beside electronic mosquito circuit are 555 Timer, resistors, present resistors, variable resistors
and speaker. The oscillation frequency is given by the value of the resistors and capacitor
components and can be modified by changing the value of components or replacing the fixed
resistor with a variable resistor. The actual oscillation frequency of the electronic mosquito
repellent is around (20-65 KHz). The reason 555 Timer is used in this circuit is because it can
convert an analogue signal input (voltage) to digital signal output (frequency), which functions
as an ADC (Analogue to Digital Converter).

32
Electrical and computer engineering BSC thesis 2014

The oscillation frequency is calculated with the following formula:

F = 1/0.67 (R1 + 2 x R2) x C

F = 1/0.67(200+2*500)*0.005uF

F = 24.87 kHz

Thus this is the desired frequency that the mosquito can be repelled. Figure below show the
circuit of mosquito repellent.

Figure 3.13 Electronic mosquito repellent systems

Resistor R1 is connected between VCC and the discharge pin (pin 7) and another resistor (RV1)
is connected between the discharge pin (pin 7), and the trigger (pin 2) and threshold (pin 6) pins
that share a common node. Hence the capacitor is charged through R1and (RV1), and discharged
only through RV2, since pin 7 has low impedance to ground during output low intervals of the
cycle, therefore discharging the capacitor. When the push button is pressed the circuit will be
activated produce an ultrasonic frequency of 20 kHz.

33
Electrical and computer engineering BSC thesis 2014

Chapter Four

4. Result and Discussion

4.1 Result
The main targets of the project is to safe guard the life of human from being burned and protect
wealth of the company as well as the individual propriety from the damage that the fire can
cause. Apart from that the project aimed with creating a healthy environment to protect human
from being ill by the malaria disease and increasing the working capacity of individual.
Therefore the result of the project shows how to overcome problems oriented in the field of fire
and mosquito that both can cause enormous loose of life and wealth.

4.1.1 Expected result from the Hardware circuit components

Figure 4.1 PIC development board

Case1.Emergency exit door

After configuring the pic 16f877a on the development board the required result can be executed
based on the program loaded on the pic microcontroller. when the temperature value is greater
or equal 50 degree centigrade the motor first should be activated in order to open the Emergency

34
Electrical and computer engineering BSC thesis 2014

exit door thus the figure below shows emergency exit door opening motor when it receive high
signal from the temperature value.

Figure 4.2 an emergency exit door activator motor

When the motor receive a high signal from one of the three sensors the motor will automatically
open the door. To do this the microcontroller send the high signal to activate the motor as the
result when high temperature value, smoke and flame value reaches high the emergency door is
motor activated and the motor rotate forward 360 degree and the door will be opened

Case2. Alarm unit

Simple mechanisms which can everybody can simply understand the existence of fire is using an
alarm unit. When the temperature is of the surrounding increases gradually the microcontroller
send the high signal to the sounder (alarm unit). As the result the alarm unit will be on and
produce sound frequency of 880MHz.

Figure 4.3 Alarm circuit activated when high signal comes.

Case3. GSM modem

Another feature of this project is the GSM modem. The interfacing of GSM Modem and
microcontroller can also be done directly with the help of cable. GSM modem works with AT

35
Electrical and computer engineering BSC thesis 2014

COMMANDS. A USB cable is used to interface the PC with the mobile through the AT
command of ‘AT+CMGS’. This command is used to send message to the subscribed phone with
the connection of the PC through the networking. Thus when the temperature value is above 50
degree centigrade the microcontroller send the high signal to the serial port through the USB
cable the charged person will receive an SMS which indicate the fire is to glow out and to take
care of the remedy action.

Figure 4.4 GSM circuit when it is interface with the Nokia mobile

Case 4.Red light unit

This red light shows the hazard light to the worker simply identify that the temperature and other
sensing element are on the high state. Therefore the LED unit shows the red light with high
intensity to be seen by all workers and take the actual remedy action. Thus when the
microcontroller send the high signal to LED then it shows and emit red light.

Figure4.5 red light circuits

Case 5.LCD display

The operation of the display can be categorize into two

Before Temperatures is < 50 degree centigrade

36
Electrical and computer engineering BSC thesis 2014

Before Temperatures is = > 50 degree centigrade

Case 5.1 Before Temperatures is < 50 degree centigrade

The LCD shows normal reading of the temperature value of the working environment as the
result the microcontroller does not send high signal to take the action.

Figure 4.6 LCD display for <50 degree centigrade

Case 5.2 Before Temperatures is = >50 degree centigrade

When the value reaches 50 degree centigrade the microcontroller send the high signal to the
perspective peripheral device to be activated and respond to the existence of fire. At this stage
the LCD display unit shows that as fire and smoke is detected

Figure4.7 LCD display for >50 degree centigrade

Case6. Mosquito repellant system

The design of the circuit produces an ultrasonic frequency greater than 20 KHz which is below
human hearing capacity but can repel mosquito from the surrounding effectively.

37
Electrical and computer engineering BSC thesis 2014

Chapter Five
5. Conclusion and recommendation

5.1 Conclusion
The project’s main concern is developing dual system which can minimize the existing problems
of the country and developing such a system can control fire hazards, protection of life, and
property along with portable mosquito repellant system which can safe an environment where
the system is in act. The project is successful in developing the prototype using MICRO C,
instruction code and proteus circuit simulation software. After rigorously working on the detail
analysis, results and discussion the following conclusion are drawn out:

The project presents successful means of controlling fire and mosquito repellent system
based on an embedded microcontroller system.
Specifically the project demonstrates the working software solution in detecting pre-set
requirement to set tools like smoke sensor, alarm module, sound, RED light glow, and
flame sensor for efficient controls of the fire for the objectives of the project. While the
project has limitations particularly in determining the cause of fire.
The project will have a capacity of solving multi socioeconomic problems witnessed in
society.
Reducing malaria infection rate and making the society more active is the other feature
of the project. as a result the project is successful to repel mosquito
Finally, the project will have a promising technology transform for the coming works
with related and advanced transformation of technology

38
Electrical and computer engineering BSC thesis 2014

5.2 Recommendation
This project has already finalized, because of a great passion and devotion of the group
members, in manner expected to be accomplished on our premise. However, had it been some of
the following recommendation considered it will be more appealing to effectively use on our
daily base where such system is crucial and even can be marketed.

Due to different nature of chemicals found in a place where fire is set off it is not
advisable to use water sprinkler. So we recommend that for feature works in relation with
water sprinkler, if proper investigation is made one can develop a system according to
cause of fire existence.
For the further development of the system we recommend to develop a system which will
tell to the worker to which exit door he/she should escape when fire is occurred.
In some cases a false signal due to temperature variation of the environment a false signal
may be send to the microcontroller to activate the buzzer so it produce alarm so we
recommend for future extent we recommend to develop a system that reject a false signal.
With regardless of mosquito repellent we can put sensor and led lights in the circuit to
detect mosquitoes so that we will be able to know when there are mosquitoes around us.
Finally, we recommend repelling mosquito for large area coverage can be attained by
integrating additional feature on the circuit to clean the environment free of mosquito.

39
Electrical and computer engineering BSC thesis 2014

Reference
[1] Ethiopia disaster prevention and preparedness agency annual broacher, Addis Zemen
Magazine, Held on 2005

[2] WHO 2005 report on malaria, by Roll Back Malaria World Health Organization UNICEF

[3] Electronic pests control, retrieved November 24, 2012 from http://electronic _pest_
control.com

[4] M. Brain, “how Smoke detector works,” June 1995. http://home .how stuff
works.com/Smoke.htm

[5] Martin Bates: Interfacing Pic Microcontroller embedded design by Interactive Simulation,
Elsevier, 2006.

[6] Enayati AA, Hemingway J and Garner P. Electronic mosquito repellents for preventing
mosquito bites and Malaria infection, Cochrane database system revised 2007;18:34-42

40
Electrical and computer engineering BSC thesis 2014

Appendix A
Abbreviation

LCD: Liquid Crystal Display PWM: Pulse Width Modulation

GSM: Global System for Mobile

PIC: Programmable Interface Controller MCLR: Master Clear

POR: Power on Reset VPP: Programming Voltage

EEPROM: Electrically Erasable HVT: High Voltage Test

Programmable Read Only Memory


Vref: Reference Voltage

TX: Transmitter
SS: Slave Select

RX: Receiver
T0CK1: Clock Input to Timer

SCK: Synchronous Clock


T1OSO: Timer 1 Oscillator Output

SCL: Substation Configuration Language


T1CK1: Clock Input to Timer 1

DT: Data Terminal


PGD: Programming Data

CK: Clock
PGC: Programming Clock

SD0: Synchronous Data Output


INT: Interrupt

SD1: Synchronous Data Input


CS: Select Control

CCP: Capture Compare


LED: Light Emitting Diode

OSC1: Oscillator input


LSB: Least Significant Bit

OSC2: Oscillator Output


MSB: Most Significant Bit

IC: Integrated Circuit

A
Electrical and computer engineering BSC thesis 2014

LDR: Light Dependent Resistor CPU: Central Processing Unit

SIM: Subscriber Identity Module UART: Universal Asynchronous


Receiver/Transmitter
SIMCOM: Subscriber Identity Module
Command SSP: Special Service Package

PC: Personal Computer SRAM: Static Random Memory

USB: Upper Side Band ADC: Analog to Digital Converter

AT: Application Terminal DAC: Digital to Analog Converter

CMGS: Command to Send GPIO: General Purpose Input/output

CMGR: Command to Read PWRT: Power up Timer

CMGD: Command to Delete EN: Enable

LPC: Linear Predicting coding RW: rewriteable

TDM: Time Division Multiplexing

B
Electrical and computer engineering BSC thesis 2014

Appendix B
Programing code

// ***********************************************************
// Project: dual system fire monitoring and mosquito repellant system
// author: group
// ***********************************************************
// LCD module connections

sbit LCD_RS at RB0_bit; int t;

sbit LCD_EN at RB1_bit; char a;

sbit LCD_D4 at RB2_bit; char lcd[] = "000 Degree";

sbit LCD_D5 at RB3_bit; int tempreture1,temprature2, temp;

sbit LCD_D6 at RB4_bit; char txt1[] = "FIRE DETECTED ";

sbit LCD_D7 at RB5_bit; char txt2[] = " SMOKE detected";

char txt3[] = "HEAT detected ";

sbit LCD_RS_Direction at TRISB0_bit; char txt4[] = "BUZZER ON";

sbit LCD_EN_Direction at TRISB1_bit;

sbit LCD_D4_Direction at TRISB2_bit; char i; // Loop variable

sbit LCD_D5_Direction at TRISB3_bit;

sbit LCD_D6_Direction at TRISB4_bit; void Move_Delay() { // Function


used for text moving
sbit LCD_D7_Direction at TRISB5_bit;
Delay_ms(500); // You can
// End LCD module connections
change the moving speed here

C
Electrical and computer engineering BSC thesis 2014

Delay_ms(1500);

void main(){

// Moving text

Lcd_Init(); // Initialize LCD for(i=0; i<4; i++) { // Move text to


the right 4 times

Lcd_Cmd(_LCD_SHIFT_RIGHT);
Lcd_Cmd(_LCD_CLEAR); //
Clear display Move_Delay();

Lcd_Cmd(_LCD_CURSOR_OFF); // }
Cursor off

Lcd_Out(1,6,txt3); // Write text


while(1) { // Endless loop
in first row
for(i=0; i<8; i++) { // Move text to
the left 7 times
Lcd_Out(2,6,txt4); // Write text
Lcd_Cmd(_LCD_SHIFT_LEFT);
in second row
Move_Delay();
Delay_ms(1000);
}
Lcd_Cmd(_LCD_CLEAR); //
Clear display

for(i=0; i<8; i++) { // Move text to


the right 7 times
Lcd_Out(1,1,txt1); // Write text
in first row Lcd_Cmd(_LCD_SHIFT_RIGHT);

Lcd_Out(2,5,txt2); // Write text Move_Delay();


in second row
}

D
Electrical and computer engineering BSC thesis 2014

} }

void Tone1() { void ToneA() {

Sound_Play(880, 9000); // Frequency = Sound_Play( 880, 9000);


659Hz, duration = 250ms
}
}
void ToneB() {

Sound_Play(20, 1000);
void Tone2() {
}
Sound_Play(20, 1000); // Frequency =
698Hz, duration = 250ms
void Melody2() {
}
unsigned short i;

for (i = 9; i > 0; i--) {

ToneA(); ToneB();

}
void Melody() { // Plays the melody
"Yellow house" void openDoor()

Tone1(); Tone2(); {

Tone1(); Tone2(); TRISC = (1<<3)|(1<<4) ; // configure


RC3 as input (1 for input and 0 for output)
Tone1(); Tone2();

Tone1(); Tone2();

Tone1(); Tone2();

E
Electrical and computer engineering BSC thesis 2014

PR2 = 0xFA; //oxFA for 250 //}


(used to set time period)
}
CCPR2L = 125; // (used to set
void sms(){
duty cycle)

CCP2CON |= (1<<2)|(1<<3); //
select for PWM mode lcd_init();

T2CON |= (1<<2)|(1<<1); // Lcd_Cmd(_LCD_CLEAR);


enabling timer 2, prescalar 16
lcd_out(1,1,"Send SMS to");

//UART1_Init(9600); // Initialize UART


//while(1) module at 4800 bps

//{ UART1_Write_Text("AT+CMGS=");

Delay_ms(1000);

if(PORTC.F3==1) // lcd_out(2,1,"0");
forward
Delay_ms(2000);
{
UART1_Write_Text("0913433311"); //
// x=x+1 Your Telephone Number
cd_chr_cp(uart_rd);
CCPR2L = 250+125; // (used
to set duty cycle)

T2CON |= (1<<2)|(1<<1); // UART1_Write(0x0D); // mean Enter


enabling timer 2, prescalar 16
Lcd_Cmd(_LCD_CLEAR);
}
lcd_out(2,1,"FIRE HELP ME
PLEASE!!!!:");

delay_ms(100); lcd_out(2,1,"0");

F
Electrical and computer engineering BSC thesis 2014

Delay_ms(2000); Sound_Init(&PORTC, 4);

Sound_Play(20, 1000);

//while (1) {

Delay_ms(2000); if (Button(&PORTB,7,1,1)) // RB7


plays Tone1
UART1_Write(26); //Ctr +Z
Tone1();
Delay_ms(2000);
while (RB7_bit) ; // Wait for
UART1_Write(0x0D); // mean Enter
button to be released
Delay_ms(2000);

Lcd_Cmd(_LCD_CLEAR);
if (Button(&PORTB,6,1,1)) // RB6
lcd_out(1,1,"SEND"); plays Tone2

lcd_out(2,1,"SUCCESSFULLY"); Tone2();

} while (RB6_bit) ; // Wait for


button to be released
void produceAlarm()

{
// Wait for button to be released

TRISB = 0xF8; // Configure


RB7..RB3 as input if (Button(&PORTB,4,1,1)) // RB4
plays Melody2

Melody2();
Sound_Init(&PORTC, 3);
//while (RB4_bit) ; // Wait for
Sound_Play(880, 9000); // Play
button to be released
sound at 880Hz for 1 second

G
Electrical and computer engineering BSC thesis 2014

void text()

//} {

} TRISC=0;

PORTC.F0=0;

int tempraturSensor(int adc_read){ ADCON1 = 0x04;

t = adc_read; Lcd_Init();

t = t * 0.4887; Lcd_Cmd(_LCD_CURSOR_OFF);

temp = t;

a = t%10; do

lcd[2] = a + '0'; {

Lcd_Cmd(_LCD_CLEAR);

t = t/10; Lcd_out(1,1, "Temperature:");

a = t%10; tempreture1 =
tempraturSensor(ADC_Read(0));
lcd[1] = a + '0';
if(tempreture1 >= 50 ) {

openDoor();
t = t/10;
PORTC.F0=1;
a = t%10;
produceAlarm();
lcd[0] = a + '0';
PORTC.F0=0;

return temp;

H
Electrical and computer engineering BSC thesis 2014

} Delay_ms(100);

tempreture1=49; }while(1);

Lcd_out(2,1,lcd); }

You might also like