Sie sind auf Seite 1von 56



B-Tech Thesis








July, 2016
Debrezeit, Ethiopia

A project

Submitted to Department of electrical power engineering

Defence University College of Engineering in partial fulfillment of the

Requirements for the Bachelor of

Electrical power Engineering


(The Department of Electrical power Engineering)



JUNE, 2016

This project result is the effort of each individual in group, except where stated on the reference.
All source and reference is acknowledged by appropriate mention and precise references that
attached. We give our approval for this project to study, photocopy. If anyone interested on it go
to library loan and can access it.

Student’s Name Signature Date

Deldle G/Wahid ……………….. ………………

Nizigiyimana Alexis ……………….. ………………

Wagaye Wana …………........... ………………..

Yirga Abrha ………………… ………………..


This is to certify that project report entitled “Intelligent fire detector with automatic water
sprinkler for industrial application” is carried out by Deldle G/Wahid, Nizigiyimana Alexis,
Wagaye Wana, Yirga Abrha student of Bachelor of Technology Defence University College of
engineering during the year 2016. In partial fulfillment of the requirements for the award of
bachelor of technology in Electrical power engineering specialization in control and automation
and the project has not formed the basis for the award previously of any degree, diploma,
associate ship, fellowship or any other similar rule.

Signature of advisor _____________



Examiners Signature

1.___________________ ___________________

2.___________________ ___________________

First of all, we would like to thank God for helping us in every aspect of our project time. Next
to God, we have special thanks to our advisor Tefera Tadesse, who helped us in giving the ideas
and the important supports to succeed to this project in good approach of guidance. And also we
would thank all the department members for their help in different situations. Lastly we would
like to thank our families, friends and other members who contributed physically, morally, and
materially to our project.


Fire accidents can take place more in areas like houses, industries, movie theatres, shopping
malls, hospitals, etc, which will lead to more losses in life along with properties. Generally
waiting for a fire engine to extinguish fire, may be delayed which may increase the chance of
loss in life and large amount of capital. There are so many preventive mechanisms have been
developed to prevent/reduce the fire accidents to some extent. But always automatic solution
brings more accuracy to protect lives and investment from fire accidents.

In this project, an automatic fire detection and extinguish is implemented by using embedded
system and sensor technology. This automatic solution responds in time, when fire is detected
and saves many lives and materials by sprinkling the water on the fire. A smoke sensor is used to
detect the fire occurred in the room and it intimates to the control circuit via electrical signals.
Now the control circuit automatically drives the motor in the sprinkler and sprinkles the water on
the fire. Generally this control circuit uses analog to digital converter to convert the analog
output from the sensor into digital, processed and then finally drives the sprinkler system.

In this project, PIC16F877A microcontroller is used as a main controller for the control circuit of
the system. The PIC16F877A itself contains 10-bit ADC, so that, it reduces the size and cost of
the system. A L293D is used to drive the DC motor by allowing the motor current through,
which is not allowed in the microcontroller. A gas/smoke detector sensor is used to detect fire
and feeds the information to the ADC which is available in PIC16F877A microcontroller (If the
sensor is digital, it gives digital signal directly to microcontroller). But here, we used a gas
sensor with digital output, so no need to program the ADC10 of PIC16F877A. Directly the
output of the gas sensor is connected to the port pin of the PIC16F877A as an interrupt.


Chapters Contents page

1.1. Background 1
1.2. Project Introduction 1
1.3. Problem statement 2
1.4. Objectives 2
1.4.1. General objective 2
1.4.2. Specific objective 2
1.5. Scope 2
1.6. Methodology 2
1.7. Limitations of the project 4
1.8. Report structure 4
2.1. Introduction 5
2.2. Paper 5
3.1. Introduction 7
3.2. Block Diagram 8
3.3. Block diagram components description 8
3.3.1. Microcontroller 8
3.3.2. Smoke sensor 13
3.3.3. DC motor 14
3.3.4. LCD Display 15

3.3.5. Motor Driver L293D 17
3.3.6. Buzzer 18
3.3.7. Water sprinkler 19
3.4. Design of components 19
3.4.1. Power circuit 20
3.4.2. Smoke sensor 25
3.5. Interfacing of peripherals to microcontroller 32
3.6. The software 33
4.1. System overview 35
5.1. Conclusion 38
5.2. Recommendation 38
A. C code fire detector with automatic water sprinkler 40
B. Pin of pic16F877A 42

Figures Page
Figure 1.1.Methodology flow chart 3
Figure 2.1.Manual fire detector 5
Figure 2.2 Firefighters 6
Figure 3.1.Block diagram 8
Figure 3.2.PIC16F877A Integrated Circuit 12
Figure 3.3.Pin diagram of PIC16F877A 12
Figure 3.4.Smoke sensor 13
Figure 3.5.DC Motor with suction system 14
Figure 3.6.LCD display 16
Figure 3.7.L293D Motor driver IC and its interfacing 18
Figure 3.8.Buzzer and its interfacing 18
Figure 3.9.Water sprinkler 19
Figure 3.10.Step-down transformer 20
Figure.3.11.Bridge rectifier 21
Figure 3.12.Bridge rectifier current flow 21
Figure.3.13.Wave rectification 22
Figure 3.14.Filter 23
Figure 3.15 Discharging and charging period of capacitor 24
Figure 3.16.Overall power supply circuit 25
Figure 3.17.Ionization chamber 26
Figure 3.18.P-channel MOSFET switch 27
Figure 3.19.Op-Amp comparator 29
Figure 3.20.ICSD 31
Figure 3.21.Overall interfacing circuit diagram 33
Figure 3.22.Flow chart of the program 34
Figure 4.1.Snap shoot of MikroC PRO for PIC window 36
Figure 4.2.Snap shoot proteus simulation 37


Tables Page

Table 3.1 Feature of PIC16F877A 11

Table B.1.Pin description of PIC16F877A 44


Symbols Meanings

A Ampere

Ao Open loop gain

AC Alternative Current

ADC or A/D Analog to Digital Converter

CCP Capture/Compare/PWM
CISC Complex Instruction Set Computer

CPU Central Processing Unit

C Capacitor

DC Direct current

EEPROM Electrically Erasable programmable ROM

EN Enable

EPROM Erasable Programmable Read Only Memory

GND Ground

I Current

IC Integrated Circuit

ICSD Ionization Chamber Smoke Detector

Id Drain Current

I/O Input /Output

LCD Liquid Crystal Display

MSSP Master Synchronous Serial Port

Max Maximum

Min Minimum

MOSFET Metal Oxide Semiconductor Field Effect Transistor

Op-Amp Operational Amplifier

P|DIP| Plastic |Dual In-line Package|

PIC Peripheral Interfacing Controller

PSP Parallel slave port

PWM Pulse Width Modulator

Rds Dain-source resistance

R Resistor

RAM Random Access Memory

RISC Reduced Instruction Set Computer

ROM Read Only Memory

RS Register-Select

R/W Read/write

RMS Root Mean Square

T Time period

USART Universal Synchronous/Asynchronous Receiver/Transmitter

V Voltage

Vcc Voltage at the common collector

Vdd Voltage Drain-to-Drain

Vin Input Voltage

Vgs Gate to source Voltage

Vout Output Voltage

Vss Source supply voltage

XT Regular Oscillator



1.1. Background

In today‟s scenario, many industries and workplaces use electrical power which can cause the
heat dissipation and some explosive matters may be the source of unwanted fire through failure
or error in control. Some methods used to detect and fight that fire are:-Pumper Truck which
carries the hose, water, and tools to extinguish a fire. A pump on the truck pushes the water
farther so it can reach fires that are high up. Pumpers with very large water tanks are used where
there are no fire hydrants. The fire is detected by the workers and manpower is required to use
manually those pumpers. Those manual activities to fight fire may not be efficient and lead to
losses of lives and many material damages.

1.2. Project introduction

In this project, a fire sensor is used to detect the occurrence of the fire in the surrounding
environments. Actually here a fire sensor is connected to a circuit which produces a digital
output when the fire is detected. This digital output is connected to the PIC16F877A
microcontroller pin as interrupt signal. A motor driven program or a part of it is written to be
called as the interrupt service routine which is executed when the sensor digital output is high
(interrupt signal to PIC16F877A). A water sprinkler mechanism is connected to the shaft of the
dc motor, which will sprinkle the water when the fire is detected by the sensor (fire
extinguisher). A 16x2 LCD is also interfaced with PIC16F77A to show the status about the fire
occurred or not in more effective way. Instead of the LCD one can use a buzzer or speaker to
make the project output more effective by playing sound using the buzzer. But in this project,
both LCD and Buzzer are used to make the project output more beautiful. To achieve this digital
output, the sensor is connected to the operational amplifier and a preset is used to fix the
threshold level. Therefore the Op-Amp acts as a comparator and its output is either logic High or
logic Low depend up on the sensor output and preset value.

1.3. Problem statement

In the industries or working environment when fire occurs it may be detected lately by the
workers and when it is detected manpower is needed to extinguish fire. In that manner it
takes a long time to start fighting that fire. The lateness or lack of detecting that fire and the
inefficient use of manpower cause significant losses such as loss of life, injury to employees,
property damage, product damage, loss of information, community damage, environmental
damage. That is why we are going to design a fastest fire detector and automatic water
sprinkler to protect industries and minimize those losses due to the fire.

1.4. Objective

1.4.1. General objective

The goal of this project is to design and implement a cost effective and intelligent
microcontroller based fire detector which can check continuously the presence of fire occurred in
industries and automatically spray water where the fire is detected by using water sprinkler.

1.4.2. Specific objectives

To realize the general objective of this work, the following subtasks are performed

 Design of components

 Software program design

 The simulation of the hardware in proteus simulation environment

 Hardware implementation

1.5. Scope

This project can detect the occurring fire, alarm and spray the water where the fire is detected.
The sensor is located in the suspected area in the shop or any other place of industry.

1.6. Methodology

This project started with getting idea and concept of fire protection followed by reading some
literature reviews where different control systems have been reviewed in order to establish the
fire detector with automatic water sprinkler system. Then, the next task is to design the block
diagram of the system and some components such as power supply and sensor necessary for this

project. The other components have been selected based on specifications and circuitry of the
interconnections of the components of the system to be built. The next step is computer software
where the hardware of the system is simulated in proteus by selecting all elements from proteus
library but some components may not be available in the library; in this case the component must
be replaced by another component which can replace the function of the unavailable component.
In this project the fire sensor is not found in proteus library. So that a simple push button have
been used because it can replace the function of sensor for simulation purpose only. The program
is written, compiled and hex file is generated using mikroC PRO for PIC software. Then, if all
the design has been finalized, the implementation of the hardware and the circuitry takes place.
Reaching the peak of the project, the performance of the system with the programming segment
takes place, especially on program of the microcontroller, receiving input signals from the sensor
and performs actuation processes. Lastly, certain modification on the circuitry and software took
place in order to make the system performing in a better way.

Literature Design
Concept & Idea

Testing Programming Construction

Modification Result Presentation

Figure1.1 Methodology flow chart

1.7. Limitation of the project

This project work was limited to design our controller and some other components of the system
for practical applications. Our priority focus is to investigate and make a possible suggestion on
how we can design and how designed system is working properly, and hence by assessing
different sources, we got a solution for our design of the required controller. But we cannot get
the required equipment for fire detector design and money for necessary materials like water

1.8. Report structure

Chapter one introduces the project as whole. The early and basic explanations were mentioned in
this chapter. This chapter consists of the background, the project introduction, objectives,
problem statements, limitations and scope of work.

Chapter two, literature review, deals with the overview of different projects done before, and
articles papers written on the concern of intelligent fire detector and automatic water sprinkler.

Chapter three reports about the proposed system detailing the block diagram, explanations for
various blocks with their process flow diagrams and details of the circuits including their
interfacing with microcontroller. And also Software for the system, compilation, proteus
simulation and hardware implementation are detailed in this chapter.

The chapter four will discuss about the results obtained. The last chapter will deal with
conclusion and recommendation.



2.1. Introduction

This section summarizes the literature background related to this work” Intelligent fire detector
with automatic water sprinkler for industrial application”. It discusses about several papers to
serve to achieve the purpose of this project and compare this work with other related works or
theories done or discussed before.

2.2. Papers

In the past time the fire detection was by human being as written in the paper “Fire Alarm
System Basics” by Stanford University fire MARSHAL‟s office. That manual fire detection is
the oldest method of detection. In the simplest form, a person yelling can provide fire warning.
In buildings, however, a person's voice may not always transmit throughout the structure. For
this reason, manual alarm stations are installed. The general design philosophy is to place
stations within reach along paths of escape. It is for this reason that they can usually be found
near exit doors. [5]

Figure 2.1 Manual fire detectors [5]

OSHA described in its manual “Fire Service Features of Buildings and Fire Protection Systems”
how the firefighters work to protect people and materials from fire incidents. They use fire
detectors for alarming when fire occurs. The alarm gives them information and they call other
society of firefighters to help them because they don‟t use any automatic fighter in case of fire
occurrence: Upon arrival at an incident, firefighters must handle many tasks. Standard operating
procedures should enable firefighters to quickly assess the situation. Rescuing of occupants is the
first priority, followed by confining and extinguishing the fire. The firefighters are equipped by
“truck”, “ladder”, “aerial”, “ladder truck”, “tower” or “tower ladder. In the buildings they install
some hoses to sprinkle water but their valves are controlled manually. This method has many
challenges: delays in taking action of protection causing many losses, death of firefighters during
rescuing and controlling valves. [4]

Figure 2.2 Firefighters [4]

The development of an ionization chamber device began in 1939 by Ernst Meili, a Swiss
physicist, who devised an ionization chamber device capable of detecting combustible gases in
mines. [8]

In 1812, British inventor Sir William Congreve patented a manual sprinkler system using
perforated pipes along the ceiling. When someone noticed a fire, a valve outside the building
could be opened to send water through the pipes.[9]

From the above papers and theories, manpower is involved in fire protection systems contrarily
to our work which is automatically based system. Our project can efficiently reduce time and
cost of taking action.



3.1. Introduction

This section discusses about the whole system design system detailing the block diagram,
explanations for various blocks with their process flow diagrams and details of the circuits
including their interfacing with microcontroller. All components incorporating the system are
described, selected and some of them are designed. And also Software used for the system,
compilation, proteus simulation and hardware implementation are detailed in this section. This
section of project describes the details of the following units:

 Block diagram
 Description and selection
 Design of components
 Interfacing of each components
 Software
 Simulation

The logical structure of the project design is shown in the block diagram shown in figure (3.1)
below. The central system (microcontroller) handles the sensor input and data which are given to
the actuators. The controller decides and sends a control signal to the specified output peripheral
device on specified ports. This means according to the input from the smoke sensor and the

microcontroller makes decision and gives the corresponding output to the actuators.

3.2. Block diagram






Figure 3.1 Block diagram of intelligent fire detector with automatic water sprinkler

3.3. Block diagram components description

3.3.1. Microcontroller

A microcontroller is a small computer on a single integrated circuit containing a processor core,

memory, and programmable input/output peripherals which is the central brain of the thesis. A
Set of digital logic circuits integrated on a single silicon chip. A microcontroller is an integrated
chip that is often part of an embedded system.

The microcontroller includes a CPU, RAM, ROM, I/O ports, and timers like a standard
computer, but because they are designed to execute only a single specific task to control a single
system, they are much smaller and simplified so that they can include all the functions required
on a single chip. All components are connected via an internal bus and are all integrated on one
chip. The modules are connected to the outside world via I/O pins.
Advantages of Microcontroller

Microcontrollers are widely used in today‟s control systems for the following reasons:

 Design and simulation - Because programming is must, detailed simulations may be

performed in advance to assure correctness of code and system performance.
 Flexibility - Ability to reprogram using Flash, EPROM or EEPROM which allows
straightforward changes in the control used in the future.
 High Integration - Most microcontrollers are essentially single chip Computers with on-
chip processing unit, memory, and input out modules and are capable of reading analog
signals with an analog-to-digital converter (ADC) inside the chip. This differentiates a
microcontroller from a microprocessor. Microprocessors require that this functionality be
provided by added components.
 Cost - Cost savings come from several locations. Development costs are greatly
decreased because of the design and/or flexibility advantages mentioned previously.
Because so many components are included on one IC, board area and component savings
are often evident as well.
 Easy to Use - Just program and go! While in the past, programming has often involved
tedious assembly code, today C compilers are available for most microcontrollers.

Microcontrollers often only require a single 5V supply as well which makes them easier to
power and use. The following list contains the modules typically found in a microcontroller.

Processor Core: it is the central processing unit of the controller. It contains the arithmetic logic
unit, the control unit, and the registers (stack pointer, program counter, accumulator register,
register file).

Memory: The memory is sometimes split into program memory and data memory.

Digital I/O: Parallel digital I/O ports are one of the main features of microcontrollers. The
number of I/O pins varies from 3-4 to over 90, depending on the controller family and the
controller type.

In a microcontroller what have to be done is to make proper connections of the pins and then
feed a program into it. After that the microcontroller responds in accordance with the program
that has been fed into it. In a microcontroller, program inputs are received from a set of input

pins that you specify and then process the input and produce an output on a set of output pins in
the form of digital signal. However in order to connect the pins, the pin diagram of the
microcontroller should be known.

Any microcontroller needs a clock to perform its function properly. There are two main clock
modes, CR and XT. The CR mode needs a simple capacitor and resistor circuit attached to
CLKIN, whose time constant (CR) determines the clock period. R should be between 3 kΩ and
100 kΩ, and C greater than 20 pF. For example, if R 10 kΩ and C 10 nF, the clock period will be
around 2* C*R = 200 μs (calculated from the CR rise/fall time) and the frequency about 5 kHz.
This option is acceptable when the program timing is not critical.

The XT mode is the one most commonly used, since the extra component cost is small compared
with the cost of the chip itself and accurate timing is often a necessity. An external crystal and
two capacitors are fitted to CLKIN and CLKOUT pins. The crystal frequency in this mode can
be from 200 kHz to 4 MHz and is typically accurate to better than 50 ppm (parts per million) or
0.005%. A convenient value is 4 MHz, as this is the maximum frequency possible with a
standard crystal and gives an instruction execution time of 1.000 μs (1 million instructions per
second, or 1 MIP). A low-speed crystal can be used to reduce power consumption.

PIC16F877A is very popular because is very cheap. Apart from that it is also very easy to be
assembled. It comes in a 40 pin DIP pin out and it has many internal peripherals. Additionally,
this IC is just a 5V power supply adapter, a 20MHz crystal oscillator and two units of 22pF
capacitors. This IC can be reprogrammed and erased up to 10,000 times. Therefore it is very
good for new product development phase.[2]

Key Features PIC16F877

MAX Operating Frequency 20MHz

FLASH Program Memory

(14-bit words)

Data Memory (bytes) 368

EEPROM Data Memory (bytes) 256

RA0-5 (6)
RB0-7 (8)
I/O Ports RC0-7 (8)
RD0-7 (8)
RE0-2 (3)

Timers 3


Serial Communications MSSP, USART

Parallel Communications PSP

10-bit Analog-to-Digital Module 8 Channels

Instruction Set 35 Instructions

Pins (DIP) 40 Pins

Table 3.1 Features of PIC16F877A

Figure 3.2 PIC16F877A Integrated Circuit (IC)[11]

This IC has no internal oscillator so an external crystal of other clock source is needed. The
16F877A is a capable microcontroller that can do many tasks because it has a large enough
programming memory (large in terms of sensor and control projects) 8k words and 368 Bytes of

Figure 3.3 Pin diagram of PIC16F877A [11]

3.3.2. Fire/smoke sensor

Figure 3.4 Smoke sensor

A smoke detector is a device that senses the presence of smoke in a building and warns the
occupants, enabling them to escape a fire before succumbing to smoke inhalation or burns.

Two basic types of smoke detectors are currently manufactured for residential use. The
photoelectric smoke detector uses an optical beam to search for smoke. When smoke particles
cloud the beam, a photoelectric cell senses the decrease in light intensity and triggers an alarm.
This type of detector reacts most quickly to smoldering fires that release relatively large amounts
of smoke.

The more popular that we use in this project is the second type of smoke detector, known as an
ionization chamber smoke detector (ICSD), is quicker at sensing flaming fires that produce little
smoke. It employs a radioactive material to ionize the air in a sensing chamber; the presence of
smoke affects the flow of the ions between a pair of electrodes, which triggers the alarm.
Although most residential models are self-contained units that operate on a 9-volt battery,
construction codes in some parts of the country now require installations in new homes to be
connected to the house wiring, with a battery backup in case of a power failure. The typical
ICSD radiation source emits alpha particles that strip electrons from the air molecules, creating
positive oxygen and nitrogen ions. In the process, the electrons attach themselves to other air
molecules, forming negative oxygen and nitrogen ions. Two oppositely charged electrodes
within the sensing chamber attract the positive and negative ions, setting up a small flow of
current in the air space between the electrodes. When smoke particles enter the chamber, they
attract some of the ions, disrupting the current flow. A similar reference chamber is constructed
so that no smoke particles can enter. The smoke detector constantly compares the current flow in
the sensing chamber to the flow in the reference chamber; if a significant difference develops, an
alarm is triggered.

3.3.3. DC motor

A DC motor is any of a class of electrical machines that converts direct current electrical power
into mechanical power. The most common types rely on the forces produced by magnetic fields.
Nearly all types of DC motors have some internal mechanism, either electromechanical or
electronic type, to periodically change the direction of current flow in part of the motor. Most
types produce rotary motion; a linear motor directly produces force and motion in a straight line.

DC motors were the first type widely used, since they could be powered from existing direct-
current lighting power distribution systems. A DC motor's speed can be controlled over a wide
range, using either a variable supply voltage or by changing the strength of current in its field
windings. Small DC motors are used in tools, toys, and appliances. The universal motor can
operate on direct current but is a lightweight motor used for portable power tools and appliances.
Larger DC motors are used in propulsion of electric vehicles, elevator and hoists, or in drives for
steel rolling mills. Here a 12 V DC motor is used to suck water.

Figure 3.5 Motor with suction system

3.3.4. LCD Display

A Liquid Crystal Display is an electronic device that can be used to show numbers or text. There
are two main types of LCD display, numeric displays (used in watches, calculators etc.) and
alphanumeric text displays (often used in devices such as photocopiers and mobile
telephones).The display is made up of a number of shaped crystals·. In numeric displays
these crystals are shaped into bars, and in alphanumeric displays the crystals are simply arranged
into patterns of dots·. Each crystal has an individual electrical connection so that each crystal can
be controlled independently. When the crystal is off· (i.e. when no current is passed through the
crystal), the crystal reflects the same amount of light as the background material, and so the
crystals cannot be seen. However when the crystal has an electric current passed through it, it
changes shape and so absorbs more light. This makes the crystal appear darker to the human eye
and so the shape of the dot or bar can be seen against the background. More microcontroller
devices are using 'LCD' displays to output visual information. This component is specifically
manufactured to be used with microcontrollers, which means that it cannot be activated by
standard IC circuits.

It is used for displaying different messages on a miniature liquid crystal display. This LCD
displays module is inexpensive, easy to use, and it is even possible to produce a readout using
the 8 x 80 pixels of the display. For a 8-bit data bus, the display requires a +5V supply plus 11
I/O lines. For a 4-bit data bus it only requires the supply lines plus seven extra lines. When the
LCD display is not enabled, data lines are tri-state which means they are in a state of high
impendence (as though they are disconnected) and this means they do not interfere with the
operation of the microcontroller when the display is not being addressed. The LCD also requires
3 "control" lines from the microcontroller. The enable (E) line Determines whether the LCD
listens to the other control and data lines. When disabled, the LCD ignores all data an Figure 4:
LCD displayed control signals. When enabled, the LCD checks the state of the other two control
lines and responds accordingly. The function of the 3 control lines are summarized below.

a) b)

Figure 3.6: LCD display: a) with pins and b) with characters displayed

When power is applied to the LCD, it resets itself and waits for instructions. Typically these
instructions turn on the display, turn on the cursor, and set the display to print from left to right.
Once the LCD is initialized, it can receive data or instructions. If it receives a character, it prints
it on the screen and moves the cursor one character to the right. The cursor marks the next
location at which a character will be printed. The LCD‟s internal processing is similar. A
memory pointer determines where the next byte will be stored. When a new byte arrives, the
pointer advances. To write to sequential locations, establish the starting address and then write
one byte after another. Characters are stored in data display (DD) RAM. Regardless of the
number of characters visible on the display, the LCD has 80 bytes of DDRAM. Characters in off-
screen RAM can be made visible by scrolling the display. The LCD also has 64 bytes of
character-generator (CG) RAM then it is low, an instruction is being written to the LCD. When it
is high, a character is being written to the LCD.

Logic status on control lines:

The read/write (R/W) line determines whether the LCD reads bits from the data lines, or Writes
bits to them. Register-select (RS) determines whether the LCD treats data as instructions or
characters. Here is the truth table for the control lines:

 E= 0 LCD disabled.
 E=1 LC D enabled.
 R/W =0 Write to LCD, 1 Read from LCD.

 RS =1 Instructions,1 Characters/bytes.

Writing to the LCD requires the basic steps listed below. (Reading from the LCD follows the
same sequence, but the R/W bit must be set.)

 Clear the R/W bit.

 Set or clear the RS bit as appropriate.
 Set the E bit (E=1).
 Clear the E bit (E=0).

3.3.5. Motor driver L293D

L293D is a Motor driver integrated circuit which is used to drive DC motors rotating in either
direction. It is a 16-pin IC which can control a set of two DC motors simultaneously. The L293D
uses 5V for its own power and external power source is needed to drive the motors, which can be
up to 36V and draw up to 600mA.

The L293D works on the concept of typical H-bridge, a circuit which allows the high voltage to
be flown in either direction. In a single L293D IC there two H-bridge circuits which can rotate
two DC motors independently. Due to its size and voltage requirement, it is frequently used in
robotics applications for controlling DC motors. The L293D is also a key component in larger
'motor driver' boards available premade for hobbyists. There are two Enable pins on L293D. Pin
1 (left H-bridge) and pin 9 (right H-bridge). To drive the corresponding motor, pin 1 or 9 need to
be set to HIGH. If either pin 1 or pin 9 goes low then the motor in the corresponding section will
suspend working. The four Input pins for the L293D are pin 2 and 7 on the left and pin 15 and 10
on the right as shown on the pin diagram. Left input pins will regulate the rotation of motor
connected on the left side and right input for motor on the right hand side. The motors are rotated
on the basis of the inputs provided at the input pins as LOGIC 1 or LOGIC 0.

Assuming a motor connected on left side output pins (pin 3 and 6).

 Pin 2 = Logic 1 and Pin 7 = Logic 0 | Clockwise Direction

 Pin 2 = Logic 0 and Pin 7 = Logic 1 | Anticlockwise Direction

 Pin 2 = Logic 0 and Pin 7 = Logic 0 | Idle [No rotation] [Hi-Impedance state]

Figure 3.7 L293D Motor driver IC and its interfacing

3.3.6. Buzzer

Buzzer is an electrical device, which is similar to a bell that makes a buzzing noise when current
passes through it and is used for signaling. Typical uses of buzzers and beepers include alarm
devices, timers and confirmation of user input such as a mouse click. To interface a buzzer the
standard transistor interfacing circuit is used. Note that if a different power supply is used for the
buzzer, the 0V rails of each power supply must be connected to provide a common reference. If a
battery is used as the power supply, it is worth remembering that piezo sounders draw much less
current than buzzers. Buzzers also just have one tone·, whereas a piezo sounder is able to create
sounds of many different tones. The transistor is used as a switch to control the buzzer. The
diode prevents the transistor and also the logic circuit from the current induced by the inductive
property of the buzzer. This diode is a freewheeling diode.

Figure 3.8 Buzzer and its interfacing circuit

3.3.7. Water sprinkler

Water sprinkler commonly called fire sprinkler in intelligent fire detection systems; is a device
consisting of water supply system, providing adequate pressure and flow rate to a water
distribution piping system. It is used to discharge water

Figure 3.9 Water sprinkler

In this project water sprinkler is connected to a system sucking water by a motor as shown in
above figure (Figure 3.9), where water sprinkler will be connected to discharge pipe.

3.4. Design of components

This section consists of designing some components to make them appropriate and suitable for
our project. The design part contains the design of the following components.

a. Power supply circuit

b. Smoke sensor

The other components are selected according to the need of the project to meet the objective.

3.4.1. Power Supply Circuit

Power supply circuit, the name itself indicates that this circuit is used to supply the power to
other electrical and electronic circuits or devices. There are different types of power
supply circuits based on the power they are used to provide for devices. For this, the micro-
controller based circuits, usually the 5V DC regulated power supply circuit, are used, which can
be designed using different techniques for converting the available 230V AC power to 5V DC
power. Generally the converters with output voltage less than the input voltage are called as step-
down converters. This circuit mainly consists of four Steps to convert 230V AC to 5V DC: (1)
Step down AC voltage (2) Rectification (3) Filtration (4) Voltage Regulation.

i) Step-Down the Voltage Level

The step-down converters are used for converting the high voltage into low voltage. The
converter with output voltage less than the input voltage is called as a step-down converter, and
the converter with output voltage greater than the input voltage is called as step-up converter.
There are step-up and step-down transformers which are used to step up or step down the voltage
levels. 230V AC is converted into 12V AC using a step-down transformer. 12V output of step-
down transformer is an RMS value and its peak value is given by the product of square root of
two with RMS value, which is approximately 17V.

Figure 3.10 Step-down transformer

Step-down transformer consists of two windings, namely primary and secondary windings where
primary can be designed using a less-gauge wire with more number of turns as it is used for
carrying low-current high-voltage power, and the secondary winding using a high-gauge wire

with less number of turns as it is used for carrying high-current low-voltage power. Transformer
works on the principle of Faraday‟s laws of electromagnetic induction.

ii) Convert AC to DC

230V AC power is converted into 12V AC (12V RMS value wherein the peak value is around
17V), but the required power is 5V DC; for this purpose, 17V AC power must be primarily
converted into DC power then it can be stepped down to the 5V DC. But first and foremost, we
must know how to convert AC to DC. AC power can be converted into DC using one of
the power electronic converters called as Rectifier. There are different types of rectifiers, such as
half-wave rectifier, full-wave rectifier and bridge rectifier. Due to the advantages of the bridge
rectifier over the half and full wave rectifier, the bridge rectifier is frequently used for converting
AC to DC.

Figure 3.11 Bridge rectifier

In the diagrams below, when the input connected to the left corner of the diamond is positive,
and the input connected to the right corner is negative, current flows from the upper supply
terminal to the right along the red (positive) path to the output, and returns to the lower supply
terminal via the blue (negative) path.


Figure 3.12 (a) and (b) Bridge rectifier current flow

When the input connected to the left corner is negative, and the input connected to the right
corner is positive, current flows from the lower supply terminal to the right along
the red (positive) path to the output, and returns to the upper supply terminal via
the blue (negative) path. In each case, the upper right output remains positive and lower right
output negative. Since this is true whether the input is AC or DC,

Figure 3.13 Wave rectification

Bridge rectifier consists of four diodes which are connected in the form a bridge. We know that
the diode is an uncontrolled rectifier which will conduct only forward bias and will not conduct

during the reverse bias. If the diode anode voltage is greater than the cathode voltage then the
diode is said to be in forward bias. During positive half cycle, diodes D2 and D4 will conduct
and during negative half cycle diodes D1 and D3 will conduct. Thus, AC is converted into DC;
here, the output voltage of rectifier is not a pure DC as it consists of pulses. Hence, it is called as
pulsating DC power. But voltage drop across the diodes is (2*0.7V) = 1.4V; therefore, the peak
voltage at the output of this rectifier circuit is 15V (17-1.4) approximately.

iii) Smoothing the ripples using filter (filtration)

15V DC can be regulated into 5V DC using a step-down converter, but before this, it is required
to obtain pure DC power. The output of the diode bridge is a DC consisting of ripples also called
as pulsating DC. This pulsating DC can be filtered using an inductor filter or a capacitor filter or
a resistor-capacitor-coupled filter for removing the ripples. Consider a capacitor filter which is
frequently used in most cases for smoothing.

Figure 3.14 Filter

We know that a capacitor is an energy storing element. In the circuit, capacitor stores
energy while the input increases from zero to a peak value and, while the supply voltage
decreases from peak value to zero, capacitor starts discharging. This charging and discharging of
the capacitor will make the pulsating DC into pure DC, as shown in figure above.

Calculation of smoothing capacitor

First of all in addition to these components you would need a step down transformer in order to
make the full-wave rectified output voltage of your bridge rectifier small enough. You can't feed
the rectified 230 V directly to LM7805, because LM7805 operates in the input ranges of 7 V to
20 V (and has a maximum input rating of 35 V).

If we assume that your step down transformer reduces the amplitude of 50 Hz sine wave from
230 V to 15 V, and if we assume that your 5 V power supply will need to output at most I_max =
1 A current, then we can start making some calculations. Your reservoir capacitor, which you
will place after the bridge rectifier, will have V_max = 15 V on it, which is the amplitude of your
sine wave. In the image:

Figure 3.15 Discharging and charging period of capacitor

You see that capacitor discharges during almost the whole period of half-wave rectified wave (in
our case this discharge is caused by the I_max = 1 A load current going into LM7805). The
discharge time of reservoir capacitor in the case of half-wave rectifier is T discharge = T = (1/f)
= (1/50 Hz) = 20 ms, however, notice that, in our case we have a more sophisticated rectifier
(Diode bridge) which gives a full-wave rectified output. So, the discharge time will be
T_discharge = T/2 = (1/2*f) = 10 ms.

Now, at the beginning of each discharge period our capacitor is charged up to V max = 15 V. In
order to prevent our capacitor voltage going below V min = 7 V (which is the lowest input
operating point for LM7805 voltage regulator) in the end of the discharge period, our capacitor
value should be chosen with the equation:

C >= (I max*T discharge)/(V before discharge -V after discharge)

Using the values; V before discharge = V max = 15 V and V after discharge = V min = 7 V and
Imax = 1 A and T discharge = 10 ms, we can calculate that:

C min = (1 A)*(10 ms)/(15 V - 7 V) = 1.25 mF. You can see that if you use a step down
transformer which reduces the 230 V input into 20 V instead of 15 V and if your power supply
will require at most I max = 0.5 A current, you can use an even smaller capacitance with the
value: C min = (0.5 A)*(10 ms)/(20 V - 7 V) = 0.38 mF.

Here you can see an example design which uses LM7805 just like we are, and they picked a
capacitor value of 0.47 mF, which is close to the values we calculated above.

iv) Regulating of 15V DC into 5V DC using Voltage Regulator

15V DC voltage can be stepped down to 5V DC voltage using a DC step-down converter called
as voltage regulator IC7805. The first two digits „78‟ of IC7805 voltage regulator represent
positive series voltage regulators and the last two digits „05‟ represents the output voltage of the
voltage regulator.

Figure 3.16 Overall power supply circuit

The input 0.0001mf capacitor of voltage regulator is the filter capacitor employed to
steady(stabilize) the slow changes in the voltage applied at the input of the regulator circuit
where as the output 0.0001mf capacitor of voltage regulator is the filter capacitor employed to
steady the slow changes in the voltage applied at the output of the circuit.

3.4.2. Digital Smoke Sensor (ICSC)

This sensor is composed by three main components:

-Ionization chamber;

-MOSFET as switch;

-Op-Amp comparator

i) The ionization chamber smoke

It uses a kind of chemistry to spot unusual molecules (smoke) heading inward. Detectors like this
are called ionization smoke detectors. Inside the detector, there's an ionization chamber open to
the air filled with ions, which, in this case, are atoms that have lost electrons to make positively
charged nuclei. Where do the ions come from? Inside the chamber, there's a small piece of a
chemical element called americium. It constantly spews out tiny radioactive particles
(called alpha particles), which leak into the detection chamber. As they do so, they crash into air
molecules and turn them into positively charged ions and negatively charged electrons. The ions
and electrons move in opposite directions between two electrodes (electrical contacts, rather like
the terminals of a battery). As long as the ions and electrons are moving, a current flows between
the electrodes. However, if a fire breaks out, smoke particles get into the detector and start to
clog up the ionization chamber. They attach themselves to the ions and effectively shut off the
electric current. Once the fire is out and the smoke is gone, the detection chamber clears, the ions
travel back and forth between the electrodes as before.

Figure 3.17 Ionization chamber

ii) MOSFET as Switch

In this project P-channel device is used to control the source to drain current. It has a distinct
advantage over the N-channel MOSFET, that is in the simplicity of the on/off control block.

a) Definition of P-channel MOSFET

MOSFET which has p-channel region between source and gate is known as p-channel MOSFET.
It is a four terminal devices, the terminals are gate, drain, source and substrate or body. The drain
and source are heavily doped with p+ region and the substrate is in n-type. The current flows due
to the flow of positively charged holes that‟s why it is known as p-channel MOSFET. When we
apply negative gate voltage, the electrons present beneath the oxide layer, experiences repulsive
force and they are pushed downward in to the substrate, the depletion region is populated by the
bound positive charges which are associated with the donor atoms. The negative gate voltage
also attracts holes from p+ source and drain region in to the channel region. Thus hole which
channel is formed now if a voltage between the source and the drain is applied current flows. The
gate voltage controls the holes concentration of the channel.

b) P-Channel MOSFET as switch:

The transistor shown is a P-channel MOSFET acting as a "high-side switch". Setting parameters:
Set Vdd = 5V and to control the" Output "of the device apply 0V on "gate Control".

Figure 3.18 P-channel MOSFET switch

When the control goes "HIGH" the MOSFET switch is "OFF." When the control goes "LOW"
the MOSFET acts as ON switch, essentially shorting the drain and source. While this is not
entirely true, it is a close approximation as long as the transistor is fully saturated. The source is

connected to the power rail (Vcc). In order to allow current to flow the Gate needs to be pulled to
ground. To turn it off the gate needs to be pulled to Vcc. So the schematic shown above can be
used to switch 5V to something, but it will not connect the output to 0V unless a pull down
resistor is used as shown in the above image.

A P-channel FET switches ON when Vgs>-5V. It switches OFF when Vgs = 0. So we can switch
the MOSFET ON by applying 0V on gate ( Vgs = -Vin) and we can switch the MOSFET OFF
by applying 5V on gate ( Vgs = 0). Where Vgs = Vg -Vs

c) P-channel parameters and Drain-source current calculation

Ids = 0 if -Vgs < -Vth (off)

Ids = -K*[(Vgs - Vth)*Vds - Vds^2/2]*(1+L*|Vds|) if 0 < -Vds < -Vgs + Vth] (linear region)

Ids = -(K/2)*(Vgs - Vth)^2*(1+L*|Vds|) if 0 < -Vgs + Vth < -Vds (saturated region)

Where K is a constant, Vth is the Threshold voltage, L is the channel modulation, Vgs is the
gate-source voltage and Vds is the drain-source voltage.


Drain-source on resistance, Rds(on): 0.5 Ohm

Drain current, Ids, for Rds(on):

Gate-source voltage, Vgs, for Rds (on): -5V

Gate-source threshold voltage, Vth: -1.4V

Channel modulation, L= 0

Set K =1

 For linear region : 0 < -Vds < -Vgs + Vth, we have

0 < -Vds < 3.6V and then set Vds = -3V

Ids =-1*[(-5+1.4)*(-3) –(-3)^2/2]*1 = -6.3A

 For saturated region : 0 < -Vgs + Vth < -Vds , we have

0 < 3.6< - Vds, and then set Vds = -4V

Ids = -1/2*[(-5+1.4)]^2*1 = -6.5A

 Take the switch to work in saturated region :Vds = -4V and Ids =-6.5A
 The FET output voltage is equal to input op-amp voltage :Vout =Vin
 Vout =Vin= Vdd – ILoad - Rds(on) = 5V-(-6.5*0.5)V= 8.25V

iii) The Op-amp Comparator

The comparator is an electronic decision making circuit that makes use of an operational
amplifier very high gain in its open-loop state, that is, there is no feedback resistor. The Op-amp
comparator compares one analogue voltage level with another analogue voltage level, or some
preset reference voltage, VREF and produces an output signal based on this voltage comparison.
In other words, the op-amp voltage comparator compares the magnitudes of two voltage inputs
and determines which is large of the two. The standard operational amplifier is characterized by
its open-loop gain AO and that its output voltage is given by the expression: VOUT = AO(V+ – V-
) where V+ and V- correspond to the voltages at the non-inverting and the inverting terminals
respectively. The open-loop op-amp comparator is an analogue circuit that operates in its non-
linear region as changes in the two analogue inputs, V+ and V- causes it to behave like a
digital bi stable device as triggering causes it to have two possible output states, +Vcc or -Vcc.
Then we can say that the voltage comparator is essentially a 1-bit analogue to digital converter,
as the input signal is analogue but the output behaves digitally. Consider the basic op-amp
voltage comparator circuit below.

If .Vin  Vref then Vout  Vcc

If .Vin  Vref then Vout  Vcc

Figure 3.19 Op-Amp comparator

With reference to the op-amp comparator circuit above, lets first assume that Vin is less than the
dc voltage level at Vref, ( Vin < Vref ). As the non-inverting (positive) input of the comparator is
less than the inverting (negative) input, the output will be low and at the negative supply
voltage, -Vcc resulting in a negative saturation of the output.

If we now increase the input voltage, Vin so that its value is greater than the reference voltage
Vref on the inverting input, the output voltage rapidly switches high towards the positive supply
voltage, +Vcc resulting in a positive saturation of the output. If we reduce again the input
voltage, Vin so that it is slightly less than the reference voltage, the op-amp‟s output switches
back to its negative saturation voltage acting as a threshold detector.

Then we can see that the op-amp voltage comparator is a device whose output is dependent on
the value of the input voltage, Vin with respect to some dc voltage level as the output is high
when the voltage on the non-inverting input is greater than the voltage on the inverting input, and
low when the non-inverting input is less than the inverting input voltage. This condition is true
regardless of whether the input signal is connected to the inverting or the non-inverting input of
the comparator.

We can also see that the value of the output voltage is completely dependent on the op-amps
power supply voltage. In theory due to the op-amps high open-loop gain the magnitude of its
output voltage could be infinite in both directions, (±∞). However practically, and for obvious
reasons it is limited by the op-amps supply rails giving Vout = +Vcc or Vout = -Vcc.

We said before that the basic op-amp comparator produces a positive or negative voltage output
by comparing its input voltage against some preset dc reference voltage as comparator reference

In theory the comparators reference voltage can be set to be anywhere between 0V and the
supply voltage but there are practical limitations on the actual voltage range depending on the
op-amp comparator being device used.


ONOFFswitch inputresistor

sensor largeresistor
1.25mA 4Kohm

Figure 3.20 ICSD

When there is no fire, a detector generates 0.125mA amount of current flowing through small
resistor with meaningless drop, then through huge resistor of 4Kohm where 5V is created
therefore the gate voltage becomes 5v , Vgs = 0 as result the MOSFET does not conduct (no
drain current). Then there is no input voltage to the Op-Amp comparator implying that non-
inverting input voltage is less than inverting voltage resulting as Low state output of Op-Amp

When fire occurs there is no current detector flowing in huge resistor so that the gate voltage is
approximately zero, then the gate to source voltage Vgs = -5V (Vgs becomes negative ) allowing
the MOSFET to conduct by giving drain current (Id), producing input voltage to comparator. In
this case input voltage to comparator is greater than reference voltage resulting High state output
of comparator.

3.5. Interfacing the peripherals to microcontroller

The 5V DC voltage of power supply is connected to pin.1 (RE3/VPP) of PIC16877A. The fire
sensor digital output is connected to pin.16 (RC0) of Microcontroller. A 5v buzzer is connected
to the pin.33 (RBO/INT) of Microcontroller. The clock source external crystal is connected one
terminal to pin.13 (OSC1), the other one to pin.14 (OSC2) of PIC16F877A.The upper four MSB
lines (D4 – D7) of the 16x2 LCD are connected to the pins.27, 28, 29 and 30( RD4-RD7) of
PIC16F877A. The Register Select (RS) line and Enable (EN) line are connected respectively to
Pin.21 (RD2) and Pin.22 (RD3) of Microcontroller. In this circuit the read write (R/W) pin is
connected to ground, because the microcontroller program is used to write the data on to the
LCD, no read operation. Also VSS, VEE, D0, D1, D2, and D3 are connected to ground. The
pins.2, 7,and 1(IN1, IN2, and EN) of L293Dare connected respectively to pins 28, 29, and 30
(RB5, RB6, and RB7) of PIC16F877A, then the two outputs pins.3 and 6 of LM293D are
connected to the two terminals of dc motor. L293D current sinker allows maximum of 500mA
current and is used to drive the dc motor by connecting the one end of it to ground via 500mA
fuse. When pin.5 of the PIC16F877A is at logic high which is connected to the L293D input,
then the corresponding output pin is connected to ground and the motor current start flowing
through the motor from the 12V DC supply.

Operation of the whole system:

When circuit power is up, the LCD will display a message “No fire is detected”. When the fire
sensor detected the fire, its output turn to logic HIGH and it acts as an interrupt signal to
PIC16F877A. Then immediately, corresponding ISR function is executed in the PIC16F877A
and set the motor pin to high, which in turn enable the input pin of the L293D. Therefore the
L293D drives the motor by allowing the current motor to flow through the motor. Now the LCD
updates its status, by displaying the message “Fire detected” and at the same time the buzzer will
alarm about the fire occurred. A water sprinkler mechanism is connected to the motor to sprinkle
the water on fire to light off.

Figure 3.21 Overall interfacing circuit diagram

3.6. The Software

To program the microcontroller MikroC PRO for PIC software environment for programming
hardware with C-compiler is used. There are several different ways of writing a code for
embedded systems depending on the complexity of the system and the amount of time and
money that can be spent. This project uses a C language to program the microcontroller. The
code is compiled by C-compiler and simulated using PROTEUS software. This file may have
references to other software files, called libraries. The assembler file is next assembled and
converted into an object file. Finally the code is converted to hex file which can be loaded to a
microcontroller. The flow chart of the project program is shown below.








Figure 3.22 flow chart of the program



4.1. System Overview

In this project PIC16F877A Microcontroller Integrated Chip plays the main role. The program
for this project is embedded in this Micro controller Integrated Chip and interfaced to all the
peripherals. The Liquid crystal Display (LCD) is interfaced to PIC17F877A Micro controller to
display the message. DC motor is used for the purpose of pumping water through the sprinkler
and is interfaced with current driver chip L293D which is a 16-pin IC. The ion chamber smoke
detector (ICSD) is used in this project for the detection of the fire; whenever it sends a signal
through ADC to Micro controller, the message will be displayed on LCD and buzzer alarms at
the same time, then after a short delay time for assuming the persistence of fire, the dc motor
should start operating. The software is written in C-language and is dumped to the
microcontroller to run the project. During simulation, first of all the required components are
imported to the design window by clicking a “P” button on the window which means pick a
component from a library, when this button is clicked, another window will be opened to select
the desired component. By writing the name of the component and selecting it or double clicking
on it, the component is imported to the design window. In this way all components can be
imported. By selecting from the imported list of components, each component is placed on the
appropriate position on the design space. After putting the components the necessary connection
is done exactly the same as the overall integration circuit diagram. Some components may not be
available in the library. In this case the component must be replaced by another component
which can replace the function of the unavailable component. In this project the designed ICSD
is not found in proteus library. So that a simple push button is used because it can replace the
function of ICSD for simulation purpose only. Diode is used for protection of transistor from
induced current by the buzzer. The program is written, compiled and hex file is generated using
MikroC PRO for PIC software.

The hex file is loaded to the microcontroller on the proteus simply by right clicking on the
microcontroller; clicking “edit properties” and giving the directory of the hex file on the program
file space. The code is available on the appendix.

Figure 4.1 snap shoot of MikroC PRO for PIC window








1nF U1
13 33
14 34
X1 RB2
3 37
4 38
5 39
6 40
1nF 15
8 16
9 17
10 18
1 24
26 16 8
19 2 3
20 7 6
21 1

28 9
29 10 11
30 15




Figure 4.2 Snap shoot of proteus simulation

The figure above simulates the intelligent fire detector with automatic water sprinkler system.
When it starts, it displays continuously “No fire is detected”, when push button (sensor) is
pressed and held (fire), the system displays “ the fire is detected”, the buzzer sounds and after
some delay time around 10s ( to escape from the place, keep away some electronic devices a
check if the fire can persist), the motor starts running. When push button is relaxed (fire ends
up), buzzer and motor stop but LCD displays again “No fire is detected”.



5.1. Conclusion

The overall aim of this project was to develop an intelligent fire detector with automatic water
sprinkler for industrial application, by following the methodology proposed at the beginning we
meet the objective planned. We made the study for the proposed hardware requirements and their
specification. We also identified the required software along with their specification and make
the analysis with them. Then we conquer a meaningful result. During the study of the project we
were able to design the general structure of it successfully, write the C langue and compile it
using mikroC PRO for PIC effectively and achieve the required result by simulating the system
using proteus tools.

In general, our system can check continuously the occurrence of fire in all suspected places of
industry and take action within a short time around 10s to extinguish it.

Finally, depending on the availability of farther advance technologies, this type of project for
automatic fire protection could be further improved to save materials from damage and reduce time
taken to protect industries from fire.

5.2. Recommendation

It is recommended to METEC industries, chemical industries, production industries and other

industries to implement and use this system which can solve and avoid many accidents and
materials losses due to the fire. Each working place needs to have one or more systems, depends
on the size of that place.

Future work

 Use the combination of different fire sensors

 Implement a big system which can control the whole industry
 Develop a system which can send information to a remote location using mobile or internet


[1] Kilian, “Modern control technology: components and systems”, 2nd Edition.

[2] Martin P.B, “Programming 8-bitPIC microcontrollers in C with interaction hardware

simulation”, 2008.

[3] Nebojsa Matic, "Programming in BASIC for PIC microcontrollers", 2001.

[4] OSHA, “Fire service features of buildings and fire protection systems” 2006.

[4] Stanford University fire MARSHAL‟s office, “Fire Alarm System Basics”







A. C Code of Intelligent fire detector with automatic water sprinkler

// LCD module connections

sbit LCD_RS at RD2_bit;

sbit LCD_EN at RD3_bit;

sbit LCD_D4 at RD4_bit;

sbit LCD_D5 at RD5_bit;

sbit LCD_D6 at RD6_bit;

sbit LCD_D7 at RD7_bit;

sbit LCD_RS_Direction at TRISD2_bit;

sbit LCD_EN_Direction at TRISD3_bit;

sbit LCD_D4_Direction at TRISD4_bit;

sbit LCD_D5_Direction at TRISD5_bit;

sbit LCD_D6_Direction at TRISD6_bit;

sbit LCD_D7_Direction at TRISD7_bit;

// End LCD module connections

void main()

TRISD=0; // Set Port D as Output

PORTD=0; // Initialize Port D

TRISC=1; // Set Port C as Input

PORTC=0; // Initialize Port C

TRISB=0; // Set Port B as Output

PORTB=0; // Initialize Port B

Lcd_Init(); // Initialize LCD

Lcd_Cmd(_LCD_CLEAR); // Clear display

Lcd_Cmd(_LCD_CURSOR_OFF); // Cursor off

while(1) // infinite loop

if(PORTC.B0==1) // check weather pin B0 gets High

PORTB.B0=1; // make buzzer ON

Lcd_Out(1,2," The fire is "); // Write text in first row

Lcd_Out(2,2," detected "); // Write text in second row

Delay_ms(500); // give some delay

PORTB.B5=1; // run the motor


PORTB.B7=1; // enable the motor driver


PORTB.B0=0; // buzzer OFF

Lcd_Out(1,2," No fire is "); // Write text in first row

Lcd_Out(2,2," detected "); // Write text in second row

PORTB.B5=0; // stop motor



B. Description of PIC16F877A microcontroller pins

Table B.1 Pin description of PIC16F877A