Iot Based Fire Detection
Iot Based Fire Detection
AProject Report
BACHELOR OF ENGINEERING
IN
COMPUTER SCIENCE ENGINEERING
Submitted by:
22BCS12816 (Rohit Yadav)
22BCS10065 (Pratul Kumar)
22BCS15890 (Abhayanand Kumar)
22BCS15108 (Sumit Kumar)
a
BONAFIDE CERTIFICATE
submitted by
in partial fulfilment of the requirements for the award of the Degree Bachelor of Engineering
in “Computer Science & Engineering” is a bonafide record of the work carried out from
“May of 2024” to “June of 2024” under the supervision at Chandigarh University, Gharuan.
Signature
Er. Kussum
(Supervisor)
b
ACKNOWLEDGEMENT
We would like to express our heartfelt gratitude to everyone who helped us finish this
research project. We would like to thank our supervisor, Er. Kussum, first and foremost for
his guidance, support, and insightful feedback throughout the project and our external
evaluation panelist Er. Kussum, for giving proper guidance. Their knowledge and
encouragement have been invaluable in shaping this research.
We'd also like to thank everyone who took part in the study and generously shared their time
and experiences with us. This study would not have been possible without their participation.
We are grateful to Chandigarh University for providing the resources, facilities that allowed
us to conduct this research. Our heartfelt gratitude goes to our family and friends for their
unwavering encouragement and support throughout our journey of making this research
paper.
Finally, we would like to thank everyone who has assisted us in various ways
throughout the course of this research. Their advice and support have been
invaluable.
1
Abstract
Real-time emotion recognition (REX) is a rapidly growing field with the potential to
revolutionize the gaming industry. REX may be utilised in a number of ways to enhance the
game experience through real-time emotional state detection in players. For instance, REX
may be used to personalize the gaming experience, provide players feedback, or even make
games that are intended to evoke particular emotions. This paper presents a project that uses
Python programming,data visualization, convolutional neural networks (CNNs), and machine
learning to develop a REX system for gaming. It works on recognizing basic emotions such as
happiness, sadness, anger, fear, surprise, and disgust. The system will be implemented in a
simple game, where it will be used to provide feedback to the player. The system will be able
to improve the player's experience by providing them with timely and relevant feedback. This
project demonstrates the potential of REX to improve the gaming experience. Future work
could focus on improving the accuracy of the system, developingsystems that can recognize
more complex emotions, and using REX to create more engaging and immersive gaming
experiences.
2
TABLE OF CONTENT
ABSTRACT……………………………………………..2
LIST OF FIGURES……………………………………...4
1.0 INTRODUCTION………………………………….5
2.0 PROBLEM STATEMENT…………………………6
3.0 OBJECTIVE………………………………………...6
4.0 PRODUCT DESCRIPTION………………………..7
5.0 PROGRAMMING…………………...…………….11
5.1 FLOWCHART………………………………….11
5.2 CIRCUIT DIAGRAM…………………..……...13
5.3 ASSEMBLY METHOD…………..……………14
5.4 CODING………………………………………..16
3
LIST OF FIGURES
4
1.0 INTRODUCTION
A fire alarm system is a system that is designed to warn people when there is fire, smokes, or any
other harmful gas appear on the premise. The alarms are activated automatically or manually
turned on with manual fire alarm activation devices such as manual call points or pull stations. The
manual activation exist is to help people warn of a fire or harmful gas leak quickly as it may take
some time for the sensors to kick in. The alarms can either be motorized bells or wall mounted
sounder or horns. They can also be a speaker strobe which sound an alarm, followed by a voice
urging evacuation message which alarming people on the situation and warning them not to use
elevators if there is any. The fire alarms sounders can be set to different frequencies and tones
depending on the country and the manufacturer. Some place needs a higher frequency and tone
such as shopping malls and high-leveled building.
5
2.0 PROBLEM STATEMENTS
Fire alarm system is crucial in every building as it can prevent any mishaps and can save lives.
The system can sense heat and gas thus alarming people via buzzer, automated announcements,
or alarming lights. It is faster than having to scream to alarm people of a fire or a gas leak.
Basically, heat sensor will sense any temperature above the normal room temperature. The
Arduino will be used as micro-controller to control the whole system. Once the temperature rise
is detected, the signal will be sent to the buzzer or LED to alarm people. Thus, the people will be
alarmed, and everyone will be able to evacuate safely.
3.0 OBJECTIVE
In this project, we have objectives to achieve at the end of our project. This objective will
implement the application of MEC523 (Applied Electronics and Microprocessor) course. The
objective we want to achieve are:
6
4.0 PRODUCT DESCRIPTION
1) The fire alarm system is a safety system that warn people when the flame and flammable
gas are detected. This system will automatically activate when the flame sensor and gas
sensor detected the flame and gas. Then, the piezo buzzer will trigger and the LED will
turn on to warn the people surrounding. In addition, the LCD also will display the status
of this fire alarm system.
2) In this fire alarm system, the Arduino uno R3 ATMEGA328P has been used. The
Arduino environment has two platform which are a development board and the software
environment. A development board has 8-bit microcontroller, programming hardware,
USB programming interface and input/output pin. For software development which is
Integrated Development Environment (IDE) has cross-compiler, debugger, simulator and
programmer. To make the programming code of the system, the code is upload from
Arduino IDE to microcontroller (ATMEGA328P) at Arduino uno.
7
3) The flame sensor is to detect the presence flame at the surrounding. This component has
four pins which are pin A0, ground, VCC and D0. The pin A0 is connect to the analog
pin A2 at Arduino Uno while the ground and VCC are connect to ground pin and power 5
Volt respectively. In this fire alarm system, the threshold is set 200. When the flame
sensor value at pin A0 is less than 200, the LED will turn on and the buzzer will activate.
4) Next, the type of gas sensor in this fire alarm system that used is MQ-2. This type of gas
sensor can detect methane, butane, LPG and smoke. This gas sensor has 4 pins which are
A0, D0, ground and VCC. The pin A0 is connected to pin A0 in Arduino uno. In this fire
alarm system, when the value at gas sensor is crossed the safety level which is 500, the
LED will turn on and the buzzer will trigger.
8
5) For light-emitting diode (LED) which semiconductor diode will glow when the sensors
have detected the flame and flammable gas. The LED has two pins which are anode and
cathode. The anode is connected to pin 13 while the cathode is connected to ground pin.
6) For piezo buzzer has two pins which are positive and negative. The positive is connected
to pin 8 while the negative connected to ground pin. In this system, we used active buzzer
as an output. The piezo buzzer will make sound when the sensors have detected the fire
and flammable gas or smoke. This will warn the people that the fire alarm system has
activated.
9
7) The Liquid-Crystal Display which is call LCD is a flat-panel display that uses the light-
modulating properties of liquid crystal combined with polarizers. LCD is available to
display arbitrary image or fixed image with low information content which can be
displayed or hidden. In this fire alarm system, this LCD will display “NO FLAME/NO
GAS” when the gas and flame are not detected by sensors while it will display “FLAME
DETECTED/GAS DETECTED” when the sensors have detected the fire and flammable
gas. In this system, we have use 5V Arduino I1C I2C 1602 LCD. This LCD is combined
with I2C. When wired the LCD, it used only four pins compared to normal LCD which
must use more pins. So, the circuit will look tidy compared to normal LCD. It has four
pins which are ground, power, SDA and SCL. The pins SDA and SCL are connected to
pin A4 and A5 respectively.
10
5.0 PROGRAMMING
5.1) FLOWCHART
11
1. For flame sensor and gas sensor, the program will execute in microcontroller
ATMEGA328P which pin A2 and A0 as input, respectively.
2. For buzzer, LED and LCD as output. LCD is connected to analog pin A4 and A5 while
buzzer and LED is connected to digital pin 8 and pin 13 respectively.
4. If the flame sensor detects the flame (flame value<500), buzzer and LED will activate,
and LCD will display “FLAME: FLAME IS DETECTED”. While if the flame sensor
does not detect the flame (flame value>500), buzzer and LED will not activate, and the
LCD will display “FLAME: NO FLAME”.
5. If gas sensor detects the flammable gas or smoke (>500), buzzer and LED will activate
and LED will display “GAS: GAS IS DETECTED”. While if the gas sensor does not
detect the flammable gas or smoke (<500), buzzer and LED will not activate, and LCD
will display “GAS: NO GAS”.
12
5.2) CIRCUIT DIAGRAM
13
5.3) ASSEMBLY METHOD
Piezo buzzer
Positive pin (+) = pin 8
Negative pin (-) = ground
LED
Anode = pin 13
Cathode = ground
Flame sensor
A0 = pin A2
GND = ground
VCC = power 5 V
14
Gas sensor
A0 = pin A0
GND = ground
VCC = power 5 V
15
5.4 CODING
16
Figure 5.4.3 Arduino Coding
17
CODING
#include <Wire.h>
#include <LiquidCrystal_I2C.h>
LiquidCrystal_I2C lcd(0x27,20,4);
void setup() {
pinMode(A0,INPUT);
pinMode(A2,INPUT);
pinMode(LED,OUTPUT);
pinMode(piezo,OUTPUT);
Serial.begin(9600);
lcd.begin();
}
18
void loop() {
flamesensvalue=analogRead(A2);
gasSensor = analogRead(A0);
if (flamesensvalue<=threshold) {
digitalWrite(LED,HIGH);
digitalWrite(piezo,HIGH);
lcd.clear();
lcd.setCursor(0, 0);
lcd.print(" FLAME : ");
lcd.print("FLAME");
lcd.setCursor(0, 1);
lcd.print(" IS DETECTED");
delay(5000);
}
else {
digitalWrite(LED,LOW);
digitalWrite(piezo,LOW);
lcd.clear();
lcd.setCursor(0, 0);
lcd.print("FLAME : ");
lcd.print("NO FLAME");
delay(1000);
}
if (gasSensor>=500) {
digitalWrite(LED,HIGH);
digitalWrite(piezo,HIGH);
19
lcd.clear();
lcd.setCursor(0, 0);
lcd.print(" GAS : ");
lcd.print("GAS");
lcd.setCursor(0, 1);
lcd.print(" IS DETECTED");
delay(5000);
}
else {
digitalWrite(LED,LOW);
digitalWrite(piezo,LOW);
lcd.clear();
lcd.setCursor(0, 0);
lcd.print("GAS : ");
lcd.print("NO GAS");
delay(1000);
}
Serial.print("flamesensorValue = ");
Serial.print(" ");
Serial.print(flamesensvalue);
Serial.print("\t");
Serial.print("GasSensor = ");
Serial.print(" ");
Serial.print(gasSensor);
Serial.println();
delay(1000);
}
20
6.0 RESULT AND DISCUSSION
After several tests have been done towards our project, The Fire Alarm System has been able to
be conducted according to the desired system. The system consists of two inputs, which are
flame sensor and gas sensor. Starting off with the flame sensor, it detects the presence of the fire
and it will send a signal to its output. In this case, the outputs are LED, Piezo Buzzer and the
LCD Panel. The LED will lights up and the buzzer will produce the sound after obtain the signal
to aware the users about the presence of fire. The LCD Panel will display the information about
the presence of fire.
The second input, which is the gas sensor is a component that measures presences of the gas,
which is smoke in this case. The type of gas sensor we use for this project is MQ-2. This type of
gas sensor able to detects butane, methane, LPG and smoke. This gas sensor is placed at this fire
alarm system to enhance to safety when there are fires. When the situation occurs, it will send a
signal to its output, which is the buzzer. This buzzer acts as an alarm that reminds the users to be
aware of the situation.
Certain tests, improvements and changes were done to achieve the results mentioned above. The
sensors have been tested and it work well as intended. This project certainly can be a huge
helping to the society to prevent the unwanted situation. This alarm system can implement the
OSHA Fire Alarm requirement to maintain the safety and eliminate hazard.
21
7.0 CONCLUSION
From this project, the expected results are obtained successfully. The fire alarm functions well as
designed to be. The flame sensor and gas sensor has performed well in sensing the present of the
fire and smoke using the Arduino Uno R3 ATMEGA328P and the output which is LED and
Piezo Buzzer. The LED will lights up and the Piezo Buzzer’s sound will warn the public about
the fire. This system will be useful for building especially for large area building. As we don’t
aware if there are fire, the Piezo Buzzer act to alert us to work on necessary action. So the Fire
Alarm System will gain the interest of plenty party to ensure the safety and precaution on fire. As
conclusion, our project will help on implement the OSHA fire alarm requirement.
22