Professional Documents
Culture Documents
Inal Year Project Alekhaya Datta Smart Fire Alarm Systems 5
Inal Year Project Alekhaya Datta Smart Fire Alarm Systems 5
net/publication/352208163
FINAL YEAR PROJECT REPORT Smart Fire Alarm System and Device Smart Fire
Alarm Device and System Final Year Report of Alekhaya Datta
CITATIONS READS
0 744
1 author:
Alekhaya Datta
Management Development Institute of Singapore
2 PUBLICATIONS 0 CITATIONS
SEE PROFILE
All content following this page was uploaded by Alekhaya Datta on 08 June 2021.
I. ABSTRACT
In recent times we have seen a lot of accidents related to fire, like burning of houses and
electronic devices. Although this problem cannot be completely stopped, but the severity of
damage can be reduced which will potentially save lives through a smart-fire alarm system and
device.
The system will alert the user of any presence of fire via sound alarm. In addition, if the user
is not present in the vicinity of the fire, then a notification will be sent instantly through push-
notifications in the user’s mobile device. In addition to that a mobile application will be
developed from scratch which will be capable of showing data to the user from the Smart Fire
Alarm Device .The device will also have live-streaming video capabilities. This is an extra
feature which will allow rescuers to view the vicinity in case of Fire.
The aim for this project is to create a Smart Fire Alarm Device and design a system which
capable of having the above feature and moreover the device should be small in terms of size.
and the system should be inexpensive in terms of cost
II. ACKNOWLEDGEMENT
Foremost, I would like to thank Teesside University and Management Development Institute
of Singapore for putting Final Year Project in their course curriculum. Final Year Project
helped me gain knowledge on new things, new technology and new business ideas which I
might not have gained without the exposure of the Final Year Project.
I would like to express my sincere gratitude to my supervisor Prof. Dr Lum Kum Meng for
the continuous support of my Final Year Project study and research, for his patience,
motivation, enthusiasm, and immense knowledge. His guidance helped me in all the time of
research and writing of this thesis. I could not have imagined having a better advisor and mentor
for my Bachelor in Electronics and Electrical Engineering studies.
Besides my advisor, I would like to thank the module lecturer Dr. Tan Kim Piew for his
guidance and briefing of the Final Year Project procedures, protocols, and briefing.
My sincere thanks also goes to the Dean of MDIS Dr. Tham Yiengwei and Lab Technician Mr
Abdul Razak for their continuous support and motivation for completing the project
Last but not the least, I would like to thank my family: my parents Koushik Datta and Paramita
Datta, for supporting me spiritually and mentally throughout my life.
Smart Fire Alarm Device and System
Final Year Report of Alekhaya Datta 2
Smart Fire Alarm Device and System
Final Year Report of Alekhaya Datta 3
I. ABSTRACT .......................................................................................................................... 1
II. ACKNOWLEDGEMENT.................................................................................................. 1
1. INTRODUCTION.............................................................................................................. 13
3. INSTRUMENTATION ..................................................................................................... 19
3.4 Electronic Equipment required for the Fire Alarm Device ........................................... 34
4.1 NODE MCU V3 (ES 8266 12E) Connection and Circuit Diagram .............................. 37
4.2 ESP32-Cam module & FTDI-Programmer Connection & Circuit Diagram .................. 38
5. PROCEDURES .................................................................................................................. 39
V. LIST OF FIGURES
1. A Smoke Sensor................................................................................................................... 13
18. Circuit Diagram of ESP-32 Cam Module & FTDI-Programmer Before Upload (Left Fig)
& After Upload (Right Fig) ..................................................................................................... 38
46. DHT-11 temperature sensor reading declaration and code for updating data on Firebase
Database .................................................................................................................................. 55
47. MQ-2 Gas sensor reading declaration and code for updating data on Firebase Database 55
55. Web Page for live streaming from the ESP 32 Camera Module ....................................... 63
56. Project Files for developing the Flutter Mobile Application ............................................. 66
70. Terminal Message after the deploy of Firebase Cloud Function ....................................... 88
71. (Top) Firebase Function named as “FIRE” deployed in Firebase, (Bottom) Firebase Cloud
Message Statistics ................................................................................................................... 89
94. Push Notification send to user device once a Fire is detected ......................................... 103
18. ESP-32 Cam Module & FTDI-Programmer Pin Connection Before Upload ................... 38
Smart Fire Alarm Device and System
Final Year Report of Alekhaya Datta 12
19. ESP-32 Cam Module & FTDI-Programmer Pin Connection After Upload ..................... 38
2 DIY Do it Yourself
9 OS Operating System
10 IP Internet Protocol
12 CO Carbon Monoxide
14 Fig Figure
Smart Fire Alarm Device and System
Final Year Report of Alekhaya Datta 13
1. INTRODUCTION
1.1 Background
The rapid oxidation of a material in an exothermic chemical reaction, releasing heat, light and
various reaction product is defined as fire (Anonymous, 2009). Ever since the discovery of fire
in the early stone age era by the people of the stone age era, humans have used this form of
energy as the primary source in various domestic and industrial application. For over the years
human have learned various technique to control this natural form of energy.
However, although fire is used in various applications, but if it is not controlled properly Fire
can cause destruction and damage to household or an area. It can even cause health hazard
which can eventually lead to death. Accident can happen at any time & anywhere. If proper
precautions are taken at an early stage, then the accidents along with the destruction and
damages caused by fire could be prevented. Proper precautions can also prevent injuries and
mishaps, but most importantly it can also potentially can save many lives.
There are many devices available in the market that can prevent the deadly and destructive fire.
Fire Alarm is one of such examples of a Fire Prevention and Alert Device available in the
market. Now the way the fire alarm works is quite simple. There are mainly two steps involved
in this type of traditional Fire Alarm Systems which are given as follows:
There are sensors which can detect the fire in its proximity
There are buzzers or an audio device which will alert the people nearby.
Normally this system will work and will prevent destruction and damage to only a certain
extent. There are many limitations to the traditional fire alarm system. Some of the limitation
are listed as follows:
Alerting the people nearby only works within a certain range: Suppose the person
stays in Location-A and currently that person is in Location-B. Let us consider that
Location-B is 10kms away from Location-A and Location-A is situated in one of the
remote areas of a town. Now if there is Fire in Location-A and let’s say the person is
Smart Fire Alarm Device and System
Final Year Report of Alekhaya Datta 14
the only one staying in that house, there is no way for the person currently in Location-
B to know that there is a fire in his/her house. The time the person knows about the fire,
everything is over.
It is not possible to understand the source, extent of damage and the number of
people stuck inside a room or building if there is a fire : There are different types of
fire and different ways to extinguish the fire. Some types of fire can be extinguished
using water. However, if there is any electrical source beside the fire, sand is mostly
preferred because water can cause electrocution. Fire Fighters or rescuers must
understand what type of extinguishing source they will use. But during this time of
emergency, they must act first. So, these devices are really disadvantageous in this type
of situation.
In this project the above issues are addressed, and an inexpensive easy solution is provided just
by using basic Electronics equipment and Programming techniques which could potentially
save lives and can prevent the damage and destruction caused by fire.
1.2 Objectives
The main aim of this project is to design a smart Fire Alarm System and Device. Apart from
this aim the below list shows the following objective that the design should meet:
1) The Fire Alarm device should be connected to the internet to send the sensor data to any
database service provider.
2) Develop a web/mobile application, so user can visualize the sensor data.
3) Send notifications to the user’s device if there is a fire which is detected by the sensors
4) (Optional) Add an inexpensive camera module which will support live streaming, so
developer can see the live stream if there is a Fire in a room or area.
5) Design a casing for the Fire Alarm Device and implement the microcontroller, sensors and
camera within the casing
2. LITERATURE REVIEW
Now in this project the main focus is not on the available extinguishing medium. Instead the
main focus is on the characteristics of flames. The basic knowledge on the characteristics and
Smart Fire Alarm Device and System
Final Year Report of Alekhaya Datta 16
terms for fire and flames will come in handy during the selection of sensor and the design of
the circuit.
Earlier Fire was discussed, now Flame will be discussed. Most people think that fire and flames
are the same thing. In reality they are different. The visible and the gaseous part of the fire is
defined as a Flame which is caused by an extremely heat-releasing reaction happening in a thin
zone. Very hot flames are hot enough to have ionized gaseous components of sufficient density
to be considered plasma (Schmidt & Symes, 2008).
Depending on the combustion medium, the temperature and colour of the flame differ from
each other. Let us take the example of a candle in order to understand how the flame occurs.
The heat applied allows the molecules of fuel in the candle wax to vaporize (If this process
occurs without oxidizer in the inert atmosphere, it is called pyrolysis). They can then readily
react with oxygen in the air in this state, which gives off enough heat to vaporize even more
fuel in the ensuring exothermic reaction, thereby retaining a constant flame. The high flame
temperature allows the molecules of vaporized fuel to decompose, creating various incomplete
products of combustion and free radicals, and these products then react with each other and
with the reaction-involved oxidizer. All the various parts of the flame from a candle with a cold
metal spoon may be inspected. Water vapour is the higher part, the end product of combustion;
soot is the yellow part in the middle; unburned wax is down just next to the candlewick. In
some of the transient reaction intermediates, such as the methylidyne radical (CH) and diatomic
carbon (C2), ample energy in the flame can excite the electrons, resulting in the emission of
visible light as these substances release their excess energy (see spectrum below for a
description of which particular radical species emit specific colours). As a flame's combustion
temperature increases (if the flame contains small particles of unburnt carbon or other
material), the total electromagnetic radiation energy released by the flame increases. Apart
from oxygen, other oxidizers may be used to create a blaze. Hydrogen burning in chlorine
produces a flame and, as the combustion product, releases gaseous hydrogen chloride (HCl) in
the process. Hydrazine and nitrogen tetroxide, which
is hypergolic and widely used in rocket engines, is
another of the potential chemical combinations.
Fluoropolymers may be used as an oxidizer of
metallic fuels, for example, in the composition of
magnesium / Teflon / Viton, to provide fluorine
(Anonymous, 2008). The chemical kinetics that occur
in the flame are very complex and usually include a
large number of chemical reactions, most of them
radicals, and intermediate species. For example, to
define biogas combustion, a well-known chemical
kinetics scheme, GRI-Mech, utilizes 53 species and
325 elementary reactions.
The methods of distributing the necessary
combustion components to a flame are different.
Oxygen and fuel diffuse through one another in a
diffusion flame; the flame happens where they meet.
The oxygen and fuel are premixed beforehand in a
Figure 2: Various Parts of a Flame
Smart Fire Alarm Device and System
Final Year Report of Alekhaya Datta 17
premixed flame, resulting in a different form of flame. By evaporating the fuel that rises in a
laminar flow of hot gas that then mixes with surrounding oxygen and combusts, candle flames
(a diffusion flame) work.
Almost all the fire accident which happened in various parts of the world produced the flame
whose primary source of gas is oxygen. Although oxygen is one of the main sources of live for
almost all the species living in the earth, but oxygen can act as deadly source when it comes to
fire mishaps. Hence it can be said that the temperature of the flame is dependent upon the
percentage of oxygen in air.
The table given below shows the flame temperature during the combustion of various materials
(Various, 2019)
4 Candle flame ≈1,100 °C (≈2,012 °F) [majority]; hot spots may be 1,300–
1,400 °C (2,372–2,552 °F)
3. INSTRUMENTATION
The below table shows the list of required instrument and equipment which will be required
for the Fire Alarm Device.
Table 3: List of Equipment Used For this Project
Sl no Type Equipment Picture
1 Microcontroller NodeMCU V3 (ESP8266
12-E)
4 Temperature Sensor
5 Smoke Sensor
Smart Fire Alarm Device and System
Final Year Report of Alekhaya Datta 20
6 Buzzer
7 Display
9 Board Breadboard
In this design for the “Fire Alarm System”, a microcontroller is used and preferred instead of
a microprocessor. The main reason for using a microcontroller instead of a microprocessor is
Smart Fire Alarm Device and System
Final Year Report of Alekhaya Datta 22
because the final hardware must be smaller and inexpensive. When it comes to microcontroller,
the microcontroller is attached to a development board. There are many developments board
option which are available in the market. Arduino UNO is one of the examples of such board
which is widely used in the market. To programme an Arduino, the programming language
which is used is known as the Arduino language. Most people tend to confuse Arduino
Language with C++ or C due to its similarity in syntax and the data structures. The Integrated
Development Environment which people use mostly to programme is called as Arduino IDE.
People can use other IDE as well like Visual Code Studio or Arduino Online Editor etc.
Due to this small issue electronic designers or the developer must purchase a FTDI programmer
which will allow the developer upload the code from the U0R and U0T pins of the ESP-32 cam
module. The camera which will be attached to the ESP-32 cam module is a OV2640 camera.
It is one of the cheapest and smallest webcams currently available in the market. For this
application, the ESP32 cam module has the following advantages:
• It is cheaper compared to other camera modules in the market
• It has an inbuilt Wi-Fi module. This feature makes it easier to perform Internet based
operation with just a few lines of code.
The pin diagram for the ESP-32 cam module is shown in Figure 5
capacitance changes as well. The picture given below shows the constructions of DHT11 for
sensing the humidity.
This type of sensors are small and inexpensive. However, most importantly the series of MQ
sensors are compatible with any family of microcontroller. Now there are various types of MQ
sensors which are available in the market and each of those different sensors detect different
type of gas in its surroundings. The most common type of MQ sensors which designer and
consumers use are listed as follows along with their usages (Davidegironi, 2018) .
Table 7: Different Types of MQ sensor and their usage
Sl No Name Usage
1 MQ-2 This model of sensor detects mostly flammable gas such as
LPG, Carbon Monoxide etc in its surroundings
2 MQ-3 Detects the presence of ethanol in its surroundings
3 MQ-4 Detects the presence of methane and natural gases
4 MQ-5 Detects the presence of LPG and methane in its surroundings
5 MQ-6 Like the MQ-5, this sensor also detects the presence of LPG
and methane in its surroundings
6 MQ-7 Like the MQ-2 this type of sensor is capable of detecting
Carbon Monoxide and also Hydrogen (H2) in its
surroundings
7 MQ-8 Detects the presence of Hydrogen (H2) and other types of
gases in its surroundings
8 MQ-135 Detects the presence of gaseous ammonia (NH3), benzene,
ethyl alcohol, carbonic dioxide (CO2) and other types of
gases in it’s surroundings.
Now from the above table, it is very hard to conclude the type of sensor which will be used in
the design because there are sensors which can detect the same types of gases. To avoid this
problem electronic designers will need to refer to a table that shows the range of the types of
gases which will be detected. The table shown in Table 8 shows the range of the gases a particle
module can detect
Table 8: Different Types of MQ sensor and their range
H2 1 ~ 1000 ppm
CO 0.05 ~ 10 ppm
Grove - Gas
CH4 200 ~ 10000 ppm
Sensor (MQ5)
CO 20 ~ 2000 ppm
Grove - Gas
CH4 500 ~ 10000 ppm
Sensor (MQ9)
Grove - Dust
Dust 0 ~ 8000 pcs/0.01cf
Sensor
Grove - Alcohol
Alcohol 20 ~ 1000 ppm
Sensor
Grove - Gas
O2 0 ~ 25% VOL
Sensor (O2)
Grove - HCHO
HCHO 5 ~ 40 ppm
Sensor
From the above table it is seen that the range is given in ppm or parts per million. Parts-per-
million (abbreviated ppm) is the ratio of one gas to another. For example, 1,000ppm of CO2
means that if you could count a million gas molecules, 1,000 of them would be of carbon
dioxide and 999,000 molecules would be some other gases (Various, 2014).
In the project, MQ-2 sensor will be used. MQ-2 Gas Sensor can detect Carbon Monoxide,
Smoke and other types of gases.
It is difficult to detect carbon monoxide because it does not have any scent, taste, or colour.
This also means that, without realizing, it is easy to inhale.
When fuels such as gas, oil, coal, and wood do not burn entirely, carbon monoxide is emitted.
Smart Fire Alarm Device and System
Final Year Report of Alekhaya Datta 30
In an enclosed space, as a fire burns, the oxygen in the room is eventually used up and replaced
by carbon dioxide. The fuel is stopped from burning entirely after a build-up of carbon dioxide
in the air and begins to emit carbon monoxide.
The diagram given below shows the pin diagram of a Flame sensor.
In Figure 12, if seen carefully, it is noticed that the Flame sensor has a black cylindrical object
mounted on the top of the Flame Sensor PCB that looks like a LED. This part is the
phototransistor, and it is the main component which detects the infrared wavelength of the
flame.
The phototransistor is an NPN Transistor with three terminals, where the emitter is the long
lead and the collector is the shorter one (there is no base terminal because the light it detects
will allow current flow).
In the wavelength ranging from 760 nm to 1100 nm, this photo transistor is coated with black
epoxy, making it sensitive to infrared radiation and this photo transistor (YG1006) is sensitive
to infrared radiation.
The sensor can detect infrared light up to 100 cm within its 60-degree detection angle using
this specific type of flame sensor.
There are two types of YG1006 Photo Transistor Flame Sensor implementations: one is with
both Analog Output and Digital Output, while the other is with Digital Output only (Ayesha
Rafat Arkeri, 2019).
In this design the module which has the Digital Output Pin will be used.
3.4.1 Display
Although a mobile application will be created, but there are certain users who might want to
view the sensor data from the actual device. For this type of scenarios an electronic display
needs to be added to design which is an extra feature for the Fire Alarm Device. There are
many types of display which are currently available in the market and are compatible with the
ESP8266 microcontroller. These displays come in various sizes, types, and functionalities. It
solely depends on the electronic designer on which display they want to select.
One of the most popular display which people use widely is the LCD (16*2) display. This type
of display are developer friendly when it comes to coding and implementation. However, there
are various disadvantages to these types of display:
• The display does not have a nice Graphical Developer Interface (GUI) and the display
is not colourful. In 2021, this display fells really outdated considering modern standards
• The display is huge and bulky. Currently for almost all electronic devices are small and
having a huge display will make the hardware design look
ugly.
• Although the size is huge, but the display can only show
32 characters. Although the numbers might vary for other
types of LCD display but if a developer wants to display
a greater number of characters, the display size will also
be increased.
• For this display the developer cannot increase or decrease
Figure 14: 16*2 LCD Display
the font-size. Neither the screen could be rotated.
In order to avoid the above-mentioned issues, the display which will be used for the Fire Alarm
device is a Thin Film Transistor (TFT) display. Like the LCD display, TFT display comes in
various sizes and configuration. For the Fire Alarm Device, 1.8 inches TFT display with
128*160 resolution will be used.
The advantages of this display are listed as
follows.
• It offers a colourful display.
• The module is itself quite light.
• Although the display is small
compared to the LCD (16*2)
display, but the developer can
programme it to display a greater
number of characters.
• The developer can rotate the screen
and can increase or decrease the
font-size. Figure 15: TFT Display Top & Bottom View
• The developer can also programme this to display custom images by loading the images
with a SD card by inserting the card within the slot attached to the TFT display
Smart Fire Alarm Device and System
Final Year Report of Alekhaya Datta 35
Standard TFT displays use a white, bright light backlight to produce the image. To produce
their light, newer panels use LED or light emitting diodes and thus use less power and need
less depth by design.
The following table shown in Table 16 shows some technical specification of the Piezo Buzzer
Table 16: Piezo Buzzer Technical Specification
Parameters Value
Rated current 30mA
Operating Voltage 3 V to 5 V
Approx. resonant frequency 2300Hz
The connection of the ESP-32 Cam Module and FTDI-Programmer board after uploading the
code is shown in table 19
Table 19: ESP-32 Cam Module & FTDI-Programmer Pin Connection After Upload
Sl No FTDI PROGRAMMER PIN ESP32-CAM PIN
1 RX UOT
2 TX UOR
3 VCC 5V
4 GND GND
Figure 18: Circuit Diagram of ESP-32 Cam Module & FTDI-Programmer Before Upload (Left Fig) & After
Upload (Right Fig)
The circuit diagram shown in Figure 17 and 18 was done using Fritzing. Fritzing is an
electronics Computer Aided Design software which allows an electronic designer to design
electrical hardware before building the actual circuit to avoid Electrical accidents or mishaps.
Smart Fire Alarm Device and System
Final Year Report of Alekhaya Datta 39
5. PROCEDURES
Before jumping into the coding part, the designer or the developer have to do and perform
certain task in order to test the system. The steps which will be followed by the Developer are
given as follows.
• After clicking on Preferences, the developer will have to add the following url in the
Additional Board Manager URL section. This will ensure that the developer can
perform CURD (Create Update Read Delete) Operation using the NodeMCU
Development Board and also the ESP-32 Cam Module. The Data will be sent and
received from the internet in JSON format.
https://dl.espressif.com/dl/package_esp32_index.json
http://arduino.esp8266.com/stable/package_esp8266com_index.json
• The next step is to install the board. To install the ESP8266 and the ESP32 board the
developer will have to navigate as follows:
Tools -> Board->Boards Manager
• Once the board manager was selected, the developer will see the window as shown in
Figure 22. Developer will search for “ESP-32” and “ESP-8266” and install the
respective boards with the latest version.
• The following settings were selected for the ESP-8266 and the ESP-32 development
board
Figure 23: Settings Window for the two boards in Arduino IDE
• The next step is to install some libraries. These libraries can either be installed
externally by navigating as follows:
Tools->Manage Libraries
In the flow chart it was mentioned that the sensor data will be shown in a Mobile Application.
There are many Frameworks which are available for developing Application but for this project
Flutter is going to be used. Flutter is an open-source UI software development kit created by
Google. It is used to develop applications for Android, iOS, Linux, Mac, Windows, Google
Fuchsia, and the web from a single codebase.
The language which is used in Flutter is Dart. Dart is relatively a new programming language
but it’s very similar to languages like C, C++ and Java.
Smart Fire Alarm Device and System
Final Year Report of Alekhaya Datta 42
There are mainly two types of IDE which people use for using flutter: 1) Android Studio
2)Visual Code Studio
In this project Android Studio will be used as the IDE. Firstly, Developer must install the Flutter
and Dart extension in Android Studio. In order to install the plugins, developer will need to
navigate as follows
File->Settings->Plugins
After that developer must restart the Android Studio. The setup show in the above Figures is
for windows, for Mac the setup might be different.
Smart Fire Alarm Device and System
Final Year Report of Alekhaya Datta 43
Before restarting the Android Studio, the Flutter Software Development Kit (SDK) was
installed and the path for the Flutter Project was set.
Once the above steps waere performed, the Flutter Project was started to initialise the App
Development stage.
Earlier it was mentioned that Firebase will be used as the database service provider for this
project. All the sensors data will be updated to Firebase database and we can view those data
in our Flutter Application. Configuring Firebase with Arduino and Firebase is easy and simple
and requires only a few steps to get started. The steps for getting started with Firebase are given
as follows.
• Firstly developer must to navigate to the Firebase website and click on “Add Projects”
https://console.firebase.google.com/u/0/
• After clicking on “Add Projects” developer will be bought to a new page as shown in
Figure 28 where developer will be asked to add the name of the project. The name of
the project was added, and the continue button was clicked.
• Once the developer click on continue, developer will be navigated to the page shown
in Figure 29. In this page developer will be asked if the developer want to install Google
Analytics tool or not. The toggle button was turned as enable because in the future
“Event Based Cloud Function Triggering Function “will be needed.
• The last step is to select the service account which developer want to use for the project.
For this case the “Default Account for Firebase was selected” and then “Create Project”
button was selected
• If the above steps are successfully executed, developer will be bought to the following
page shown in Fig
If developer click on the project crated earlier, developer will be bought to the Firebase
Console. Here developer can see what the Firebase Services are currently that particular project
is using, how many people signed used our App, was there any crash reported in the last 24
hours etc. The picture shown in Figure 32 is the Firebase Console for our project. The name of
our project is “TESTFIREBASE”
Now we have to configure our Firebase in our microcontroller and Application inorder to
perform the following operations:
• ESP 12-E: Perform for both read and write operations
• Flutter App- Only Perform Read Operations.
• The first step is to install the Firebase Library for Arduino. The installation can be done
as per the steps mentioned in section 5.1. Once the library was successfully installed,
the library was inclued in the code as follows:
• The next step is to declare or define the Firebase Account which a particular developer
is using and the Firebase API key in order to make read and write operations in the
Firebase Realtime Database
• The second step is to initialise the Firebase in the void setup () section of the code as
shown below.
• Once the above steps are done, the developer can perform read and write operations on
the Real Time Database using the following Arduino command
while performing this operation. The steps which we did inorder to setup Firebase in Flutter
are given as follows.
• In the Firebase Console firstly The developer have to click on “+ Add App” icon and
after that select Android. For this assignment the IOS installtion part was skipped
because the available laptop was with Windows OS (Operating System) when the setup
was done. For setting up IOS, the developer will need to work with X-Code and X-
Code is only availavle in Mac devices.
• Once the developer click on the Android Icon, the developer will be bought to page as
shown in Fig 36 and the developer will be asked to follow the steps mentioned in the
page inorder to setup Firebase SDK in the Android Devices. The package name for this
project is “com.dscmdis.fyp”. The package name can be found out in the App
Development File under “fyp> android> app> src> main> AndroidManifest.xml” as
shown in Fig 37
Once the developer run this above command, the developer will be asked to enter the
password. The developer can just click enter or the developer can input the password if
there is any password. Once the developer perform the above-mentioned steps, the
developer will get the SHA-1 certificate. Along with SHA-1 the developer will also get
a SHA-256 certificate. The SHA-256 certificate is even more secured than the SHA-1.
In the later part of this project need the SHA-256 certificate will be needed.
• Once the step-1 is completed, the developer will go to Step 2 of the installation process.
Here the developer will be asked to download the google-service.Json file as shown in
Fig 38. The file was downloaded and was put in the project under “fyp> android>
app>”. Once done, the developer must click on “Next” which will direct him/her to
Step-3.
• In step 3, the developer will be asked to add Firebase Software Development Kit in the
App Development project file by using the following commands as shown in Fig 39.
• Now earlier it was mentioned that the SHA-256 key will be used for the App to be safe
from unethical hackers. In order to do that the developer will have to navigate to
Firebase Settings from our Firebase Console. The SHA-256 key was added under the
“Your App” card. In this report the key is not shared because it is private and
confidential.
• The next step which the developer needs to perform is to import the Firebase packages
which will be needed while developing the App. In order to add packages developer
will need to navigate to pubspec.yaml and add it into the dependencies section of the
“pubspec.yaml” code. “pubspec.yaml” is the file for the App Development project
where the developer adds the list of packages, list of files or assets which the developer
wants to use in the project. The format for adding the package is given as follows:
Name_of_package: <Version_of_the_package>
If the version of page is not mentioned, Flutter will assume that the developer want to
install the latest packages for our project. Once the package name was added and the
“Pub get” option was selected. After that Flutter will install the packages.
This is section covers all the necessary steps and the code needed for the ESP-32 and the ESP-
8266 work smoothly and efficiently with the devices and the sensor. In the first section, the
ESP-32 cam code is shown and explained. In the second section the code for the ESP-8266 is
shown and explained. The coding for both modules are equally important, and a wrong
connection or code will result in affecting the entire circuit, and the worst-case scenario will
be the components to blow up.
Smart Fire Alarm Device and System
Final Year Report of Alekhaya Datta 52
• Firstly, the developer must import the following libraries shown in Fig 42 to make the
ESP8266 compatible with Firebase Wi-Fi and the internet. (In Arduino “//” are used to pass
comments. This makes the programme readable and understandable for other developers
or users. During compilation of the programme, the compiler understand that double slash
indicates a comment and does not executes the commented statement.)
The first function is the “void setup ()” function. Within this function if a developer or an
electronic designer wants to execute a respective task only a single time, the developer
write their code with the curly braces of the void setup function. For example, if a device
needs to be turned on or initialised at the beginning, all the necessary commands for turning
on the device must be written within the setup function
The second function is the “void loop ()” function. If the electronic devices or modules
needed to be run repeatedly, then the developer must write their code within the loop
function. For example, a sensor need to gather and compare old data throughout the time
interval when the sensor is active, all the necessary commands for performing this case
must be written within the setup function.
• The following commands were used in the void setup () function. The explanation of all
the command used are given as follows:
Table 21: Explanation of the Commands used in void setup () function
Smart Fire Alarm Device and System
Final Year Report of Alekhaya Datta 54
• The setup code for the Fire Alarm Device is given as follows
• The “wifiConnect()” function is a developer defined function of type void (non-return type)
whose task is to initialise the Wi-Fi connection between the ESP8266 12-E and the Wi-Fi
source. If suppose there is any error during connection with the Wi-Fi, the ESP8266 will
again try to connect with the Wi-Fi source and the number of connection attempts will be
printed in the Serial Monitor of the Arduino by using a simple “while loop”. Once the
connection is successfully established, the IP address will be printed along with other
characters in the Serial monitor. The code for the function is given as follows:
Figure 46: DHT-11 temperature sensor reading declaration and code for updating data on Firebase Database
• Like the DHT11 sensor, the MQ-2 sensor’s gathered values (LPG CO & Smoke) will be
copied to “lpg, co, smoke” respectively. The copied variables are of type “float”. The
gathered data will then be uploaded and updated to Firebase Realtime Database during each
execution of the loop function.
Figure 47: MQ-2 Gas sensor reading declaration and code for updating data on Firebase Database
Smart Fire Alarm Device and System
Final Year Report of Alekhaya Datta 56
• The gathered data will be shown in the TFT Display with various background colours and
text colours. The code used to achieve this is shown below.
• The next step is to have a logic where the Flame Sensor will detect if there is a Flame or
not in the Flame Sensor’s range. If there is Fire or flame detected, the buzzer will be
activated, and the data will be sent to Firebase. After that Firebase will oversee sending the
push notifications or Alert Messages to developer (this part will be discussed in the later
part of the report). If there is no fire or flame detected, the buzzer will not be activated, and
the notifications will be not be triggered by Firebase. Fortunately, an if-else statement will
be used to solve the issue.
Smart Fire Alarm Device and System
Final Year Report of Alekhaya Datta 57
Initially the Digital pin of the Flame sensor was set to “HIGH” and since the pin is digital,
it can only take two value which are “HIGH” or “LOW”. Now whenever there is a Fire,
the Boolean variable “Flame” will change to “LOW” and the buzzer will be activated in
different tones along with a Firebase push notification will be tiggered to the developer
otherwise the buzzer will not be activated and the “Flame” will change to “HIGH”. During
execution of the code, it will also be checked whether the ESP8266 12-E is connected to
the Wi-Fi source or not. If the device is not connected with the Wi-Fi, then the
“wifiConnect()” function will be called again. The code for achieving the above scenarios
is given as follows:
• Firstly, the following option must be selected “File> Examples > ESP 32> Camera>
Camera Web Server as shown in Fig
• Once the files are loaded, the developer will need to edit few lines of code of the
“CameraWebServer.ino” file. The first step is to define the model name of the camera
which is currently in use. For this case, the module which is in use is a
“CAMERA_MODEL_AI_THINKER”. So that’s why line number 14 of the Code given
in Fig 52 was uncommented.
• The IP address was copied and pasted in a secured browser window. The browser will
display the ESP32 camera playground console. There are multiple services like Face
Recognition, Image Resolution selection etc. For this project only real-time video
streaming is required. In the later part of this report, ways of displaying the camera
playground console in a mobile application is discussed.
Figure 55: Web Page for live streaming from the ESP 32 Camera Module
Smart Fire Alarm Device and System
Final Year Report of Alekhaya Datta 64
In this section the code structure of the Flutter Application is going to be explained. Within the
mobile application the following things will be implemented:
• Google Sign In / Log In
• User can view the data gathered by the sensor in a nice animation format.
• In case there is a Fire, a push notification will be sent to the developer’s phone.
• User can also view the live recording from our
application.
Before going into the main section of the code it is always a
good idea to know the structure of the Flutter code, so it is easier
for other the developer to understand the code who is viewing
the application for the first time.
In Flutter all the code is written in the “lib” folder for this
project. The file which is executed in the lib folder is called the
“main.dart” file. The “main.dart” file can have multiple widgets
or file linked to it. Figure 57 shows an example of a basic
structure of a Flutter project.
Figure 56: Project Files for developing
the Flutter Mobile Application
• The code shown in Code 3 is the code for the main.dart file.
• In Line no 1 and 2 the packages were imported which will be needed in the main.dart
file. The first one is the “material.dart” package which will be imported in almost all
the files involving widgets operation. The second one is not a package, it is actually file
which is created created that will display the Login Page of the App.
• In Line no 4, the Debugger is told to run the file whose name is “My App” within the
void function
• From Line no 6 to Line 14 it is declared that the “Main App” file is a stateless widget
and the Main App is toled to return a Material App whose home is the “Login Page”
Widget. The debugShowCheckedModeBanner is set to as false because the debug
banner should not be dispalyed to the developer or user.
• The code shown in Code 4 is the code for the LoginUI.dart file.
• The code written within this file will display the Login Screen of our App. When a
developer opens the application, in the beginning the developer will be bought to the
Login Screen.
Smart Fire Alarm Device and System
Final Year Report of Alekhaya Datta 68
• Before starting to code the developer must enable Google Sign In from the Firebase
Console. This will enable the use of Google Sign-In method for the application as show
in Figure 58.
• From Line no 1 to 7 the packages and files were imported which will be used for this
code.
• From Line no 9 to 12 it is declared that the “LoginPage” will be a stateful widget. In
Flutter the developer have to specify the types of widget as stateless or stateful. Stateless
widget are widgets whose UI changes e.g. if a developer wants to have scrolling action
within there App, then Stateful widget will be used. Stateless widget are used when the
state of that UI doesnot change e.g. if a developer wants to display a picture within the
App, then a Stateless Widget will be used. The usage of this widgets varies for different
cases. A developer will decide the type of widget to use for this various cases
• From Line no 14 to 70 it is defined to extend the
stateless widget. Here a logic is defined for generating
push notifications within the App. Push notification
are required inorder to notify the users in case of a
Fire. In later part of this report a Cloud Function will
be written in JavaScript which will be incharge of
generating push-notification in case there is a fire.
• From Line no 72 to 181 is the logic behind display of
the UI. Here a developer will define how he/she wants
to view the Widgets. The picture shown in Figure 59
shows the widget tree off the project. This is an
excellent service by Android Studio where a
developer can view the Widget Tree which makes it
easier for a developer to change and debug the code if
needed. Scaffold, Container, ListView , Sized Box etc
are the different types of Widgets which Flutter
provides. Each of this widget as different
functionalities. Stateful or Stateless widget are the
parent widgets and ListView, Container etc. are the
child widgets. Figure 59: Widget Structure for
LoginUI.dart code
Smart Fire Alarm Device and System
Final Year Report of Alekhaya Datta 69
• The code shown in Code 5 is the code for the authentication.dart file.
• The code written within this file is the backend logic for Login UI file. This is the
file where the authentication logic for the Google Sign In along with Firebase is
defined.
• If the user authenticates successfully, user will be navigated to the “MainSection”
page of the Application.
• From Line no 1 to 3 the packages and
files were imported which will be used
for this code.
• From Line no 5 to 9, the name of the
parameters of the function were
declared.
• From Line no 11 to 51, the
authentication logic and data which
will be collected from the
authentication like Profile Image,
Name, Gmail-Id is defined.
• From Line no 53 to 57, the Google
Sign-out logic is defined. The picture
shown in Figure 60 shows the code
structure of this file. Figure 60: Widget Structure for
authentication.dart code
Smart Fire Alarm Device and System
Final Year Report of Alekhaya Datta 72
• The code shown in Code 6 is the code for the Main_Section.dart file.
• The code written within this file defines the basic
layout for our Application i.e. App Bar & Bottom
Navigation Bar. Once the user successfully Login to
the App, user will land into this Main Section Page
• If the user authenticates successfully, user will be
navigated to the “MainSection” page of the
Application.
• From Line no 1 to 5 the packages and files were
imported which will be used for this code.
• From Line no 7 to 12 it is declared that the
“MainSection” will be a stateful widget.
• From Line no 13 to 104, the UI of the App is defined
or specified. In this section the pages which the user
is going to see if the user clicks on any of the button
is also specified.The picture shown in Figure 61 Figure 61: Widget Structure for
shows the code structure of this file. Main_Section.dart code
• The code shown in Figure 63 is the code for the dht.dart file.
• In this section a class is written and it is named as “DHT”. In this class the variables
are defined which will be fetched from Firebase in JSON format. There will be four
variables returned for this DHT class which are
1) Temperature in Celsius scale
2) Temperature in Fahrenheit scale
3) Humidity
4) Heat Index
• The Heat-Index will not be shown within
the App. However heat index will be
declared otherwise it will mess up the
Firebase Logic
• The picture shown in Figure 63 shows the
code structure of this file. Figure 63: Widget Structure for dht.dart code
• The code shown in Code 10 is the code for the Temperature.dart file.
• The code written within this file will show data gathered from the Firebase Real
Time Database which is gathered from the DHT11 sensor.
• From Line no 1 to 4 the packages and files were imported which will be used for
this code.
• From Line no 6 to 9 it has been declared that the “SinglePageApp” will be a stateful
widget.
• From Line no 11 to 20, the varibles were
declared and the Stateful Widget was
told to return another Function which is
of type Widget which is named as
“mainScaffold()”.
• From Line no 22 to 48, the code for the
“mainScaffold()” function is written.
Here the the logic on what the user is
expecting to return and what will the
function return if a certain condition is
not met by the implementation of a
simple “If-else” statement. In the
statement again another function is
returned of widget type whose name is
“_temperatureLayout()”.
• From line 51 to 147, the
“_temperatureLayout” function is
defined. This is the function which
specifies the UI for this particular page
i.e. the types of animations and the format
in which the users will be able to veiw the
DHT-11 sensors data is specified.
• The picture shown in Figure 65 shows the
code structure of this file. Figure 65: Widget Structure for
Temperature.dart code
• The code shown in Code 11 is the code for the Smoke.dart file.
• The code written within this file will show data gathered from the Firebase Real
Time Database which is gathered from the MQ2-Smoke sensor.
• From Line no 1 to 4 the packages and files were imported which will be used for
this code.
• From Line no 6 to 9 it has been declared that the “Smoke” will be a stateful widget.
• From Line no 11 to 16 the
varibles were declared and the
Stateful Widget was told to
return another Function which is
of type Widget which is named
as “SmokeValue()”.
• From Line no 18 to 47, the code
for the “SmokeValue()” function
is written. Here the the logic on
what the user is expecting to
return and what will the function
return if a certain condition is not
met by the implementation of a
simple “If-else” statement. In the
statement again another function
is returned of widget type whose
name is “_smokeLayout()”.
• From line 48 to 107, the
“_temperatureLayout” function
is defined. This is the function
which specifies the UI for this
particular page i.e. the types of
animations and the format in
which the user will be able to
veiw the MQ-2 sensors data is
specified.
• The picture shown in Figure 66
shows the code structure of this
file.
• The code shown in Code 12 is the code for the Camera_Webview.dart file.
• The code written within this file will show the Web Page for the ESP32-camera
module.
• From Line no 1 to 3 the packages and files were imported which will be used for this
code.
• From Line no 5 to 8 it has been declared that the “CameraView” will be a stateful
widget.
• From line 10 to 24, it has been defined
the functionality and the type of widget
“CameraView” is going to return. For
this case it is a “WebView” widget to
simply display the web page given in
Figure 55 in the mobile application. The
JavaScript mode was set as unrestricted
to avoid the “JavaScript Disabled” Error
Message while users opens the App.
• The picture shown in Figure 67 shows the
code structure of this file. Figure 67: Widget Structure for
Camera_Webview.dart code
Smart Fire Alarm Device and System
Final Year Report of Alekhaya Datta 85
Once “nodeJS” is installed in the system, the developer will need to open command prompt
and install the Firebase tool kit for publishing and writing the Cloud Function. The steps needed
to be followed for initialising, writing, and publishing the Cloud Function are given as follows:
• The following command needs to be used for installing the firebase tool kit in the local
computer:
npm install -g firebase-tools
• Once the Firebase is initialised, the developer will be asked to confirm whether he or
she wants to proceed to the next step or not. The developer must type “Yes” to proceed
to the next steps.
• Once proceeded the developer will be asked to select the Firebase services which the
developer needs to be used. For writing Cloud Function, the following option was
selected.
( ) Functions: Configure and deploy Cloud Functions
• Once the developer selects the above option, the developer will be asked to select the
language which they want to code with. Currently there are only two languages which
are available for writing Firebase Cloud Function. The languages are -1) JavaScript 2)
TypeScript
For this project JavaScript was used as the language for writing Cloud Function.
• After selecting JavaScript as the language for writing the Cloud Function, The
developer will receive the following confirmation question:
Do you want to use ESLint to catch probable bugs and enforce style?
• The developer must type in “Yes” to create the “index.js” file and other types of
JavaScript File which will be required for write the Cloud Function.
• After the files are created, the developer will receive the following confirmation
question:
Do you want to install dependencies with npm now?
Smart Fire Alarm Device and System
Final Year Report of Alekhaya Datta 87
• Developer must type in “Yes” to install the Node.JS dependencies. Once installed, the
developer must navigate to the file where they have created the folder for writing the
Cloud Function. The folder must be opened in IDE’s which are JavaScript compatible
like Visual Code Studio IDE or
Android Studio etc. For this project
Android Studio will be used. After
opening the Folder for writing the
Cloud Function, the developer must
navigate to the “index.js” file. This
is the file where the developer will
write the Firebase Cloud Function
for sending Automated push
notifications to the developer
whenever there is a fire.
Figure 69: File Structure of Firebase Cloud Function
• Earlier in the earlier section it was discussed that when the flame sensor detects a flame,
the variable “FIRE” in the Firebase Realtime will be updated to 1 and if there is no fire
detected the Firebase Realtime database will be updates to 0. The logic which is created
Smart Fire Alarm Device and System
Final Year Report of Alekhaya Datta 88
for this project is that whenever the variable “FIRE” is updated to 1 or 0, the Cloud
Function will get triggered and Firebase will send a Firebase Push Notification to the
user’s device through the application created earlier.
• In Line no 5, the function was named as “fire”. The variable is “FIRE” and it was
specified that the Cloud Function will be activated whenever the value of “FIRE” is
updated. Other types operations involve “read”, “write”, and “delete” can also be
specified.
• From Line no 6 to 13, the description of the notification is given. The “title” is the
heading of the notification. The term “body” is what comes below the heading or the
main message. The “badge” is the number which will be displayed on the App Icon
(available only for Android OS for version above 8.0). The “sound” is the sound in the
device when the notification arrives.
• From line no 15 to 24 is the is the logic for getting the Firebase Cloud Messaging Token
and printing a message in the console along with an inbuilt function for sending the
Firebase Push notification to the developer device. Now there could be certain times
when there could be a glitch, if anything like that happens then an error message will
be printed in the console.
• Once the coding is done, developer will need to open the Command Prompt again or
the terminal of the respective IDE and will need to type the following command to
deploy the Cloud Function on Firebase.
firebase deploy
• Once the function is deployed, a message will be shown in terminal as shown in Figure
70 and the function will be deployed on Firebase as shown in Figure 71
Figure 70: Terminal Message after the deploy of Firebase Cloud Function
Smart Fire Alarm Device and System
Final Year Report of Alekhaya Datta 89
The last and final stage is to design a casing where the circuit shown in Figure 17 &18 and the
electronic devices discussed in the earlier sections of the report could fit in together. The aim
before designing the casing was that the 1) Design should be made as small as possible 2) The
device should be handy and carried and can be installed anywhere by the user.
The designing stage was divided into three stages. The first two stages were designing the two
parts 1) static part 2) movable part. The third and final stage of the design is the assembly stage
where mainly the interference between the movable part and the static part was tested before
3D-printing the two parts which are designed earlier.
This part is the main part or the main body of the casing. This part is the part where all the
sensors i.e. MQ-2 Gas Sensor, DHT-11 Temperature Sensor, Flame Sensor & the electronic
devices i.e. Camera, TFT Display, Buzzer, ESP-32 camera module, FTDI Programmer, NODE
MCU 3 Development board will be attached. The aim before designing was to make the design
as small as possible without damaging the sensor or the
electronic equipment.
• Fillet: This is a feature that allows a product designer to include circular curves
especially at the edges of their 3D object. The feature is also available for 2D-sketches
as well.
The design was initialised by doing a simple rectangular box of the following dimension -
50mm(width) * 100mm(length) * 69mm(height). Once the rectangular box was designed, there
were various cut-outs which were made in order to accommodate the sensor and devices in a
single box. The final box have a wall thickness of 2mm, and the base had a thickness of 5 mm.
The design was done in such a way that the sensors and the ESP-32 cam module will be
attached at the front of the casing. The TFT display and the buzzer will be placed at the top of
the casing. The microcontroller, FTDI Programmers and the wires will be placed inside of the
casing and this will be only partially visible. The four-sectional view for the casing is shown
in Figure 74
This is the part which will be movable and will be assembled at the back of casing. The part
was designed in such a way that it will fit into the slots
designed at the back of the Static Part. The tools used for
designing this part is like the tools used for designing the
Static part. There is only one extra tool which was used
during the design of the movable part. The tool which
was used is defined as follow:
• Linear Pattern: If a product designer want to
replicate a particular design or object on a straight
line by taking reference to a particular sketch or
object, then the product designer can use the tool
to reduce the designing time and increase the
overall time efficiency.
Figure 76: Tools used for
designing the Movable Part
The design was initialised by doing a simple rectangular object of the following dimension -
2.5mm(width) * 97.50mm(length) * 75mm(height). Once the rectangular object was designed,
there were various circular cut-outs which were made using “Extruded-Cut” and “Linear
Pattern” for cooling purpose. All electronic devices will have some heating effect and heat
needs to be dissipated. The holes were done for the electronic device to dissipate the heat in
the air. The two-sectional view for the casing is shown in Figure 77.
Smart Fire Alarm Device and System
Final Year Report of Alekhaya Datta 93
The last and final step is the assembly stage. This is an excellent feature which is provided by
Solidworks, where product designer can perform a virtual assembly and simulate it. This will
allow the product designer to understand if there is any interference between any parts before
the manufacturing and the physical assembly of the product. The tools which were used as
follows:
• Coincident mate: Positions selected planes, edges, and faces on the same infinite plane.
If the two vertices are chosen then it will position them so that they touch.
• Limit-Distance mate: Add a limiting distance between components by giving it a
maximum and minimum distance between
components faces, edges, or planes
(Unspecified, 2014). In this assembly, the
maximum distance until which the movable
part can slide from the static part was added
as 80mm and the minimum distance was
added as 0mm.
The interface between the static and movable part
was tested and no interferences was detected after
the virtual assembly. Figure 78: Tools used for doing
the assembly in Solidworks
Smart Fire Alarm Device and System
Final Year Report of Alekhaya Datta 94
• First of all the SolidWorks file which is in “.SLDRT” format must be converted into a
“.STL” file. This can be done so by saving the file in “.STL” file or else using various
websites available for conversion from “.SLDRT” to “.STL” file.
• Once the above step is completed, a software named as “Cura” will be opened. “Cura”
is a software which allows manufacturer to set and edit certain 3D-printer machine
Smart Fire Alarm Device and System
Final Year Report of Alekhaya Datta 95
settings. The software is compatible with Creality CR-10 and these is one of the main
reasons why Cura should be used for changing the print settings.
• Once the software is opened in the local device, the “.STL” files will be imported.
There are two files and for both files are loaded in two separate windows because the
print setting was different for two of the files.
• Static Part:
There are many machine settings which are available in Cura. Each of the settings
affect the print quality, time, and overall cost & efficiency. For this part, the following
settings was adjusted:
o Infill percentage %: The infill percentage is the measure of by how much
percentage the material is fully solid. For this design, the infill% was set to
10% which means the static part is 10% solid and 90% hollow.
o Profiles: The profile was set 0.2 mm. This setting affect the accuracy of the
print. For more accurate measurement the profile should be set to a lower
number.
o Support and Adhesion: The support was enabled since there are some holes
or an hollow part in the design. For certain design, there could be a part which
has a large empty gap or separation in it. Enabling supports creates a
temporary support to the design. These supports can later be removed by hand
or by the application of certain tools.
Adhesion is required for the 3D printer where the base of the design is not
sticking to the bed of the 3D printer properly. Since a transparent glass bed
was used on the day of the printing and glass is slippery, so enabling the
Adhesion helped the design to stick properly to the bed during printing.
The next step is to click on the “Slice” option to see the estimated time and the percentage of
materials used. It was found out that the static part takes around 8hours and 6minutes to print
and takes around 55gm of PLA.
• Movable Part:
For the movable part the following settings were adjusted:
o Infill percentage %: The infill percentage was set to 100%
o Profiles: The profile was set 0.2 mm.
o Support and Adhesion: The support was disabled, and the adhesion was
enabled.
It was found out that the movable part takes around 2hours and 59minutes to print
and takes around 17gm of PLA .
The next step is to 3D-print the design. This can be done either by either connecting the local
device with the 3D-printer or using an SD card to export the design. Firstly, the bed and the
extruder will heat until 50 C and 200 C respectively and once the temperature is reached, the
rest is the machine job for 3D-printing the design. The code which the machine uses for
interpreting the “.stl” file is called as “G-CODE”.
Firstly, the circuit shown in Figure 17 and 18 was implemented over a breadboard and was
tested. Due to the ongoing Covid-19 pandemic electronic equipment like buzzer and the TFT
display did not arrive during the time when the circuit shown in Figure 84 was constructed.
For the ESP-32 cam module, the speed and the video quality was mainly
tested. Now since the camera price is quite low, so developer should not
expect it to live-stream FHD or HD quality video. There are multiple
options for the quality from the live-streaming video which are available
for the developer. The quality ranges from QQVGA(160*120) to
UXGA(1600*1200). For faster streaming and better video quality the
cam module is recommended to run at XGA (1024*768).
Figure 85: Camera Page of the App
Smart Fire Alarm Device and System
Final Year Report of Alekhaya Datta 98
In this test the UI and the latency for updating the sensor data in the mobile application was
tested. The codes which were involved for creating the mobile application is shown in Section
5.7. During the test it was found out that it took only around a maximum of one second for the
Data to get updated in the Mobile Application. The overall Application structure is shown in
Flow Chart-2.
Smart Fire Alarm Device and System
Final Year Report of Alekhaya Datta 99
User will click on the icon User will click on “Sign in with User will select the Google
labelled as “fyp” to enter the Google button” Account they wish to login with.
Mobile Application Code Involved: main.dart, Code Involved:
LoginUI.dart authentication.dart
Once the user is User can see the temperature User can see the smoke, CO User can see the live stream
authenticated, the user will and humidity value sensed and LPG value sensed by the captured by the ESP-32
be bought to the home page by the DHT-11 sensor by MQ-2 Gas sensor by cam module by clicking on
of the App. User can either navigating to the navigating to the Smoke the Camera View Page.
Sign Out by clicking on Temperature Page. Sensor Page. Code Involved:
“Sign Out” button or can Code Involved: Code Involved: Smoke.dart, Camera_Webview.dart,
navigate to other pages. Temperature.dart, main_Section.dart, MQ2.dart main_Section.dart
9.4 Casing
Code Involved: Im main_Section.dart, dht.dart
main_Section.dart,
First_Screen.dart
Smart Fire Alarm Device and System
Final Year Report of Alekhaya Datta 100
The design for the casing discussed in Section 5.9 was manufactured using 3D printer. The
type of manufacturing for the casing is called an “Additive Manufacturing” where materials or
the ingredients are added from ground bottom to create a part of given shape and sizes. The
total weight for the casing was found out to be only 50gm. Once the casing was manufactured,
the sensors and the electronic equipment or devices were assembled using adhesives. After
putting the equipment in there respective slots of the casing, the wires were connected with as
per the circuit shown in Figure 17 & 18. Mostly male-female or female-female jumper wires
were used during the connection. After the assembly was done, the weight of the casing was
measured again, and it was found out to be only 72 gm. At the end, the movable part was put
at the back of the casing. The following picture shows the casing, and the two circuits shown
in Figure 17 & 18 implemented inside the casing.
Figure 94: Push Notification send to user device once a Fire is detected
Smart Fire Alarm Device and System
Final Year Report of Alekhaya Datta 104
7. CONCLUSION
7.1 Troubleshooting
Now all devices and system have some inaccuracy and disadvantages. An engineer cannot
completely get rid of the problem but can minimise the inaccuracy through various techniques
to get accurate readings. The table shown below are some of the things which an engineer,
designer, developer or an user might encounter, and the steps required for overcoming those
problems:
Table 22: List of troubleshooting methods
Sl no Problem Statement Reason Solution
1 Buzzer and Firebase Flame sensor gets activated In order to avoid the
Cloud Function getting when it detects Infrared false alarm, the
activated when the radiation from the Fire. potentiometer will be
device is kept under Sunlight also emit Infrared needed to be calibrated
direct sunlight Radiation which triggers the to avoid this issue.
false alarm.
2 The sensors are already In the programme the Flame
To make the device
calibrated but false alarm Sensor is only responsible
more accurate, an and
are still getting triggered. for the triggering of the Fire
logic could be used
Alarm. Sometime the sensor
(“&&”) i.e. the alarm
might be activated
will get triggered only if
depending on various
a certain condition is
environmental factor. met for the three sensors
3 The triggering of the The CPU frequency of the
The CPU frequency of
Alarm is taking a few ESP8266 was set to 80MHz
the ESP8266 can be set
seconds. which means it takes the
to 160MHz which
ESP8266 12.5ns to execute
means it will take the
a single task. ESP8266 6.25ns to
execute a single task.
4 The 3D printed casing is The nozzle size for a For accurate volume a
about 2mm larger than standard 3D printer is nozzle of diameter
the original volume 0.4mm. 0.2mm could be used.
designed in SolidWorks
5 The Flutter Mobile This an issue which This will be solved by
Application size is quite currently the Flutter team is the Flutter Team in the
large. facing and trying to solve. upcoming versions.
6 Firebase Services does Firebase services are not Firebase web support is
not work in Flutter Web. configured for Web needed to be configured
separately for Flutter
Smart Fire Alarm Device and System
Final Year Report of Alekhaya Datta 105
3 Using Image
Recognition • Large number of
• The design will be images related to fire is
techniques, the
smaller needed to be gathered.
camera could
• The design will • Extra cost will be
be used to
replace the need of incurred from the Cloud
detect
using the sensor. Service provider.
Fire/Flame and
Smoke
4 GSM could be • Reduce the overall • GSM modules available
used for sending code and in the market are mostly
SMS to the user development cost. 2G. In most of the
• Eliminates the need countries 2G networks
of Internet based are getting shutdown
operation. • GSM modules with 3G
and 4G network
capabilities are
expensive.
• With the evolution of
5G, it is possible 3G
and 4G networks will
get shutdown
Smart Fire Alarm Device and System
Final Year Report of Alekhaya Datta 106
8. BIBLIOGRAPHY
2C%201ppm%20%3D%200.0001%25%20gas.
[Accessed 21 11 2020].
• Various, 2019. Wikipedia. [Online]
Available at: https://en.wikipedia.org/wiki/Flame
[Accessed 16 11 2020].
9. APPENDIX