<?xml version="1.0" encoding="UTF-8"?>
<article xmlns:xlink="http://www.w3.org/1999/xlink">
<front><article-meta>
<title-group><article-title>Development of a Gas Sensor Alarm for Domestic and Remote Locations Using Arduino IDE and Node MCU</article-title></title-group>
<contrib-group>
<contrib contrib-type="author"><name><surname>Badathala</surname><given-names>Ganesh</given-names></name><xref ref-type="aff" rid="aff1"/></contrib>
<contrib contrib-type="author"><name><surname>Trivedi</surname><given-names>Khushabu</given-names></name><xref ref-type="aff" rid="aff1"/></contrib>
<contrib contrib-type="author"><name><surname>Aghajafari</surname><given-names>Arian</given-names></name><xref ref-type="aff" rid="aff2"/></contrib>
<aff id="aff1">Department of Mechanical Engineering, School of Engineering, Ajeenkya D. Y. Patil University, Lohegaon, Pune, Maharashtra 412105, India.</aff>
<aff id="aff2">Department of computer Engineering, Ayandegan Institute, Tonekabon, Iran.</aff>
</contrib-group>
<abstract><p>This paper discusses the development of two cost-effective and efficient gas sensor alarm systems utilizing Internet of Things (IoT) technology for domestic and remote monitoring scenarios. Gas leaks and fires are significant threats, particularly in third-world countries, often resulting in loss of life due to inadequate early-warning systems. To address these critical safety issues, this research implements two innovative methodologies. The first approach involves the use of an Arduino microcontroller connected to an MQ-2 gas sensor, providing immediate localized alerts through an alarm system and visual indicators like LEDs. The sensor&apos;s sensitivity threshold is determined experimentally, allowing the device to alert occupants in case of gas leakage or fire promptly. The second approach integrates a NodeMCU microcontroller with cloud services (PushingBox and Pushbullet) to send real-time push notifications to mobile devices irrespective of geographical distance or network constraints. Users receive distinctive alerts for different gas leakage severity levels, enhancing the response time and reducing risks associated with delayed detection. The straightforward setup procedure, combined with readily available components and software libraries, ensures that minimal technical knowledge is required for implementation. Overall, the presented IoT solutions offer a practical, scalable, and affordable means to significantly enhance safety measures in residential and remote environments, potentially saving numerous lives.</p></abstract>
<kwd-group kwd-group-type="author"><kwd>Gas sensor</kwd><kwd>Arduino</kwd><kwd>Node MCU</kwd><kwd>Internet of things</kwd><kwd>Safety alarm</kwd></kwd-group>
</article-meta></front>
<body>
<sec id="sec-1"><label>1</label><title>Introduction</title>
<p>Safety and security at the workplace and home are essential. In third-world countries, fires due to short circuits and gas leakage are significant factors that contribute to the loss of life. It is observed that most of such incidents happen at migrant workers&apos; temporary residences, where the safety of the workers is compromised. Gas leakage is also a significant problem that needs to be addressed, as workers are exposed to harmful and toxic gases like methane and CO while digging wells, cleaning sewage canals, mining, etc.</p>
<p>The human body is sensitive to a variety of harmful gases and dangerous chemicals found in the atmosphere. If the level of gases surpasses the human tolerance limit, a person may be in danger. The quantity of dangerous gases in regions where people live, such as industrial areas, near gas wells, and also in houses, must be detected and measured by a gas detection system. Some of the gases, like methane, are odorless, due to which gross damage may be caused before their influence is detected on the sensory organs. The recent incident in Kuwait resulted in the loss of 49 Indian lives, including a family with 2 children. Investigations of the incident reveal that the fire occurred in the early hours of the day due to a fire in the kitchen that had quickly spread to all the floors of the apartment silently. It is evident that there is always a risk of leakage whenever gas is used, threatening human lives and property <xref ref-type="bibr" rid="ref-1">[1]</xref>, <xref ref-type="bibr" rid="ref-2">[2]</xref>.</p>
<p>The help of technology is needed to prevent these potential dangers in the form of early warning alerts to ensure that enough time is available to prevent potential dangers <xref ref-type="bibr" rid="ref-3">[3]</xref>. In pipelines, gas transfer and gas leakage are inevitable, as there is a necessity for joints and other transmission components. Gas leakage up to a specific mass level can be ignored; however, it is essential to raise an alarm if it surpasses specific threshold values. During training in the oil and gas industry, the problem was mainly identified at the connection of gas valves. Internet of Things (IOT) can be utilized for efficient and easy monitoring of gas leakages continuously and from any distance <xref ref-type="bibr" rid="ref-4">[4]</xref>, <xref ref-type="bibr" rid="ref-5">[5]</xref>.</p>
<p>The Internet of Things is the interworking of physical devices such as household appliances with sensors and network connectivity, electric vehicles, etc., which enable communication and the exchange of data, and perform any action as required. In the past, developing an IOT solution required deep technical expertise across the domains of electronics, networking, and software personnel <xref ref-type="bibr" rid="ref-6">[6]</xref>. Today, the advent of plug-and-play models, cloud integration, and a strong knowledge base in the form of YouTube, ChatGPT, and forums enables individuals or small teams to build scalable, functional IOT products quickly at a low cost. The development of various gadgets working with IOT functionalities ranges from home furnishings to sophisticated industrial machines. Healthcare, Agriculture, Traffic monitoring, Safety management, and environmental monitoring are just a few of the areas where IOT has become more significant <xref ref-type="bibr" rid="ref-7">[7]</xref>. Persistent continuous monitoring without human intervention is required for improving the quality of life. Advanced technologies available today, such as the application of AI, ML, and Edge AI chipsets, have made significant breakthroughs in analyzing, understanding, and taking appropriate action without human intervention <xref ref-type="bibr" rid="ref-8">[8]</xref>, <xref ref-type="bibr" rid="ref-9">[9]</xref>. The following critical factors contributed to the development of IoT science in today’s scenario.</p>
<p>Expensive hardware with limited options, such as storage and computation efficiency, has been replaced by low-cost, highly efficient microcontrollers such as Arduino Uno, ESP32, and Raspberry Pi.</p>
<p>IOT systems in the past were hand-wired, unlike today&apos;s availability of networks to connect through Wi-Fi, BLE, LORA, etc.</p>
<p>Programming IoT projects involved complex C/C++ code without the help of any libraries. Today, the availability of libraries online and simple programming techniques with Arduino IDE, having additional compatibility to connect ESP systems, has empowered developers/freelancers to explore any project and convert it to reality.</p>
<p>IOT projects in earlier days required web development skills, whereas today user-friendly applications and dashboards with drag-and-drop means are available for easy integration between various hardware and software components, as well as with the external environment.</p>
<p>The availability of cheap microcontrollers such as ESP32 and NodeMCU with WIFI and Bluetooth capabilities has given an advantage to the developer to operate things anywhere in the world with the help of Backend as a Service (BAAS) from cloud services.</p>
<p>The time required for development in earlier days would range from weeks to months. In contrast, today, with abundant literature available online, the time required from conceptualization to a realistic product has reduced to days.</p>
<p>This paper presents two types of development of Gas Sensors: 1) a gas sensor operated by an Arduino microcontroller for household security, and 2) a gas sensor operated with NodeMCU to send push notification alarms of gas leakage anywhere in the world, through a third-party application, irrespective of the network. The paper intends to create broad awareness in the development of these IOT projects with minimum hardware and software knowledge <xref ref-type="bibr" rid="ref-10">[10]</xref>.</p>
</sec>
<sec id="sec-2"><label>2</label><title>Methodology</title>
<sec id="sec-3"><label>2.1</label><title>Method 1: Systematic Implementation of MQ-2 Gas Sensor for Real-Time Hazard Detection and Alarm Response</title>
<p>Flow chart, program, and schematic representation of the connection are shown in <xref ref-type="fig" rid="fig1">Figs. 1</xref>-3. The MQ-2 gas sensor is connected to the A0 pin, as sensor values are analog in nature. In contrast, the buzzer is connected to digital pin 7, which responds to alarm the surroundings through control logic in the program. This logic is used by an if statement, which triggers the buzzer if the gas sensor exceeds the threshold value. An LED light can also be connected to pin 13, which will glow if the threshold value is exceeded.</p>
<fig id="fig1"><label>Figure 1</label><caption><p>Flowchart to develop gas sensor system.</p></caption><graphic content-type="pdf-region" xlink:href="pdf-region:2:66,109.8,537.1,500.8"/><p content-type="note">This figure is shown in the PDF version of the article.</p></fig>
<fig id="fig2"><label>Figure 2</label><caption><p>Connections of the MQ-2 gas sensor, buzzer, and LED.</p></caption><graphic content-type="pdf-region" xlink:href="pdf-region:3:66,621.4,537.1,779.1"/><p content-type="note">This figure is shown in the PDF version of the article.</p></fig>
<fig id="fig3"><label>Figure 3</label><caption><p>Arduino program for gas sensor.</p></caption><graphic content-type="pdf-region" xlink:href="pdf-region:3:66,308.9,537.1,607"/><p content-type="note">This figure is shown in the PDF version of the article.</p></fig>
<p>Gas from an incense stick is used for preliminary gas value readings from the serial monitor, primarily to assess the authenticity of the sensor and also to have an idea about the surrounding environment when the incense stick is lit and also in an off condition. The images from <xref ref-type="fig" rid="fig1">Figs. 1</xref>-3 clearly show the on position of the buzzer once the sensor reacts to the gas from the incense stick.</p>
<p>The program shown in <xref ref-type="fig" rid="fig2">Fig. 2</xref> clearly shows the steps to follow to build a gas sensor with Arduino IDE. In the setup function, the A0 pin is only set as an input pin, whereas both pins 7 and 13 are used in the setup function as outputs for buzzer and LED functionality. The serial monitor is involved in this program, which operates with a baud rate of 9600, invoked by Serial. The value of ‘X’ is initialized with gas sensor values. Once the values displayed in the serial monitor are stabilized; an lighted incense stick is brought near the sensor. The sensor value, which typically shows a value of 300-400, is taken as the threshold value. Now the program is altered according to the above value, so that any minute change in the household environment, with the slightest smoke accompanied by fire, can immediately trigger the buzzer and glow the LED light. The buzzer can also be connected to pulse width modulated pins(PWM) such as 3,5,6,9,10,11 so that with the analogWrite function, the buzzer sound can be modulated with low to high intensity. This PWM-based control can be done with the command “analogWrite (3, (60,120,240)) which can alarm the surroundings with low, medium, and high sound depending on the sensor values.</p>
</sec>
<sec id="sec-4"><label>2.2</label><title>Method 2: NodeMCU-based Remote Notification System</title>
<p>In this method, NodeMCU is used for sending push notifications to a mobile. This notification message is set explicitly to a separate unique ringtone to signify the alert and to create a signal of danger whenever this is displayed on a mobile. This method can be of outstanding importance as it can operate irrespective of the network.</p>
<p>An application such as pushingbox.com is opened, and the pop-up MY SERVICES icon is selected. In addition, under MY SERVICES, the Pushbullet app is also selected. It is required to open the Pushbullet app in the browser, log in with Gmail credentials, and once login is completed, an API is generated for the upcoming project. API can be obtained from the API Tokens section of the app.</p>
<p>Again, Pushingbox.com is to be opened, and from the MY SERVICES icon, ADD SERVICE is to be opened. This process enables a new page where you are required to type the title of your project along with the API token. Next, a Scenario is to be created from MY Scenarios, and an appropriate Message has to be typed, which will eventually be displayed on the mobile. The final step is to obtain the Device ID, which is supposed to be incorporated into the program. The sequence of the steps has been clearly represented in the <xref ref-type="fig" rid="fig4">Figs. 4</xref>-8. The entire code of the project is given in the description of the YouTube video, for which the link is given in the reference <xref ref-type="bibr" rid="ref-11">[11]</xref>. This video on sending push notifications for a soil moisture sensor has been altered for fire and smoke alerts using a gas sensor. This video can guide developers to replicate and make this safety device with ease, and also to save valuable human lives.</p>
<fig id="fig4"><label>Figure 4</label><caption><p>Browsing available services on the Pushbullet platform (Step 1).</p></caption><graphic content-type="pdf-region" xlink:href="pdf-region:4:66,211.1,537.1,456.2"/><p content-type="note">This figure is shown in the PDF version of the article.</p></fig>
<fig id="fig5"><label>Figure 5</label><caption><p>Obtain API Token from Pushing Bullet (Step 2).</p></caption><graphic content-type="pdf-region" xlink:href="pdf-region:5:66,521.2,537.1,779.1"/><p content-type="note">This figure is shown in the PDF version of the article.</p></fig>
<fig id="fig6"><label>Figure 6</label><caption><p>Message alert configuration for the proposed scenarios (Step 3).</p></caption><graphic content-type="pdf-region" xlink:href="pdf-region:5:66,215.5,537.1,506.7"/><p content-type="note">This figure is shown in the PDF version of the article.</p></fig>
<fig id="fig7"><label>Figure 7</label><caption><p>Creating a message alert in my scenarios (Step 4).</p></caption><graphic content-type="pdf-region" xlink:href="pdf-region:6:66,534.8,537.1,780.3"/><p content-type="note">This figure is shown in the PDF version of the article.</p></fig>
<fig id="fig8"><label>Figure 8</label><caption><p>Device ID acquisition for program input (Step 5).</p></caption><graphic content-type="pdf-region" xlink:href="pdf-region:6:66,251.9,537.1,520.3"/><p content-type="note">This figure is shown in the PDF version of the article.</p></fig>
<p>To obtain the alerts on mobile devices, the Pushbullet app has to be downloaded from the Play Store on Android devices. Notifications should be enabled in the app after logging in to the application with the same Gmail credentials. Notifications/Messages, such as mild gas, medium gas, and high alerts, can also be added by obtaining individual API tokens and creating scenarios for each message. In this case, all the API tokens can be kept in one single program itself.</p>
</sec>
</sec>
<sec id="sec-5"><label>3</label><title>Conclusion</title>
<p>This paper helps in easy understanding of the development of the Gas sensor alarm system, both in the domestic environment and while away from home, irrespective of internet connection. The hardware components and their integration with software are relatively straightforward. The cost is as little as twenty USD. The Future scope is that entrepreneurs can also manufacture this device with a 3d printing casing, which can fit all the hardware.</p>
</sec>
<sec id="sec-6"><title>Acknowledgments</title>
<p>The authors sincerely appreciate the valuable contributions and support provided throughout this research.</p>
</sec>
<sec id="sec-7"><title>Funding</title>
<p>No specific funding was received for this research.</p>
</sec>
<sec id="sec-8"><title>Data Availability</title>
<p>The data used in this study are available from the corresponding author upon reasonable request.</p>
</sec>
</body>
<back><ref-list><title>References</title>
<ref id="ref-1"><label>1</label><mixed-citation>Anderson, R. N. (2017). &apos;Petroleum Analytics Learning Machine&apos;for optimizing the Internet of Things of today&apos;s digital oil field-to-refinery petroleum system. In 2017 IEEE International Conference on Big Data (Big Data) (pp. 4542-4545). IEEE. <ext-link ext-link-type="uri" xlink:href="https://doi.org/10.1109/BigData.2017.8258496">https://doi.org/10.1109/BigData.2017.8258496</ext-link></mixed-citation></ref>
<ref id="ref-2"><label>2</label><mixed-citation>Abbasi, A., &amp; Hashim, F. M. (2019). Evaluating pressure in deepwater gas pipeline for the prediction of natural gas hydrate formation. Engineering, Technology &amp; Applied Science Research, 9(6), 5033-5036. <ext-link ext-link-type="uri" xlink:href="https://pdfs.semanticscholar.org/27ab/1f48db0a8335d5c29f11af1ad2c31c85e13d.pdf">https://pdfs.semanticscholar.org/27ab/1f48db0a8335d5c29f11af1ad2c31c85e13d.pdf</ext-link></mixed-citation></ref>
<ref id="ref-3"><label>3</label><mixed-citation>Yadav, V., Shukla, A., Bandra, S., Kumar, V., Ansari, U., &amp; Khanna, S. (2016). A review on microcontroller based LPG gas leakage detector. Journal of VLSI Design and Signal Processing, 2(3), 1-10. <ext-link ext-link-type="uri" xlink:href="https://www.academia.edu/download/99844961/230489852.pdf">https://www.academia.edu/download/99844961/230489852.pdf</ext-link></mixed-citation></ref>
<ref id="ref-4"><label>4</label><mixed-citation>Zafar, S., Miraj, G., Baloch, R., Murtaza, D., &amp; Arshad, K. (2018). An IoT based real-time environmental monitoring system using Arduino and cloud service. Engineering, Technology &amp; Applied Science Research, 8(4), 3238-3242. <ext-link ext-link-type="uri" xlink:href="https://pdfs.semanticscholar.org/ccef/9364d35331adb759fc476cf25f33c842a0df.pdf">https://pdfs.semanticscholar.org/ccef/9364d35331adb759fc476cf25f33c842a0df.pdf</ext-link></mixed-citation></ref>
<ref id="ref-5"><label>5</label><mixed-citation>Yadav, G., &amp; Devi, H. M. S. (2017). Arduino based Security System–An Application of IOT. International Journal of Engineering Trends and Technology (IJETT), no. Special, 209-212.</mixed-citation></ref>
<ref id="ref-6"><label>6</label><mixed-citation>Sonoli, D. S., Akash, H., Bhargavi, Y., Dharani, G., &amp; Hiregoudar, A. A. (2022). Harmful Gas Detection and Monitoring system in Industries using IoT. International Journal of Creative Research Thoughts (IJCRT), IJCRT, 10(7).</mixed-citation></ref>
<ref id="ref-7"><label>7</label><mixed-citation>Sharma, V. P., Dugyala, R., Padmavathi, V., &amp; Gurram, V. R. (2023, May). Gas leakage detection system using iot and cloud technology: A review. In E3S Web of Conferences (Vol. 391, p. 01063). EDP Sciences. <ext-link ext-link-type="uri" xlink:href="https://doi.org/10.1051/e3sconf/202339101063">https://doi.org/10.1051/e3sconf/202339101063</ext-link></mixed-citation></ref>
<ref id="ref-8"><label>8</label><mixed-citation>Islam, M. R., Matin, A., Siddiquee, M. S., Hasnain, F. M. S., Rahman, M. H., &amp; Hasan, T. (2020, November). A novel smart gas stove with gas leakage detection and multistage prevention system using iot lora technology. In 2020 IEEE Electric Power and Energy Conference (EPEC) (pp. 1-5). IEEE. <ext-link ext-link-type="uri" xlink:href="https://doi.org/10.1109/EPEC48502.2020.9320109">https://doi.org/10.1109/EPEC48502.2020.9320109</ext-link></mixed-citation></ref>
<ref id="ref-9"><label>9</label><mixed-citation>Yang, H., &amp; Bethge, J. (2022). Applied Edge AI: Deep Learning Outside of the Cloud. Hasso Plattner Institute. <ext-link ext-link-type="uri" xlink:href="https://open.hpi.de/learn/edgeai2022">https://open.hpi.de/learn/edgeai2022</ext-link></mixed-citation></ref>
<ref id="ref-10"><label>10</label><mixed-citation>Mohapatra, H., Mohanta, B. K., Nikoo, M. R., Daneshmand, M., &amp; Gandomi, A. H. (2022). MCDM-based routing for IoT-enabled smart water distribution network. IEEE internet of things journal, 10(5), 4271–4280. <ext-link ext-link-type="uri" xlink:href="https://doi.org/10.1109/JIOT.2022.3216402">https://doi.org/10.1109/JIOT.2022.3216402</ext-link></mixed-citation></ref>
<ref id="ref-11"><label>11</label><mixed-citation>Mohapatra, H., Rath, A. K., &amp; Panda, N. (2022). IoT infrastructure for the accident avoidance: An approach of smart transportation. International Journal of Information Technology, 14(2), 761-768. <ext-link ext-link-type="uri" xlink:href="https://doi.org/10.1007/s41870-022-00872-6">https://doi.org/10.1007/s41870-022-00872-6</ext-link></mixed-citation></ref>
</ref-list></back>
</article>