The Design of Microcontroller Based Early Warning Fire Detection System for Home Monitoring

— Fire is a type of disaster that can occur anytime and anywhere as a result of any accidental or intentional causes. Without exception, houses are also very vulnerable to fire. To anticipate the catastrophic effects of fire that can destroy houses, advanced technology, such as the Internet of Things (IoT) can be utilized to detect the smoke and fire. This study aims to design an early warning fire detection system for home monitoring using smoke detection sensors based on Arduino microcontroller together with NodeMCU ESP8266. This early warning fire detection system is expected to function by notifying homeowners when detecting the presence of smoke in their homes. With the aid of this detection system, the issue of potential damage, death, or material loss caused by fire can be significantly reduced. The results and testing of the designed system will be discussed in the paper.


A. Background and Purpose
Disasters such as flooding, earthquake, tsunami, typhoon, and fires can occur anywhere and anytime. Fire particularly, is a type of disaster that may be caused by accident or deliberate action which can also occur at anytime and anywhere, including in the house. According to Indonesian Central Bureau of Statistics (Badan Pusat Statistik), throughout 2018 there were 552 cases of housing fires in the DKI Jakarta region alone. This number increased to 1898 cases in 2020 [1]. Based on the aforementioned data, it can be inferred that the residential fires becomes more common in recent years. As for the cause of the fire, there are several factors, such as: short circuit in electrical installations, exploding gas stoves, cigarette butts, and others. In general, a fire is known if the fire has started to grow or the smoke has started to blacken or has billowed out of the building. From several cases of a house fire, the fire usually started in the kitchen due to a gas leak. This fact is supported by the statistics provided by the DKI Jakarta government that, in 2020, 180 cases of residential fires were caused by gas leaks [2].
The impact of house fire might be very devastated, catastrophic, and even deadly especially to humans if they are still inside the house when the fire broke out. Hence, it is very crucial to have an advanced Information Technology in the form of Internet of Things which is able to detect fire disaster as early and accurately as possible. To date, the use of current technology such as Internet of Things (IoT) can be very beneficial to anticipate potential disasters caused by fire. Fire can be anticipated with an immediate detection, for instance using a smoke detection. The presence of smoke can serve as an early indicator of the presence of fire in a room. In addition, indicators that have the potential to cause fires are gas leaks, so that homeowners can know if a gas leak occurs. In general, there are two indicators of gas leakage that should be taken into account, namely LPG (liquified petroleum gas) leakage and CO (carbon monoxide) leakage. Due to this potential leaks, detecting smoke and gas in a room in the house at any time requires a fire early detection system with the ability to notify homeowners immediately with ongoing situations. In this study, the early warning fire detection system was designed and developed using smoke detection sensors based on the Arduino UNO microcontroller together with Node MCU ESP 8266.

B. Literature Review
Internet of Things (IoT) is a technology that allows ones to connect machines, equipment and other ISSN 2355-0082 physical objects with network sensors and actuators to obtain data and manage its own performance. In other words, IoT is everything about objects that are connected to the Internet. This technology is allowing machines to collaborate and even act on new information that is obtained independently [3]. The term IoT itself refers to a concept that aims to broaden the benefits of continuously connected Internet connectivity. IoT generally consists of three parts: network, sensors, and usage application. Several communication technologies can be used to support the connection device to IoT. IoT has been considered as the latest technology in the internet world, where this technology will become a technology trend in the future. To date, IoT has expanded and become the leading platform for communication devices. It is estimated that the amount IoT users will increase massively where the economy grows significantly [3].
Fire Detector. Detection is a process of examining something using certain methods and techniques. Detection can be applied in various problems including fire detection system. This particular type of system can detect the occurrence of fire [4]. Generally, a fire detector refers to a device whose main function is to detect the presence of initial fire in order to prevent it from becoming larger. With the help of early warning fire detection system, fire fighting can be done immediately. In turn, this may minimize the loss risk from the very beginning. Fire detection system works on the presence of smoke, heat, and fire. Based on those elements, fire detector is basically divided into three types, namely: Smoke Detector (smoke detector) is a device that serves to detect smoke. When the detector detects smoke, it will immediately send a signal to activate fire alarm sounds; Heat Detector, which detect changes in thermal energy (heat) caused by the presence of fire; Flame Detector, that detects the presence of flames and available in three types, namely optical sensors, ionisation, and thermocouple [5]. Fire detector used in this research is MQ-2 (as seen in Figure.   MQ-2 is a particular sensor that functions to detect the concentration of substances in the air. Few types of substance concentrations that can be captured by MQ-2, among other things are, Liquified Petroleum Gas (LPG), Carbon monoxide (CO), and smoke [6]. The following are the thresholds of the parameters used: Liquified Petroleum Gas (LPG) is gas produced from oil refineries and gas refineries whose main components are propane and butane gas of approximately 99% and the rest is liquified pentane gas. The composition ratio of propane (C 3 Hg) and butane (C 4 H 10 ) is 30:70. This LPG is included in the category of flammable gas. LPG is a gas that is circulated in the market by Pertamina with a pungent smell, non-toxic but if inhaled more than 1,000 ppm it can cause fainting and death. To prevent fires caused by LPG, the LPG gas concentration value must be below 1.8%, if the LPG gas concentration value is 1.8%-10% in the air, it can cause fires and explosions. The amount of 1.8%-10% is equivalent to 18,000 PPM to 100,000 PPM. Therefore, the fire detection system must be set below the safe limit of gas content which is less than 1.8% in order to overcome the potential for fires [7]. Meanwhile, according to ISPU (Air Pollution Standard Index) No. KEP107/KABAPEDAL/11/1997 article 9 states that the standard index number and category for carbon monoxide (CO) gas in normal clean air is with a concentration size between 0-50 ppm [8]. Besides, based on the Air Quality Index (AQI) Basics for smoke indicators, the level of smoke density in normal air is 0-50 ppm [9].
Arduino is a microcontroller device that is generally used to automate human work. Arduino consists of two main elements: Arduino board on which the sensor components used are plugged in, and the software, called the Arduino Integrated Development Environment (IDE). Using this IDE one can write any program code to make Arduino work as wanted [10]. The use of Arduino is increasing in number along with the need of microcontroller devices that are affordable and are also supported by the trend of job automation using devices that can be controlled through mobile applications [11]. In the meantime, the homeowners have begun to make use smart home for facilitating their daily routines at home. Research conducted by Jabbar and Kawitkar [11] showed that Arduino devices can be used to build smart home applications that are able to automatically manage some electronic devices located inside the house through a network connection. Apart from affordability, Arduino also has several advantages, namely [10]: to support for multi-platform technology; large user community; and ease of use in terms of programming (coding).
Node MCU ESP 8266 is an embedded chip designed for Wi-Fi based communication [6]. This chip has TTL and GPIO serial outputs. ESP8266 can be used independently alone (standalone) or combined with other controllers such as microcontrollers. ESP 8266 can act as a client to a WiFi router, so that when configuring a name setting is needed, access point and password. This chip can also be considered as an IoT platform that is distributed as an open source. It consists of hardware in the form of System On Chip ESP8266 manufactured by Espressif System [6]. In addition, the firmware used, uses scripting ISSN 2355-0082 programming language. The term NodeMCU literally universal which refers to the firmware used than the NodeMCU hardware development kit can interpreted as the board or the Arduino board ESP8266. Hence, due to its advantages, as well as the possible applications, it is very promising to use Arduino based devices to design early warning fire detection system for home monitoring. Figure 2 depicts the diagram of ESP 8266 hardware.
My Structure Query Language (MySQL) is one of Database Management Systems (DBMS) that is widely known among database programmers, database administrator and software developers. People are familiar also with other DBMS such as Oracle, MS SQL, and Postgre SQL. MySQL functions to process databases using SQL language. According to [12] MySQL is the most popular and the most widely used DBMS. On the other hand, Java is a widely known programming language, as well as a platform. As a programming language, Java is known as a high level programming language. Java is easy to learn, especially for programmers who are already familiar with C / C ++. Java is an object-oriented programming language which has been considered as the paradigm of future programming language. As a programming language, Java is designed to be reliable and secure. Java is also designed to be able to run on all platforms and various devices [13]. Android is an operating system for Linux-based cellular phones. Android provides an open platform for developers to create their own applications to run on various types of mobile devices [14]. Meanwhile, by using the prototyping system development method, the analysis, design and implementation stages are repeated to produce a complete working system. After conducting analysis and initial design, system implementation is carried out and produces a prototype system. This prototype system will then be evaluated by users to obtain valuable feedbacks from them. These feedbacks will be taken into consideration and its analysis result will be used to provide a basis to form a prototype on the further steps. This iterative process continues until all parties including analysts, users, and sponsor agree with the prototype result [15].
Push notification is an event based mechanism for sending information to client mobile devices. Considered and adjusted use of push notifications can improve the user experience where these push notifications provide information to the user without the user's knowledge or effort. Push notifications can show alerts or generate sounds to notify users of the latest updates. In the research, the push notification process was carried out using a google service, namely Firebase Cloud Messaging [16].
Firebase Cloud Messaging (FCM) formerly called Google Cloud Messaging (GCM), is a free cloud service from Google that allows app developers to send notifications and messages to users across a variety of platforms, including Android, iOS and web applications. FCM allows software developers to send push notifications for their applications to end users through an application programming interface (API). Push notifications are popular on mobile devices because they conserve battery life, unlike pull notifications, which continually poll the developer's server for new information and can drain a device's battery life. With push notifications, the cloud service acts on behalf of the app and only connects to the mobile device when there are new notifications [17]. FCM Architectural Overview is shown in the image below (Fig 3). Related Works. Several researchers have conducted some studies pertaining to fire detection and monitoring related topic. In the literature, we found at least six (6) papers associated with the aforementioned topic. These six academic papers will be briefly discussed here. First paper was written by Muhammad Dhedy Dwi Putra and Dwi Pramudita [18], in which the development of detection system API based on Internet of Things for home use was comprehensively discussed. Specifically, the objective of their research was to design an IoT-based fire detector to prevent house fires. They used prototyping method in designing their system. The developed system was expected to ISSN 2355-0082 overcome or prevent fires in residents' homes and provide information to homeowners who were using smart-phones, as well as fire alarms so that the residents or the people around the house would know that the house had caught fire, in so doing the residents could evacuate their belongings and could also help extinguish the fire in their homes. Their system was claimed to have a 90% success rate, based on black box testing method. Second paper was written by Herwin Hutapea and Yano Roy Setiawan [19]. The purpose of their research was to design and build an integrated fire alarm system using Arduino, as the main controller. In addition, they also used supporting components such as smoke sensors and heat sensors which were installed in several places that functioned as fire detection. The exhaust fans would light up when the smoke sensor was active to remove smoke from the room. Their system was also equipped with a buzzer that functioned as a warning alarm when the sensor was active, an LCD display that functioned as monitoring system during normal conditions, and when the sensor was active, it displayed the address where the source of the fire occurred. In general, the goal of their research was to make it easier and faster to act on the location of the occurrence of fire detection so that the process of extinguishing and evacuating could be carried out as effective and efficient as possible.
Third paper was written by Haris Isyanto, Deni Alamnda, and Helmy Fahmiansyah [20]. In their study, a fire early detection system was specifically designed using IoT to provide phone notifications and share location to Smartphone in real-time via GPS. The design of their system used a fire sensor, smoke sensor and temperature sensor. In addition, the Ublok Neo 6M GPS module had a special function to send email to share the location of the fire using a GSM SIM 800L module. The Blynk app was utilized to monitor the sensors and send some notifications that appeared on the Smartphone. Based on the testing results, their system had a success rate of 90% for fire alarms, smoke sensors were 91%, temperature sensors were 100%, and call response times were 90%. Fourth paper was written by Artansyah Rahmatan Putra, Triuli Novianti, and Tining Haryanti [21]. The main objective of their research was to develop an IoT prototype of fire detection system and light controlling. For more detailed explanations, the developed system combined fire and electrical short circuit monitoring systems and lighting control in the home with Smartphone controls that could remotely control and tell whether the lights on the Smartphone were on or off. The system was designed to detect an electrical short circuit and therefore automatically disconnect the power supply. To detect the presence of fire automatically using a fire/fire sensor, the system would be able to detect a fire, read the light intensity using infrared rays on the sensor, and if a fire was detected, a notification would appear on the Smartphone. Furthermore, their study used Arduino uno, esp8266 WiFi module and blynk app (as the controller). Moreover to control the lights, the Blynk app also used to remotely control whether the lights are on or off. Fifth paper was written by Rizqi Sukma Kharisma and Ardi Setiyansah [22]. In this paper, they described the development of fire early warning system using fire sensors, a microcontroller, and also a SMS gateway. The fire early location framework was constructed utilizing smoke, heat, and gas sensors based on SMS system. This framework was utilized to provide data about fire discovery as soon as possible to secure against fire catastrophes. With their framework, the potential and hazard of fire could be diminished. Their framework was further utilized to recognize potential fires that happen in the housing area. Moreover, they did some experiments to test the system that included smoke testing, temperature testing, gas testing, and SMS message testing reactions from different telecommunication providers.
The sixth paper was written by Tatik Juwariay, Sugeng Prayitno, and Akalily Mardhiyya [23]. In the paper, they reported the design of early warning fire detection for preventing housing fires based on ESP8266 and Blynk apps. The purpose of their research was to design an Arduino-based fire early detection system, gas sensor, fire sensor, ESP8266 and a notification system based on the Blynk application on a Smartphone. Their designed system consisted of hardware circuit Arduino Mega2560 microcontroller, an MQ6 gas sensor, a fire sensor and an ESP8266 board as an embedded chip based on WiFi communication. The ESP8266 module was used as a client for the WiFi router. The function of this module was to send and receive information data between the microcontroller and the Smartphone. In the meantime, The Blynk library and the Blynk application support communication as a graphical user interface on Android Smartphone.

II. METHOD
The research method used in this research is described as follows. At first, the literature review study was conducted to determine the design of Arduino Uno technology for IoT implementation and to find supporting theories needed to provide proper ground for this research. A feasibility study was then carried out to find out whether this system is feasible to develop or not, including to review the benefits resulting from the application of the system to be designed and developed. Among various available methods, prototyping method was selected for designing and developing an early warning fire detection system for home monitoring.

A. The Flowchart System
To provide an overview of how the system functions, the following figure depicts the flowchart of the developed system (Fig. 4). From the flowchart it can be seen that IoT will always be in standby state to be able to read the concentration indicators for fire detection including smoke, LPG and CO gas. Each concentration indicator will be measured, whether it exceeds the normal limit or not.

START
If it exceeds the limit, the system will notify the homeowner as a potential fire alarm. All data collected from parameter measurements will be stored in the existing database for further processing.

B. The System Design
The general mechanism of the fire detection system for home monitoring is illustrated in the Figure 5. The followings are the explanations on how the early warning fire detection system is designed. The design of this system can be seen consecutively in Figure 6 and 7.  Early warning fire detection system for home monitoring in the form of a smoke detector sensor (MQ-2) assembled in Arduino is installed in a house.
 Smoke Detector will capture the value of the concentration of certain gases in the air. All concentration values captured are to be stored in a database, via an ESP 8266 device connected to WiFi network.
 When the gas concentration value is above the normal limit which has the potential for fire in the form of a gas leak, the system will provide warning information to the user.
 Information received by homeowners help them to immediately check the various potential fires that may occur.

C. System Implementation
The ESP8266 microcontroller-based early warning fire detection system for home monitoring uses Arduino IDE software, and the application for Android smart phones was written in JAVA and Android Studio IDE. The ESP8266 microcontroller was used in this research due to the following properties: its high durability with stable performance in industrial environments, its wide operating temperature range that supports WiFi, and its compactness in a small package with a microprocessor 32-bit Tensilica, a standard digital peripheral interface, switch antenna, RF balun, power amplifier, low noise receiving amplifier, filter, and power management module [24]. Moreover, this microcontroller also has a powersaving architecture, which results in low power consumption. In particular, the gas-sensitive material used in the MQ2 gas sensor is stannic or tin oxide, formulated as SnO 2 , a material with low electrical conductivity in clean air. The results of the implementation of this early warning fire detection system are summarized in Table 1. At the time of implementation, it was detected that during 46-60 seconds, the LPG value reading was 100 ppm, CO was 170 ppm and the smoke was 20 ppm. Based on the concentration of substances present, the fire detector sensor is able to detect the potential for a fire to occur at home. To prevent fire, the ESP 8266 device is connected to the WiFi network, and then the device will send a notification to the homeowner so that he/she can immediately check his/her house to avoid a fire disaster. The example warning notification to homeowner can be seen in Figure 8.

A. Testing Results
In this study, there are three (3) indicators used as a determinant of whether there is a potential fire in a home, i.e. the content of LPG, CO and smoke. The testing of the early warning fire detection system for home monitoring was performed in a designed environment with a known LPG gas leak. The leak was directed to the fire detector sensor at a distance of 30 cm. The tests were conducted in ten (30) attempts to determine the ability of the system to detect potential fires that occurred. A snapshot of the test results of fire detection system is shown in Figure 9. While the detailed version of the test results can be seen in the table attached in the appendix at the end of this paper. After thirty (30) attempts, it was found that twenty five (25) attempts succeeded in detecting existing substances, and successfully sending information to homeowners. There was five failed trial due to interrupted Internet connection experienced by the NodeMCU ESP8266 which resulted in unsuccessful notification delivery.

B. Conclusions
The results of this study indicate that the Internet of Things (IoT) application in form of the early warning fire detection system based on the Arduino ESP8266 microcontroller is very beneficial for homeowners. For instance, whenever there is a possibility of a fire in their home, the homeowner will be notified as early as possible through the system. In doing so, our early warning fire detection system will make homeowners aware of fires which in turn can prevent the possibility of larger fire occuring. In addition, the test results show a detection success rate of 83%. However, as for future research, it is recommended to consider a more sensitive smoke detection sensor with a capability of detecting gas concentrations in a wider area. Besides, the quality of the Internet connection should be well guaranteed also in support of achieving a high level of success in delivering notifications to homeowners. As a final note, this fire detection system must be housed in a fireproof box for the sensor and IOT devices to function properly.