1. Introduction
In recent years, an increase in the frequency of fires in large indoor spaces, such as large-scale logistics warehouses, has increased the loss of life and property. However, when conventional vision-based fire-detection systems are used in such environments, numerous high-resolution cameras and high-performance servers are required to eliminate blind spots, which substantially increases both installation and maintenance costs [
1]. Additionally, conventional ionization-type or photoelectric contact detectors exhibit inherent limitations, including slow responses before smoke reaches the sensor in large spaces and frequent false alarms caused by environmental factors such as dust and humidity [
2].
Hence, various approaches have been investigated. In vision-based detection, deep-learning models, such as convolutional neural networks, have been introduced to enhance detection performance [
3]. Nevertheless, these approaches require high-performance GPU servers or cloud resources to process large volumes of image data and thus do not fundamentally resolve the issue of high deployment costs.
As an alternative, non-vision-based methods using low-cost optical sensors have been actively investigated. Researchers have proposed approaches that measure light emitted in specific wavelength bands during fire events or variations in light intensity caused by smoke using photodiodes or RGB color sensors [
4]. To improve detection reliability, some studies combined UV and IR sensors or analyzed flame flicker frequencies through spectral analysis [
5]. However, such multisensor fusion strategies and complex signal-processing schemes increase both system cost and computational complexity, thus limiting their applicability to compact edge devices.
By contrast, conventional approaches based on simple light-intensity measurements using a single RGB sensor offer lightweight system configurations but are extremely sensitive to changes in the surrounding environment, such as variations in sunlight, flickering of indoor lighting, or movement of people and objects [
6]. Simple threshold-based decision algorithms cannot clearly distinguish actual fire signals from daily environmental noise, thus resulting in reduced reliability and hindering practical deployment [
7].
In this study, we propose an edge-based real-time fire-detection system that integrates the optical characteristics of low-cost RGB sensors with machine-learning techniques. Instead of relying on expensive imaging equipment, the proposed system employs an affordable RGB color sensor to capture subtle light-intensity variation patterns associated with smoke and flames during the early stages of a fire. The acquired data are preprocessed based on temporal variations instead of absolute intensity values, and the resulting patterns are used to train a lightweight machine-learning model. Through this design, the system effectively suppresses environmental interference and enables rapid and accurate fire detection on a resource-constrained edge device.
2. Machine Learning-Based On-Device Smoke and Flame-Detection System
2.1 Experimental environment
To conduct the experiments, a simplified experimental apparatus was constructed, as shown in
Figure 1. The apparatus was fabricated using polycarbonate and measured 120 cm × 50 cm × 30 cm; additionally, a ventilation opening measuring 30 cm × 45 cm was installed at a height of 60 cm from the floor. A heating device was placed at the bottom of the apparatus. The measurement sensor was mounted on the inner wall at a height of 80 cm, and an LED was installed at the top of the apparatus to reproduce lighting conditions similar to those in warehouse environments. Experiments were performed by combusting 4.7 g of paper, 7 g of rubber, and 5 g of fabric.
2.2 System configuration
The proposed system consists of an edge device that integrates an RGB color sensor and a microcontroller, enabling the precise acquisition of optical data from smoke and flames generated during fire events. Additionally, a monitoring system was designed to enable real-time remote analysis and visualization of the acquired data for efficient data management. The overall system architecture is illustrated in
Figure 2.
For data acquisition aimed at indoor fire detection, the ISL29125 RGB light sensor manufactured by SparkFun was employed. This sensor measures the intensities of red, green, and blue wavelength light with a 16-bit resolution and communicates with the controller via the I2C interface. The measurement range was configured to 375 Lux to capture subtle variations in light intensity during the early stages of smoke generation. The XIAO ESP32S3 was selected as the microcontroller. The ESP32S3 features a 32-bit dual-core architecture and operates at a maximum clock speed of 240 MHz, thus rendering it suitable for neural-network inference. Additionally, it includes built-in Wi-Fi and Bluetooth modules, thereby providing excellent extensibility for Internet of Things applications.
For machine-learning implementation, we designed and executed sensor-data acquisition, variation-based preprocessing, and TinyML model inference in an integrated manner using Edge Impulse. To enable real-time monitoring and logging of fire-related events in the field, the MQTT protocol was adopted. Data published through the HiveMQ cloud broker were subscribed to using a Node-RED server and then stored in the MongoDB Atlas. Additionally, the Edge Impulse platform was utilized for machine-learning model training and optimization.
2.3 Data-acquisition method
Data measurement and acquisition were conducted remotely using wireless communication, and the acquired data were visualized using a Node-RED dashboard, as shown in
Figure 3. This interface enabled remote monitoring of real-time variations in RGB sensor data as well as the fire-inference results generated by the edge device. The actual combustion of the test materials is presented in
Figure 4.
2.4 Machine-learning model design
Data acquisition for machine-learning model generation was conducted in an open warehouse-type space that closely resembled an actual fire-detection environment. Under controlled conditions, various combustible materials such as wood, paper, and fabric were burned to acquire 7 h 36 min worth of RGB time-series data. The complete dataset was classified into training and test sets at a ratio of 74:26 for model training and performance evaluation. The acquired data were categorized into three classes: a normal condition without fire (Normal), a condition in which smoke was generated by combustion (Smoke), and a condition in which flames began to appear (Fire).
Figure 5 presents the distribution of the entire training dataset visualized using Data Explorer.
Based on an analysis of the acquired dataset characteristics, we determined the optimal model parameters as follows: A time-series windowing approach was applied to construct the input data. The window size for data segmentation was set to 10,000 ms to capture sustained smoke patterns during fire events, while the window stride was set to 500 ms to achieve a data-augmentation effect. The input layer could accept 30 preprocessed features. The first hidden layer comprised 20 neurons and employed the ReLU activation function to learn nonlinear feature representations. The second hidden layer comprised 10 neurons with the ReLU activation function, followed by a dropout layer with a rate of 25% to prevent overfitting. The final output layer comprised three neurons, and the Softmax function was used for multiclass classification to output the probability of each class (Normal, Smoke, and Fire). To ensure reliable detection, predictions in which the maximum Softmax probability was below 0.6 were regarded as unreliable and not assigned to a specific class; instead, they were classified as uncertain. During training, the categorical cross-entropy loss function was adopted owing to its suitability for multiclass classification, and the Adam optimizer was used. The hyperparameters for model training were set to a learning rate of 0.0005, a batch size of 32, and 50 epochs. The overall neural-network architecture is shown in
Figure 6.
3. Experimental Results and Discussion
3.1 Analysis of experimental results
In this study, a machine learning-based analysis algorithm was designed to precisely extract distinctive fire-related patterns from light-intensity data obtained in complex environments. The time-series light-intensity data acquired using the RGB sensor exhibited diverse characteristics depending on the surrounding environmental conditions.
Figure 7 shows the light-intensity patterns observed during daily environmental changes such as flickering indoor lighting and pedestrian movement. These routine events are generally characterized by abrupt and discontinuous variations, whereas the light intensity tends to change gradually during most periods.
Figure 8 presents the data patterns observed under actual smoke-generation conditions. The experimental results indicated that, unlike the case in typical environmental situations, smoke-related signals exhibited relatively small amplitude variations but showed a continuous oscillatory behavior that persisted without interruption for approximately 10 s or longer.
Figure 9 shows the light-intensity variation patterns associated with flame occurrence. Owing to the high luminance of flames, the variation in the sensor data increased significantly, and highly irregular time-series patterns were observed in accordance with the dynamic movement of the flames. The data analysis indicates that simple threshold-based fire-detection methods are inadequate for clearly distinguishing these subtle yet sustained patterns from daily environmental noise. Accordingly, this study extracts fine-grained temporal variations in light intensity based on raw RGB sensor data and trains an artificial-intelligence model using these features. Using this approach, a machine-learning model that can effectively detect nonlinear patterns characteristic of smoke generation was developed.
3.2 Analysis of model training results
To objectively evaluate the performance of the trained model, model assessment was conducted using a separate test dataset that was not included in the training process. The test dataset comprised 1,709 Smoke samples and 3,667 Normal samples. The experimental results showed that the model achieved classification accuracies of 98.3% and 92.2% for the Normal and Smoke classes, respectively. In particular, the confusion-matrix analysis presented in
Table 1 indicates that the missed detection rate, in which smoke was misclassified as a normal condition, was 4.9%. Additionally, the F1 score exceeded 0.9 for both classes, thereby confirming that stable learning was achieved without significant performance degradation caused by data imbalance. By contrast, the Fire class exhibited a relatively low classification accuracy of 42.1%, which is attributable to the limited amount of training data available for this class. However, a detailed analysis of the misclassified samples revealed that the proportion of actual flame events misclassified as Normal was 15.8%, whereas 36.8% were misclassified as Smoke. This result suggests that even when the model does not perfectly distinguish flame-specific characteristics, it tends to recognize such events as hazardous smoke-related conditions instead of as normal states.
To deploy the trained model on the edge device, it was converted into the TensorFlow Lite format optimized for edge environments and deployed on the ESP32S3 microcontroller. The model performance and resource usage are summarized in
Table 2. The model inference time was measured at 1 ms, and the required RAM usage was 3.2 kB, thus indicating that the model can be executed stably on the ESP32S3 microcontroller.
3.3 Application results of proposed on-device-based system
To verify the detection performance of the proposed system, experiments were conducted under four different scenarios by combining daytime and nighttime conditions with lighting on and off, namely daytime-light-off, daytime-light-on, nighttime-light-on, and nighttime-light-off. For a quantitative comparison across scenarios, data were collected under conditions in which 4.7 g of paper was completely combusted in each case.
Figure 10(a) presents the experimental results under the daytime-light-off condition. Smoke was visually observed at approximately 80 s after ignition, and flames appeared at 93 s. Based on the real-time inference results, the system began classifying the state as Smoke at 80.28 s, i.e., immediately after smoke generation, but failed to classify the state as Fire.
Figure 10(b) shows the results under the daytime-light-on condition. In this experiment, smoke was observed at 35 s after ignition, followed by flame generation at 67 s. The edge device continuously detected the Smoke state beginning at 40.2 s, i.e., approximately 5 s after smoke occurrence. However, for the Fire class, inference was performed at approximately 100 s, i.e., approximately 33 s after flame generation.
Figure 10(c) shows the results under the nighttime-light-on condition. In this scenario, smoke was generated at 18 s after ignition, and flames were observed at 100 s. The system temporarily misclassified the state as Fire at 9.9 s. Nevertheless, it subsequently detected the Smoke state stably from 20.1 s onward and correctly inferred the Fire class at 100.5 s, i.e., immediately after flame occurrence.
Figure 10(d) presents the experimental results under the nighttime-light-off condition. Smoke was observed at 46 s after ignition, and flames appeared at 95 s. Based on the inference results, Smoke and Fire were classified beginning from 50.2 and 100 s, respectively. Based on the experimental results of the four scenarios described above,
Table 3 quantitatively summarizes the time difference between the actual event occurrence and the system detection time.
Based on these experiments, the system showed high detection performance for smoke generation under various lighting conditions. By contrast, flame detection exhibited delays or instability in some scenarios. This limitation is attributed to the constrained fire experiments conducted for safety reasons and the resulting insufficient amount of training data for the Fire class. By acquiring additional data from a wider range of environments—including actual fire scenes—and incorporating these data into the training process, the proposed system is expected to achieve rapid and accurate real-time monitoring of both smoke and flames during fire events.
4. Conclusions
In this study, a real-time fire-detection system that operates independently of the cloud infrastructure was implemented by integrating light-intensity variation analysis using an RGB color sensor with machine-learning techniques in an edge-based architecture. Experimental results showed that the proposed system achieved classification accuracies of 98.3% and 92.2% for the Normal and Smoke classes, respectively. In particular, the system recorded a missed detection rate of 4.9% and a minimum response time of 0.28 s for smoke detection, thereby experimentally validating its practical effectiveness. By contrast, flame detection exhibited relatively limited performance, with a classification accuracy of 42.1% under complex lighting conditions and detection delays of up to 33 s in certain scenarios. Based on these findings, the developed system is considered sufficiently effective for the early detection of smoke during the initial stages of a fire, particularly in environments where conventional fire detectors cannot be installed easily or where communication infrastructure is limited, while maintaining low deployment costs. Future investigations may address the identified limitations in flame detection by introducing spectral-analysis techniques to characterize the wavelength properties of smoke and flame phenomena more precisely. Additionally, multisensor fusion approaches can be investigated to minimize false alarms and further enhance detection reliability.