MQTT Implementation of IoT Based Fire Alarm Network
MQTT Implementation of IoT Based Fire Alarm Network
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.
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.