# Developing a Fire Monitoring System Based on MQTT, ESP-NOW, and a REM in Industrial Environments
## 4 Experimental Implementation
### Machine Learning Integration for REM Construction  
To enhance the quality of REM optimization, the collected dataset (which includes both localization and RSSI values) is processed using the Extra Tree Regressor (ETR) machine learning algorithm. This regression technique was chosen for its ability to handle large, complex datasets and to accurately predict continuous target variables, like RSSI values [28]. The ETR algorithm performed exceptionally well in predicting signal strength based on the location of the TurtleBot3 within the workspace. The proposed ML-based indoor REM construction framework is shown in Figure 6. By combining machine learning techniques with detailed signal data, the system is able to construct a highly accurate REM that not only depicts areas of high signal strength but also identifies coverage gaps or areas prone to interference.  
Figure 5: 2D map of the test environment at the University of Ulsan.  
The primary objective of REM construction is to optimize multi-hop wireless communications, ensuring reliable data transmissions with minimal packet loss. Based on the REM analysis, the placement of the relay nodes allows for robust signal distributions between different areas of the workspace, with a signal strength threshold of \(-30\) dBm considered optimal for maintaining strong and reliable network performance. By accurately mapping the radio environment, the system is able to improve node placement, enhance signal reliability, and minimize the likelihood of communication failures in challenging environments characterized by interference or physical obstructions. Additionally, integrating advanced tools, such as LiDAR sensors, SLAM algorithms, and machine learning techniques, like the ETR, allows real-time adaptation and improves the network's performance. This combination of technologies reinforces the system's capacity to autonomously navigate complex indoor environments while ensuring efficient and reliable communication between nodes, which is critical for large-scale industrial applications.  
The pseudocode in Algorithm A2 in Appendix A.2 outlines the key steps involved in generating a REM to optimize the placement of ESP32 relay nodes in the fire detection system. REM construction ensures optimal network coverage by analyzing signal strength in different areas of the industrial environment and identifying areas with weak or strong signals. The process begins with the initialization of the TurtleBot3 robot, which is equipped with a Wi-Fi module to measure RSSIs at various points in the environment.  
Additionally, ESP32 modules are initialized as relay nodes that are strategically placed based on the REM to ensure optimal communication coverage. The TurtleBot3 robot is deployed to autonomously navigate the designated workspace within the industrial environment. RSSI data are collected at different positions as the robot moves through the environment, mapping out the signal strengths at various points in the workspace. This data collection is critical for identifying areas with strong and weak signals, which is essential for network optimization. After collecting the RSSI data, they are synchronized with the TurtleBot3's position coordinates to create an accurate map of the wireless environment. The X and Y coordinates corresponding to each RSSI measurement allow precise localization of signal strength variations across the industrial site. The Extra Tree Regressor is applied to the collected RSSI data to generate the REM used to optimize the placement of ESP32 relay nodes in positions that ensure maximum signal coverage and minimal interference. The system verifies the effectiveness of node placements by re-measuring signal strengths. If coverage is not optimal, node placements are adjusted and the process is repeated until the best configuration is achieved.  
Figure 6: The proposed ML-based indoor REM construction framework.