0% found this document useful (0 votes)
142 views

MQTT Implementation of IoT Based Fire Alarm Network

This document proposes an IoT-based fire alarm system using MQTT. It consists of NodeMCU sensor nodes with smoke and temperature sensors distributed throughout a building. The nodes continuously monitor for fires and send alerts over MQTT to a Raspberry Pi broker. If a fire is detected, the Pi sends an email notification to relevant parties with the location of the fire. The system aims to provide early detection of fires at low cost and power usage.

Uploaded by

Ahmad Iqbal
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
142 views

MQTT Implementation of IoT Based Fire Alarm Network

This document proposes an IoT-based fire alarm system using MQTT. It consists of NodeMCU sensor nodes with smoke and temperature sensors distributed throughout a building. The nodes continuously monitor for fires and send alerts over MQTT to a Raspberry Pi broker. If a fire is detected, the Pi sends an email notification to relevant parties with the location of the fire. The system aims to provide early detection of fires at low cost and power usage.

Uploaded by

Ahmad Iqbal
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 4

MQTT Implementation of IoT based Fire Alarm

Network
Ravi K Kodali and Aditya Valdas
Department of Electronics and Communication Engineering
National Institute of Technology, Warangal,
WARANGAL-506004, India
Email: [email protected]

Abstract—In these times of rapidly developing technology, we fueled by the presence of any flammable materials in the
are becoming more and more dependent on our machines and building. This factor is a very dangerous one and needs to
devices to support us in our daily lives. With this development, be considered in designing fire alarms for buildings as there
for any installation or establishment, there arises the hazard of
a potential fire breaking out anytime for any reason. In India, will be no time for caution in such an occurrence as a fire
there was an average of 59 deaths per day in the year 2016 due breaking out. This is true especially in the current scenario
to fire accidents arising from various sources. Of these, one one- as a majority of buildings, at least in urban environments, are
fourth of the total was due to accidents in households. The rest multi-storeyed and there are more and more high-rise towers
was a mix of other factors ranging from vehicular accidents to coming up in cities all over the world.
industrial mishaps. To prevent these fatal accidents due to fires,
there is an urgent need for an effective and efficient fire alarm Ever since the time of industrialization, there has been an
system which can monitor a place or a location and accurately increase in transport facilities all over the world. Many forms
locate where a fire has broken out so that immediate action can of transport right from small vehicles like cars, through
be taken to mitigate losses and casualties. As a solution to this trucks, to the heavy ones like ships and airplanes run on
problem, we propose a network of IoT devices which continually some form of fuel or the other. Any malfunction in these, or
monitor for fire and alert a central hub if there is a fire about
the occurence and its location. From there on, this information the occurrence of an accident during travel, causes fires and
is sent to the concerned people and authorities so that preventive results in casualties or deaths. Even in contemporary times,
measures can be implemented. For this, we have designed an this problem is still persisting and is a factor to consider, in
MQTT network where a Raspberry Pi acts as the MQTT Broker spite of the safety measures introduced in them.
and a distributed group of NodeMCUs attached with smoke and Another aspect where fires are a huge danger is places where
temperature sensors act as a sensor network to relay information
to the Raspberry Pi. Whenever there is a fire in a certain location, there is abundance of plant life and vegetation. This includes
the corresponding sensor node sends an alert and thus an email forests, parks, countryside areas and wildlife reserves. These
is sent to the concerned people. are huge areas and detecting a fire and determining its
location is of paramount importance in order to mitigate the
I. I NTRODUCTION casualties to as much an extent as possible. This is important
Over the last two decades, there has been a lot of due to the damages caused by the destruction of a mass
advancement in technology all over the world at a never- amount of plants and trees, and this is something which we
seen-before pace. This caused a spurious outburst of new just cannot afford to have.
machines, devices and gadgets, thus enmeshing our world A cost-effective and power-efficient solution to this problem
with the digital world tighter than ever. With our increasing comes with the concept of the Internet of Things coming into
dependence on machines at an alarmingly fast rate, we are play. This project implements a system which is efficient and
slowly finding ourselves being surrounded by a plethora of effective with the help of proper communication protocols
things that are useful to us. But this has now lead to a serious and inexpensive devices to realize the solution. A network
problem to face. As the number of machines and devices we of NodeMCUs have low-cost smoke and temperature sensors
use keeps on increasing, so does the chance of a fire breaking attached to them and are placed at strategic points in the
out due to any of these. This is in addition to the already establishment where the system is to be implemented. These
existing causes of fires like natural causes, small accidents nodes now constantly monitor for any fire breaking out and
due to heaters or burners, accidents while cooking etc. Fires send the information to a Raspberry Pi which acts as a central
break out in many places and for many reasons, and it is near hub. The communication is done using the MQTT protocol
impossible to predict the occurrence, although it is possible which helps in power consumption to a very large extent as
to prevent it. compared to the standard HTTP protocol. In the event of
a fire the Raspberry Pi will get the information about the
Building and structures catching fire has been historically a incident and the location from the corresponding sensor node,
very menacing problem to mankind. When a building catches and sends this information via email to the concerned people.
fire, it consumes everything and everyone in it, and is further This way, we can know when and where a fire has broken

978-1-5386-2459-3/18/$31.00 2018
c IEEE 143
out. power consumption, it has become one of the most popular
microcontrollers in the IoT scenario.
II. D ESIGN AND I MPLEMENTATION
The core design of this project is aimed at being cost-
effective and power-efficient. The main component is a
Raspberry Pi motherboard which has been configured as
an MQTT broker. The sensor nodes are low-cost and low-
power NodeMCU’s which are Wi-Fi enabled microcontrollers
which have very little memory and processing, and are ideally
suited for IoT applications. The sensors sense the location for
smoke and drastic temperature changes. When any of these
is observed, they communicate the same to the Raspberry
Pi which processes the information received and accordingly
sends email notifications to the concerned people. Fig. 2. NodeMCU

A. Raspberry Pi
The Raspberry Pi is in itself a small computer. It was C. DHT Sensor
initially manufactured by the Raspberry Pi Foundation in The DHT11 sensor is a low-cost and low-power sensor to
February, 2016. Consequently newer versions have also been measure the temperature and humidity in the atmosphere. It
rolled out. The latest model is the Raspberry Pi 3 Model B. It is very inexpensive but on the downside the sensor is very
has Broadcom BCM2837 System on Chip (SoC). It has a CPU basic and slow to work, often involving a delay of around
(central processing unit) which is ARM compatible, and also a two seconds. The DHT sensor is made up of two parts, the
VideoCore IV GPU (graphics processing unit). It has a single capacitive humidity sensor and a thermistor. We can read the
processor which runs at 1.2GHz and includes a RAM of 1GB. data directly without having to do calibrations of any sort for
Storage can be included in the form of a micro SD card for temperature or humidity.
which a slot has been provided. It has an Ethernet port, four
USB ports, along with a micro USB port and a HDMI port for
output. It has on-board Wi-Fi 802.11n and Bluetooth, which
make it ready-to-use for IoT applications. It runs on Raspbian,
which is a version of the Debian OS specially optimized for
the Raspberry Pi.

Fig. 3. DHT Temperature and Humidity Sensor

Fig. 1. Raspberry Pi 3 Model-B D. Smoke Sensor


The MQ2 is a sensor we use to detect the presence of
combustible gas and smoke. This sensor uses a small heater
B. NodeMCU
inside with an electrochemical sensor. It is sensitive to a range
NodeMCU is an open source IoT platform. It includes of gases and is used indoors at room temperature. It is an
firmware which runs on the ESP8266 Wi-Fi SoC from Espres- analog sensor which outputs an analog value which directly
sif Systems, and hardware which is based on the ESP-12 corresponds to a change in voltage according to the amount of
module. It is quite compact and also affordable, making it smoke that envelopes the sensor. Higher the amount of smoke,
one of the most popular choices for many people working on higher will be the value which can be read from the smoke
IoT applications. With a RAM of 128kB and a storage space sensor, thus making it easy to interpret. It has a wide detecting
of 4MB, it is quite light on memory and power consumption. scope, high sensitivity and fast response time. It is a simple
It has one analog and eight digital GPIOs, thus making it design sensor with a long life and stability.
quite convenient to run a variety of different applications
integrating sensors and actuators with it. It is very comfortable E. Mosquitto on Raspbian
to work with, as it is a quite versatile device and also there Mosquitto is an open source MQTT broker introduced by
is a lot of documentation available on it on the Internet. Eclipse. It implements the MQTT versions 3.1 and 3.1.1,
Owing to its advantages with respect to size, memory and thus providing a method to publish and subscribe messages

144 International Conference on Communication, Computing and Internet of Things (IC3IoT)


Fig. 4. MQ2 Smoke Sensor

Fig. 6. Node-RED Flow

using as less number of bytes as possible. Message Queue


Telemetry Transport (MQTT) is a lightweight protocol which
is data-centric rather than document-centric and takes up very
little message sizes, thus saving costs in data transmission
by sensors. It works on a publish/subscribe basis where the
publisher publishes data to the broker under some topics and
the subscriber receives this data by subscribing to those topics.

Fig. 5. Mosquitto Publish/Subscribe


Fig. 7. The network with two sensor nodes and the Raspberry PI

F. Node-RED on Raspbian
is also monitored and if it crosses a threshold, then the
Node Red is a programming tool introduced by IBM for node will publish a message intimating the broker about
hardware components. It is unique in that it provides facility it.
to connect hardware devices on a GUI and create ’flows’ rather • Based on these inputs provided by the sensors, the node
than actually programming them to function according to the publishes data via MQTT protocol to the broker. The
need. The flow dictates how the hardware setup is to function. Raspberry Pi has Mosquitto installed on it and receives
It helps bring together a wide variety of devices and services, the published message from the sensor node.
all in one easy-to-use browser-based flow editor.
IV. S OFTWARE S ETUP
III. H ARDWARE S ETUP
• The Raspberry Pi, with the help of a flow created using
The hardware setup consists of the main device, the Rasp- Node-RED, receives the published data by the sensor
berry Pi, to which the sensor nodes, the NodeMCUs, are nodes. Then the flow directs it to save this data in a text
connected via MQTT. The Pi acts as an MQTT broker and file on Raspbian. Here the number corresponds to an ID
the sensor nodes as MQTT publishers. given to the particular sensor node.
• The smoke sensor senses for the presence of smoke and • A Python script running on Raspbian takes this data and
the DHT sensor senses the temperature values continu- processes it. Accordingly it creates another file with a
ally. Whenever there is a fire, the smoke sensor outputs message which is to be sent to the concerned people.
an analog value of voltage according to the intensity of • Now, again, the Node-RED flow will read this new text
smoke. This will trigger a message publish instance to the file’s contents and send an email to the concerned people
Raspberry Pi which is the MQTT broker. The temperature about the fire breaking out and its location.

International Conference on Communication, Computing and Internet of Things (IC3IoT) 145


• Next we see that the Raspberry Pi is collecting the
published data, processing it and making decisions based
on it. Then emails are sent to the concerned people when
a fire breaks out in a particular location, which helps
them know when and where it happened so that it can be
immediately addressed.
Fig. 8. The file where published data is stored
VI. C ONCLUSION
With this application, it is quite clear that disastrous con-
sequences from something as simple as a fire can be averted
by implementing this circuit wherever required. The low-cost
devices function suitable to the need and their low power-
consumption translates to money saving on a large scale over
a period of time.
This shows the importance of deploying IoT networks for
Fig. 9. The file where the Python script outputs its messages various applications to achieve the desired results in a short
span of time and conserve resources by a combination efficient
and low-cost devices.
R EFERENCES
[1] Rohini Shete; Sushma Agrawal, IoT based urban climate monitoring using
Raspberry Pi, International Conference on Communication and Signal
Processing (ICCSP), 6-8 April, 2016. Melmaruvathur, India.
[2] Chi-Sheng Shih; Ching-Chi Chuang; Hsin-Yuan Yeh, Federating public
and private intelligent services for IoT applications, 13th International
Wireless Communications and Mobile Computing Conference (IWCMC),
26-30 June, 2017. Valencia, Spain.
[3] Ravi Kishore Kodali, Archana Sahu, An IoT based soil moisture monitor-
ing on Losant platform, 2nd International Conference on Contemporary
Computing and Informatics (IC3I), 14-17 Dec. 2016. Noida, India.
[4] Ravi Kishore Kodali; Kopulwar Shishir Mahesh, A low cost imple-
mentation of MQTT using ESP8266, 2nd International Conference on
Fig. 10. Email notification sent when a fire is detected Contemporary Computing and Informatics (IC3I), 14-17 Dec. 2016,
Noida, India.
[5] Aniruddha Sinha, Shubham Sharma, Puja Goswami, Vivek Kumar Verma,
Munish Manas, Design of an energy efficient Iot enabled smart system
The software coding has been done in the Arduino software, based on DALI network over MQTT protocol, 3rd International Con-
ference on Computational Intelligence and Communication Technology
v1.8.3. Arduino is an open-source software which is very (CICT), 9-10 February, 2017. Ghaziabad, India.
popular for writing codes for various microcontrollers and their [6] Abdukodir Khakimov; Ammar Muthanna; Ruslan Kirichek; Andrey
applications. It is well-documented and has many forums and Koucheryavy; Mohammed Saleh Ali Muthanna, Investigation of methods
for remote control IoT-devices based on cloud platforms and different
a lot of online support. interaction protocols, IEEE Conference of Russian Young Researchers in
Electrical and Electronic Engineering (EIConRus), 1-3 February, 2017.
St. Petersburg, Russia.
[7] Ravi Kishore Kodali; Kopulwar Shishir Mahesh, Low cost ambient mon-
itoring using ESP8266, 2nd International Conference on Contemporary
Computing and Informatics (IC3I), 14-17 Dec. 2016, Noida, India.
[8] Ma Yue; Yan Ruiyang; Sun Jianwei; Yao Kaifeng A MQTT Protocol
Message Push Server Based on RocketMQ, 10th International Conference
on Intelligent Computation Technology and Automation (ICICTA), 2017,
Changsha, China.
[9] Ashutosh Bhatt; Jignesh Patoliya, Cost effective digitization of home
appliances for home automation with low-power WiFi devices, 2nd Inter-
Fig. 11. Serial Monitor Output on Arduino national Conference on Advances in Electrical, Electronics, Information,
Communication and Bio-Informatics (AEEICB), 27-28 February, 2016.
Chennai, India.
[10] Ahmed Imteaj; Tanveer Rahman; Muhammad Kamrul Hossain; Mo-
V. T ESTING AND R ESULTS hammed Shamsul Alam; Saad Ahmad Rahat, An IoT based fire alarm-
• Now that the hardware and software have been ap- ing and authentication system for workhouse using Raspberry Pi 3,
International Conference on Electrical, Computer and Communication
propriately set up and the code has been succesfully Engineering (ECCE), 16-18 February, 2017. Cox’s Bazar, Bangladesh.
uploaded onto the devices, we check the results. Firstly
the updating of events including connecting to Wi-Fi,
the Mosquitto MQTT broker and publishing the sensor
data via MQTT can be seen on the Serial Monitor of the
Arduino IDE.

146 International Conference on Communication, Computing and Internet of Things (IC3IoT)

You might also like