Early Detection System For Gas Leakage and Fire in Smart Home Using Machine Learning
Early Detection System For Gas Leakage and Fire in Smart Home Using Machine Learning
Abstract — Making houses more inclusive, safer, resilient and local warning to anyone in the nearby place, with the
sustainable is an important requirement that must be achieved in assumption that someone will be around and can hear the
every society. Gas leakage and fires in smart houses are serious sound of the alarm [3]. However, with many residential
issues that are causing people’s death and properties losses. housing life style cases such as for couples and single
Currently, preventing and alerting systems are widely available.
residents who are almost outside home in work or in travel, as
However, they are generally individual units having elementary
functions without adequate capabilities of multi-sensing and well as, for people with special needs and elder people, a
interaction with the existing Machine-to-Machine (M2M) home remote notification system must be implemented to
network along with the outside networks such as Internet. Indeed, automatically alert the relevant persons, such as the
this communication paradigm will be clearly the most dominant in householder, his neighbors and the necessary emergency
the near future for M2M home networks. In this paper, we are services. Indeed, it should be great to have gas leakage and
proposing an efficient system model to integrate the gas leakage fire detection systems connected to Machine-to-Machine
and fire detection system into a centralized M2M home network (M2M) home networks as we can obtain more additional
using low cost devices. Then, through machine learning approach, services such as having automated pre-planned action and
we are involving a data mining method with the sensed information
remote warning systems.
and detect the abnormal air state changes in hidden patterns for
early prediction of the risk incidences. This work will help to Opportunely, with the drastic penetration of low cost
enhance safety and protect property in smart houses. embedded devices and Wireless Sensor Networks (WSN)
Keywords — smart home, gas leakage detection, fire detection, technologies, M2M communications may play a key role that
machine-to-machine, wireless sensor network, machine learning. can handle the previous cases preventing many incidences.
WSN is a current trend which is deployed to control and
monitor the physical environment by using sensor nodes [4].
I. INTRODUCTION
M2M connects between devices through WSN without (or
Gas leakage and fires in houses are causing many victims with minimum) human intervention. The devices collect
and property damages. For example, the natural gas leaks, useful information and then autonomously flow the data
which is highly flammable, increase the risk of fire and can between other devices up to the gateway. This can offer a
even provoke explosion. Furthermore, exposure to gas leak in panoply of new innovative services through the interaction
home or smoke inhalation can cause very serious respiratory with other smart home systems (e.g. aeration system, smart
complications. Indeed, the use of an early warning system gas, etc.), and furthermore provides Internet of Things (IoT)
results in significant reduction in losses. The sooner a gas or for wide range of services.
smoke is detected, the better the outcome for saving lives and
properties. Practically, smoke and fire detection devices are In this paper, we propose a novel approach in which we
considered the first line of defense against these issues. On the first deploy an M2M system prototype and collect the data
current market, most of these devices are standalone from devices. We then apply machine learning methods in
(individual units) and typically used as an immediate indicator order to correlate data between them and propose methods to
of fire incidence that generally issues a local audible or early detect disaster scenario with imminent fire or gas
visual alarm from the detector itself announcing that there is leakage, etc.
an emergency for evacuation [1,2].
The rest of the paper is organized as follows. In Section
Comparing to industrial domains where usually the gas II, we introduce our Architecture and describe the dataflow
leakage and fire detectors are permanently monitored and structure. Section III describes our experimental set up and
connected to local fire station, the current solutions in scenario, while Section IV presents the results of our
residential houses are very basic and work separately from any experiments. Section V surveys the related work, and finally,
communication to other systems, and satisfied only giving a Section VI conclude the paper and present some perspectives.
II. SYSTEM OVERVIEW
A. Architecture
In our system proposal, we considered that smart home
architecture (or home automation and control) includes pre-
integrated M2M solutions such as smart metering, lightning
control, door openers for example [5,6,7]. Furthermore, an
M2M data exchange among smart devices is guaranteed
without human intervention.
We implemented a prototype for our early-detection In order to collect pertaining data, our experiments have
system in smart-home environment. Our prototype collects been conducted during a couple of days. The sensors have
data through four sensors. This included air temperature, air been exposed to different conditions, sensing data from
humidity, smoke, LPG, CO, flame and CO2. regular ambient condition to more extreme conditions with gas
and fire. The aggregation node transmitted continuously and
As shown in Fig.3(a), an Arduino Uno R3 device [12] is periodically data every 5 seconds. The sensors have been
used to aggregate the data from sensors. The Zigbee configured with their default parameter values that served as a
protocol [13] is also used for communications among baseline for comparisons with different conditions.
devices. We also have tested the efficiency of our prototype, and
implemented a notification service through emails and Line
Then, a Raspberry Pi 3 Model B device [14] is used as Messaging API for alerting pertaining persons.
M2M gateway to receive the sensed information as
depicted in Fig.3(b). Zigbee interface is used for joining Furthermore, the interaction with other systems such as
the corresponding WSN nodes. The data received is smart aeration and smart gas systems was presented through
handled by creating topics and using publish/subscribe the second edge node containing some actuators as output in
methods through Message Queuing Telemetry Transport case of incidence (e.g. Fans, LEDs).
(MQTT) protocol [15]. A graphical user interface (GUI) IV. RESULTS
for monitoring as well as a (local/remote) notification A. Data acquisition
systems are built. During data acquisition, we collected during 1.5 days
21,146 sample measures from the sensors. Each sample counts
Finally, a second Arduino Uno R3 device, as shown in
7 values, i.e., one value by sensor. Every sample have been
Fig.3(c), is used for emulating the triggered functions
collected periodically every 5s. The data have been collected
ordered by the gateway in case of incidence.
under usual and extreme conditions engendering risks.
Fig. 4 presents our experiment in regular conditions. All Table II provides a comparison between the range of
the sensed data was relatively stable over time. For instance, values under normal and extreme conditions.
Temperature presents a typical day/night pattern with peak
TABLE II. THE RANGE OF VALUES UNDER REGULAR AND EXTREME
above 30°C as it is commonly the case in Japan in summer. CONDITIONS
This experiment is to serve as a comparison baseline to predict
anomalous pattern during extreme conditions. The range Ranges in Min/Max values in Tendency in
Parameters
Regular conditions Extreme conditions Extreme conditions
values for regular conditions are presented in Table II.
Temperature 25-35 C⁰ 60 °C (*) Increase
Humidity 60-70 % 0% Decrease
LPG 0-30 PPM 63,898 PPM Increase
CO 0-50 PPM 65,280 PPM Increase
Smoke 0-100 PPM 65,395 PPM Increase
Flame 400-500 65,835 Increase
CO2 400-500 PPM 38 PPM Decrease
(*)
Maximal value allowed by DHT-11 sensor
True label
0.8% %97 2.5% 0% Correct predictions
Fig.6. The different algorithms score comparison. 0 0 157 0
2
0% 0% 100% % Erroneous predictions
C. Discussion 3
0 0 0 18
0% 0% 0% 100%
Sensors can measure wrong information or miss
0 1 2 3
collecting the information due to the extreme conditions or Predicted label
data losses. For instance, when sensors are exposed to high Fig.8. The confusion matrix of the model.
temperature or flame. These loss of information can be critical The classification report given in the following table
for the accuracy of our system. We then provide an analysis to (Table III) provides more details of each class by precision,
minimize the impact of false values. recall, f1-score and support showing excellent results.
As a first solution, one can delete entries from our dataset TABLE III. THE CLASSIFICATION REPORT
corresponding to any missing or wrong values (sample with Risk Precision Recall f1-score Support
missing values). Figure 7 presents the accuracy of evaluated 0 1.00 1.00 1.00 3964
algorithms with the initial data set and the data set whose 1 1.00 0.97 0.98 121
missing values have been deleted. Deleting missing data helps 2 0.98 1.00 0.99 157
indeed increasing the accuracy score. However, there is a risk 3 1.00 1.00 1.00 18
to remove too many samples and therefore losing valuable Avg. / Total 1.00 1.00 1.00 4260
information that our classifier needs to differentiate between V. RELATED WORK
classes of risks and can lead to a non-reliable analysis. Thus, Some efforts have been conducted in terms of detecting
as another solution, the mean imputation technique can be and preventing smoke and fire in smart-home environment. In
used to estimate the values of each missing data. The mean particular, Chen et al. [1] have presented a fire sensor system
values are computed in the training data set and missing data based on the simultaneous detection of CO, CO2, and smoke
is replaced by this computed mean value. As shown in Fig.7, concentrations. Islam et al. [2] proposed an application for
the accuracy score is improved compared with initial data set automating standalone smoke alarms for remote notifications.
and the entire data set is maintained, which means that our This decreases the time delay between a fire incidence and the
classifier still has sufficient amount of data to learn classify notification to relevant persons or emergency services. Ayyubi
our data set. et al. [3] proposed an enhanced design of a wireless control
system for smoke and fire detection with alarming provision
and messages notification systems. A home based fire
monitoring and warning system for home owners primarily
has also been implemented [16]. Tao et al. [17] proposed a
smoke detection based on deep convolutional neural networks
from visual scenes. In [18], an adaptive threshold deep
learning method for fire and smoke detection was proposed, in
which authors has proposed a novel method for fire and smoke
detection using video images. Solorzano et al. [19] proposed a
fire detection using a gas sensor array with sensor fusion
algorithms. A fuzzy logic approach for event detection using
Fig.7. Handling the missing values. wireless sensor network was proposed by [20]. Similarly, [21-
From previous evaluations, CART algorithm is the most 23] have also used the same logic to combine data coming
accurate for our data set. Then, we evaluate the accuracy of from many sensors for getting the probability for fire occur-
the CART algorithm more precisely. Confusion matrix is a rences. Finally, Yan-Hua et al. [24] adopted the back
way to present in a table different predictions and test results propagation neural network algorithm of multi-sensor data
and contrasts them with real-world values. It outlines the true fusion approach for fire alarm.
Our work differs from previous ones as we are proposing [5] D. Boswarthick, O. Elloumi and O. Hersent; “M2M
an effective implementation of a preventive system for gas Communications: A Systems Approach,” Published by John
leakage and fire incidences in smart home environment which Wiley & Sons Ltd, April 30, 2012
is natively including an improved monitoring and warning [6] ETSI, “Machine-to-Machine Communications (M2M); M2M
system comparing to [1-3] and [16]. Then, instead of focusing service requirements,” ETSI TS 102 689 V2.1.1 (2013-07)
on visual scenes to detect smoke and fire, we are looking in [7] M. Chen, J. Wan, S. Gonzalez, X. Liao and V. Leung, “A sur-
our study for detecting these incidences in earlier stages as an vey of recent developments in home M2M networks,” IEEE
assertive method using other data inputs such as gas and Communications Surveys & Tutorials (Vol. 16, Issue: 1, First
temperature which are not considered in [17] and [18]. Quarter 2014)
Furthermore, comparing to [19-24] we are using additional [8] B. Krishnamachari, D. Estrin, and S.B. Wicker, “Modeling
sensors for obtaining more precise condition and from many data-centric routing in wireless sensor networks,” USC
vantage points. Finally, although we are involving machine Comput. Eng. Tech. Rep. CENG 02-14, Oct. 2002
learning methods for combining the multi-sensed data [9] A. Smola and S.V.N. Vishwanathan, “Introduction to Machine
Learning,” Cambridge University Press 2008
similarly to these studies, this work presents the particularity
[10] C.M. Bishop, “Pattern recognition and machine learning,”
of treating the missing values for reducing the false alerts and
Information Science and Statistics, Springer, 2006
improving the prediction performance.
[11] S. Raschka, and V. Mirjalili, “Python Machine Learning,
VI. CONCLUSION Second Edition,”, Pub. by Packt Publishing Ltd. Sep. 2017
[12] Arduino, https://www.arduino.cc
In this paper, we have contributed in the way of
[13] Zigbee Alliance, http://www.zigbee.org
integrating gas leakage and fire systems within smart home
[14] Raspberry Pi, https://www.raspberrypi.org
environment in order to enhance safety using low-cost and
[15] MQTT.org, http://mqtt.org
less-energy consumption devices through M2M standard
[16] S. Suresh, S. Yuthika, and G.A. Vardhini, “Home based fire
communication protocols. We proposed an effective dataflow monitoring and warning system,” 2016 Int. Conf. ICT in
system for gathering useful information to a central point in Business Ind. & Gov. (ICTBIG), Indore, India, April 2016
M2M home network. We deployed our system prototype with [17] C. Tao, J. Zhang, and P. Wang, “Smoke detection based on
sensors and perform experiments under different conditions. deep convolutional neural networks,” Int. Conf. Ind. Inform. –
From our data set, we applied a supervised machine learning Comput. Technol., Intell. Technol., Ind. Inf. Integration
process on several algorithms for observing events which are (ICIICII), pp.150-153, Wuhan, China, Dec. 2016
not conform to the expected pattern, and predicting the level [18] X. Wu, X. Lu, and H. Leung, “An adaptive threshold deep
of risks of danger. Our system is also able to send a learning method for fire and smoke Detection,” 2017 IEEE Int.
notification to alert relevant persons and proceed accordingly. Conf. Syst., Man, and Cybern. (SMC), pp.1954-1959, Banff,
In future, we will collect more additional data and apply Canada, Oct. 2017
other machine learning algorithms to improve the accurate of [19] A. Solórzano, J. Fonollosa, L. Fernández, J. Eichmann, and S.
the model to reduce the false positive. We have also the trend Marco, “Fire detection using a gas sensor array with sensor
toward real-time analysis using cloud services. fusion algorithms,” 2017 ISOCS/IEEE Int. Symp. Olfaction
and Electron. Nose (ISOEN), Montreal, Canada, May 2017.
ACKNOWLEDGMENT [20] P. Manjunatha, A.K. Verma, and A. Srividya, “Multi-sensor
I would like to express my special thanks of gratitude to data fusion in cluster based wireless sensor networks using
my MINET Laboratory’s colleagues who gave me a great and fuzzy logic method,” IEEE R10 and 3rd Int. Conf. Ind. Inf.
Syst., Kharagpur, India, Dec. 2008
considerable support.
[21] V. Khanna and R.K. Cheema, “Fire detection mechanism using
REFERENCES fuzzy logic,” Int. J. Comput. Appl., vol.65, no.12, pp.5-9,
[1] S.J. Chen, D.C. Hovde, K.A. Peterson, and A.W. Marshall March 2013
“Fire detection using smoke and gas sensors,” Fire Safety J., [22] K. Kumar, N. Sen, S. Azid, and U. Mehta, “A fuzzy decision in
vol.42, issue 8, pp.507-515, Nov. 2007 smart fire and home security system,” in Proc. Of Comput. Sci.,
[2] T. Islam, S. A. Abdullah, and G. Sarowar, “Enhanced Wireless vol.105, pp.93-98, 2017
Control System for Smoke and Fire Detection,” Int. J. Comput. [23] F.A. Saputra, M.U.H.A. Rasyid, and B.A. Abiantoro,
and Electr. Eng., vol.5, no.2, pp.233-236, April 2013 “Prototype of early fire detection system for home monitoring
[3] S. Ayyubi, Y. Miao, and H. Shi, “Automating standalone based on wireless sensor network,” Int. Elec. Symp. Eng. Tech.
smoke alarms for early remote notifications,” 13th Int. Conf. and Appl. (IES-ETA), pp.39-44, Surabaya, Indonesia, Sept.
Control, Autom., Robot., and Vision (ICARCV), pp.675-680, 2017
Marina Bay Sands, Singapore, Dec. 2014 [24] L. Yan-hua, and T. Wei-min, “Multi-Sensor Fusion Approach
[4] R. Faludi, “Building Wireless Sensor Networks,” Published by for Fire Alarm using BP Neural Network,” Int. Conf. on
O’Reilly Media, 2011 Intelligent Net. & Collaborative Sys. (INCoS), pp.99-102, 2016