Professional Documents
Culture Documents
AND
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
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.
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
V
Electrical and computer engineering BSC thesis 2014
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.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.
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:-
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.
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.
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 .
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
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
Key Features
Special Features
PIC16F877 chip is available in different types of packages. According to the type of applications
and usage, these packages are differentiated.
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).
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
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.
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)
13
Electrical and computer engineering BSC thesis 2014
14
Electrical and computer engineering BSC thesis 2014
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.
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.
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.
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.
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.
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.
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.
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
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
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
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
25
Electrical and computer engineering BSC thesis 2014
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
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.
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
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.
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.
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.
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
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.
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.
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
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
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.
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.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.
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.
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
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.
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
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.
36
Electrical and computer engineering BSC thesis 2014
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.
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
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
TX: Transmitter
SS: Slave Select
RX: Receiver
T0CK1: Clock Input to Timer
CK: Clock
PGC: Programming Clock
A
Electrical and computer engineering BSC thesis 2014
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
C
Electrical and computer engineering BSC thesis 2014
Delay_ms(1500);
void main(){
// Moving text
Lcd_Cmd(_LCD_SHIFT_RIGHT);
Lcd_Cmd(_LCD_CLEAR); //
Clear display Move_Delay();
Lcd_Cmd(_LCD_CURSOR_OFF); // }
Cursor off
D
Electrical and computer engineering BSC thesis 2014
} }
Sound_Play(20, 1000);
void Tone2() {
}
Sound_Play(20, 1000); // Frequency =
698Hz, duration = 250ms
void Melody2() {
}
unsigned short i;
ToneA(); ToneB();
}
void Melody() { // Plays the melody
"Yellow house" void openDoor()
Tone1(); Tone2(); {
Tone1(); Tone2();
Tone1(); Tone2();
E
Electrical and computer engineering BSC thesis 2014
CCP2CON |= (1<<2)|(1<<3); //
select for PWM mode lcd_init();
//{ 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)
delay_ms(100); lcd_out(2,1,"0");
F
Electrical and computer engineering BSC thesis 2014
Sound_Play(20, 1000);
//while (1) {
Lcd_Cmd(_LCD_CLEAR);
if (Button(&PORTB,6,1,1)) // RB6
lcd_out(1,1,"SEND"); plays Tone2
lcd_out(2,1,"SUCCESSFULLY"); Tone2();
{
// Wait for button to be released
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;
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);
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); }