Efficient energy management in public facilities such as public toilets has become an important challenge in the modern era, especially with the increasing demand for environmental sustainability. In this research, we developed a smart toilet system based on the Internet of Things (IoT) using the ESP32 as the main microcontroller and fuzzy logic methods for intelligent decision-making. This system is equipped with temperature (DHT22), humidity, and distance (HC-SR04) sensors to detect environmental conditions and user presence. Based on this data, the toilet fan and light are automatically controlled to minimize energy consumption. To facilitate real-time monitoring and threshold control, this system is integrated with a Flutter-based application, which provides an intuitive user interface for viewing environmental data and setting temperature, humidity, and distance thresholds. Fuzzy logic is used to determine the fan speed based on temperature and humidity inputs, with the output being a gradual fan speed control. (PWM). The test results show that the system can reduce energy consumption by up to 30% compared to the manual method, especially by reducing the unnecessary device idle time. Additionally, the system has an average response time of 200 ms to send sensor data to the application and receive threshold updates from the user. With this approach, the research shows that the integration of IoT with fuzzy logic provides significant energy efficiency and enhances the user experience. This research also opens up opportunities for further development, such as the integration of machine learning technology for predicting facility usage patterns or the implementation of additional sensors for air quality detection. These findings support the implementation of IoT-based automated systems in public facilities to achieve energy efficiency and environmental sustainability.
                        
                        
                        
                        
                            
                                Copyrights © 2025