You are on page 1of 10

11.

Smoke Detector Using 8051 Microcontroller

In any modern structure or building of the world, safety has the highest priority and therefore fire
detection system is one of the basic components of the structure. Timely information of fire not
only helps save lives but also makes it easier to put out fire.

Figure:11.1

11.1. Objectives
Our objective is to design a Fire Alarm System that would full fill the following objectives:
Indicate the room in which fire erupted. Sound the alarm if fire occurs.
False Alarm occurrence should be kept minimum.
The system should be flexible enough to be easily modified in case if new rooms are added to the
building.
The system should also provide the flexibility to adjust the temperature and smoke sensitivity
levels as per the operating environment.

11.2. Working

This paper proposes the design and construction of fire alarm system which is controlled
by 89S52 microcontroller. LCD is used to indicate situations of the system composed of 2 modes
of working state, regular working mode and fire mode. Graphic output states are displayed on
LCD by using software „Keil uVision2‟, interfacing with microcontroller. Input signal coming
from the normally opened warning devices such as heat detector and smoke detector is sent into
a detectable instrument to separate the mode of working state. After that, output signal

19
is dispatched to 89S52 microcontroller for analysis. This microcontroller can transfer data
and display the situation of detector in 4 zones. Thus, the environment of the zones is exposed
on LCD. In case of fire mode, the data will be sent to LCD and to Buzzer simultaneously.

11.3. Requirements

This system consists of following modules.

Heat Detection Circuit

This is the first module of our project in which we have used LM 35 sensor and a
comparator. LM 35 has three pins a, b and c. Pin a is connected to Vcc pin b is connected with
ground while the output is from pin c .The output of this sensor is going to a comparator .As per
our requirement we need to send a high signal to the microcontroller when the temperature is
50 degree centigrade As the output of sensor gives 10mv change with a change of 1
degree centigrade in temperature. 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.
Smoke Detection Circuit

The second module of our project is to detect smoke from the environment which is
inevitable outcome of fire. So to full fill this requirement we have used smoke sensor TGS 308
and a comparator. 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 a output voltage according to
the intensity of smoke .As soon as the smoke vanishes its output again comes to zero .The
internal circuitry of TGS-308 contains a heater .as the smoke particles will pass through , the
heater will ionize the smoke particles and they will act as a charge carriers so a voltage will be
built at output .TGS-308 has four pins Pin A, B, C and D. out of these A and B are connected to
Vcc, pin D is connected with ground and pin C is the output pin. The output pin is connected
20
with the positive input of comparator while at its negative input there is constant 3 volts .so as
the smoke will produce, there will be voltage at output of sensor. As the smoke intensity
increase and the sensor output will reach 3.1 volts the comparator will pass a high signal
to microcontroller. As this sensor is quite sensitive to smoke so we have kept 3 volts as a
standard at comparator input so that it should detect real fire and do not activate on fake signals
just like if someone is smoking.

Microcontroller Programming and Interfacing


We have used 89S52 microcontroller. It has 40 pins .pin no 40 is connected to Vcc while pin
no 20 with ground.
LCD Interfacing
The LCD we used was having 16 pins out of which 8 pins are directly going to
microcontroller pin number 1 to 8. Two pins are connected with Vcc one with ground and one
with the potentiometer to set the resolution of LCD. Three control pins of LCD are also
connected to microcontroller pin no 2.5, 2.6, and 2.7 .They are used for enabling LCD,
performing read or write operations and to select command or data register
Buzzer
It has two pins; one is connected with the supply and the other one with the microcontroller pin
no 2.4. When microcontroller will provide low signal, the circuit will be completed and
the buzzer will start alarming.
11.4. Software Design

Conditions

In case if both the bits of a particular room are high (i.e. the smoke and heat levels are above
normal conditions), the program sets the pin connected to the buzzer, turning it
ON. Simultaneously the LCD displays the room number of the room where fire has erupted.

In case if one of the bits of a particular room is set (i.e. either the smoke sensor or his operating
above normal conditions), the program takes this situation as ambiguous and displays
“NORMAL” on the LCD.

21
If both the bits are at low logic levels (i.e. both the heat and smoke sensors are operating
under normal conditions), the program simply displays “NORMAL” on the LCD and the buzzer
also remains OFF.

The programming approach to display output on the LCD includes character by


character transfer of the entire string with an appropriate delay. The LCD is initialized only once
and only the top line of the LCD is being used for display purpose.

Code:

LCD_RS BIT P2.7


LCD_RW BIT P2.6
LCD_EN BIT P2.5

LCD EQU P1
ORG 000H

CALL INIT_LCD

again:
CALL GET_SENSOR_DATA

MOV A,#81H
CALL WR_LCD_COMMAND
CALL DELAY

JNC HERE
MOV A,#' '
CALL WR_LCD_CHR
MOV A,#'F'

22
CALL WR_LCD_CHR
MOV A,#'I'
CALL WR_LCD_CHR
MOV A,#'R'
CALL WR_LCD_CHR
MOV A,#'E'
CALL WR_LCD_CHR
MOV A,#' '
CALL WR_LCD_CHR
MOV A,#'A'
CALL WR_LCD_CHR
MOV A,#'L'
CALL WR_LCD_CHR
MOV A,#'A'
CALL WR_LCD_CHR
MOV A,#'R'
CALL WR_LCD_CHR
MOV A,#'M'
CALL WR_LCD_CHR
MOV A,#' '
CALL WR_LCD_CHR
MOV A,#'#'
CALL WR_LCD_CHR
MOV A,#' '
CALL WR_LCD_CHR

CLR P2.4

MOV A,#31H
CALL WR_LCD_CHR
JMP AGAIN

23
HERE: MOV A,#' '
CALL WR_LCD_CHR
MOV A,#' '
CALL WR_LCD_CHR
MOV A,#' '
CALL WR_LCD_CHR
MOV A,#' '
CALL WR_LCD_CHR
MOV A,#'N'
CALL WR_LCD_CHR
MOV A,#'O'
CALL WR_LCD_CHR
MOV A,#'R'
CALL WR_LCD_CHR
MOV A,#'M'
CALL WR_LCD_CHR
MOV A,#'A'
CALL WR_LCD_CHR
MOV A,#'L'
CALL WR_LCD_CHR
MOV A,#' '
CALL WR_LCD_CHR
MOV A,#' '
CALL WR_LCD_CHR
MOV A,#' '
CALL WR_LCD_CHR
MOV A,#' '
CALL WR_LCD_CHR
MOV A,#' '
CALL WR_LCD_CHR

24
SETB P2.4

JMP AGAIN

INIT_LCD:
MOV A,#38H ;2 line 5x7
CALL WR_LCD_COMMAND
MOV A,#0CH ;LCD on cursor on
CALL WR_LCD_COMMAND
MOV A,#01H ;clear LCD
CALL WR_LCD_COMMAND
MOV A,#06H ;shift cursor right
CALL WR_LCD_COMMAND
DISP: MOV A, #81H ; Curser at LINE # 1, Position # 3
CALL WR_LCD_COMMAND
RET

WR_LCD_COMMAND:
CALL DELAY
MOV LCD,A
CLR LCD_RS
CLR LCD_RW
SETB LCD_EN
CLR LCD_EN
RET

WR_LCD_CHR:

25
CALL DELAY
MOV LCD,A
SETB LCD_RS
CLR LCD_RW
SETB LCD_EN
CLR LCD_EN

RET

DELAY:
mov r5, #0ffh ; delay loop instead of checking bit-7
djnz r5, $
RET

GET_SENSOR_DATA:

MOV C, P2.0
ANL C, P2.2
RET
END

26
12. CONCLUSION

An embedded system is a computer system with a dedicated function within a larger mechanical
or electrical system, often with real-time computing constraints. It is embedded as part of a
complete device often including hardware and mechanical parts. By contrast, a general-purpose
computer, such as a personal computer (PC), is designed to be flexible and to meet a wide range
of end-user needs. Embedded systems control many devices in common use today.
Embedded systems contain processing cores that are either microcontrollers, or digital signal
processors (DSP).
A processor is an important unit in the embedded system hardware. It is the heart of the
embedded system. The key characteristic, however, is being dedicated to handle a particular task.
Since the embedded system is dedicated to specific tasks, design engineers can optimize it to
reduce the size and cost of the product and increase the reliability and performance. Some
embedded systems are mass-produced, benefiting from economies of scale.
Physically, embedded systems range from portable devices such as digital watches and MP3
players, to large stationary installations like traffic lights, factory controllers, and largely
complex systems like hybrid vehicles, MRI, and avionics. Complexity varies from low, with a
single microcontroller chip, to very high with multiple units, peripherals and networks mounted
inside a large chassis or enclosure.

27
13. REFERENCES

1. Michael Barr.” Embedded system Glossary “. Neutriono Technical Library. Retrieved


2007-04-21.
2. Heath, Steve (2003).Embedded system design. EDN series for design engineers ( 2ed).
Newness.p.2.ISBN 978-0-7506-5546-0.”An embedded system is a microprocessor based
system that is built to control a function or a range of functions.”
3. Giovanni ,Bill.”Micro controller.com-Embedded System supersite”.
4. Embedded System Dell OEM Solution /Dell.contnt.dell.com (2011-01-04). Retrieved on
2013-02-06.
5. Raj Kamla (2008).Embedded Systems- Architecture, Programming and design. Tata
McGraw-Hill.p.5.ISBN 978-0-07-066764-8.
6. Ayala Keeneth j. The 8051 Microcontroller-Architecture, Programming and Application
,3rd edition 2008, Cengage Learning India PVT. Ltd.
7. Deshmukh ,Ajay V Microcontroller [Theory and Application], 1st edition,2006 Tata
McGraw-Hill.
8. Gadre,Dhananjay V.Programming and Customizing the AVR Microcontroller,It
Edition(10th reprint ),Tata McGraw Hill.
9. “ Tektronixshaks up prototyping ,Embedded Istrumentation Boosts Boards to Emulator
status .”Electronics Engineering Journal.2012-10-30.Retrieved 2012-10-30.
10. Embedded.com – Under the Hood: Robot Guitar embeds autotuning By David Carey,
TechOnline EE Times (04/22/08, 11:10:00 AM EDT)Embedded Systems Design –
Embedded.com
11. "Tektronix Shakes Up Prototyping, Embedded Instrumentation Boosts Boards to
Emulator Status". Electronic Engineering Journal. 2012-10-30. Retrieved 2012-10-30.
12. Heiser, Gernot (December 2007). "Your System is secure? Prove it!". ;login:2 (6): 35–8.
13. "Working across Multiple Embedded Platforms". clarinox. Retrieved 2010-08-17.

28

You might also like