Next Article in Journal
GDAL and PROJ Libraries Integrated with GRASS GIS for Terrain Modelling of the Georeferenced Raster Image
Previous Article in Journal
How to Bell the Cat? A Theoretical Review of Generative Artificial Intelligence towards Digital Disruption in All Walks of Life
Previous Article in Special Issue
Application and Analysis of Modified Metal-Oxide Memristor Models in Electronic Devices
 
 
Font Type:
Arial Georgia Verdana
Font Size:
Aa Aa Aa
Line Spacing:
Column Width:
Background:
Article

A Gas Leakage Detection Device Based on the Technology of TinyML  †

by
Vasileios Tsoukas
,
Anargyros Gkogkidis
,
Eleni Boumpa
,
Stefanos Papafotikas
and
Athanasios Kakarountas
*
Department of Computer Science and Biomedical Informatics, University of Thessaly, 35 131 Lamia, Greece
*
Author to whom correspondence should be addressed.
This paper is an extended version of our paper published in Gkogkidis, Anargyros, et al. “A TinyML-Based System for Gas Leakage Detection.” 2022 11th International Conference on Modern Circuits and Systems Technologies (MOCAST), 2022, pp. 1–5. IEEE Xplore, https://doi.org/10.1109/MOCAST54814.2022.9837510.
These authors contributed equally to this work.
Technologies 2023, 11(2), 45; https://doi.org/10.3390/technologies11020045
Submission received: 24 January 2023 / Revised: 5 March 2023 / Accepted: 16 March 2023 / Published: 22 March 2023
(This article belongs to the Special Issue MOCAST 2022)

Abstract

:
Internet of Things devices are frequently used as consumer devices to provide digital solutions, such as smart lighting and digital voice-activated assistants, but they are also employed to alert residents in the instance of an emergency. Given the increasingly costly nature of present neural network systems, it is necessary to transport information to the cloud for intelligent machine analysis. TinyML is a potential technology that has been presented by the research world for building fully independent and safe devices that can gather, analyze, and produce data, without transferring it to distant organizations. This paper describes a gas leakage detection system based on TinyML. The proposed solution can be programmed to identify anomalies and warn occupants via the utilization of the BLE technology, in addition to an incorporated LCD screen. Experiments have been employed to show and assess two distinct test situations. For the first occasion, the smoke detection test case, the system earned an F1-Score of 0.77, whereas the F1-Score for the ammonia test case was 0.70.

1. Introduction

Indoor Air Quality (IAQ) monitoring is a vital process for persons with health-related difficulties, such as respiratory disorders, and is attracting more scientific interest. Numerous IAQ monitoring systems have been adopted for diverse locations, including homes, clinics, and workspaces over the years [1,2,3,4]. The most installed IAQ monitoring systems rely on Wireless Sensor Networks (WSNs) and Internet of Things (IoT) devices. These systems gather many forms of sensory data in real time and transmit them to the cloud, where they are saved, evaluated, and filtered. However, the security and privacy of the data acquired from smart homes constitute a significant obstacle to the widespread usage of IoT monitoring devices. Consequently, the research community has created alternate and new strategies to reduce the risk of a sensitive information breach [5].
Enabling edge intelligence is one potential method for developing new smart services and devices that are capable of providing machine intelligence in real-time. Utilizing intelligence in edge devices will result in the local processing of data and, as a result, privacy-sensitive processing. Additionally, data results may be accessed in real-time, and, despite the security benefits, the resulting devices may be small, inexpensive, low-power, and autonomous [6].
This paper presents an IAQ system based on Tiny Machine Learning (TinyML) for real-time gas leakage and smoke detection. The system analyzes sensory data at the edge using TinyML technology. Specifically, the proposed system detects anomalies comprising high concentrations of ammonia and/or smoke in an indoor environment. Furthermore, the proposed IAQ system is based on open hardware and freely accessed software tools, allowing reproducibility and low-cost implementation. According to the authors’ knowledge, this is one of the first IAQ systems to be developed using TinyML. In addition, a mobile application was created to improve the alerting and monitoring of inhabitants.
The remainder of the paper is structured as follows: the Section 2 introduces the IAQ mechanism as an aspect of smart homes and presents earlier work regarding IAQ monitoring. Section 3 introduces the TinyML technology. Section 4 presents the hardware and software details of the proposed TinyML-based system, the developed application, and the experiments conducted for the evaluation of the system. Section 5 provides a discussion regarding current and future solutions. Finally, Section 6 summarizes the conclusions of this study and outlines future plans.

2. Smart Home and Air Quality

The research area of smart home technology has attracted the attention of researchers and has advanced over the past few decades. Initially, it was referred to as home automation, but as research in the specific subject has advanced, this nomenclature has evolved into smart homes. Primarily, a smart home is a collection of automated devices installed in residences to enhance the comfort and quality of life for its occupants, and to reduce their effort and time costs in regard to their everyday tasks [7].
While smart home technology was maturing and improving, many works were focused on residents’ assistance, their health monitoring, and their safety, by a variety of in-house smart sensors and smart devices. Active and Assisted Living (AAL) [8] refers to the usage of smart home technologies, aiming at in-house personal well-being and healthcare monitoring. Schieweck et al. [9] presented the most important aspects that have to be considered in an AAL smart home. In Figure 1, the four aspects of AAL smart homes are depicted in a diagram, highlighting their importance in ensuring the best possible quality of life for residents. The socio-technical aspect is depicted as a crucial component in ensuring the optimal monitoring of residents’ healthcare. The socio-ethical aspect is represented by the importance of allowing residents to live in a technologically advanced home, with minimal intrusions into their privacy and daily life. The functionality and data security aspect is emphasized in the diagram, showing the need for the simple and secure administration of daily operations. Finally, the instrumentality aspect is represented by the improvement of IAQ and energy efficiency, as well as a reduction in environmental impact, which is crucial in promoting sustainability and a healthier living environment [10,11].
IAQ is an aspect of AAL smart homes and a very interesting field that many researchers have focused on, as poor IAQ causes various health issues, especially when people are constantly exposed to it. Moreover, the monitoring of IAQ is also expanded to other environments, except homes, as many people spend more than 90% of their daily time indoors, while indoor air pollution is on the top global five environmental health dangers, causing morbidness and mortality [12]. The most common indoor environmental air pollutants that are commonly monitored by various smart home systems include Carbon Oxides (CO 2 and CO) [13], Particulate Matters ( P M 1 , P M 2.5 , and P M 10 ) [4], and Volatile Organic Compounds (VOCs). The aforementioned pollutants are presented in Table 1, with their units and their indoor exposure thresholds.
Despite the fact that the vast majority of smart home implementations involve IoT devices, new and emerging technologies are continuously employed, in order to overcome some or all of the obstacles posed by these devices. Blockchain [17], Federated Learning [18], and TinyML [19], which will be described further in Section 5, are among the technologies being studied to improve the security measures of conventional IoT devices.

Related Systems

Various IAQ and gas detection monitoring systems have been proposed over time, utilizing different types of sensors, architectures, and methods of data processing. In the following paragraphs, a brief description of the various aforementioned systems is provided.
Krayden et al. [20] employed a TinyML approach to improve the Gas Metal–Oxide– Semiconductor (GMOS) sensor results in their work. The proposed system comprises a GMOS sensor detecting ethanol and acetone, an Arduino board, and LEDs that indicate the detection of the gases. Edge Impulse (EI) was utilized for system training, and the network structure consists of 24 features, representing an input layer, 30 neurons, as a hidden layer, 20 neurons, as a hidden layer, and 3 classes, as an output layer. The success rate for the detection of each gas (ethanol, acetone, and no gas) in the test set was 100%. The system resources that were utilized were 1.7 KB of RAM and 19.5 KB of flash memory, while the system’s latency was 1 ms.
Another work [21], proposed a method for detecting dangerous VOCs, e.g., xylene, hexane, acetone, toluene, methanol, and butanol, by using a multichannel GMOS sensor that generates signature responses specific to every organic component. These signatures served as the training data set for a quantified Neural Network (NN) model in EI. Then, the NN model was transformed to an 8-bit integer precision using TensorFlow Lite and deployed to embedded devices. The study’s embedded device is the Wio terminal development platform, an all-in-one solution that consists of a colored LCD screen, a 120 MHz ARM Cortex-M4F microcontroller (MCU), and a wireless network. On the primary sensor module, four distinct sensors, e.g., GM-102B, GM-302B, GM-502B, and GM-702B, are coupled, resulting in accurate gas detection. Except for methanol and butanol, whose signatures were substantially identical and thus misclassified by the system, this investigation obtained a detection rate of 99.8% for distinct gases. In addition, the conversion of the model from a 32-bit floating point to an 8-bit integer precision quantization consumed fewer system resources, while producing almost the same inference, and using 53% less RAM, 52% less flash memory, and 0.01 ms more inference.
Salhi et al. [22] describe a Machine to Machine (M2M) system comprised of various sensors, such as DHT-11 (temperature and humidity), MQ-2 (smoke, Liquefied Petroleum Gas (LPG), and CO), LM35 (flame), and an MG-811 (CO 2 ). All of the sensors are connected to an Arduino Uno R3 board, which uses the Zigbee communication protocol, and transmits the collected data to a Raspberry Pi 3 Model B for additional processing. This study employed supervised Machine Learning (ML) and evaluated six algorithms: logistic regression, linear discriminant analysis, K-Nearest Neighbors (KNN), Classification And Regression Trees (CART), Gaussian Naive Bayes, and Support Vector Machines (SVM). The algorithms with the highest accuracy were the CART algorithm, with 99.93%, and the KNN, with 99.71%. In addition, the system can transmit alerts to a smartphone, display real-time data, and connect to other embedded devices, via the Zigbee communication protocol, in order to trigger potential functions in the event of an incident.
Another study [23] employed an array of eight Metal Oxide–Semiconductor (MOS) sensors with distinct features. This makes the detection more precise when compared to commercially available MOS sensors. Various ML techniques were used to train the proposed system, which detected NO 2 , ethanol, SO 2 , H 2 , and O 2 gases. Then the system is evaluated by various algorithms, such as decision tree, SVM, Naive Bayes, and KNN. The SVM and Naive Bayes algorithms were the only classification algorithms with 100% classification accuracy for single or mixed gases, while the acquisition of the data used UV light at 20 °C, which results in reduced power consumption.
A real-time CO 2 monitoring system proposed by Spachos et al. employs sensor nodes for sensing and relaying data packets across available simple relay nodes that are located at various locations within the building where measurements are collected [24]. All data packets are stored, processed, and monitored by a scalable monitoring system, called MonArch, located in the main control room. The proposed system is able to work in complex indoor situations, due to the plug-and-play nature of the sensor nodes and simple relay nodes, which construct different data packet pathways based on the availability of each relay node. This makes the proposed system robust and capable of real-time data storage and processing, despite environmental interference.
The iAirCO 2 [25] is an IAQ system that measures CO 2 concentrations. The system consists of an MHZ19CO2 sensor connected to an ESP8266 MCU, and is responsible for transmitting encrypted and signed communications to a web server by using Microsoft.Net web services with SSL certification. The received data is stored on an SQL Server, and authorized users can gain access via a smartphone application or a web browser. The iAirCO2 system is designed for use in homes, in which healthcare experts or caregivers can monitor the IAQ, configure the system’s thresholds, and receive extra notifications, such as e-mails, SMS, and notifications on their smartphones.
The authors of study [26] presented an artificial intelligence-based system for the indoor detection of numerous hazardous gases on a remotely driven vehicle (robot). By using the ML methods, such as KNN, SVM, and Softmax regression, the system classifies three dangerous gases; cigarette smoke, flammable ethanol, and the off-flavor of rotting food. The system was trained automatically via MatLab software, and the input vector represents the output characteristics of the three sensors (TGS2620, TGS2603, and TGS2600). In the proposed study, SVM with the TGS2620 sensor, KNN with the TGS2603 sensor, and SVM with the TGS600 sensor were the best combinations of sensors and classifiers in terms of sensitivity, specificity, and accuracy, respectively, with KNN achieving the greatest performance for all three sensors, with 99.33%.
Using various ML algorithms, Taheri et al. [27] created a model to estimate CO 2 concentrations in a campus classroom, while the following six algorithms were modified and compared: SVM, AdaBoost, random forest, gradient boosting, logical regression, and multilayer perceptron. The multilayered perceptron network outperformed the other algorithms, and was employed in the final system that could re-adjust the ventilation system’s settings in real-time. This resulted in a reduction in the total energy consumption of heating, ventilation, and air conditioning systems by 51.4%.
The study [28] describes an IoT device with low-cost sensors, used for monitoring and managing air quality. By using Recurrent Neural Network (RNN) models, the system detects CO, O 3 , and NO 2 , and enhances their detection accuracies. The IoT device was used for sensing and detection, and is comprised of an Arduino Mega 2560 board, a NodeMCU Wi-Fi chip, and gas sensors. The IoT device transmits the acquired data to the Google cloud, where a personal computer performs the data preprocessing, while the processed data are used as the training input for the Artificially Intelligent (AI) model. The proposed study combined four types of RNN models, resulting in the superior performance of the testing set when compared to a single RNN. Additionally, the proposed system includes a retraining procedure to improve model performance stability. The results of the models for the gases were as follows: CO:0.73; O 3 :0.51; NO 2 :0.37.

3. The Technology of TinyML

The vast majority of IoT systems are still not intelligent, and those employing ML models capture and transmit data to the cloud for further assessment [29,30]. The reason for communicating data to a distant entity depends on the sort of procedure the data must undergo [31]. The vast and intricate structure of algorithms and ML models [32] requires additional processing resources and computing power than a modest IoT device can provide. This results in an enormous amount of information that the gadget cannot store. IoT devices are configured to interact via wireless communication protocols with other intelligent devices. Frequently, the knowledge being communicated is not protected, and the systems are perceived to lack basic security safeguards [33,34,35].
TinyML, which intends to bring machine learning to the forefront by enabling the application of deep learning models to low-power microcontrollers [36], finds the issues described earlier to be particularly pertinent. As IoT devices become more complicated and are entrusted with conducting more advanced analyses, the issues associated with networking, security, and decision-making become more pressing. These devices frequently operate in resource-constrained contexts, with limited power, memory, and computing capability. This makes it more difficult to guarantee a reliable connection, prevent security breaches, and fine-tune the system architecture for each device. In contrast, TinyML necessitates models that can operate offline and with little latency, independent of cloud services. As a result, tackling the issues presented by IoT technology is crucial for the widespread acceptance and success of TinyML across a variety of applications.
NNs have a propensity to include multiple parameters, with multiple redundancies in the models, ultimately resulting in more computing and memory requirements than necessary [37]. As noted previously, TinyML is a framework that enables ML models to run on restricted hardware without sacrificing energy efficiency [38]. To enable ML inference on devices with low resources, particularly MCUs, the models under discussion must be optimized and compressed. Refining methodologies and ML models is a difficult problem. As explained previously, it is not only a software-based issue; rather, hardware and software co-design is required to achieve the desired outcome [39]. Recent research also reveals the initial attempts to improve deep reinforcement learning for resource-constrained devices [40].
The technology under consideration could become an area of study that dramatically alters how programmers address the creation of creative and secure applications presently [17,41,42,43,44]. Notifying a user of a suspected gas leak or heightened risk is important, and there should be no risk of communication overhead or disruptions. These gadgets will perform real-time processing and notify householders, without the necessity of transferring data, ushering in a new paradigm of autonomous devices that are the equivalents of credit cards, and that require just the availability of battery power.
TinyML’s use in the proposed system, which will be explained in greater detail in the following section, is crucial, because it enables the implementation of machine learning models into compact and energy-efficient hardware. This enables the detection and processing of gas leaks in real time, without the need to transfer data to a remote cloud server for processing. The system is designed to collect, analyze, and extract data directly, resulting in more private and secure devices, because the collected data is not shared with other organizations. The TinyML framework enables us to optimize and compress our machine learning models, so that they can run on hardware with limited resources, such as MCUs. By employing techniques such as quantization and pruning, the memory requirements and energy consumption of the models are significantly reduced, making them ideal for devices with limited resources. TinyML is essential to the proposed gas leak detection system, for enabling real-time detection and protecting privacy and security.

4. The TinyML-Based System for Gas Leakage Detection

The suggested system consists of a development board, two gas leak detection sensors, an LCD display that informs the user with text, and a buzzer to be utilized for the detection of excessive amounts of dangerous gases. The core objective was to develop a small, self-contained, cost-effective, and accurate device that could identify a gas leakage and immediately alert the user. The gadget may be placed in a residence in order to allow the detection of the presence of ammonia or smoke, and to inform the residents. When the system is installed in a garage, it may also be used to notify the owner of a vehicle that is leaking LPG. The suggested solution is based on TinyML, a technology that enables the system to run autonomously without an internet connection, connectivity with other systems, or cloud access for data analysis and warnings. This is a significant advantage, as it enables the system to continuously analyze data and issue real-time alerts without network connectivity or delay limits. Additionally, because the solution does not rely on a cloud-based architecture, it is less susceptible to cyber-attacks or data breaches, which can jeopardize the system’s security and potentially risk the occupants’ safety.
In addition, the device is not a conventional Internet of Things device that operates depending on specified elements, such as criteria. Instead, it can be programmed to offer customized results and alerts based on particular factors. For instance, if the system detects an amount of smoke in a home inhabited by smokers, the device will not sound an alarm. The device can be trained to differentiate between instances in which someone is smoking and those in which there is an actual threat, and ultimately alert the homeowners if it detects irregularities in the input data. This level of personalization is made feasible by training the model using data collected on a typical day, which provides the system with a baseline of usual behavior. Consequently, this solution provides a more versatile, adaptive, and secure choice for home security, and it can be tailored to fit the specific requirements of each household.

4.1. Hardware

The Nano 33 BLE Sense board from Arduino, a popular and widely-used piece of hardware for creating TinyML applications, was chosen for the proposed system. The board is built on the Nordic Semiconductor nRF52840, which has a 64-MHz 32-bit ARM® CortexTM-M4 processor, 256 KB SRAM, and 1 MB flash memory. It operates at 3.3 V and is 45 × 18 mm, making it one of the smallest boards that are currently available. Additional details are available on the official datasheet for the board [45]. In addition, the board is compliant with the EI development platform used to construct the ML models, which will be explored in further depth in the next section. Initial evaluations involved the MQ-2, MQ-5, and MQ-135 gas sensors.
MQ-2 is a GMOS sensor, and is commonly known as a chemiresistor, due to the fact that it identifies variations in the resistance of the sensing material once the gas is brought into contact with it. Utilizing a simple voltage divider network, gas volumes may be determined. The MQ-2 gas sensor runs at 5 V DC while using around 800 mW. It can detect LPG, smoke, alcohol, propane (C3H8), hydrogen (H2), methane (CH4), and CO concentrations between 200 and 10,000 ppm [46].
The MQ-5 gas sensor is necessary for discovering gas leaks in homes and enterprises. It can detect hydrogen, LPG, carbon monoxide, and alcohol. Owing to the instrument’s high sensitivity and quick response time, instantaneous readings may be acquired. Whenever the gas concentration rises, the output voltage of the gas sensor correspondingly increases [47].
The MQ-135 gas sensor can detect hazardous gases and smoke, including ammonia (NH 3 ), sulfur (S), benzene (C6H6), and carbon dioxide (CO 2 ). This gas sensor, similar to others in the MQ series, has both a digital and an analog output pin. Whenever the level of these gases surpasses a certain threshold, the digital pin swings high. This threshold value is adjustable, using the inbuilt potentiometer. The analog output pin creates an analog signal, which can be utilized in order to determine the concentration of specific gases present in the air. The sensor module operates at 5 V and consumes around 150 mA [48].
The LCD 1602 [49], which has a display format of 16 Characters × 2 Lines, was used to alert the user to messages. In addition, the Arduino’s networking chip allows for the use of wireless protocols for data transfer. When an anomaly is detected, the onboard Bluetooth Low Energy (BLE) module alerts the user through their mobile device. Lastly, a storage-protection box for the device was 3D-printed. Figure 2 displays the system in its assembled state.

4.2. Datasets

Several datasets were generated over the course of two weeks. The Arduino Nano 33 BLE Sense board and the above-listed sensors were utilized for all monitoring periods. Using EI’s data forwarder, a technique that sends data, in real time, to a web platform, the datasets were generated. The cloud infrastructure of the laboratory was employed to store and assess the results. Due to the significant similarity between the MQ-2 and MQ-5 sensors, experiments demonstrated the redundancy of employing all three. The MQ-2 and MQ-135 sensors were chosen, in order to decrease the complexity of the ML model and to improve the system’s performance and efficiency. Figure 3 displays a warning provided by the system’s screen.
The data stored in the cloud infrastructure of the Laboratory were in a time-series format and exceed the 100.000 monitored values. Additionally, the datasets will be stored for further analysis, and, by utilizing the laboratory’s custom repository, they will be available to laboratory members for additional tests and implementations.

4.3. Model Training and Inference

The initial step in training and deploying a model to an MCU utilizing EI is to obtain sensor values via data capture. EI offers a range of data collection methods, such as connecting to devices or uploading files, which can subsequently be utilized to create a unique dataset. This dataset is then used to train the machine learning model for the specified job, such as anomaly detection. Once the dataset has been constructed, the data is preprocessed using several EI processing blocks, including the Flatten processing block. The above-mentioned block prepares the training data by flattening the multidimensional input into a single-dimensional array. The data are then delivered into the anomaly detection learning block, following preprocessing. Anomaly detection is a sort of machine learning method that detects odd data patterns. The anomaly detection learning block is trained to recognize abnormal behavior in the input data, such as unexpected sensor readings. Typically, the block is trained on labeled data, in which abnormal and normal behaviors are explicitly described. Once the block has been trained, it can generate real-time alerts anytime it detects aberrant behavior. The trained model can then be distributed to an MCU using the EI platform. EI supports a range of MCUs, including the Arduino Nano 33 BLE Sense board, and provides deployment tools for the model. Using the aforementioned method, developers can build robust solutions for real-time anomaly detection and alerting in a variety of applications. Figure 4 demonstrates the model’s training procedures as described above.
By incorporating a time-series block that gathered sensor data from MQ-2 and MQ-135 gas sensors, a novel system was generated inside the proposed framework. The flatten processing block was created, in order to allow maximum flexibility in processing sensor inputs, such as temperature, as well as other factors pertinent to the current use case. Figure 5 illustrates multidimensional data, obtained by calculating the average distance between clusters, demonstrating the device’s classification of orange data in real-time using the TinyML inference. The figure’s left side identifies gases related to the MQ-2 sensor, while the right side classifies gases associated with the MQ-135 sensor. According to both the various machine learning techniques for the prediction of IAQ parameters [4] and the restrictions of the open hardware boards, the utilization of the K-Means algorithm was selected, in order to create the anomaly detection block of the learning block. The performance of the model was assessed using the model validation tab in EI. In addition, the generated EI model was transformed into source code that was optimized and made ready for implementation into the Arduino Nano 33 Sense board. Additional experiments were conducted using the Arduino IDE and cloud architecture of the laboratory, in order to identify anomalies in newly collected data.

4.4. Model Evaluation

A case study in a typical household environment, to assess the ability of the TinyML-powered system, was performed, in order to detect changes in IAQ resulting from daily activities. The TinyML-based system was placed in two rooms of a typical household, as depicted in Figure 6, collecting and analyzing data from the daily tasks and activities being carried out by the home’s residents. Specifically, the proposed system was placed in the kitchen (device D1) and in the living room (device D2) of the household. It should be noted that the system’s ability to detect changes in air quality was affected by the presence of rooms’ ventilation, which in some instances resulted in lower values that were not identified in a timely manner. This could potentially be attributed to the device’s placement in the room. Overall, the case study demonstrated the potential of TinyML in addressing practical IAQ issues.
To evaluate the trained models for smoke and ammonia, we considered the frequency of anomalies identified by the proposed system, the fraction of recorded anomalies that were in fact anomalies, and the models’ overall performance, as depicted in Figure 7 and Figure 8. To achieve this, Precision, Recall, and F1-Score were used as performance standards. Regarding to the smoke use case, Precision scored 0.73, Recall was 0.85, and F1-Score was 0.79. The false-negative rate was 12% and the false-positive rate was 36%. The highest difference between the ammonia test case scenarios was the 0.60 point difference in the Recall score. Precision and F1-Score measurements have corresponding values of 0.83 and 0.70. In this test situation, the trials found a 35% false-negative rate and a 21% false-positive rate. Table 2 displays the experimentally determined assessment metrics for the two test scenarios, smoke and ammonia. The results are satisfactory, but there is potential for improvement that could be attained by extra training and enhanced equipment utilization.

4.5. Mobile Application

To establish a more user-friendly system and a more effective warning mechanism, a mobile application was created. The first configuration of the application must be performed by the user. The user must enter the number of rooms containing the gas leak detection gadget. To connect each room to a device, the resident should add the unique ID from each device in the subsequent step. Following the above steps, the program is configured to identify the devices in each room, and warn users accordingly. Every time a device finds a potential gas detection threat, a push-up notification warns the user. The presented information indicates the room and the type of gas detected. Figure 9 depicts a smart home with five rooms, including a kitchen, living room, garage, and two bedrooms. In the scenario depicted in this figure, the user is notified that smoke has been detected in the kitchen. Additional features of the application include a display of the current date, the ability to add additional users, as the residents of each smart home may differ, and a view that acts as a log and displays the potential gas detection identifications, along with the room, the time, and the gas detected.

5. Discussion

By alerting residents in the case of an emergency, current technology improvements could make smart homes even more secure. Despite the fact that IoT devices look appropriate for the above-mentioned cases, they are required to transport vital data to the cloud for additional processing, in order to give intelligent and customized solutions utilizing ML and DL technologies. TinyML is a new technology that provides unsupervised systems, which do not involve a connection to the internet or information transmission, due to their capacity for properly running ML and DL models locally. Several other developing technologies, such as Blockchain and Federated Learning, should also be considered, as their security measures could augment or replace those currently applied in IoT devices. In conclusion, present and emerging methods could collaborate in order to provide a better and, most importantly, safer environment. Furthermore, IAQ systems can be applied not only in smart home environments, but also in various other environments where IAQ is crucial, such as working environments, factories, classrooms, hospitals, etc.

6. Conclusions

This research presents a TinyML-based system for identifying dangerous gas leaks. The proposed device may be configured to recognize and alert residents of potential gas leaks, such as those containing LPG, smoke, alcohol, propane (C3H8), hydrogen (H2), methane (CH 4 ), Carbon Monoxide (CO), ammonia (NH 3 ), sulfur (S), benzene (C6H6), and Carbon Dioxide (CO2). For experiments of this work, the model training involved only ammonia and smoke detection.
As future work, the model will be trained to recognize and alert the leakage of additional hazardous gases. Additionally, the usage of ready-made solutions such as rechargeable Li-On batteries and power banks is investigated, as the proposed system is currently operating by utilizing a set of alkaline batteries. The aforementioned addition will assist into making the system portable and ready to be installed in various locations without electricity, such as a home garage. Furthermore, another subsequent step is to assure the security of both system and data communication to the smartphone. Regarding the system, future efforts will be focused on researching techniques for assuring firmware integrity, and a well-established security protocol will be utilized for data transfer. Lastly, based on the authors’ knowledge, having more sophisticated detectors for the detection of each gas, as opposed to sensors that detect various gases, will enhance user warnings and the displayed results.

Author Contributions

Conceptualization, V.T. and A.G.; methodology, V.T., A.G. and E.B.; software, V.T.; validation, V.T., A.G. and E.B.; investigation, E.B., V.T., S.P. and A.G.; data curation, V.T. and A.G.; writing—original draft preparation, V.T. and A.G.; writing—review and editing, V.T., S.P. and E.B.; visualization, V.T., A.G. and E.B.; supervision, A.K.; project administration, A.K.; funding acquisition, A.K. All authors have read and agreed to the published version of the manuscript.

Funding

This research has been financed by the project “ParICT_CENG: Enhancing ICT research infrastructure in Central Greece to enable processing of Big data from sensor stream, multimedia content, and complex mathematical modeling and simulations” (MIS 5047244) which is implemented under the Action “Reinforcement of the Research and Innovation Infrastructure”, funded by the Operational Programme “Competitiveness, Entrepreneurship and Innovation” (NSRF 2014-2020) and co-financed by Greece and the European Union (European Regional Development Fund).

Institutional Review Board Statement

Not applicable.

Informed Consent Statement

Not applicable.

Data Availability Statement

Not applicable.

Conflicts of Interest

The authors declare no conflict of interest.

Abbreviations

The following abbreviations are used in this manuscript:
AALActive and Assisted Living
ABSAcrylonitrile Butadiene Styrene
AIArtificial Intelligent
BLEBluetooth Low Energy
CARTClassification And Regression Trees
DLDeep Learning
DSPDigital Signal Processing
EIEdge Implulse
GMOSGas Metal Oxide Semiconductor
IAQIndoor Air Quality
IoTInternet of Things
KNNK-Nearest Neighbors
LPGLiquefied Petroleum Gas
M2MMachine to Machine
MCUmicrocontroller
MLMachine Learning
MOSMetal Oxide Semiconductor
NNNeural Network
PMsParticular Matters
RNNRecurrent Neural Network
SVMSupport Vector Machines
TFTensorFlow
TinyMLTiny Machine Learning
VOCsVolatile Organic Compounds
WSNsWireless Sensor Networks

References

  1. Rui, P.; Marques, G.; Ferreira, B.R. Monitoring indoor air quality for enhanced occupational health. J. Med. Syst. 2017, 41, 23. [Google Scholar]
  2. Baqer, S.N.; Mohammed, H.; Albahri, A.S. Development of a real-time monitoring and detection indoor air quality system for intensive care unit and emergency department. Signa Vitae 2023, 19, 77–92. [Google Scholar]
  3. Sreevas, R.; Shanmughasundaram, R.; Vadali, V.S. Development of an IoT based air quality monitoring system. Int. J. Innov. Technol. Explor. Eng. 2019, 8. [Google Scholar] [CrossRef]
  4. Omidvarborna, H.; Kumar, P.; Hayward, J.; Gupta, M.; Nascimento, E.G.S. Low-cost air quality sensing towards smart homes. Atmosphere 2021, 12, 453. [Google Scholar] [CrossRef]
  5. Zhao, Y.; Haddadi, H.; Barnaghi, P. Edge Intelligence for Connected In-home Healthcare: Challenges and Visions. Available online: https://iot.ieee.org/newsletter/march-2021/edge-intelligence-for-connected-in-home-healthcare-challenges-and-visions (accessed on 23 January 2023).
  6. David, R.; Duke, J.; Jain, A.; Reddi, V.J.; Jeffries, N.; Li, J.; Kreeger, N.; Nappier, I.; Natraj, M.; Wang, T.; et al. Tensorflow lite micro: Embedded machine learning for tinyml systems. Proc. Mach. Learn. Syst. 2021, 3, 800–811. [Google Scholar]
  7. Liu, Y.; Uthra, R.A. Bluetooth based smart home control and air monitoring system. Int. J. Adv. Res. Eng. Technol. (IJARET) 2020, 11. [Google Scholar] [CrossRef]
  8. Active and Assisted Living Programme—AAL. Available online: https://www.age-platform.eu/glossary/active-and-assisted-living-programme-aal (accessed on 6 February 2023).
  9. Schieweck, A.; Uhde, E.; Salthammer, T.; Salthammer, L.C.; Morawska, L.; Mazaheri, M.; Kumar, P. Smart homes and the control of indoor air quality. Renew. Sustain. Energy Rev. 2018, 94, 705–718. [Google Scholar] [CrossRef]
  10. Wilson, C.; Hargreaves, T.; Hauxwell-Baldwin, R. Smart homes and their users: A systematic analysis and key challenges. Pers. Ubiquitous Comput. 2015, 19, 463–476. [Google Scholar] [CrossRef] [Green Version]
  11. Marques, G.; Pitarma, R. An indoor monitoring system for ambient assisted living based on internet of things architecture. Int. J. Environ. Res. Public Health 2016, 13, 1152. [Google Scholar] [CrossRef] [Green Version]
  12. Abraham, S.; Li, X. Design of A Low-Cost Wireless Indoor Air Quality Sensor Network System. Int. J. Wirel. Inf. Netw. 2016, 23, 57–65. [Google Scholar] [CrossRef]
  13. Kumar, P.; Imam, B. Footprints of air pollution and changing environment on the sustainability of built infrastructure. Sci. Total Environ. 2013, 444, 85–101. [Google Scholar] [CrossRef] [PubMed] [Green Version]
  14. World Health Organization Guidelines for Indoor Air Quality: Selected Pollutants. Available online: https://www.who.int/publications/i/item/9789289002134 (accessed on 24 February 2023).
  15. EU. Directive 2008/50/EC of the European Parliament and of the Council on Ambient Air Quality and Cleaner Air for Europe. 21 2008.L 152/1 116.2008. 2008. Available online: https://eur-lex.europa.eu/eli/dir/2008/50/oj (accessed on 24 February 2023).
  16. Umweltbundesamt. Beurteilung von Innenraumluftkontaminationen mittels Referenz- und Richtwerten. Bundesgesundheitsblatt 2007, 50, 990–1005. [Google Scholar] [CrossRef]
  17. Tsoukas, V.; Gkogkidis, A.; Kampa, A.; Spathoulas, G.; Kakarountas, A. Blockchain technology in food supply chain: A state of the art. In Proceedings of the 2021 6th South-East Europe Design Automation, Computer Engineering, Computer Networks and Social Media Conference (SEEDA-CECNSM), IEEE, Preveza, Greece, 24–26 September 2021. [Google Scholar]
  18. Bakopoulou, E. Federated Learning for Mobile Data Privacy. Ph.D. Thesis, University of California, Irvine, CA, USA, 2021. [Google Scholar]
  19. Tsoukas, V.; Gkogkidis, A.; Kakarountas, A. Elements of TinyML on Constrained Resource Hardware. In Advances in Computing and Data Sciences: 6th International Conference, ICACDS 2022, Kurnool, India, 22–23 April 2022, Revised Selected Papers, Part II; Springer International Publishing: Cham, Switzerland, 2022. [Google Scholar]
  20. Krayden, A.; Schohet, M.; Shmueli, O.; Shlenkevitch, D.; Blank, T.; Stolyarova, S.; Nemirovsky, Y. CMOS-MEMS Gas Sensor Dubbed GMOS for SelectiveAnalysis of Gases with Tiny Edge Machine Learning. Eng. Proc. 2022, 27, 81. [Google Scholar] [CrossRef]
  21. Shamim, M.Z.M. TinyML Model for Classifying Hazardous Volatile Organic Compounds Using Low-Power Embedded Edge Sensors: Perfecting Factory 5.0 Using Edge AI. IEEE Sens. Lett. 2022, 6, 1–4. [Google Scholar] [CrossRef]
  22. Salhi, L.; Silverston, T.; Yamazaki, T.; Miyoshi, T. Early detection system for gas leakage and fire in smart home using machine learning. In Proceedings of the 2019 IEEE International Conference on Consumer Electronics (ICCE), IEEE, Las Vegas, NV, USA, 11–13 January 2019. [Google Scholar]
  23. Khan, M.A.H.; Thomson, B.; Debnath, R.; Motayed, A.; Rao, M.V. Nanowire-based sensor array for detection of cross-sensitive gases using PCA and machine learning algorithms. IEEE Sens. J. 2020, 20, 6020–6028. [Google Scholar] [CrossRef]
  24. Spachos, P.; Lin, J.; Bannazadeh, H.; Leon-Garcia, A. Smart room monitoring through wireless sensor networks in software defined infrastructures. In Proceedings of the 2015 IEEE 4th International Conference on Cloud Networking (CloudNet), IEEE, Niagara Falls, ON, Canada, 5–7 October 2015. [Google Scholar]
  25. Marques, G.; Ferreira, C.R.; Pitarma, R. Indoor Air Quality Assessment Using a CO2 Monitoring System Based on Internet of Things. J. Med. Syst. 2019, 43, 67. [Google Scholar] [CrossRef]
  26. Wu, Y.; Liu, T.; Ling, S.H.; Szymanski, J.; Zhang, W.; Su, S.W. Air Quality Monitoring for Vulnerable Groups in Residential Environments Using a Multiple Hazard Gas Detector. Sensors 2019, 19, 362. [Google Scholar] [CrossRef] [Green Version]
  27. Taheri, S.; Razban, A. Learning-based CO2 concentration prediction: Application to indoor air quality control using demand-controlled ventilation. Build. Environ. 2021, 205, 108164. [Google Scholar] [CrossRef]
  28. Lai, W.-I.; Chen, Y.-Y.; Sun, J.-H. Ensemble Machine Learning Model for Accurate Air Pollution Detection Using Commercial Gas Sensors. Sensors 2022, 22, 4393. [Google Scholar] [CrossRef]
  29. Shi, W.; Cao, J.; Zhang, Q.; Li, Y.; Xu, L. Edge computing: Vision and challenges. IEEE Internet Things J. 2016, 3, 637–646. [Google Scholar] [CrossRef]
  30. Karageorgopoulou, A.; Tsoukas, V.; Spathoulas, G.; Kakarountas, A.; Koziri, M. Porting the Paillier Algorithm for Homomorphic Encryption on Portable Devices. In Proceedings of the 2023 IEEE International Conference on Consumer Electronics (ICCE), Las Vegas, NV, USA, 6–8 January 2023; pp. 1–5. [Google Scholar] [CrossRef]
  31. Abbas, N.; Zhang, Y.; Taherkordi, A.; Skeie, T. Mobile edge computing: A survey. IEEE Internet Things J. 2017, 5, 450–465. [Google Scholar] [CrossRef] [Green Version]
  32. Tsoukas, V.; Kolomvatsos, K.; Chioktour, V.; Kakarountas, A. A Comparative Assessment of Machine Learning Algorithms for Events Detection. In Proceedings of the 2019 4th South-East Europe Design Automation, Computer Engineering, Computer Networks and Social Media Conference (SEEDA-CECNSM), Piraeus, Greece, 20–22 September 2019; pp. 1–4. [Google Scholar] [CrossRef]
  33. Mao, Y.; You, C.; Zhang, J.; Huang, K.; Letaief, K.B. A survey on mobile edge computing: The communication perspective. IEEE Commun. Surv. Tutor. 2017, 19, 2322–2358. [Google Scholar] [CrossRef] [Green Version]
  34. Wang, S.; Bie, R.; Zhao, F.; Zhang, N.; Cheng, X.; Choi, H.A. Security in wearable communications. IEEE Netw. 2016, 30, 61–67. [Google Scholar] [CrossRef]
  35. Boumpa, E.; Tsoukas, V.; Gkogkidis, A.; Spathoulas, G.; Kakarountas, A. Security and Privacy Concerns for Healthcare Wearable Devices and Emerging Alternative Approaches. In Wireless Mobile Communication and Healthcare: 10th EAI International Conference, MobiHealth 2021, Virtual Event, 13–14 November 2021, Proceedings; Springer International Publishing: Cham, Switzerland, 2022. [Google Scholar]
  36. Tsoukas, V.; Gkogkidis, A.; Kampa, A.; Spathoulas, G.; Kakarountas, A. Enhancing Food Supply Chain Security through the Use of Blockchain and TinyML. Information 2022, 13, 213. [Google Scholar] [CrossRef]
  37. Denil, M.; Shakibi, B.; Dinh, L.; Ranzato, M.; de Freitas, N. Predicting parameters in deep learning. In Proceedings of the 26th International Conference on Neural Information Processing Systems—Volume 2 (NIPS’13), Lake Tahoe, NV, USA, 5–10 December 2013; Curran Associates Inc.: Red Hook, NY, USA, 2013; pp. 2148–2156. [Google Scholar]
  38. Doyu, H.; Morabito, R.; Brachmann, M. A tinymlaas ecosystem for machine learning in iot: Overview and research challenges. In Proceedings of the 2021 International Symposium on VLSI Design, Automation and Test (VLSI-DAT), IEEE, Hsinchu, Taiwan, 19–22 April 2021. [Google Scholar]
  39. Dutta, L.; Bharali, S. Tinyml meets iot: A comprehensive survey. Internet Things 2021, 16, 100461. [Google Scholar] [CrossRef]
  40. Svoboda, F.; Nunes, D.; Alizadeh, M.; Daries, R.; Luo, R.; Mathur, A.; Bhattacharya, S.; Silva, J.S.; Lane, N.D. Resource efficient deep reinforcement learning for acutely constrained tinyML devices. Res. Symp. Tiny Mach. Learn. 2020. Available online: https://openreview.net/forum?id=_vo8DFo9iuB (accessed on 24 February 2023).
  41. Tsoukas, V.; Boumpa, E.; Giannakas, G.; Kakarountas, A. A Review of Machine Learning and TinyML in Healthcare. In Proceedings of the 25th Pan-Hellenic Conference on Informatics (PCI 2021), Volos, Greece, 26–28 November 2021; Association for Computing Machinery: New York, NY, USA, 2022; pp. 69–73. [Google Scholar] [CrossRef]
  42. Han, S.; Pool, J.; Tran, J.; Dally, W.J. Learning both weights and connections for efficient neural networks. In Proceedings of the 28th International Conference on Neural Information Processing Systems—Volume 1 (NIPS’15), Montreal, QC, Canada, 7–12 December 2015; MIT Press: Cambridge, MA, USA, 2015; pp. 1135–1143. [Google Scholar]
  43. Raspberry, P. Available online: https://www.raspberrypi.org/ (accessed on 23 January 2023).
  44. Gkogkidis, A.; Tsoukas, V.; Kakarountas, A. A TinyML-based Alcohol Impairment Detection System for Vehicle Accident Prevention. In Proceedings of the 2022 7th South-East Europe Design Automation, Computer Engineering, Computer Networks and Social Media Conference (SEEDA-CECNSM), IEEE, Ioannina, Greece, 23–25 September 2022. [Google Scholar]
  45. Arduino Nano 33 Datasheet. Available online: https://docs.arduino.cc/resources/datasheets/ABX00031-datasheet.pdf (accessed on 23 January 2023).
  46. Dorcea, D.; Hnatiuc, M.; Lazar, I. Acquisition and Calibration Interface for Gas Sensors. In Proceedings of the 2018 IEEE 24th International Symposium for Design and Technology in Electronic Packaging (SIITME), Iasi, Romania, 25–28 October 2018; pp. 120–123. [Google Scholar] [CrossRef]
  47. Grove—Gas Sensor (MQ5). Available online: https://wiki.seeedstudio.com/Grove-Gas_Sensor-MQ5/ (accessed on 23 January 2023).
  48. MQ-135 Air Quality Gas Sensor Module. Available online: https://quartzcomponents.com/products/mq-135-air-quality-gas-sensor-module (accessed on 23 January 2023).
  49. Specification for LCD Module 1602A-1. Available online: https://www.openhacks.com/uploadsproductos/eone-1602a1.pdf (accessed on 23 January 2023).
Figure 1. The most important aspects of an Active and Assisted Living smart home.
Figure 1. The most important aspects of an Active and Assisted Living smart home.
Technologies 11 00045 g001
Figure 2. The TinyML-based system for gas detection.
Figure 2. The TinyML-based system for gas detection.
Technologies 11 00045 g002
Figure 3. An anomaly detected from the system.
Figure 3. An anomaly detected from the system.
Technologies 11 00045 g003
Figure 4. The Model’s Training Procedure.
Figure 4. The Model’s Training Procedure.
Technologies 11 00045 g004
Figure 5. Data Visualization related to sensors’ data.
Figure 5. Data Visualization related to sensors’ data.
Technologies 11 00045 g005
Figure 6. A typical household environment, used in a case study of the proposed system’s evaluation.
Figure 6. A typical household environment, used in a case study of the proposed system’s evaluation.
Technologies 11 00045 g006
Figure 7. Anomalies related to the smoke test case, as detected by the system.
Figure 7. Anomalies related to the smoke test case, as detected by the system.
Technologies 11 00045 g007
Figure 8. Anomalies related to the ammonia test case, as detected by the system.
Figure 8. Anomalies related to the ammonia test case, as detected by the system.
Technologies 11 00045 g008
Figure 9. The developed mobile application.
Figure 9. The developed mobile application.
Technologies 11 00045 g009
Table 1. The most common indoor environmental air pollutants and their exposure thresholds.
Table 1. The most common indoor environmental air pollutants and their exposure thresholds.
PollutantsIndoor ThresholdsReferences
CO 2 (ppm)<1000 (harmless)[14]
1000–2000 (high)
>2000 (unacceptable)
CO (mg/m 3 )100 (average time 15min)[15]
35 (1 h)
10 (8 h)
7 (24 h)
P M 2.5 (μg/m 3 )10 (a year)[14]
25 (24 h)
P M 10 (μg/m−3)20 (a year)[14]
50 (24 h)
VOCs (mg/m−3)<0.3 (harmless)[16]
0.3–1 (relevant harmless)
1–3 (some harmless)
3–10 (high)
>10 (unacceptable)
Table 2. Evaluation of the trained model.
Table 2. Evaluation of the trained model.
Test CasesPrecisionRecallF1-Score
Smoke0.730.850.79
Ammonia0.830.60.70
Disclaimer/Publisher’s Note: The statements, opinions and data contained in all publications are solely those of the individual author(s) and contributor(s) and not of MDPI and/or the editor(s). MDPI and/or the editor(s) disclaim responsibility for any injury to people or property resulting from any ideas, methods, instructions or products referred to in the content.

Share and Cite

MDPI and ACS Style

Tsoukas, V.; Gkogkidis, A.; Boumpa, E.; Papafotikas, S.; Kakarountas, A. A Gas Leakage Detection Device Based on the Technology of TinyML . Technologies 2023, 11, 45. https://doi.org/10.3390/technologies11020045

AMA Style

Tsoukas V, Gkogkidis A, Boumpa E, Papafotikas S, Kakarountas A. A Gas Leakage Detection Device Based on the Technology of TinyML . Technologies. 2023; 11(2):45. https://doi.org/10.3390/technologies11020045

Chicago/Turabian Style

Tsoukas, Vasileios, Anargyros Gkogkidis, Eleni Boumpa, Stefanos Papafotikas, and Athanasios Kakarountas. 2023. "A Gas Leakage Detection Device Based on the Technology of TinyML " Technologies 11, no. 2: 45. https://doi.org/10.3390/technologies11020045

APA Style

Tsoukas, V., Gkogkidis, A., Boumpa, E., Papafotikas, S., & Kakarountas, A. (2023). A Gas Leakage Detection Device Based on the Technology of TinyML . Technologies, 11(2), 45. https://doi.org/10.3390/technologies11020045

Note that from the first issue of 2016, this journal uses article numbers instead of page numbers. See further details here.

Article Metrics

Back to TopTop