0% found this document useful (0 votes)
43 views66 pages

Vision-Based Fire Detection Using AI

Uploaded by

J.H. SRIVARSHAN
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
43 views66 pages

Vision-Based Fire Detection Using AI

Uploaded by

J.H. SRIVARSHAN
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd

VISION BASED FIRE DETECTION SYSTEM

USING DEEP LEARNING

A PROJECT REPORT

Submitted by

Praveen Raj A
Srivarshan J H

in partial fulfillment for the award of

thedegree of

BACHELOR OF TECHNOLOGY

in

ARTIFICIAL INTELLIGENCE AND DATA SCIENCE

KARPAGA VINAYAGA COLLEGE OF ENGINEERING


ANDTECHNOLGY

ANNA UNIVERSITY :: CHENNAI 600 025

MAY 2024

I
KARPAGA VINAYAGA COLLEGE OF ENGINEERING AND
TECHNOLGY
ANNA UNIVERSITY, CHENNAI – 600 025

BONAFIDE CERTIFICATE

Certified that this project report “VISION BASED FIRE DETECTION SYSTEM
USING DEEP LEARNING” is the bonafide work of “Praveen Raj A
(421220243008), Srivarshan J H (421220243010)” who carried out the project work
under my supervision.

SIGNATURE [HOD] SIGNATURE [SUPERVISOR]


[Link] Howsalya Devi, [Link].D. [Link], M.E.,
Head of the Department, Assistant Professor,
Department of Artificial Intelligence Department of Artificial Intelligence
and Data Science, and Data Science,
Karpaga Vinayaga College of Karpaga Vinayaga College of
Engineering and Technology. Engineering and Technology.
Chengalpattu District. Chengalpattu District.

Submitted for the project viva-voce examination held on

INTERNAL EXAMINER EXTERNAL EXAMINER

II
ACKNOWLEDGEMENT

With profound gratitude and due regards, we whole heartedly and sincerely
acknowledge with thanks the opportunity provided to us by our Respectful Director
Dr. Meenakshi Annamalai for allowing us to do this project in partial fulfillment for
the degree of Bachelor of Technology under Anna University, Chennai.
We thank our dedicated Principal Dr. P. Kasinatha Pandian B.E.,M.S.,
Ph.D.,F.I.E.,M.I.S.T.E., for his valuable suggestions and timely advice which helped us
in completing this project on schedule.
We thank our Head of the Department [Link] Howsalya Devi M.E.
Ph.D. for allotting us this project and his able guidance.
We thank our Project Guide [Link] M.E,,for her painstaking efforts
and proper guidance without which this project could not have been completed.
We thank our various faculty members and friends for their timely help and
guidance in one way or other which went a long way in the completion of this project.
We will be failing in our duty if we don’t thank our parents for their
benevolence and blessings which stood us in good stead during the course of the project.
We would like to thank the authors of various journals and books whose
works and resultsare used in this project.

III
ABSTRACT

VISION BASED FIRE DETECTION SYSTEM USING DEEP


LEARNING

Fire is one of the hazardous, unwanted and sometimes uncontrolled events. Urban fires generally occur
because of short-circuits in electrical devices, leakage on LPG gas cylinder ducts, or due to human ignorance
itself. But at present, the system that is generally used in the community is a smoke sensor that is affixed to
the ceiling of the room to detect a fireplace. Apart from the matter of early fire detection, present fire alarm
systems are inefficient in terms of the false triggering of the alarm systems. Traditional Fire detection methods
that is. Sensor-based and Color Based Flame detection have high false rate and low accuracy. Real-time Fire
detection using Convolution Neural Network will overcome many problems in traditional fire identification.
Convolutional Neural Network (CNN) is an algorithm which classifies images with a high degree of
accuracy and good performance. The proposed system will be using the Convolution Neural Network,
YOLO v3 (You Only Look Once Version 3) algorithm, OpenCv, Keras deep learning library.

Key words - Deep Learning, Fire and Smoke Detection, Convolution Neural Network, YOLO, artificial
intelligence.

IV
TABLE OF CONTENT

CHAPTER NO. TITLE PAGE NO.


BONAFIDE II
ACKNOWELDGEMENT III
ABSTRACT IV
LIST OF FIGURES VI
1. INTRODUCTION 8
1.1. Fire detection system 8
1.2. Existing System 9
1.3. Proposed System 9
1.4. Block Diagram 9
1.5. Introduction to IOT 10
1.6. Interoperability in IOT 10
1.7. Security Challenges 12
1.8. Firebase 13
2. REVIEW OF LITERATURE 25
2.1. Review of Literature 25
3. MODULE REQUIREMENTS 29
3.1. Hardware Requirements 29
3.2. Software Requirements 53
4. IMPLEMENTATION 56
4.1 Fire Base 56
5. CONCLUSION 63
FUTURE WORK 63
REFERENCES 64

V
LIST OF FIGURES

FIG PAGE NO.


DESCRIPTION
NO.
1.1 BLOCK DIAGRAM 9

1.2 APPLICATION OF IOT 11

1.3 FIREBASE 13

1.4 FIREBASE SERVICES 14

1.5 REAL TIME DATABASE 15

1.6 FCM 16

1.7 DATABASE QUERY 17

1.8 DATABASE QUERY 18

1.9 DATABASE QUERY 18

1.10 INSTRUMENTATION TEST 19

1.11 FIREBASE APP INDEXING 20

1.12 FIRESTORE 21

1.13 DATA COLLECTION 22

1.14 DATA SUB-COLLECTION 22

1.15 DATA FETCHING 23

3.1 ESP8266 29

3.2 SOLENOID LOCK 31

3.3 DC FAN 33

3.4 BUZZER PIN CONFIGURATION 34

VI
3.5.1 RELAY SWITCH 36

3.5.2 PIN DIAGRAM 37

3.6 ULN2003A 38

3.7.1 LOGICAL DIAGRAM 39

3.7.2 LOGICAL DIAGRAM 39

3.8 POWER SUPPLY BOARD 40

3.9 CAPACITOR 41

3.10 CARBON COMPOSITION RESISTORS 42

3.11 CARBON FILM RESISTORS 43

3.12 METAL FILM RESISTORS 43

3.13 WIRE WOUND RESISTORS 44

3.14 WATER PUMP 50

4.1 REALTIME DATABASE BEFORE AND AFTER FIRE DETECTION 61

4.2 VISION BASED DATA 62

4.3 PSYCHOLOGICAL DATA 62

VII
CHAPTER-1
INTRODUCTION
1.1. FIRE DETECTION SYSTEM
Fire detection systems are designed to discover fires early in their development when time will still be
available for the safe evacuation of occupants. Early detection also plays a significant role in protecting the safety
of emergency response personnel. Property loss can be reduced and downtime for the operation minimized through
early detection because control efforts are started while the fire is still small. Most alarm systems provide
information to emergency responders on the location of the fire, speeding the process of fire control.
To be useful, detectors must be coupled with alarms. Alarm systems provide notice to at least the building
occupants and usually transmit a signal to a staffed monitoring station either on or off site. In some cases, alarms
may go directly to the fire department, although in most locations this is no longer the typical approach.
These systems have numerous advantages as discussed above. The one major limitation is that they do
nothing to contain or control the fire. Suppression systems such as automatic sprinklers act to control the fire. They
also provide notification that they are operating, so they can fill the role of a heat detection-based system if
connected to notification appliances throughout the building. They will not, however, operate as quickly as a smoke
detection system. This is why facilities where rapid notice is essential, even when equipped with sprinklers, still
need detection and alarm systems.
Image recognition algorithms which are used to detect fire are based on deep learning can automatically
learn and extract complex image features effectively. This kind of algorithms has attracted great concerns and
achieved great performance on visual search, automatic driving etc. Therefore, some people have introduced deep
learning into the field of image fire detection thereby developing the self-learned ad used algorithm in collection of
fire image features to analyze them.
The process of fire detection through algorithms based on deep learninghave recently witnessed more usage
in detection of fire as accuracy of these systems in complex systems are way better than traditional systems, though
some problem still exists in them. First, the current algorithms based on deep learningmostly considered image as
a fire detection classification task, and the region proposal stage has been ignored. The algorithms consider the
entire image to be in one class. However, if there is fire, smoke and flame only in early stage of fire covered over a
small area of the image than the feature of smoke and flame is not obvious, therefore the use of the entire image
feature will decrease the accuracy of detection of the system and also will delay fire detection alarm

8
1.2. EXISTING SYSTEM
The existing sensors contains the hardware sensors to detect the fire. The main disadvantage of installing a
sensor based fire alarm system is the cost involved. Depending on the plan selected, installation costs can range
from hundreds to thousands and this doesn’t include any routine maintenance costs such as testing or replacing
batteries periodically. Additionally, false alarms caused by faulty sensors can be costly (in terms of fines) and
frustrating for homeowners/building occupants if they occur too often.
1.3. PROPOSED SYSTEM
The proposed system has a web camera connected with a Laptop/Pc with a python code running. Whenever
fire is detected the software send the signal to an ESP 8266 via [Link] soon as the controller receives the signal it
updates to the cloud and simultaneously activates an alarm and a water extinguisher. In addition to it an exhaust fan
is switched on to control smoke. An emergency exit door is unlocked to facilitate the safe exit of humans.
1.4. BLOCK DIAGRAM

Fig.1.1

9
1.5. INTRODUCTION TO IOT
IoT refers to an Internet Of Things (IoT). Connecting any device (including everything from cell phones,
vehicles, home appliances and other wearable embedded with sensors and actuators) with Internet so that these
objects can exchange data with each other on a network. It is interesting to note that there is a difference between
IoT and the Internet; it is the absence of Human role. The IoT devices can create information about individual’s
behaviors, analyze it, and take action.
A question would arise in your mind that why we are concerned about IoT? Here is the answer that why
you should be concerned about IoT. Say for example you are on your way to a meeting; your car could have access
to your calendar and already know the best route to take. If the traffic is heavy your car might send a text to the
other party notifying them that you will be late. What if your alarm clock wakes up you at 6 a.m. and then notifies
your coffee maker to start making coffee for you? Being able to turn the lights on in your house or heating before
coming home using your smartphone? Yes, all these things are possible because of IoT.
Smart System and the Internet of the Things are driven by a combination for:

1. Sensors & Actuators


2. Connectivity
3. People & Process

1.6. INTEROPERABILITY IN IOT

The Internet of Things (IoT) is an incredibly diverse space, encompassing a large variety of hardware form
factors and software ecosystems unlike anything we have seen in technology. Smart watches, connected cameras,
drones, thermostats, voice-enabled speakers, smart appliances and more—they all live together within the IoT.
The diversity and innovation that excites many IoT fans is a big challenge not just for manufacturers and
developers, but also (and most importantly) consumers. Which technology options should be used when designing
or deploying IoT devices? How do they keep up with updated or new operating systems? What about new software
and connectivity technologies coming up? Those are just some of today’s challenges.
Having a single, unified communication and software framework for the IoT seems like an ideal solution,
but the diverse and fast-paced nature of the IoT makes this utopia a big challenge. Diversity in the IoT is not
something to be solved, but an aspect that must be embraced and managed.

10
1.6.1. APPLICATION AREAS FOR THE INTERNET OF THINGS

Fig 1.2 Application of IOT


Smart Home
The concept of Smart Home is brought up to save time, energy and money. With the introduction
of Smart Homes, we would be able to switch on air conditioning before reaching home or switch off lights even
after leaving home or unlock the doors to friends for temporary access even when you are not at home.
Smart cities
Smart surveillance, automated transportation, smarter energy management systems, water
distribution, urban security and environmental monitoring all are examples of internet of things applications for
smart cities. IoT will solve major problems faced by the people living in cities like pollution, traffic congestion and
shortage of energy supplies etc. By installing sensors and using web applications, citizens can find free available
parking slots across the city. Also, the sensors can detect meter tampering issues, general malfunctions and any
installation issues in the electricity system.
Wearables
Wearable devices are installed with sensors and software’s which collect data and information about
the users. This data is later pre-processed to extract essential insights about user. These devices broadly cover
fitness, health and entertainment requirements. The pre-requisite from internet of things technology for wearable
applications is to be highly energy efficient or ultra-low power and small sized.

11
Healthcare
IoT in healthcare is aimed at empowering people to live healthier life and regular checkup by
wearing connected devices. The collected data will help in personalized analysis of an individual’s health and
provide tailor made strategies to combat illness.
1.7. SECURITY CHALLENGES
Security is a big issue with IoT devices. With billions of devices being connected together over
Internet, how can people be sure that their information is secure? These security issues can be of the following
kinds.
Data Encryption
IoT applications collect tons of data. Data retrieval and processing is integral part of the whole IoT
environment. Most of this data is personal and needs to be protected through encryption. Encryption is widely used
on the internet to protect user information being sent between a browser and a server, including passwords, payment
information and other personal information that should be considered private. Organizations and individuals use
encryption to protect sensitive data stored on computers, servers and mobile devices like phones or tablets.

Data Authentication
After successful encryption of data chances of device itself being hacked still exist. If there is no way
to establish the authenticity of the data being communicated to and from an IoT device, security is compromised.
For instance, say you built a temperature sensor for smart homes. Even though you encrypt the data it transfers is
there is no way to authenticate the source of data then anyone can make up fake data and send it to your sensor
instructing it to cool the room even when its freezing or vice versa.
Side-channel Attacks
Encryption and authentication both in place still leave scope for side channel attacks. Such attacks focus
less on the information and more on how that information is being presented. For instance, if someone can access
data like timing information, power consumption or electromagnetic leak, all of this information can be used for
side channel attacks.
Privacy Challenges
Then we have the issue of privacy and data sharing. That is because these devices not only collect
personal information like users’ names and telephone numbers, but can also monitor user activities (e.g., when users
are in their houses and what they had for lunch).

12
Connectivity Challenges — Billions of devices on a centralized server
One of the biggest challenges for IoT in the future is to connect large number of devices and massive
amounts of data that all of these devices are going to produce. There will be need to find out a way to store, track,
analyze and make sense of the vast amounts of data that will be generated. Presently, we rely upon centralized,
server/client model to authorize, authenticate, and connect several nodes present on the network. This model is
sufficient for the number of IoT devices that are currently a part of the ecosystem. However, in the future, when
hundreds of billions of devices will join the network, it will be difficult to manage all the data. Moreover, the
capability of current cloud servers is so less that it can breakdown if it has to handle large amounts of information.
Compatibility and Longevity Challenges-Extra hardware and software
Different technologies like ZigBee, Z-Wave, Wi-Fi, Bluetooth and Bluetooth Low Energy (BTLE)
are all battling to become the dominant transport mechanism between devices and hubs. This becomes a major
source of problems when a lot of devices have to be connected; such dense connectivity requires the deployment
of extra hardware and software. Conversations about the IoT are taking place all over the world as we are trying to
understand how this will impact our lives. We are also trying to understand what the many opportunities and
challenges are going to be as more and more devices start to join the IoT. So, all that we can do is educate ourselves
about what the IoT is and how it will be after some years.
1.8. FIREBASE

With a variety of server-side technologies that are on the market today, developers have a tough job of
deciding what kind of backend is most suitable for their app. In this post, we will explore one of these choices that
go by the name of Firebase , and all the tools and services that it provides.

Fig 1.3 Firebase

13
Firebase is a mobile and web app development platform that provides developers with a plethora of tools
and services to help them develop high-quality apps, grow their user base, and earn more profit. Back in 2011,
before Firebase was Firebase, it was a startup called Envolve. As Envolve, it provided developers with an API that
enabled the integration of online chat functionality into their website. What’s interesting is that people used Envolve
to pass application data that was more than just chat messages. Developers were using Envolve to sync application
data such as a game state in real time across their users.

This led the founders of Envolve, James Tamplin and Andrew Lee, to separate the chat system and the real-
time architecture. In April 2012, Firebase was created as a separate company that provided Backend-as-a-Service
with real-time functionality.

After it was acquired by Google in 2014, Firebase rapidly evolved into the multifunctional behemoth of a
mobile and web platform that it is today.

FIREBASE SERVICES

Fig 1.4 Firebase Services

Real-time Database

The Firebase Real-time Database is a cloud-hosted NoSQL database that lets you store and sync
between your users in Real-time. The Real-time Database is really just one big JSON object that the developers can
manage in Real-time. Real-time Database => A Tree of Values With just a single API, the Firebase database
provides your app with both the current value of the data and any updates to that data.
14

14
Fig 1.5 Real time Database

Real-time syncing makes it easy for your users to access their data from any device, be it web or mobile.
Real-time Database also helps your users collaborate with one another. Another amazing benefit of Real-time
Database is that it ships with mobile and web SDKs, allowing you to build your apps without the need for servers.

When your users go offline, the Real-time Database SDKs use local cache on the device to serve and store
changes. When the device comes online, the local data is automatically synchronized. The Real-time Database can
also integrate with Firebase Authentication to provide a simple and intuitive authentication process.

Authentication

Firebase Authentication provides backend services, easy-to-use SDKs, and ready-made UI libraries to
authenticate users to your app. Normally, it would take you months to set up your own authentication system.

And even after that, you would need to keep a dedicated team to maintain that system. But if you use
Firebase, you can set up the entire system in under 10 lines of code that will handle everything for you, including
complex operations like account merging.

You can authenticate your app’s users through the following methods:

 Email & Password


 Phone numbers
 Google

15
 Facebook

 Twitter

 & more!

Using Firebase Authentication makes building secure authentication systems easier, while also improving
the sign-in and on boarding experience for end users. Firebase Authentication is built by the same people who
created Google Sign-in, Smart Lock, and Chrome Password Manager.

Firebase Cloud Messaging (FCM)

Firebase Cloud Messaging (FCM) provides a reliable and battery-efficient connection between your
server and devices that allows you to deliver and receive messages and notifications on iOS, Android, and the web
at no cost.

You can send notification messages (2KB limit) and data messages (4KB limit). Using FCM, you
can easily target messages using predefined segments or create your own, using demographics and behavior. You
can send messages to a group of devices that are subscribed to specific topics, or you can get as granular as a single
device.

FCM can deliver messages instantly, or at a future time in the user’s local time zone. You can send
custom app data like setting priorities, sounds, and expiration dates, and also track custom conversion events. The
best thing about FCM is that there is hardly any coding involved! FCM is completely integrated with Firebase
Analytics, giving you detailed engagement and conversion tracking.

Fig 1.6 FCM

16
Firebase Database Query
Firebase has simplified the process of retrieving specific data from the database through queries.
Queries are created by chaining together one or more filter methods.

Firebase has 4 ordering functions:

 Order By Key()
 Order By Child(‘child’)
 Order By Value()

 Order By Priority()

Note that you will only receive data from a query if you have used the on() or once() [Link] can also use these
advanced querying functions to further restrict data:

 Start At(‘value’)

 End At(‘value’)
 Equal To(‘child key’)

 Limit To First(10)

 Limit To Last(10)

In SQL, the basics of querying involve two steps. First, you select the columns from your table. Here I am
selecting the Users column. Next, you can apply a restriction to your query using the WHERE clause. From the
below-given query, I will get a list of Users whose name is GeekyAnts.

Fig 1.7. Database Query

17
You can also use the LIMIT clause, which will restrict the number of results that you will get back from
your query.

Fig 1.8. Database Query

In Firebase, querying also involves two steps. First, you create a reference to the parent key and then you
use an ordering function. Optionally, you can also append a querying function for a more advanced restricting.

Fig 1.9 Database Query

18
How to Store Data? => Firebase Storage

Firebase Storage is a standalone solution for uploading user-generated content like images and videos from
an iOS and Android device, as well as the Web. Firebase Storage is designed specifically to scale your apps,
provide security, and ensure network resiliency. Firebase Storage uses a simple folder/file system to structure its
data.

Instrumentation Test

These are tests that you written specifically to test your app, using frameworks like Espresso and UI
Automaton 2.0

 Robo Test

This test is for people who just want to relax and let Firebase worry about tests. Firebase Test Labs
can simulate user touch and see how each component of the app functions.

 Game Loop Test

Test Labs support game app testing. It comes with a beta support for using a “demo mode” where
the game app runs while simulating the actions of the player.

Fig 1.10 Instrumentation Test

19
Remote Config essentially allows us to publish updates to our users immediately. Whether we wish to
change the color scheme for a screen, the layout for a particular section in our app or show promotional/seasonal
options — this is completely doable using the server side parameters without the need to publish a new version.

Remote Config gives us the power to:

 Quickly and easily update our applications without the need to publish a new build to the app/play store.

 Effortlessly set how a segment behaves or looks in our application based on the user/device that is using it.

Firebase App Indexing

To get your app’s content indexed by Google, use the same URLs in your app that you use on your
website and verify that you own both your app and your website. Google Search crawls the links on your website
and serves them in Search results. Then, users who’ve installed your app on their devices go directly to the content
in your app when they click on a link.

Fig 1.11 Firebase App Indexing

20
Firebase Dynamic Links

Deep links are URLs that take you to content. Most web links are deep links. Firebase can now
modify deep links into Dynamic Links! Dynamic Links allow the user to directly come to a particular location in
your app.

There are 3 fundamental uses for Dynamic Links

 Convert Mobile Web Users to Native App Users.

 Increase conversion for user-to-user sharing. By converting your app’s users, when the app is shared with
other users you can skip the generic message which is shown when a user downloads it from the store.
Instead, you can show them personalized greeting message.

 Drive installs from the third party. You can use social media networks, email, and SMS can be used to
increase your target audience. When users install the app, they can see the exact content of your campaigns.

Firestore

Cloud Firestore is a NoSQL document database that lets you easily store, sync, and query data for
your mobile and web apps — at a global scale. Though this may sound like something similar to the Real-time
Database, Firestore brings many new things to the platform that makes it into something completely different from
Real-time Database

Fig 1.12 Firestore

21
Improved Querying and Data Structure

Where Real-time Database stores data in the form of a giant JSON tree, Cloud Firestore takes a much
more structured approach. Firestore keeps its data inside objects called documents. These documents consist of
key-value pairs and can contain any kind of data, from strings to binary data to even objects that resemble JSON
trees (Firestore calls it as maps). The documents, in turn, are grouped into collections.

Fig 1.13 Data Collection

Firestore database can consist of multiple collections that can contain documents pointing towards sub-
collections. These sub-collections can again contain documents that point to other sub-collections, and so on.

Fig 1.14 Data Sub-collections

22
You can build hierarchies to store related data and easily retrieve any data that you need using queries. All
queries can scale with the size of your result set, so your app is ready to scale from its first day itself.

Fire store’s queries are shallow. By this, I mean to say that in Firestore, you can simply fetch any document
that you want without having to fetch all of the data that is contained in any of its linked sub-collections.

Fig 1.15 Data Fetching

You can fetch a single document without having to grab any of its sub-collections.

Query with Firestore

Imagine that you have created a collection in Firestore that contains a list of Cities. So, before you
can send out a query, you will have to store the database inside a variable. But Cloud Firestore can make querying
even easier! In some cases, Cloud Fire store can automatically search your database across multiple fields. Fire
store will guide you towards automatically building an index that will help Firestore to make querying extremely
simple.

Better Scalability

Though Firebase’s Real-time Database is capable of scaling, things will start to get crazy when your
app becomes really popular or if your database becomes really massive. Cloud Fire store is based on Googles Cloud
infrastructure. This allows it to scale much more easily and to a greater capacity than the Real-time Database.

23
Multi-Region Database

In Firestore, your data is automatically copied to various regions. So if one data center goes offline
due to some unforeseen reason, you can be sure that your app’s data is still safe somewhere else. Fire store’s multi-
region database also provides strong consistency. Any changes to your data will be mirrored across every copy of
your database.

Different Pricing Model

The Real-time Database charges its users based on the amount of data that you have stored in the
database. Cloud Fire store also charges you for the same, but the cost is significantly lower than that of Real-time
Database and instead of basing the cost on the amount of data stored, Fire store’s pricing is driven by the number
of reads/writes that you perform.

Latest Updates in Firebase

Robo Scripts

Firebase Test Labs have this amazing service called Robo Test that allows us to test our app with
having to write any test scripts. With Robo Test, you can have Firebase test your app completely, even fill in specific
form fields and push buttons! Now Firebase has come up with another cool testing feature called Robo Scripts. With
Robo Scripts, you can record a series of actions for Firebase to take in you app. When you run a Robo Test with a
Robo Script attached to it, Firebase first steps through your recorded actions from the Robo Script and then explores
the app as usual.

Firebase Predictions

Firebase now comes with machine learning, with it uses to analyse your app’s data and create
dynamic user groups based on the user’s predicted behavior. Firebase Predictions can work with Remote Config to
increase conversions by providing a customized experience based on each of your user’s behavior. Or it can work
with the Notifications composer to deliver the right message to the right user group. Firebase Predictions can also
work hand-in-hand with A/B testing to evaluate the effectiveness of your prediction-based strategies.

24
CHAPTER-2
REVIEW OF LITERATURE
2.1 LITERATURE SURVEY
Literature Survey is a systematic and thorough search of all types of published literature
as well as other sources including dissertation, these to identify as many items as possible that are
relevant to a particular topic.

2.1.1 Project Title : A real-time forest fire and smoke detection system using deep learning
Author Name : Raghad K. Mohammeda
Year of Publish : 2022
Abstract :Large parts of the world’s forests are threatened by fires. These fires happen
continuously every month around the globe. They are very costly to society and cause serious damage to the
ecosystem. This raises the necessity to build a detection system to intervene early and take action.
Fire and smoke have various colours, textures, and shapes, which are challenging to detect. In the modern
world, neural networks are used extensively in most fields of human activities. For the detection fire and
smoke, we suggest a deep learning technology using transfer learning to extract features of forest fire and
smoke. We used a pre-trained Inception-ResNet-v2 network on the ImageNet dataset to be trained on our
dataset which consists of 1,102 images for each fire and smoke class. The classification accuracy, precision,
recall, F1-Score, and specificity were 99.09%, 100%, 98.08%, 99.09%, and 98.30%, respectively. This
model has been deployed on a Raspberry Pi device with a camera. For real-time detection, we used the Open
CV library to read the camera stream frame by frame and predict the probability of fire or smoke.

2.1.2 Project Title : Fire accident detection using deep learning


Author Name : Yaroju Raj Kumar
Year of Publish : 2022
Abstract : From sprawling urbans to dense jungles, fire accidents create a significant threat to the
planet. These might be prevented by Deploying fire detection systems, however the prohibitory value, false
alarms, would like for dedicated infrastructure, and also the overall lack of strength of the current hardware
and software-based detection systems have served as roadblocks during this direction. During this work, we
have a tendency to endeavor to create a stride towards detection of fire in videos with the help of Deep
learning. Deep learning is rising idea supported artificial neural networks and has achieved exceptional ends
up in varied fields as well as computer vision. We have a tendency to arrange to overcome the shortcomings
of the current systems and supply correct and precise system to sight fires as early as doable and capable of
operating in varied environments thereby saving incalculable lives and resources.

25
2.1.3 Project Title : KutralNet: A Portable Deep Learning Model for Fire Recognition
Author Name : Angel Ayala 1, Bruno Fernandes
Year of Publish : 2023
Abstract : Most of the automatic fire alarm systems detect the fire presence through sensors like
thermal, smoke, or flame. One of the new approaches to the problem is the use of images to perform the
detection. The image approach is promising since it does not need specific sensors and can be easily
embedded in different devices. However, besides the high performance, challenge to their deployment in
portable devices. In this work, floating-point operations (flops) for fire recognition. Additionally, we
propose a portable approach for fire recognition and the use of modern techniques such as inverted residual
block, convolutions like depth-wise, and octave, to reduce the model’s computational cost. The experiments
show that our model keeps high accuracy while substantially reducing the number of parameters and flops.
One of our models presents 71% fewer parameters than FireNet, while still presenting competitive accuracy
and AUROC performance. The proposed methods are evaluated on FireNet and FiSmo datasets. The
obtained results are promising for the implementation of the model in a mobile device, considering the
reduced number of flops and parameters acquired.

2.1.4 Project Title : Fire Detection Using Deep Learning


Author Name : Suhas G1, Chetan Kumar1
Year of Publish : 2020
Abstract : From sprawling urbans to dense jungles, fire accidents pose a major threat to the world.
These could be prevented by deploying fire detection systems, but the prohibitive cost, false alarms, need for
dedicated infrastructure, and the overall lack of robustness of the present hardware and software-based
detection systems have served as roadblocks in this direction. In this work, we endeavor to make a stride
towards detection of fire in videos using Deep learning. Deep learning is an emerging concept based on
artificial neural networks and has achieved exceptional results in various fields including computer vision.
We plan to overcome the shortcomings of the present systems and provide an accurate and precise system to
detect fires as early as possible and capable of working in various environments thereby saving innumerable
lives and resources.
2.1.5 Project Title : Deep Learning Based Fire Detection System
Author Name : Mathew Regi1*, Renju George Varghese2
Year of Publish : 2018
Abstract : The fundamental necessity of a fire alarm system is to report the occurrence of fire at the
earliest. With the advent of computer vision this has become more advanced and reliable. A prerequisite of a
Fire Detection System is the detection of fire conditions as early as possible, to provide enough time for
Automated Systems/Fire personnel for effective counter actions. Conventional fire detection systems detect

26
and forecasts fire by using by-products of combustible such as smoke, flame, temperature which takes a
significant time to develop the required level to trigger heat sensors and smoke sensors. All these situations
motivated us to think of a new method of fire detection which uses the technique of computer vision.
Computer vision based fire detection systems overcome these limitations since it detects the combustible
instead of it are by products. Furthermore, it detects through a camera, which is a volume sensor and covers
a wide range from a single camera. The primary objective of this computer vision based fire detection
system is to detect the fire, which is done by the method of deep learning, and produce warning alarms if the
fire is detected. All of the above clues are combining to form a more efficient fire detection system
compared to the conventional systems.

2.1.6 Project Title : Real-time fire and smoke detection


Author Name : 1 Komal Mahesh Dhotre ,
Year of Publish : 2022
Abstract : Fire is one of the hazardous, unwanted and sometimes uncontrolled events. Urban fires
generally occur because of short-circuits in electrical devices, leakage on LPG gas cylinder ducts, or due to
human ignorance itself. But at present, the system that is generally used in the community is a smoke sensor
that is affixed to the ceiling of the room to detect a fireplace. Apart from the matter of early fire detection,
present fire alarm systems are inefficient in terms of the false triggering of the alarm systems. Traditional
Fire detection methods that is. Sensor-based and Color Based Flame detection have high false rate and low
accuracy. Real-time Fire detection using Convolution Neural Network will overcome many problems in
traditional fire identification. Convolutional Neural Network (CNN) is an algorithm which classifies images
with a high degree of accuracy and good performance. The proposed system will be using the Convolution
Neural Network, YOLO v3 (You Only Look Once Version 3) algorithm, OpenCv, Keras deep learning
library.
2.1.7 Project Title : Smoke and Fire Detection using Deep Learning
Author Name : K. Manoj1, P. Suniti2
Year of Publish : 2022
Abstract : The fire and smoke monitoring systems are useful in numerous industries like military,
Social Security and economical. The recent methods for fire and smoke detection are used only motion and
colour characteristics thus many wrong alarms are happening and this is often decrease the performance of
the systems. During this study, we will observe the way we are able to divide the smoke columns with object
detection and a deep learning-based approach and convolutional neural network (CNN) model for extracting
smoke features and smoke detection. The colour, motion and disorder are useful characteristics in fire and
smoke detection algorithm. Smoke of fireplace will blur the entire or a part of the photographs. Thus by
processing of the frames, different objects will detect. Because of evaluate the features of objects, the goal
objects (fire and smoke) will be defined easily. The results of the study have broad application prospects

27
within the important military, social insurance, forest-fire alarm, commercial applications, and so on.
preprocessing, feature extraction, and fire detection. Among, feature extraction is that the core part in
algorithms. Traditional algorithm depends on the manual selection of fireplace whereas algorithms of deep
learning, Convolutional Neural Networks (CNNs) like GAN, SS-GAN, DCGAN, DCNN, AlexNet, VGG,
Bi-LSTM, Inception, ResNet, RetinaNet Faster R-CNN can automatically learn and extract complex image
features effectively. These processes has many advantages like early fire detection, high accuracy, flexible
system installation, and the capability to effectively detect fires in large spaces and complicated building
structures.

28
CHAPTER-3
MODULE REQUIREMENTS

3.1 HARDWARE REQUIREMENTS


 ESP8266
 Solenoid lock
 Dc fan
 Buzzer
 Relay - 3
 Power supply board
 Dc water pump
 PC/ laptop with camera
 USB cable
3.2. SOFTWARE REQUIREMENS
 Language: Embedded C
 Compiler: Arduino IDE
 Python 3

3.1. Hardware Description


ESP8266

Fig.3.1 ESP8266

The ESP8266 12-E chip comes with 17 GPIO pins. Not all GPIOs are exposed in all ESP8266
development boards, some GPIOs are not recommended to use, and others have very specific functions.

29
With this guide, you’ll learn how to properly use the ESP8266 GPIOs and avoid hours of frustration by
using the most suitable pins for your projects.

ESP8266 Peripherals

The ESP8266 peripherals include:

• 17 GPIOs
• SPI
• I2C (implemented on software)
• I2S interfaces with DMA
• UART
• 10-bit ADC

Best Pins to Use – ESP8266


One important thing to notice about ESP8266 is that the GPIO number doesn’t match the label on
the board silkscreen. For example, D0 corresponds to GPIO16 and D1 corresponds to GPIO5.

The following table shows the correspondence between the labels on the silkscreen and the GPIO
number as well as what pins are the best to use in your projects, and which ones you need to be cautious.

The pins highlighted in green are OK to use. The ones highlighted in yellow are OK to use, but
you need to pay attention because they may have unexpected behavior mainly at boot. The pins highlighted
in red are not recommended to use as inputs or outputs.

GPIOs connected to the Flash Chip

GPIO6 to GPIO11 are usually connected to the flash chip in ESP8266 boards. So, these pins are
not recommended to use.

The ESP8266 can be prevented from booting if some pins are pulled LOW or HIGH. The
following list shows the state of the following pins on BOOT:

• GPIO16: pin is high at BOOT


• GPIO0: boot failure if pulled LOW
• GPIO2: pin is high on BOOT, boot failure if pulled LOW
• GPIO15: boot failure if pulled HIGH
• GPIO3: pin is high at BOOT

30
• GPIO1: pin is high at BOOT, boot failure if pulled LOW
• GPIO10: pin is high at BOOT
• GPIO9: pin is high at BOOT

Pins HIGH at Boot

There are certain pins that output a 3.3V signal when the ESP8266 boots. This may be
problematic if you have relays or other peripherals connected to those GPIOs. The following GPIOs output a
HIGH signal on boot:

• GPIO16
• GPIO3
• GPIO1
• GPIO10
• GPIO9
Additionally, the other GPIOs, except GPIO5 and GPIO4, can output a low-voltage signal at boot, which
can be problematic if these are connected to transistors or relays. You can read this article that investigates
the state and behavior of each GPIO on boot.

Analog Input

The ESP8266 only supports analog reading in one GPIO. That GPIO is called ADC0 and it is
usually marked on the silkscreen as A0. The maximum input voltage of the ADC0 pin is 0 to 1V if you’re
using the ESP8266 bare chip. If you’re using a development board like the ESP8266 12-E NodeMCU kit,
the voltage input range is 0 to 3.3V because these boards contain an internal voltage divider.
On-board LED

Most of the ESP8266 development boards have a built-in LED. This LED is usually connected to
GPIO2.

Solenoid Lock:

Fig.3.2 Solenoid lock

31
The solenoid lock denotes a latch for electrical locking and unlocking. It is available in
unlocking in the power-on mode type, and locking and keeping in the power-on mode type, which can be
used selectively for situations. The power-on unlocking type enables unlocking only while the solenoid is
powered on. A door with this type is locked and not opened in case of power failure or wire disconnection,
ensuring excellent safety. This type is used mainly for places requiring crime prevention. The power-on
locking type can lock a door while the solenoid is powered on. If the power is disconnected, the door is
unlocked. This type unlocks the door in case of wire disconnection due to a fire or accident, and it is used
for emergency exits through which fire-fighting activity or evacuation should preferentially be made rather
than safety for crime prevention. The keeping type performs two operations, locking and unlocking by
applying a positive or negative pulse voltage to the solenoid, and keeps the no-power state in each position.
This type features energy saving because it is unnecessary to always power the solenoid on. For the
continuous rating and the intermittent rating, the continuous rating is designed to be able to feed a rated
voltage power continuously for hours without exceeding a specified temperature rise limit, and the
intermittent rating is designed to be able to feed a specified voltage only for a specified time duration
without exceeding a specified temperature rise limit.
DC Fan:

Axial-flow fans have blades that force air to move parallel to the shaft about which the blades
rotate. This type of fan is used in a wide variety of applications, ranging from small cooling fans for
electronics to the giant fans used in cooling towers. Axial flow fans are applied in air conditioning and
industrial process applications. Standard axial flow fans have diameters of 300–400 mm or 1,800–2,000 mm
and work under pressures up to 800 Pa. Special types of fans are used as low-pressure compressor stages in
aircraft engines. Examples of axial fans are:

 Table fan: Basic elements of a typical table fan include the fan blade, base, armature, and lead wires,
motor, blade guard, motor housing, oscillator gearbox, and oscillator shaft.
 The oscillator is a mechanism that motions the fan from side to side. The armature axle shaft comes out
on both ends of the motor, one end of the shaft is attached to the blade and the other is attached to the
oscillator gearbox.
 The motor case joins to the gearbox to contain the rotor and stator. The oscillator shaft combines the
weighted base and the gearbox.
 A motor housing covers the oscillator mechanism.
 The blade guard joins to the motor case for safety.

32
Fig.3.3 DC Fan

 Domestic extractor fan: Wall- or ceiling-mounted, the domestic extractor fan is employed to remove
moisture and stale air from domestic dwellings. Bathroom extractor fans typically utilize a four-inch
(100 mm) impeller, whilst kitchen extractor fans typically use a six-inch (150 mm) impeller as the room
itself is often bigger. Axial fans with five-inch (125 mm) impellers are also used in larger bathrooms
though are much less common. Domestic axial extractor fans are not suitable for duct runs over 3 m or
4 m, depending on the number of bends in the run, as the increased air pressure in longer pipework
inhibits the performance of the fan.
 Continuous running extractor fans run continuously at a very slow rate, running fast when necessary, for
example when a bathroom light is switched on. At working speed they are just normal extractor fans. At
continuous speed they extract typically 5 to 10 l/sec and use little electricity, 1 or 2 watts, for low annual
cost. Some have humidity sensors to control trickle operation. They have the advantage of ensuring
ventilation and preventing build-up of humidity. Alternatively, a normal extractor fan may be fitted to
operate intermittently at full power for the same purpose. [15] In cold weather they may have noticeably
cool the room they are in, or, if the door is open, the house.[16]
 Electro-mechanical fans: Among collectors, are rated according to their condition, size, age, and number
of blades. Four-blade designs are the most common. Five-blade or six-blade designs are rare. The
materials from which the components are made, such as brass, are important factors in fan desirability.
 Ceiling fan is a fan suspended from the ceiling of a room. Most ceiling fans rotate at relatively low
speeds and, being inaccessible to reach, do not have blade guards. Ceiling fans are used in both
residential and industrial/commercial settings.
 In automobiles, a mechanical or electrically driven fan provides engine cooling and prevents the engine
from overheating by blowing or drawing air through a coolant-filled radiator. The fan may be driven
with a belt and pulley off the engine's crankshaft or an electric motor switched on or off by
a thermostatic switch.
 Computer fan for cooling electrical components and in laptop coolers
 Fans inside audio power amplifiers help to draw heat away from the electrical components.
33

33
 Variable pitch fan: A variable-pitch fan is used where precise control of static pressure within supply
ducts is required. The blades are arranged to rotate upon a control-pitch hub. The fan wheel will spin at a
constant speed. The blades follow the control pitch hub. As the hub moves toward the rotor, the blades
increase their angle of attack and an increase in flow results.

Buzzer:

An audio signaling device like a beeper or buzzer may be electromechanical or piezoelectric or


mechanical type. The main function of this is to convert the signal from audio to sound. Generally, it is
powered through DC voltage and used in timers, alarm devices, printers, alarms, computers, etc. Based on
the various designs, it can generate different sounds like alarm, music, bell & siren. The pin configuration
of the buzzer is shown below. It includes two pins namely positive and negative. The positive terminal of
this is represented with the ‘+’ symbol or a longer terminal. This terminal is powered through 6Volts
whereas the negative terminal is represented with the ‘-‘symbol or short terminal and it is connected to the
GND terminal.

Fig.3.4 Buzzer Pin Configuration

Working Principle

The working principle of a buzzer depends on the theory that, once the voltage is given
across a piezoelectric material, then a pressure difference is produced. A piezo type includes piezo crystals
among two conductors.
Once a potential disparity is given across these crystals, then they thrust one conductor &
drag theadditional conductor through their internal property. So this continuous action will produce a sharp
sound signal.

34
Once a potential disparity is given across these crystals, then they thrust one conductor & drag the
additional conductor through their internal property. So this continuous action will produce a sharp sound
signal.

Specifications

The specifications of the buzzer include the following.

 Color is black
 The frequency range is 3,300Hz
 Operating Temperature ranges from – 20° C to +60°C
 Operating voltage ranges from 3V to 24V DC
 The sound pressure level is 85dBA or 10cm
 The supply current is below 15mA

Types of Buzzer

A buzzer is available in different types which include the following.

 Piezoelectric
 Electromagnetic
 Mechanical
 Electromechanical
 Magnetic

Piezoelectric

As the name suggests, the piezoelectric type uses the piezoelectric ceramic’s piezoelectric effect
& pulse current to make the metal plate vibrate & generate sound. This kind of buzzer is made with a resonance
box, multi resonator, piezoelectric plate, housing, impedance matcher, etc. Some of the buzzers are also
designed with LEDs. The multi resonator of this mainly includes ICs and transistors. Once the supply is given
to this resonator, it will oscillate and generates an audio signal with 1.5 to [Link]. The impedance matcher will
force the piezoelectric plate to produce sound.

Electromagnetic

This type of buzzer is made with a magnet, solenoid coil, oscillator, housing, vibration diaphragm,
and magnet. Once the power supply is given, the oscillator which produces the audio signal current will supply
throughout the solenoid coil to generate a magnetic field. Sometimes, the vibration diaphragm will vibrate &

35
generates sound under the magnet & solenoid coil interaction. The frequency range of this ranges from 2 kHz
to 4kHz.

Mechanical

These types of buzzers are subtypes of electromagnetic, so the components used in this type are also
similar. But the main difference is that the vibrating buzzer is placed on the outside instead of the inside.

Electromechanical

The designing of these types of buzzers can be done with a bare metal disc & an electromagnet. The
working principle of this is similar to magnetic and electromagnetic. It generates sound throughout the disc
movement & magnetism.

Magnetic

Like a piezo type, magnetic is also used to generate a sound but they are different due to core
functionality. The magnetic type is more fixed as compared to the piezo type because they work through a
magnetic field. Magnetic buzzers utilize an electric charge instead of depending on piezo materials to generate
a magnetic field, after that it permits another element of the buzzer to vibrate & generate [Link]
applications of magnetic buzzers are similar to the piezo type in household devices, alarms such as watches,
clocks & keyboards.

Relay Switch

Fig.3.5.1 Relay switch

36
Relay is an electromagnetic device which is used to isolate two circuits electrically and connect them
magnetically. They are very useful devices and allow one circuit to switch another one while they are
completely separate. They are often used to interface an electronic circuit (working at a low voltage) to an
electrical circuit which works at very high voltage. For example, a relay can make a 5V DC battery circuit to
switch a 230V AC mains circuit. Thus a small sensor circuit can drive, say, a fan or an electric bulb.
A relay switch can be divided into two parts: input and output. The input section has a coil which generates
magnetic field when a small voltage from an electronic circuit is applied to it. This voltage is called the
operating voltage. Commonly used relays are available in different configuration of operating voltages like
6V, 9V, 12V, 24V etc. The output section consists of contactors which connect or disconnect mechanically.
In a basic relay there are three contactors: normally open (NO), normally closed (NC) and common (COM).
At no input state, the COM is connected to NC. When the operating voltage is applied the relay coil gets
energized and the COM changes contact to NO. Different relay configurations are available like SPST, SPDT,
DPDT etc, which have different number of changeover contacts. By using proper combination of contactors,
the electrical circuit can be switched on and off. Get inner details about structure of a relay switch.

Fig.3.5.2 Pin diagram

RELAY:

A relay is an electrically operated switch. Many relays use an electromagnet to operate a switching
mechanism mechanically, but other operating principles are also used. Relays are used where it is necessary
to control a circuit by a low-power signal (with complete electrical isolation between control and controlled
circuits), or where several circuits must be controlled by one signal.

The first relays were used in long distance telegraph circuits, repeating the signal coming in from one
circuit and re-transmitting it to another.
Relays were used extensively in telephone exchanges and early computers to perform logical
operations.

37
A type of relay that can handle the high power required to directly control an electric motor or other
loads is called a contactor. Solid-state relays control power circuits with no moving parts, instead using a
semiconductor device to perform switching.

Relays with calibrated operating characteristics and sometimes multiple operating coils are used to
protect electrical circuits from overload or faults; in modern electric power systems these functions are
performed by digital instruments still called "protective relays".

Fig.3.6 ULN2003A

An ULN2003A is a high-voltage, high-current Darlington transistor array. It consists of seven NPN


Darlington pairs that feature high-voltage outputs with common-cathode flyback diodes for switching
inductive loads.

The drivers can be paralleled for higher current capability, even stacking one chip on top of
another, both electrically and physically has been done.

Features

 500 mA rated collector current (single output)


 50 V output
 Includes output flyback diodes
 Inputs compatible with various types of logic.

38
Fig.3.7.1 Logical diagram

Fig.3.7.2 Logical diagram

Power Supply:
Alternating current (AC) is used for power line transmission and for high power devices like
appliances and lights. The characteristics of AC make it ideal for transmission over long lines and for
delivering large amounts of power for relatively unregulated uses, such as generating heat and light.
Lower power appliances and devices require the closely regulated control of direct current power (DC).
As a normal house is supplied with AC, it must be converted to DC for many uses. Use these tips to
learn how to make an AC DC converter.

39
Fig 3.8 Power supply board

A transformer contains 2 magnetically coupled wire windings. One winding is called the
primary. The primary is driven by the main AC supply. The other winding is called the secondary. The
secondary serves as the power input to the AC DC converter. This transformer and all of the other items
needed to build the AC DC converter are readily available at electronic stores and hobby stores.

• Size the transformer windings. AC mains provide 120 volts AC. If 120 volts AC were directly
converted to a DC voltage, the resulting DC voltage would be far too high a voltage for use by
appliances and devices. The primary and secondary windings of the transformer are scaled to
each other in order to produce a lower voltage on the secondary winding.
• Choose a secondary winding. The AC output of the secondary winding should be rated as the
same voltage of DC that is being created.

Wire the primary winding of the transformer to the main AC supply. This transformer
connection has no polarity and may be connected either way.
Connect the secondary winding of the transformer to a full wave bridge rectifier package.
The transformer connections and the connections to the marked inputs of the rectifier package have no
polarity and may be connected either way.

• Build a full wave rectifier. This rectifier can be built up from 4 discrete rectifying diodes, rather
than using a rectifier bridge package. The diodes will be marked to show a positive (cathode)
end and a negative (anode) end. Connect the 4 diodes into a loop. Connect the cathode of diode
1 to the cathode of diode 2. Connect the anode of diode 2 to the cathode of diode 3. Connect the
anode of diode 3 to the anode of diode 4. Connect the cathode of diode 4 to the anode of diode
[Link] the discrete rectifier to the transformer secondary. The transformer secondary should
be connected to the cathode of diode 3 and the cathode of diode 4. There is no required polarity

40
For these connections. The positive output of the rectifier is at the point where the cathodes of diodes1 and 2
join. The negative output of the rectifier is at the point where the anodes of diodes 3 and4 join.

Fig 3.9 Capacitor


Attach a smoothing capacitor. Attach a polarized capacitor across the output connections
of the rectifier. The positive terminal of the polarized capacitor must connect to the positive output of
the regulator. This capacitor should be sized such that the capacitance in farads (F) is equal to (5 times
the current to be supplied by the AC DC converter) divided by (transformer secondary rating times 1.4
times frequency). Frequency varies from country to country, but is typically either 50 Hertz (Hz) or 60
Hertz.

Provide the final regulation. Choose a commercially available voltage regulator designed
to control the output of the AC DC converter to the desired output voltage. The regulator will be a 3-pin
device. The regulator pins will be a common, an input from the smoothing capacitor and an output of
the regulator. This regulator output also will be the final output of the completed AC DC converter.

• Wire the regulator as directed in the manufacturer's data sheet. There probably will be a noise
suppression capacitor specified in the regulator manufacturer's data sheet. Acquire and install
that capacitor per the manufacturer's data sheet for the regulator.

Resistor:

An electric resistor is a two-terminal passive component specifically used to oppose and limit
current. A resistor works on the principle of Ohm’s Law which states that voltage across the terminals
of a resistor is directly proportional to the current flowing through it.

Ohm’s Law: V = IR
where V is the voltage applied across resistor,
I is the current flowing through it,
and R is the constant called resistance.
The unit of resistance is ohms.

41
Types of Resistors:
Resistors can be broadly classified based on the following criteria: the type of material used,
the power rating and resistance value.
1. Fixed resistors:
In some scenarios, an electrical circuit may need a lesser amount of current to flow through it
than the input value. Fixed resistors are used in these situations to limit the flow of current.
1.1 Carbon Composition Resistors:
These resistors are cylindrical rods which are a mixture of carbon granules and powdered
ceramic. The resistor value depends on the composition of the ceramic material. A higher quantity of
ceramic content will result in more resistance. Since the rod is coated with an insulated material, there
are chances of damage due to excessive heat caused by soldering.
High current and voltage can also damage the resistor. These factors bring irreversible changes in the
resistance power of these resistors. This type of resistor is rarely used nowadays due to their high cost
and are only preferred in power supply and welding circuits.

Fig 3.10 Carbon composition resistors


1.2 Carbon film resistors:
This resistor is formed by depositing a carbon film layer on an insulating substrate. Helical cuts
are then made through the carbon film to trace a long and helical resistive path. The resistance can be
varied by using different resistivity carbon material and modifying the shape of the resistor. The helical
resistive path make these resistors highly inductive and of little use for RF applications.
They exhibit a temperature coefficient between -100 and -900 ppm/ °C. The carbon film is protected
either by a conformal epoxy coating or a ceramic tube. The operation of these resistors requires high
pulse stability.

42
Fig 3.11 Carbon film resistors

1.3 Metal Film resistor:


These resistors are made from small rods of ceramic coated with metal (such as a nickel
alloy) or metal oxide (such as tin oxide). The value of resistance is controlled mainly by the thickness
of the coating layer (the thicker the layer, the lower is the value of resistance).
A fine spiral groove can be cut along the rod using a laser to split the carbon or metal coating
effectively into a long and spiral strip, which forms the resistor.

Fig 3.12 Metal Film resistors

Metal film resistors can be obtained in a wide range of resistance values from a few Ohms to tens of
millions of Ohms with a very small tolerance. For example, for a stated value of 100K Ohm, the actual
value will be between 99K Ohm and 101K Ohm. Small carbon, metal and oxide resistors come in
various colors such as dark red, brown, blue, green, grey or white.

43
1.4 Wire wound resistor:

Wire wound resistors vary in size and physical appearance. Their resistive elements are
commonly lengths of wire, usually an alloy such as Nickel/Chromium or Manganin wrapped around a
small ceramic or glass fiber rod and coated in an insulating flameproof cement film. They are normally
available in low values of resistance but are capable of dissipating large amounts of power.
These resistors can get very hot during use. For this reason, these resistors are housed in a
finned metal case that can be bolted to a metal chassis to dissipate the heat generated. Protection from
fire is important and fireproof cases or coatings are vital.
Since wire wound resistors are primarily coils, they have more undesirable inductance than
other types of resistor, although winding the wire in sections with alternately reversed directions can
minimize inductance. Other techniques employ bifilar winding to reduce cross-section area of the coil.
For the most demanding circuits, resistors with Ayrton-Perry windings are used.

Fig 3.13 Wire wound resistor

Capacitor

Capacitor is a passive component used to store charge. The charge (q) stored in a capacitor is
the product of its capacitance (C) value and the voltage (V) applied to it. Capacitors offer infinite
reactance to zero frequency, so they are used for blocking DC components or bypassing the AC signals.
The capacitor undergoes through a recursive cycle of charging and discharging in AC circuits where the

44
voltage and current across it depends on the RC time constant. For this reason, capacitors are used for
smoothing power supply variations. Other uses include, coupling the various stages of audio system,
tuning in radio circuits etc. These are used to store energy like in a camera flash. Capacitors may be
non-polarized/polarized and fixed/variable. Electrolytic capacitors are polarized while ceramic and
paper capacitors are examples of non-polarized capacitors. Since capacitors store charge, they must be
carefully discharged before troubleshooting the circuits.

The maximum voltage rating of the capacitors used must always be greater than the supply
voltage. Click to learn more about working of a capacitor along with its internal structure.

Capacitor is a widely used electronic component. It stores electric charge and then discharges
it into the circuit. It blocks the direct current and allows the alternating current to pass through it.
Depending on the purpose, there are a variety of capacitors being used like ceramic, electrolytic, mylar,
mica, etc. We will explore an electrolytic capacitor through this article.

Structure of a Capacitor
A capacitor contains two conductor plates which are generally made of metal and an insulator
between them. This insulator also known as dielectric is made up of material like paper, plastic, ceramic
or glass. The two plates are electrically connected to the external circuit with the help of two thin metal
rods also known as the legs of the capacitor.
These two plates are used to store charge between them. One is connected with positive
voltage and other one with negative voltage. A capacitor is characterized by the parameter capacitance.
Capacitance is measured as ratio of difference of charges between the plates and total voltage drop
between the plates.
C = dQ/dV
The unit of capacitance is FARAD.
Let’s have a closer look into the structure and how a capacitor is able to store charge.

Metal Container:

Inside the metal case is a folded layer of dielectric in between metal plates. Next images give
a clear perception of the internal structure of the capacitor.

Dielectric:

In the above image, we can clearly see two different types of layers, folded like a swiss roll. A
dielectric layer is sandwiched between two metal plates. These metal plates are used to store charge and
the dielectric works as an insulator between them. These plates are folded round to minimize the size of
the capacitor.
One plate works as cathode and another as anode. To increase the value of a capacitor and the

45
same time to keep the size smaller, we use electrolyte. However depending on the size and application,
there are different types of electrolytes used in different ways within a capacitor. Generally, anode is
soaked into liquid electrolyte to increase the surface area of the plate as well as efficiency.
Crystal Oscillator:

A quartz crystal resonator plays a vital role in electronics oscillator circuitry. Sometimes
mispronounced as crystal oscillator, it is rather a very important part of the feedback network of the
oscillator circuitry. Electronics oscillators are used in frequency control application finding their usage
in almost every industry ranging from small chips to aerospace.
A quartz crystal is the heart of such type of resonators. Their characteristics like high quality
factor (Q), stability, small size and low cost make them superior over other resonators like LC circuit,
turning forks, ceramic resonator etc.
The basic phenomenon behind working of a quartz crystal oscillator is the inverse piezo electric
effect i.e., when electric field is applied across certain materials, they start producing mechanical
deformation. These mechanical deformation/movements are dependent on the elementary structure of
the quartz crystal. Quartz is one of the naturally occurring materials which show the phenomena of
piezo electricity, however for the purpose of resonator it is artificially developed since processing the
naturally occurring quartz is difficult and costly process. It is widely used in electronic oscillators
circuitry used in digital circuits and microcontroller/processors.

LORA:

LoRaWAN operates in unlicensed radio spectrum. This means that anyone can use the radio
frequencies without having to pay million dollar fees for transmission rights. It is similar to Wi-Fi, which
uses the 2.4GHz and 5GHz ISM bands worldwide. Anyone is allowed to set up Wi-Fi routers and
transmit Wi-Fi signals without the need for a license or permit.

LoRaWAN uses lower radio frequencies with a longer range. The fact that frequencies have a
longer range also comes with more restrictions that are often country specific. This poses a challenge
for LoRaWAN, that tries to be as uniform as possible in all different regions of the world. As a result,
LoRaWAN is specified for a number of bands for these regions. These bands are similar enough to
support a region-agnostic protocol but have a number of consequences for the implementation of the
backend systems.

• LoRaWAN has official regional specifications, called Regional Parameters, that you can
download from the LoRa Alliance website.
• These LoRaWAN regional specifications do not specify everything either. They only cover a
region by specifying the common denominator. For
46 example, the LoRaWAN regional

46
parameters for Asia only specify a common subset of channels - but there are variations between
regulations in Asian countries. Furthermore, each network server operator is free to select
additional parameters, such as additional emission channels. We call these parameters Other. For
The Things Network, they are defined in this GitHub repository.

More information can be found here:

• Frequency Plans

• Frequency Plan by Country

Limitations of LoRaWAN:

LoRaWAN is not suitable for every use-case, so it is important that you understand the
limitations. Here’s a quick overview:

Suitable use-cases for LoRaWAN:

• Long range - multiple kilometers

• Low power - can last years on a battery

• Low cost - less than 20€ CAPEX per node, almost no OPEX

• Low bandwidth - between 250bit/s and 11kbit/s in Europe using LoRa modulation (depending
on the spreading factor)

• Coverage everywhere - you are the network! Just install your own gateways

• Secure - 128bit end-to-end encrypted

Not Suitable for LoRaWAN:

• Realtime data - you can only send small packets every couple of minutes

• Phone calls - you can do that with GPRS/3G/LTE

• Controlling lights in your house - check out ZigBee or Bluetooth

• Sending photos, watching Netflix - check out WiFi.

Sending data from a Node to your Application (uplink):

We want you to create products that are as efficient as possible. This will get the most out of
your battery and doesn’t require you to buy many gateways. If you follow these recommendations, you’ll
definitely build an amazing product!

47
• Payload should be as small as possible. This means that you should not send JSON or plain
(ASCII) text, but instead encode your data as binary data. This is made really easy with
the Cayenne Low Power Payload format which is fully supported by The Things Network.

• Interval between messages should be in the range of several minutes, so be smart with your data.
You could for example transmit a min/avg/max every 5 minutes, or you could only transmit
when you sensor value changed more than a certain threshold or have it triggered by motion or
another event.
• Data Rate should be as fast as possible to minimize your airtime. SF7BW125 is usually a good
place to start, as it consumes the least power and airtime. If you need more range, you can slowly
increase until you have enough. You can also enable adaptive data rate (ADR), the network will
then be able to automatically optimize your data rate.

Sending responses from your Application to your Node (downlink):


We want to be able to handle as many Nodes as possible per Gateway. But as full-duplex radios
are not widely available yet, a Gateway is not able to receive transmissions from Nodes while it is
transmitting. This means that if a gateway is transmitting 10% of the time, it’s not able to receive
anything for that 10% of the time. This is even worse when you realize that a gateway can receive at 8
channels simultaneously. Except when it’s transmitting. So while an idle gateway can receive
transmissions from 8 devices, those 8 devices are worthless when the gateway is transmitting.

We want to build a network that offers high reliability. If your device transmits, the gateway
should receive it. In order to keep the gateway availability as high as we can, we ask you to follow these
recommendations.

• Data Rate should be, just as with uplink, as efficient as possible. The downlink data rate is based
on the uplink data rate, so if you send efficient uplinks, the network will respond with efficient
downlinks.

• Downlink messages should be avoided if possible, and if you send downlink, keep the payload
small.

• Confirmed Uplink is often not necessary. Try to make your application work without
confirmations.

Addressing and Activation:


LoRaWAN knows a number of identifies for devices,applications and gateways.

48
• DevEUI - 64 bit end-device identifier, EUI-64 (unique)
• DevAddr - 32 bit device address (non-unique)
• AppEUI- 64 bit application identifier, EUI-64 (unique)
• GatewayEUI - 64 bit gateway identifier, EUI-64 (unique)

Devices:

The Things Network Foundation has received a 7-bit device address prefix from the LoRa
Alliance. This means that all TTN device addresses will start with 0x26 or 0x27 (although addresses
that start with these might also belong to other networks with the same prefix). Within TTN, we assign
device address prefixes to “regions” (for example, device addresses in the eu region start with 0x2601).
Within a region, the Network Server is responsible for assigning device addresses. We are using prefixes
here too for different device classes (for example, ABP devices in the eu region start with 0x26011).

The NetworkServer assigns device addresses to devices (based on configuration).


For ABP devices you have to request an address from the NetworkServer (the console or ttnctl will do
this for you). For OTAA devices, the NetworkServer will assign an address when the device joins.
When a device joins the network, it receives a dynamic (non-unique) 32-bit address (DevAddr). It’s
good to keep in mind that device addresses are not unique. We can (and probably will) give hundreds
of devices the same address. Finding the actual device that belongs to that address is done by matching
the cryptographic signature (MIC) of the message to a device in the database.

Applications:

Applications in LoRaWAN and The Things Network have a 64 bit unique identifier (AppEUI
).When you create an application, The Things Network’s account server allocates an AppEUI from the
address block of The Things Network Foundation. This means that every application has at least an
AppEUI that starts with 70B3D57ED. If you have your own AppEUIs, you can also add those to your
application.
Gateways:
Gateways are manufactured with an embedded EUI, which can then be used to register the
gateway on The Things Network. Although the configuration files of some gateways suggest that you can
just choose an EUI for the gateway, this is not true. If your gateway did not come with an embedded EUI,
you can use another EUI that you own, or configure an AppEUI that is registered to your account. You
may also use an MQTT-based forwarder, which only needs a GatewaID that you can choose
yourself) instead of a GatewayEUI.

49
Activation:

LoRaWAN devices have a 64-bit unique identifier (DevEUI) that is assigned to the device by
the chip manufacturer. However, all communication is done with a dynamic 32-bit device address
(DevAddr )of which 7 bits are fixed for The Things Network, leaving 25 bits that can be assigned to
individual devices, a procedure called Activation.

Over-the-Air Activation (OTAA):

Over-the-Air Activation (OTAA) is the preferred and most secure way to connect with The
Things Network. Devices perform a join-procedure with the network, during which a dynamic DevAddr
is assigned and security keys are negotiated with the device.

Activation by Personalization (ABP):

In some cases you might need to hardcode the DevAddr as well as the security keys in the device.
This means activating a device by personalization (ABP). This strategy might seem simpler, because
you skip the join procedure, but it has some downsides related to security.
12V water pump

Fig.3.14 Water pump

A water pump that operates at 12V is a type of pump that is designed to run on a 12-volt DC power
supply. These types of pumps are commonly used in automotive, marine, and RV applications, as well as in
small scale irrigation, water treatment and other similar systems.
One of the advantages of using a 12V water pump is that it can be powered by a car battery or a deep-cycle
battery, which makes it portable and convenient for use in remote locations. Additionally, these pumps are
relatively low power and energy efficient, which makes them ideal for use in solar-powered systems.
The use of a 12V water pump with an Arduino microcontroller requires an external power source, as
the Arduino can’t provide the needed power to operate the pump. A relay can be used to switch the pump on

50
and off using the Arduino digital pins, and also a voltage regulator can be used to step down the voltage from
the external power source to 12V.
To use a water pump with an Arduino, you will need to connect the pump to the Arduino‘s digital
output pins. The pump typically has two wires, one for power and one for ground. These wires can be
connected to the Arduino‘s 12V and GND pins, respectively. Once the connections are made, you can use
the Arduino’s digital output pins to control the pump.

3.2. SOFTWARE REQUIREMENTS:


ARDUINO IDE:
Arduino is an open-source electronics platform based on easy-to-use hardware and
software. Arduino boards are able to read inputs - light on a sensor, a finger on a button, or a Twitter
message - and turn it into an output - activating a motor, turning on an LED, publishing something
online. You can tell your board what to do by sending a set of instructions to the microcontroller on the
board. To do so you use the Arduino programming language (based on Wiring), and the Arduino
Software (IDE), based on Processing.

Over the years Arduino has been the brain of thousands of projects, from everyday objects to
complex scientific instruments. A worldwide community of makers - students, hobbyists, artists,
programmers, and professionals - has gathered around this open-source platform, their contributions
have added up to an incredible amount of accessible knowledge that can be of great help to novices and
experts alike.

Arduino was born at the Ivrea Interaction Design Institute as an easy tool for fast prototyping,
aimed at students without a background in electronics and programming. As soon as it reached a wider
community, the Arduino board started changing to adapt to new needs and challenges, differentiating
its offer from simple 8-bit boards to products for IoT applications, wearable, 3D printing, and embedded
environments. All Arduino boards are completely open-source, empowering users to build them
independently and eventually adapt them to their particular needs. The software, too, is open-source,
and it is growing through the contributions of users worldwide.

WRITING SKETCHES:

Programs written using Arduino Software (IDE) are called sketches. These sketches are written
in the text editor and are saved with the file extension .ino. The editor has features for cutting/pasting
and for searching/replacing text. The message area gives feedback while saving and exporting and also
displays errors. The console displays text output by the Arduino Software (IDE), including complete
error messages and other information. The bottom right hand corner of the window displays the

51
configured board and serial port. The toolbar buttons allow you to verify and upload programs, create,
open, and save sketches, and open the serial monitor.

FILE

New:
Creates a new instance of the editor, with the bare minimum structure of a sketch already in place.

Open:
Allows loading a sketch file browsing through the computer drives and folders.

Open Recent:
Provides a short list of the most recent sketches, ready to be opened.

Sketchbook:
shows the current sketches within the sketchbook folder structure; clicking on any name opens the
corresponding sketch in a new editor instance.

Examples:
Any example provided by the Arduino Software (IDE) or library shows up in this menu item. All the
examples are structured in a tree that allows easy access by topic or library.

• Close:
Closes the instance of the Arduino Software from which it is clicked.

• Save:
Saves the sketch with the current name. If the file hasn't been named before, a name will be provided
in a "Save as.." window.

Save as:
Allows saving the current sketch with a different name.

Page Setup:
It shows the Page Setup window for printing.

Print:
Sends the current sketch to the printer according to the settings defined in Page Setup.

Preferences:
Opens the Preferences window where some settings of the IDE may be customized, as the language of
the IDE interface.

Quit:
Closes all IDE windows. The same sketches open when Quit was chosen will be automatically
reopened the next time you start the IDE.

52
EDIT:

Undo/Redo
Goes back of one or more steps you did while editing; when you go back, you may go forward with
Redo.

Cut
Removes the selected text from the editor and places it into the clipboard.

Copy
Duplicates the selected text in the editor and places it into the clipboard.

Copy for Forum


Copies the code of your sketch to the clipboard in a form suitable for posting to the forum, complete
with syntax coloring.

Copy as HTML
Copies the code of your sketch to the clipboard as HTML, suitable for embedding in web pages.

Paste
Puts the contents of the clipboard at the cursor position, in the editor.

Select All
Selects and highlights the whole content of the editor.

Comment/Uncomment
Puts or removes the // comment marker at the beginning of each selected line.

Increase/Decrease Indent
Adds or subtracts a space at the beginning of each selected line, moving the text one space on the right
or eliminating a space at the beginning.

Find
Opens the Find and Replace window where you can specify text to search inside the current sketch
according to several options.

Find Next
Highlights the next occurrence - if any - of the string specified as the search item in the Find window,
relative to the cursor position.

Find Previous
Highlights the previous occurrence - if any - of the string specified as the search item in the Find
window relative to the cursor position.
Sketch

Verify/Compile

53
Checks your sketch for errors compiling it; it will report memory usage for code and variables in the
console area.

Upload
Compiles and loads the binary file onto the configured board through the configured Port.

Upload Using Programmer


This will overwrite the bootloader on the board; you will need to use Tools > Burn Bootloader to
restore it and be able to Upload to USB serial port again. However, it allows you to use the full
capacity of the Flash memory for your sketch. Please note that this command will NOT burn the fuses.
To do so a Tools -> Burn Bootloader command must be executed.

Export Compiled Binary


Saves a .hex file that may be kept as archive or sent to the board using other tools.

Show Sketch Folder


Opens the current sketch folder.

Include Library
Adds a library to your sketch by inserting #include statements at the start of your code. For more
details, see libraries below. Additionally, from this menu item you can access the Library Manager and
import new libraries from .zip files.

Add File...
Adds a source file to the sketch (it will be copied from its current location). The new file appears in a
new tab in the sketch window. Files can be removed from the sketch using the tab menu accessible
clicking on the small triangle icon below the serial monitor one on the right side o the toolbar.

TOOLS

Auto Format
This formats your code nicely: i.e. indents it so that opening and closing curly braces line up, and that
the statements inside curly braces are indented more.

Archive Sketch
Archives a copy of the current sketch in .zip format. The archive is placed in the same directory as the
sketch.

Fix Encoding & Reload


Fixes possible discrepancies between the editor char map encoding and other operating systems char
maps.

54
Serial Monitor

Opens the serial monitor window and initiates the exchange of data with any connected board on the
currently selected Port. This usually resets the board, if the board supports Reset over serial port
opening.

Board
Select the board that you're using. See below for descriptions of the various boards.

Port
This menu contains all the serial devices (real or virtual) on your machine. It should automatically
refresh every time you open the top-level tools menu.

Programmer:
For selecting a hardware programmer when programming a board or chip and not using the
onboard USB-serial connection. Normally you won't need this, but if you're burning a boot loader to a
new microcontroller, you will use this.

Burn Boot loader:


The items in this menu allow you to burn a boot loader onto the microcontroller on an Arduino
board. This is not required for normal use of an Arduino or Genuine board but is useful if you
purchase a new AT mega microcontroller (which normally come without a boot loader). Ensure that
you've selected the correct board from the Boards menu before burning the boot loader on the target
board. This command also set the right fuses.

55
CHAPTER – 4
IMPLEMENTATION

4.1. FIRE BASE:

Firebase is a mobile and web app development platform that provides developers with a plethora
of tools and services to help them develop high-quality apps, grow their user base, and earn more profit.

A Brief History

Back in 2011, before Firebase was Firebase, it was a startup called Envolve. As Envolve, it
provided developers with an API that enabled the integration of online chat functionality into their
website.

What’s interesting is that people used Envolve to pass application data that was more than just chat
messages. Developers were using Envolve to sync application data such as a game state in real time
across their users.

This led the founders of Envolve, James Tamplin and Andrew Lee, to separate the chat system and the
real-time architecture. In April 2012, Firebase was created as a separate company that provided
Backend-as-a-Service with real-time functionality.

After it was acquired by Google in 2014, Firebase rapidly evolved into the multifunctional behemoth of
a mobile and web platform that it is today.

Real-time Database

The Firebase Real-time Database is a cloud-hosted NoSQL database that lets you store and sync
between your users in Real-time.

The Real-time Database is really just one big JSON object that the developers can manage in Real-time.

Real-time Database => A Tree of Values

56
With just a single API, the Firebase database provides your app with both the current value of the data
and any updates to that data. Real-time syncing makes it easy for your users to access their data from
any device, be it web or mobile. Real-time Database also helps your users collaborate with one another.
Another amazing benefit of Real-time Database is that it ships with mobile and web SDKs, allowing
you to build your apps without the need for servers. When your users go offline, the Real-time Database
SDKs use local cache on the device to serve and store changes. When the device comes online, the local
data is automatically synchronized. The Real-time Database can also integrate with Firebase
Authentication to provide a simple and intuitive authentication process.

Firebase Cloud Messaging (FCM)

Firebase Cloud Messaging (FCM) provides a reliable and battery-efficient connection between
your server and devices that allows you to deliver and receive messages and notifications on iOS,
Android, and the web at no cost. You can send notification messages (2KB limit) and data messages
(4KB limit). Using FCM, you can easily target messages using predefined segments or create your own,
using demographics and behavior. You can send messages to a group of devices that are subscribed to
specific topics, or you can get as granular as a single device. FCM can deliver messages instantly, or at
a future time in the user’s local time zone. You can send custom app data like setting priorities, sounds,
and expiration dates, and also track custom conversion events. The best thing about FCM is that there
is hardly any coding involved! FCM is completely integrated with Firebase Analytics, giving you
detailed engagement and conversion tracking. You can also use A/B testing to try out different versions
of your notification messages, and then select the one which performs best against your goals.

Firebase Database Query

Firebase has simplified the process of retrieving specific data from the database through queries.
Queries are created by chaining together one or more filter methods.

Firebase has 4 ordering functions:

 Order By Key()
 Order By Child(‘child’)
 Order By Value()

 Order By Priority()

57
Note that you will only receive data from a query if you have used the on() or once() method.

You can also use these advanced querying functions to further restrict data:

 Start At(‘value’)
 End At(‘value’)
 Equal To(‘child key’)

 Limit To First(10)

 Limit To Last(10)

In SQL, the basics of querying involve two steps. First, you select the columns from your table.
Here I am selecting the Users column. Next, you can apply a restriction to your query using
the WHERE clause. From the below-given query, I will get a list of Users whose name is GeekyAnts.

We can also use the LIMIT clause, which will restrict the number of results that you will get back from
your query.

58
In Firebase, querying also involves two steps. First, you create a reference to the parent key and
then you use an ordering function. Optionally, you can also append a querying function for a more
advanced restricting.

How to Store Data? => Firebase Storage

Firebase Storage is a standalone solution for uploading user-generated content like images and
videos from an iOS and Android device, as well as the Web.

Firebase Storage is designed specifically to scale your apps, provide security, and ensure network
resiliency.

Firebase Storage uses a simple folder/file system to structure its data.

Query with Firestore

Imagine that you have created a collection in Firestore that contains a list of Cities. So, before you can
send out a query, you will have to store the database inside a variable.

59
Here, cities Ref is that variable that contains your collection of cities. Now, if you want to find
a list of capital cities, you would write a query like this:

Here’s another example of queries in Fire store. Say you want to see only 2 of cities from your
database whose population is more than 100,000.

But Cloud Firestore can make querying even easier! In some cases, Cloud Fire store can
automatically search your database across multiple fields. Fire store will guide you towards
automatically building an index that will help Firestore to make querying extremely simple.

60
Better Scalability

Though Firebase’s Real-time Database is capable of scaling, things will start to get crazy when
you app becomes really popular or if your database becomes really massive.

Cloud Fire store is based on Googles Cloud infrastructure. This allows it to scale much more easily and
to a greater capacity than the Real-time Database.

Fig.4.1Realtime database before and after fire detection

61
Output

Fig.4.2 Vision based data

[Link] data

62
CHAPTER- 5

[Link]

CONCLUSION

In conclusion, the proposed system offers a comprehensive approach to fire detection and
mitigation. By utilizing a web camera connected to a laptop/PC running Python code, the system can
swiftly identify instances of [Link] detection, the software sends a signal to an ESP 8266 controller
via USB, triggering a cascade of actions. This includes updating the cloud for remote monitoring,
activating an alarm and a water extinguisher for immediate suppression, and switching on an exhaust fan to
manage [Link], the system unlocks an emergency exit door, prioritizing the safety and
evacuation of individuals. Through this integrated approach, the system aims to swiftly and effectively
respond to fire emergencies, mitigating risks and ensuring the well-being of occupants.

FUTURE WORK
 In Future Scope, by remote Monitoring and Control: Enhancing the system with remote monitoring
capabilities through a dedicated mobile app or web interface can provide real-time alerts, status
updates, and control options for building owners, managers, and emergency responders.

 Advanced Image Processing Techniques: Incorporating more sophisticated image processing


algorithms can enhance the system's ability to accurately detect fires and distinguish them from
false alarms or non-fire sources of heat.

63
REFERENCES

[1]Fernandes, A. M., Utkin, A. B., & Chaves, P. (2022). Automatic Early Detection of Wildfire
Smoke With Visible Light Cameras Using Deep Learning and Visual Explanation. IEEE Access, 10,
12814-12828.

[2]Zheng, X., Chen, F., Lou, L., Cheng, P., & Huang, Y. (2022).Real-Time Detection of Full- Scale
Forest Fire Smoke Based on Deep Convolution Neural Network. Remote Sensing, 14(3), 536

[3] Li, M., Zhang, Y., Mu, L., Xin, J., Yu, Z., Jiao, S., ...&Yingmin, Y. (2022). A Real-time Fire
Segmentation Method Based on A Deep Learning Approach. IFAC-PapersOnLine, 55(6), 145-150.

[4]Dewangan, A., Pande, Y., Braun, H. W., Vernon, F., Perez, I., Altintas, I., ...& Nguyen, M. H.
(2022). FIgLib&SmokeyNet: Dataset and Deep Learning Model for Real-Time Wildland Fire Smoke
Detection. Remote Sensing, 14(4), 1007.
[5]Avazov, K., Mukhiddinov, M., Makhmudov, F., & Cho, Y. I. (2021).Fire Detection Method in
Smart City Environments Using a Deep-Learning-Based Approach. Electronics, 11(1), 73

[6]Guede-Fernández, F., Martins, L., de Almeida, R. V., Gamboa, H., & Vieira, P. (2021). A deep
learning based object identification system for forest fire detection. Fire, 4(4), 75

[7]Yin, H., Wei, Y., Liu, H., Liu, S., Liu, C., &Gao, Y. (2020).Deep convolutional generative
adversarial network and convolutional neural network for smoke detection. Complexity,2020

[8]Gaur, A., Singh, A., Kumar, A., Kumar, A., &Kapoor, K. (2020). Video flame and smoke based
fire detection algorithms: A literature review. Fire technology, 56(5), 1943-1980

[9]Ayala, A., Fernandes, B., Cruz, F., Macêdo, D., Oliveira, A. L., &Zanchettin, C. (2020,
July).Kutralnet: A portable deep learning model for fire recognition. In 2020 International Joint
Conference on Neural Networks (IJCNN) (pp. 1-8).IEEE

[10]Saeed, F., Paul, A., Karthigaikumar, P., &Nayyar, A. (2020). Convolutional neural network
based early fire detection. Multimedia Tools and Applications, 79(13), 9083-9099.

[11]Jadon, A., Varshney, A., & Ansari, M. S. (2020).Low-complexity high-performance deep


learning model for real-time low-cost embedded fire detection systems. Procedia Computer Science,
171, 418-426.

64
[12]Lee, Y., & Shim, J. (2019). False positive decremented research for fire and smoke detection in
surveillance camera using spatial and temporal features based on deep learning. Electronics, 8(10),
1167

[13]Pundir, A. S., & Raman, B. (2019). Dual deep learning model for image based smoke detection.
Fire technology, 55(6), 2419-2442

[14]Cao, Y., Yang, F., Tang, Q., & Lu, X. (2019). An attention enhanced bidirectional LSTM for
early forest fire smoke recognition. IEEE Access, 7, 154732-154742.

[15]Yin, Z., Wan, B., Yuan, F., Xia, X., & Shi, J. (2017). A deep normalization and convolutional
neural network for image smoke detection. Ieee Access, 5, 18429-18438

[16]Janku P., Kominkova Oplatkova Z., Dulik T., Snopek P. and Liba J. 2018. “Fire Detection in
Video Stream by Using Simple Artificial Neural”. Network. MENDEL. 24, 2 (Dec. 2018), 55– 60.

[17]Shen, D., Chen, X., Nguyen, M., & Yan, W. Q. (2018). “Flame detection using deep learning”.
2018 4th International Conference on Control, Automation and Robotics (ICCAR).

[18]K. Muhammad, J. Ahmad, Z. Lv, P. Bellavista, P. Yang and S. W. Baik, “Efficient Deep CNN-
Based Fire Detection and Localization in Video Surveillance Applications,” in IEEE Transactions on
Systems, Man, and Cybernetics: Systems, vol. 49, no. 7, pp. 1419-1434, July 2019.

[19]Z. Jiao et al., “A Deep Learning Based Forest Fire Detection Approach Using UAV and
YOLOv3,” 2019 1st International Conference on Industrial Artificial Intelligence (IAI), Shenyang,
China, 2019.

[20]Faming Gong ,1 Chuantao Li,1 Wenjuan Gong ,1 Xin Li,1 Xiangbing Yuan,2 Yuhui Ma and Tao
Song. “A RealTime Fire Detection Method from Video with Multifeature Fusion”. Hindawi,
Computational Intelligence and Neuroscience, Volume 2019.

65
66

You might also like