Ecological dry toilet intelligent ventilation and energy scheduling system and method
Patent Information
- Application Number
- CN202610922381.1
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2026-06-25
- Publication Date
- 2026-11-03
AI Technical Summary
Ecological dry toilets have problems such as ammonia, odor, dust and humidity changing significantly with the flow of people. Traditional ventilation control cannot be dynamically adjusted. When the battery is low, critical loads cannot continue to operate. There is a lack of remote access management and security alarm linkage. Multiple toilets are prone to misoperation. Sensor data lacks continuous storage and training data construction.
The system employs a multi-source sensor unit to collect data, an STM32 control unit to connect with the fan and photovoltaic cell management unit, an ESP32 communication unit to enable remote control and alarms, a cloud server to manage permissions and data storage, a predictive control unit to predict ventilation demand based on historical data, an energy dispatching unit to prioritize power supply to the fan, and a SIM900A module to enable telephone alarm linkage.
It enables dynamic adjustment of ventilation based on real-time environmental changes, prioritizes the operation of fans, avoids power consumption by non-critical loads, provides remote access control and security alarm linkage to prevent miscontrol, and provides data foundation to support machine learning.
Smart Images

Figure CN123028388A_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of ventilation technology for ecological dry toilets, and more specifically, to an intelligent ventilation and energy dispatching system and method for ecological dry toilets. Background Technology
[0002] Ecological dry toilets have high application value in rural areas, scenic spots, construction sites, remote areas, and water-scarce areas. Compared with flush toilets, ecological dry toilets have lower dependence on water resources, but the following problems are likely to occur in actual use: The levels of ammonia, odor, dust, and humidity inside the toilet vary significantly with the flow of people, and traditional timed or fixed-level ventilation cannot be dynamically adjusted according to real-time environmental changes. Some eco-friendly dry toilets are powered by photovoltaic panels and batteries, while fans, electric blankets, sensors and communication modules share limited power. When the battery power is insufficient, if there is no load priority control, non-critical loads such as electric blankets may consume power, causing critical ventilation fans to be unable to operate continuously. Existing ventilation control systems mostly rely on local buttons or simple remote switches, and cannot be used for predictive control by combining factors such as temperature and humidity, ammonia levels, particulate matter, pedestrian traffic, weather, photovoltaic power generation, and remaining battery power. When multiple toilets are connected to the remote platform at the same time, ordinary users may accidentally control other toilets, as there is a lack of one-to-one device binding and permission verification mechanism. When an anomaly occurs, existing systems can usually only trigger an alarm locally, making it difficult to create a closed loop between alarm contacts, remote platforms, and telephone dialing. Sensor data is usually only used for real-time display, lacking continuous storage and training data construction mechanisms, and cannot provide a data foundation for subsequent machine learning predictive control. Therefore, it is necessary to propose an intelligent ventilation system and method for ecological dry toilets that can integrate multi-source sensing, predictive control, photovoltaic cell energy scheduling, remote access control and security alarm linkage. Summary of the Invention
[0003] In view of the above-mentioned problems in the existing technology, the purpose of this invention is to provide an intelligent ventilation and energy dispatching system and method for ecological dry toilets.
[0004] To solve the above problems, the technical solution adopted by the present invention is as follows: it includes the following modules: The multi-source sensor unit is used to collect data on temperature, humidity, ammonia concentration, particulate matter concentration, flow of people, water immersion status, auxiliary temperature, and fan feedback status inside the ecological dry toilet. The STM32 data acquisition and control unit is connected to the multi-source sensor unit, the fan speed control unit, the photovoltaic energy management unit, and the electric blanket group control unit, and is used to acquire status data and output fan data. Read photovoltaic cell data and control the electric blanket assembly; The ESP32 communication and edge control unit is connected to the STM32 acquisition control unit via serial communication. It is used to parse the status frames sent by the STM32, provide a local web interface, connect to the cloud server, execute remote commands, and control alarm dialing. The cloud server communicates with the ESP32 and the edge control unit to receive device status, save historical data, manage multiple toilet permissions, issue control commands and alarm contacts. A database storage unit, connected to the cloud server, is used to store real-time status logs and machine learning training data; The predictive control unit is used to predict ventilation demand based on historical environmental data, pedestrian flow data, weather data, and energy data, and to generate recommended fans. ; The energy dispatching unit is used to prioritize power supply to the wind turbine based on the battery state of charge and load power, and to reduce the power supply to the electric blanket group in stages. The web and mobile terminals connect to the cloud server to display the digital twin status, remotely control the fan, view historical data, and manage alarm contacts.
[0005] Preferably, the fan speed control unit uses a percentage-to-speed adjustment mechanism. The start-up mapping, when the wind speed percentage is 0. The value is 0; when the wind speed percentage is between 1 and 100, Calculate using the following formula: ; in, The wind speed percentage set by the user. =0 indicates that the fan is off. =100 indicates the minimum starting speed of the fan. , =1000 indicates the maximum output; The energy dispatching unit controls the number of electric blankets based on the battery state of charge: when the battery state of charge is greater than or equal to 60%, three electric blankets are allowed to work; when the battery state of charge is between 45% and 60%, two electric blankets are allowed to work; when the battery state of charge is between 30% and 45%, one electric blanket is allowed to work; when the battery state of charge is less than 30%, all electric blankets are turned off while the fan is kept running; when the battery state of charge is less than 15%, a low-battery protection mode is entered, and only safety ventilation is maintained.
[0006] Preferably, the prediction control unit uses historical ammonia concentration, temperature, humidity, particulate matter concentration, traffic flow, and fan speed. The system takes weather data, photovoltaic power generation, and battery state of charge as inputs and outputs future ammonia concentration trends, ventilation requirements, battery availability, and recommended fan models. Recommended number of electric blanket sets; increase fan speed in advance when ammonia concentration is predicted to rise above the threshold. When the predicted remaining battery time is insufficient, reduce or turn off the number of electric blanket groups; The ESP32 communication and edge control unit is connected to the SIM900A alarm dialing module, and is controlled via UART communication and AT command set. After receiving an alarm command from the cloud, the ESP32 dials the first alarm contact. If the first alarm contact does not answer within a preset time, it automatically hangs up and dials the second alarm contact. If the first contact rejects the call, is busy, or actively hangs up, it does not automatically dial the second contact. The ESP32 periodically queries the call status using the AT+CLCC command to determine whether the call is connected or unanswered.
[0007] Preferably, the cloud server assigns a unique device number to each toilet, and the mobile terminal entry link includes the device number and access token. The cloud stores the binding relationship between the access token and the device number. When a user sends a query or control request, the cloud verifies whether the device number in the request is consistent with the device number bound to the access token. If they are inconsistent, the control request is rejected and no command is issued to the device. The STM32 data acquisition and control unit periodically collects multi-source data and encapsulates it into STAT: status frames, which are then sent to the ESP32. The status frames include: temperature, humidity, ammonia concentration, PM1.0, PM2.5, PM10, current number of people, daily cumulative number of people, fan on / off status, control mode, fan target speed, displayed speed, fan feedback speed, two DS18B20 temperatures, DS18B20 fault bits, water immersion status, photovoltaic voltage, photovoltaic current, photovoltaic power, daily photovoltaic power generation, battery voltage, battery current, battery state of charge, remaining battery power, energy acquisition fault status, electric blanket group on / off status, number of electric blanket groups allowed to be turned on, current load power, and estimated uptime.
[0008] Preferably, the fan control has three modes: automatic mode, where the system automatically calculates the fan speed based on environmental conditions and prediction results; voice mode, where the system temporarily sets the fan speed based on voice commands; and remote control mode, where the user sets the fan on / off and fan speed via a webpage or mobile device. In remote control mode, the user-set target fan speed has a hold characteristic, and the STM32 automatic strategy feedback value, automatic mode status value, or temporary feedback value must not overwrite the user-set target fan speed unless the user actively switches back to automatic mode or turns off the fan.
[0009] Preferably, the cloud server writes each device status report into the device status log table, recording fields including device number, time, temperature, humidity, ammonia concentration, PM1.0, PM2.5, PM10, current number of people, fan on / off status, fan speed, display speed, fan feedback speed, control mode, water immersion status, photovoltaic voltage, photovoltaic current, photovoltaic power, daily photovoltaic power generation, battery voltage, battery current, battery state of charge, remaining battery power, electric blanket group on / off status, number of electric blanket groups allowed to be turned on, current load power, and estimated operating time. The cloud server also writes temperature, humidity, ammonia concentration, particulate matter concentration, people flow, and fan speed as training data into the training data table, and filters or emptys invalid placeholder values.
[0010] Preferably, the system accesses the weather data for the location of the toilet for the past 7 days, including weather type, highest temperature, lowest temperature, rainfall, sunshine duration, and solar radiation; and corrects the photovoltaic power generation estimate based on weather factors. ,in This refers to the daily power generation on a sunny day. The system determines the number of electric blankets based on weather conditions; when insufficient photovoltaic power generation is predicted in the future and the current state of battery charge is low, the system reduces the number of electric blanket sets in advance to ensure the continuous operation of the wind turbines.
[0011] Preferably, when the machine learning prediction model is unavailable, the cloud is inaccessible, or training data is insufficient, the system automatically switches to rule-based threshold control. This rule-based threshold control includes at least: increasing the fan speed when the ammonia concentration exceeds a set threshold. Increase the number of fans when the current number of people increases. Reduce the number of electric blankets when the battery state of charge decreases; turn off the electric blankets and keep only the fan for safe ventilation when the battery state of charge is below the protection threshold; report the fault status when the fan feedback is abnormal.
[0012] Preferably, the web page provides a digital twin display interface to display the current toilet environment status, fan on / off status and wind speed and feedback rotation speed, people flow statistics, ammonia and humidity and PM environmental historical trends, water immersion status, DS18B20 temperature status, photovoltaic power generation and battery charge status and remaining power and current load, weather and photovoltaic power generation estimation, alarm status and contact persons, and the status of multiple toilet equipment; the digital twin interface serves as the human-machine interaction entry point for equipment status, prediction results and remote control commands.
[0013] A smart ventilation and energy scheduling method for ecological dry toilets includes the following steps: Step 1: The STM32 data acquisition and control unit periodically collects multi-source environmental data, pedestrian flow data, fan feedback data and energy data in the ecological dry toilet; Step 2: Encapsulate the collected data into a STAT: status frame and send it to the ESP32 communication and edge control unit via serial port; Step 3: After parsing the status frame, the ESP32 uploads the status data to the cloud server and provides a local web interface. Step 4: The cloud server writes the status data into the database and predicts future ventilation demand and energy status through the predictive control unit based on historical status data and weather data for the past 7 days. Step 5: Generate recommended wind turbines based on the prediction results. The number of electric blankets allowed to be turned on is determined based on the battery state of charge and the current load power. Step Six: Recommend the fan The control strategy for the electric blanket group is sent to the ESP32, and the ESP32 forwards the control commands to the STM32 for execution.
[0014] Compared with the prior art, the beneficial effects of the present invention are as follows: By combining data from multiple sensors, the air quality, pedestrian flow, equipment status, and energy status inside the eco-friendly dry toilet can be more comprehensively reflected. Through machine learning predictive control, ventilation capacity can be increased in advance before NH3 or human traffic increases, reducing the accumulation of odors and harmful gases. By mapping the fan PWM start-up, the user interface can maintain an intuitive percentage display while ensuring reliable fan start-up in the low-speed zone. By prioritizing the dispatch of photovoltaic cell energy, wind turbine operation is guaranteed when power is insufficient, reducing the consumption of battery power by non-critical loads; By using group control of electric blankets, the comfort load can be reduced in stages, rather than simply cutting off all power; By binding multiple toilet deviceIds with tokens, users can avoid accidentally controlling other toilets. The SIM900A telephone alarm linkage enables a closed loop between the cloud-based alarm contact person and the local dialing execution mechanism; By storing both historical data and training data, a data foundation is provided for subsequent model training, fault analysis, and operational optimization. Improve system safety and maintainability through water immersion, fan feedback, and DS18B20 auxiliary detection.
[0015] XV. Beneficial Effects Compared with the prior art, the present invention has the following beneficial effects: By combining data from multiple sensors, the air quality, pedestrian flow, equipment status, and energy status inside the eco-friendly dry toilet can be more comprehensively reflected. Through machine learning predictive control, ventilation capacity can be increased in advance before NH3 or human traffic increases, reducing the accumulation of odors and harmful gases. By mapping the fan PWM start-up, the user interface can maintain an intuitive percentage display while ensuring reliable fan start-up in the low-speed zone. By prioritizing the dispatch of photovoltaic cell energy, wind turbine operation is guaranteed when power is insufficient, reducing the consumption of battery power by non-critical loads; By using group control of electric blankets, the comfort load can be reduced in stages, rather than simply cutting off all power; By binding multiple toilet deviceIds with tokens, users can avoid accidentally controlling other toilets. The SIM900A telephone alarm linkage enables a closed loop between the cloud-based alarm contact person and the local dialing execution mechanism; By storing both historical data and training data, a data foundation is provided for subsequent model training, fault analysis, and operational optimization. Improve system safety and maintainability through water immersion, fan feedback, and DS18B20 auxiliary detection. Attached Figure Description
[0016] Figure 1 This application provides an architectural block diagram of an intelligent ventilation and energy dispatching system and method for ecological dry toilets. Detailed Implementation
[0017] To enable those skilled in the art to better understand the present invention, the technical solutions of the present invention will be clearly and completely described below with reference to the accompanying drawings of the embodiments of the present invention. Obviously, the described embodiments are only some embodiments of the present invention, and not all embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative effort should fall within the scope of protection of the present invention.
[0018] An intelligent ventilation and energy dispatching system for ecological dry toilets includes the following modules: The multi-source sensor unit is used to collect data on temperature, humidity, ammonia concentration, particulate matter concentration, flow of people, water immersion status, auxiliary temperature, and fan feedback status inside the ecological dry toilet. The STM32 data acquisition and control unit connects to the multi-source sensor unit, fan speed control unit, photovoltaic energy management unit, and electric blanket group control unit to collect status data and output fan data. Read photovoltaic cell data and control the electric blanket assembly; The ESP32 communication and edge control unit connects to the STM32 acquisition and control unit via serial communication. It is used to parse the status frames sent by the STM32, provide a local web interface, connect to the cloud server, execute remote commands, and control alarm dialing. The cloud server communicates with the ESP32 and the edge control unit to receive device status, save historical data, manage multiple toilet permissions, issue control commands, and connect alarm contacts. The database storage unit connects to the cloud server and is used to store real-time status logs and machine learning training data. The predictive control unit is used to predict ventilation demand based on historical environmental data, pedestrian flow data, weather data, and energy data, and to generate recommended fans. ; The energy dispatching unit is used to prioritize power supply to the wind turbine based on the battery state of charge and load power, and to reduce the power supply to the electric blanket group in stages. The system is available on web and mobile devices and connects to a cloud server to display the status of the digital twin, remotely control the fan, view historical data, and manage alarm contacts.
[0019] Furthermore, the fan speed control unit adopts a percentage-to-speed ratio. The start-up mapping, when the wind speed percentage is 0. The value is 0; when the wind speed percentage is between 1 and 100, Calculate using the following formula: ; in, The wind speed percentage set by the user. =0 indicates that the fan is off. =100 indicates the minimum starting speed of the fan. , =1000 indicates the maximum output; The energy dispatching unit controls the number of electric blankets based on the battery's state of charge: when the battery's state of charge is greater than or equal to 60%, three electric blankets are allowed to operate; when the battery's state of charge is between 45% and 60%, two electric blankets are allowed to operate; when the battery's state of charge is between 30% and 45%, one electric blanket is allowed to operate; when the battery's state of charge is less than 30%, all electric blankets are turned off while the fan remains running; when the battery's state of charge is less than 15%, a low-battery protection mode is entered, with only safety ventilation remaining.
[0020] Furthermore, the predictive control unit uses historical ammonia concentration, temperature, humidity, particulate matter concentration, pedestrian traffic, and fan speed data. The system takes weather data, photovoltaic power generation, and battery state of charge as inputs and outputs future ammonia concentration trends, ventilation requirements, battery availability, and recommended fan models. Recommended number of electric blanket sets; increase fan speed in advance when ammonia concentration is predicted to rise above the threshold. When the predicted remaining battery time is insufficient, reduce or turn off the number of electric blanket groups; The ESP32 communication and edge control unit connects to the SIM900A alarm dialing module via UART communication and AT command set control. After receiving an alarm command from the cloud, the ESP32 dials the first alarm contact. If the first alarm contact does not answer within a preset time, it automatically hangs up and dials the second alarm contact. If the first contact rejects the call, is busy, or actively hangs up, it does not automatically dial the second contact. The ESP32 periodically queries the call status using AT+CLCC commands to determine whether the call is connected or unanswered. The ESP32 and STM32 are connected via serial port; the functions of the ESP32 include: Parse the STAT: status frame sent by STM32; Provides local WebServer interfaces, including interfaces for / status, / data, / speed, / fan, / mode, / alarm / test, etc. Connect to the cloud server and periodically perform status reporting; Periodically poll cloud control commands; Execute commands such as remote fan on / off, fan speed adjustment, mode switching, and alarm contact update; Control the SIM900A module to perform alarm dialing; Bypass reporting or forwarding of training data; The SIM900A communicates with the ESP32 via UART, and the connection method is as follows: ESP32GPIO25TX -> SIM900ARX ESP32GPIO26RX <- SIM900ATX Baud Rate: 9600 The ESP32 controls the SIM900A via AT commands, including: Query signal strength: AT+CSQ; Check SIM card status: AT+CPIN?; Query network registration status: AT+CREG?; To make a phone call: ATD phone number; To check call status: AT+CLCC; Hang up the phone: ATH.
[0021] Furthermore, the cloud server assigns a unique device number to each toilet, and the mobile access link contains the device number and access token. The cloud stores the binding relationship between the access token and the device number. When a user sends a query or control request, the cloud verifies whether the device number in the request matches the device number bound to the access token. If they do not match, the control request is rejected and no command is issued to the device. The STM32 data acquisition and control unit periodically collects multi-source data and encapsulates it into STAT: status frames, which are then sent to the ESP32. The status frames include: temperature, humidity, ammonia concentration, PM1.0, PM2.5, PM10, current number of people, daily cumulative number of people, fan on / off status, control mode, fan target speed, displayed speed, fan feedback speed, two DS18B20 temperature readings, DS18B20 fault bit, water immersion status, photovoltaic voltage, photovoltaic current, photovoltaic power, daily photovoltaic power generation, battery voltage, battery current, battery state of charge, remaining battery charge, energy acquisition fault status, electric blanket group on / off status, number of electric blanket groups allowed to be turned on, current load power, and estimated uptime. The cloud server receives status data uploaded by the ESP32 and provides the following functions: Receive POST / api / device / status status reports; Provides a GET / api / device / poll command polling interface; Provides control interfaces for fan switch, fan speed, mode, alarm contact person, and simulated alarm; Use deviceId+token to verify user permissions on the mobile device; Write the status data to the device_status_log history table; Write the training data into the ai_training_data table; Provide a history query interface: GET / api / history?deviceId=...&limit=...; The STM32 periodically acquires data from multiple sources and encapsulates it into a STAT: status frame, which is then sent to the ESP32. The status frame includes at least the following fields: T = Temperature; HUM = Humidity; NH3 = Ammonia Concentration; PM1 = PM1.0; PM2.5 = PM2.5; PM10 = PM10; PPL = Current Number of People; DAY = Daily Cumulative Number of People; FAN = Fan On / Off Status; MODE = Control Mode; SPEED = Fan Target Speed; DISPLAY_SPEED = Display Speed; FAN_RPM = Fan Feedback Speed; DS18B20_1 = First Channel DS18B20 Temperature; DS18B20_2 = Second Channel DS18B20 Temperature; DS18B20 FLT = DS18B20 Fault Bit; WATE R_LEAK = Water immersion status; PV_V = Photovoltaic voltage; PV_I = Photovoltaic current; PV_P = Photovoltaic power; PV_DAY = Daily photovoltaic power generation; BAT_V = Battery voltage; BATI = Battery current; BAT_SOC = Battery SOC; BAT_KWH = Remaining battery capacity; ENERGY_FAULT = Energy harvesting fault status; BLANKET_MASK = Electric blanket group on / off status; BLANKET_GROUPS = Number of electric blanket groups allowed to be turned on; LOAD_W = Current load power; RUN_HOURS = Estimated uptime. After receiving the status frame, the ESP32 parses the fields into structured status data, which is then used for local display, cloud upload, training data construction, and predictive control.
[0022] Furthermore, the wind turbine control has three modes: automatic mode, where the system automatically calculates the wind turbine speed based on environmental conditions and prediction results; voice mode, where the system temporarily sets the wind turbine speed based on voice commands; and remote control mode, where users set the wind turbine on / off and wind speed via a webpage or mobile device. In remote control mode, the target wind speed value set by the user has a hold characteristic; the STM32 automatic strategy feedback value, automatic mode status value, or temporary feedback value must not overwrite the target wind speed set by the user, unless the user actively switches back to automatic mode or turns off the wind turbine. In remote control mode, the target wind speed set by the user has a hold characteristic, that is, the STM32 automatic strategy feedback value, automatic mode status value or temporary feedback value shall not cover the target wind speed set by the user, unless the user actively switches back to automatic mode or turns off the fan. Fan PWM mapping: The webpage and mobile app display wind speed percentage, ranging from 0-100%; the actual PWM output range of the fan is 0-1000. Since the wind turbine cannot reliably start up under low PWM, the following mapping is adopted: When percent=0: PWM=0 When percent is between 1 and 100: PWM = 100 + (percent - 1) × 900 / 99 Where PWM=0 indicates that the fan is off, PWM=100 indicates that the fan starts at its lowest speed, and PWM=1000 indicates that the fan is at its maximum output. Example of correspondence: 0%->PWM0 1%->PWM100 10%->PWM approx. 1825 0%->PWM approx. 545 100%->PWM1000 This solution ensures that the user interface maintains an intuitive display from 0% to 100%, while guaranteeing that the fan can enter a reliable start-up range as soon as the slider leaves 0%. Automatic ventilation rule control: In automatic mode, the system first calculates the basic ventilation requirement based on real-time sensor data; the basic ventilation requirement can be determined by the following factors: NH3 ammonia concentration; humidity; Current number of people and short-term changes in pedestrian flow; PM1.0, PM2.5, PM10; temperature; Submerged in water; Fan feedback status; When NH3 concentration, traffic flow, or humidity increases, increase the fan PWM; when the environment returns to normal and traffic flow decreases, decrease the fan PWM to reduce energy consumption. Machine learning predictive control The system stores historical state data in a database to form training samples; the training samples include: Time characteristics, temperature, humidity, NH3, PM1.0, PM2.5, PM10, pedestrian traffic, fan PWM, fan feedback speed, weather data, photovoltaic power generation, battery SOC, battery remaining charge, electric blanket status. Machine learning models are used to predict the future: Trends in NH3 concentration; Ventilation requirements; Battery life; PWM for fan recommended; Recommended number of electric blanket sets; The predictive control process is as follows: Read recent historical sensor data from the cloud or edge. Based on the weather data of the past 7 days and the current battery SOC; Input the above data into the prediction model; Output future ventilation demand and energy status forecasts; If it is predicted that NH3 will rise above the threshold, the fan PWM will be increased in advance; If the predicted remaining battery time is insufficient, reduce or turn off the number of electric blanket sets. The recommended fan PWM and load strategy will be sent to the ESP32. ESP32 forwards control commands to STM32 for execution; Predictive control as a safety net: When the machine learning model is unavailable, the cloud is inaccessible, or training data is insufficient, the system automatically switches to rule-based threshold control; rule-based threshold control includes at least: Increase the fan PWM when NH3 exceeds the set threshold; Increase the fan PWM when the current number of users increases; Reduce the number of electric blanket sets when the battery SOC decreases; When the battery SOC is below the protection threshold, turn off the electric blanket and keep only the fan running for safe ventilation. When the fan reports an abnormality, the fault status should be reported.
[0023] Furthermore, the cloud server writes each device status report into the device status log table, recording fields including device number, time, temperature, humidity, ammonia concentration, PM1.0, PM2.5, PM10, current number of people, fan on / off status, fan speed, displayed speed, fan feedback speed, control mode, water immersion status, photovoltaic voltage, photovoltaic current, photovoltaic power, daily photovoltaic power generation, battery voltage, battery current, battery state of charge, remaining battery power, electric blanket group on / off status, number of electric blanket groups allowed to be turned on, current load power, and estimated uptime. The cloud server also writes temperature, humidity, ammonia concentration, particulate matter concentration, people flow, and fan speed as training data into the training data table, and filters or emptys invalid placeholder values.
[0024] Furthermore, the system accesses the weather data for the toilet's location for the past 7 days, including weather type, highest temperature, lowest temperature, rainfall, sunshine duration, and solar radiation; and adjusts the photovoltaic power generation estimate based on weather factors. ,in This refers to the daily power generation on a sunny day. The system determines the number of electric blankets based on weather conditions; when insufficient photovoltaic power generation is predicted in the future and the current state of battery charge is low, the system reduces the number of electric blanket sets in advance to ensure the continuous operation of the wind turbines.
[0025] Furthermore, when the machine learning prediction model is unavailable, the cloud is inaccessible, or training data is insufficient, the system automatically switches to rule-based threshold control. Rule-based threshold control includes at least: increasing the fan speed when the ammonia concentration exceeds a set threshold. Increase the number of fans when the current number of people increases. Reduce the number of electric blankets when the battery state of charge decreases; turn off the electric blankets and keep only the fan for safe ventilation when the battery state of charge is below the protection threshold; report the fault status when the fan feedback is abnormal.
[0026] Furthermore, the web page provides a digital twin display interface to show the current toilet environment status, fan on / off status and fan speed and feedback speed, people flow statistics, ammonia and humidity and PM environmental historical trends, water immersion status, DS18B20 temperature status, photovoltaic power generation and battery charge status and remaining power and current load, weather and photovoltaic power generation estimates, alarm status and contact persons, and the status of multiple toilet equipment; the digital twin interface serves as the human-machine interaction entry point for equipment status, prediction results and remote control commands.
[0027] A smart ventilation and energy scheduling method for ecological dry toilets includes the following steps: Step 1: The STM32 data acquisition and control unit periodically collects multi-source environmental data, pedestrian flow data, fan feedback data and energy data in the ecological dry toilet; Step 2: Encapsulate the collected data into a STAT: status frame and send it to the ESP32 communication and edge control unit via serial port; Step 3: After parsing the status frame, the ESP32 uploads the status data to the cloud server and provides a local web interface. Step 4: The cloud server writes the status data into the database and predicts future ventilation demand and energy status through the predictive control unit based on historical status data and weather data for the past 7 days. Step 5: Generate recommended wind turbines based on the prediction results. The number of electric blankets allowed to be turned on is determined based on the battery state of charge and the current load power. Step Six: Recommend the fan The control strategy for the electric blanket group is sent to the ESP32, and the ESP32 forwards the control commands to the STM32 for execution. Furthermore, the predictive control unit executes the predictive control process as follows: It reads recent historical sensor data from the cloud or edge; combines this data with weather data from the past 7 days and the current battery state of charge to input into the predictive model; it outputs predictions of future ammonia concentration trends, ventilation demand, and energy status; if the predicted ammonia concentration will rise above a threshold, it increases the fan speed in advance. If the predicted remaining battery time is insufficient, reduce or turn off the number of electric blanket sets; recommend a fan. The load balancing policy is then sent to the ESP32 for execution. Furthermore, the cloud server assigns a unique device number to each toilet and binds user permissions through the device number and access token. The mobile entry link contains the device number and access token. When a regular user sends a query or control request, the cloud verifies whether the device number in the request matches the device number bound to the access token. If they do not match, the control request is rejected. When a user triggers a simulated alarm, the cloud verifies the user's permissions, sets the alarm status of the corresponding toilet to active, and generates an alarm dialing command. After the ESP32 receives the command, it controls the SIM900A to dial the first contact. If no one answers within a preset time, the call is disconnected and the second contact is dialed. Furthermore, the energy dispatch unit implements grouped reduction of electric blankets based on the battery state of charge: when the battery state of charge is greater than or equal to 60%, 3 groups of electric blankets are allowed to be turned on; when the battery state of charge is between 45% and 60%, 2 groups of electric blankets are allowed to be turned on; when the battery state of charge is between 30% and 45%, 1 group of electric blankets is allowed to be turned on; when the battery state of charge is less than 30%, all electric blankets are turned off and only the fan is protected; when the battery state of charge is less than 15%, the system enters low-battery protection mode and only maintains safe ventilation; when the energy acquisition module fails or cannot read the battery state of charge, the system enters a safety fallback mode and prioritizes turning off the electric blanket groups. Furthermore, the cloud server writes historical status data into the device status log table as historical data storage, and writes temperature, humidity, ammonia concentration, particulate matter concentration, traffic flow and fan speed into the training data table as training data to update the predictive control model; when writing training data, invalid placeholder values are filtered or emptyed, and the temperature placeholder value -99 and the humidity and ammonia concentration placeholder values -1 are not included in the training. Furthermore, the system has three fan control modes: in automatic mode, the system automatically calculates the fan speed based on environmental conditions and prediction results; in voice mode, the system temporarily sets the fan speed based on voice commands; in remote control mode, users can set the fan on / off and fan speed via a webpage or mobile device; in remote control mode, the target fan speed set by the user has a hold characteristic, and the STM32 automatic strategy feedback value, automatic mode status value or temporary feedback value must not overwrite the target fan speed set by the user, unless the user actively switches back to automatic mode or turns off the fan; Furthermore, the system accesses the weather data for the toilet's location for the past 7 days, including weather type, highest temperature, lowest temperature, rainfall, sunshine duration, and solar radiation, and adjusts the photovoltaic power generation estimate based on weather factors. When future photovoltaic power generation is predicted to be insufficient and the current battery state of charge is low, the system reduces the number of electric blanket sets in advance to ensure the continuous operation of the wind turbine; the current load power is calculated according to... Calculation, where , This represents the number of electric blanket units currently allowed to be turned on; the estimated uptime is calculated as follows: Calculation, where Remaining battery power; Furthermore, when the machine learning prediction model is unavailable, the cloud is inaccessible, or training data is insufficient, the system automatically switches to rule-based threshold control: when the ammonia concentration exceeds a set threshold, the fan speed is increased. Increase the number of fans when the current number of people increases. Reduce the number of electric blankets when the battery state of charge decreases; turn off the electric blankets and keep only the fan for safe ventilation when the battery state of charge is below the protection threshold; report the fault status when the fan feedback is abnormal.
[0028] The STM32 microcontroller serves as the local real-time control core and connects to the following modules: Temperature and humidity sensors are used to collect the temperature and humidity inside the toilet. NH3 ammonia sensor, used to collect ammonia concentration in toilets; PM particulate matter sensor, used to collect PM1.0, PM2.5 and PM10; People flow detection sensors are used to count the current number of people, the number of people per hour, and the cumulative number of people per day; Two DS18B20 temperature sensors are used to collect auxiliary temperature data; Water immersion sensor module, digital output, low level indicates water immersion status; The fan PWM output circuit is used to control the fan speed. The fan speed feedback line is used to read the actual fan speed; The photovoltaic controller has an RS485 / Modbus interface for reading photovoltaic and battery data.
[0029] Electric blanket reduction strategy: Set the fan as the priority load and the electric blanket as the load that can be reduced; the grouping strategy for electric blankets is as follows: When SOC >= 60%, 3 sets of electric blankets are allowed to be turned on; when SOC <= 60%, 2 sets of electric blankets are allowed to be turned on; when SOC <= 45%, 1 set of electric blankets is allowed to be turned on. When SOC < 30%, all electric blankets are turned off, and only the fan is kept running. When SOC < 15%, the low-voltage protection is activated, and only safe ventilation is maintained. When the energy harvesting module fails or the battery SOC cannot be read, the system enters a safety fallback state, prioritizing the shutdown of the electric blanket group to prevent non-critical loads from continuously consuming battery power. The system accesses the weather data for the location of the toilet for the past 7 days, including: Weather type, highest temperature, lowest temperature, rainfall, sunshine duration, solar radiation. When it is predicted that future photovoltaic power generation will be insufficient and the current SOC is low, the system will reduce the number of electric blanket sets in advance to ensure the continuous operation of the wind turbine. Alarm linkage method: Contact configuration: The system supports saving alarm contacts individually for each toilet. Each contact includes: Name, Phone Number, Relationship After saving the contacts in the cloud, the contact configuration is sent to the corresponding ESP32 in the toilet; the ESP32 receives the contacts, writes them to local storage, and uses them for subsequent alarm dialing; Simulated alarm dialing: When a user triggers a simulated alarm on a webpage or mobile device, the system performs the following steps: The user sends a simulated alarm request to the cloud, carrying the deviceId in the request; Verify user permissions in the cloud; The cloud will activate the corresponding toilet alarm status; The trigger_alarm_test_call command is generated in the cloud. ESP32 polls cloud commands; After receiving the command, the ESP32 calls the SIM900A to dial the first contact. If the first contact does not answer within 50 seconds, the ESP32 sends an ATH to hang up and dials the second contact. If the first contact person rejects the call, is busy, or hangs up, the second contact person will not be automatically dialed. After the user confirms the alarm, the alarm status is cleared in the cloud and on the ESP32. Alarm dialing status determination: The ESP32 queries the call status periodically via AT+CLCC; when the status indicates that the call has been connected, it will not perform the no-answer forwarding; when the no-answer timeout period is reached and the call is still not connected, the forwarding logic will be executed. Remote access control method for multiple toilets: Each toilet in the system has a unique equipment number: toilet_001toilet_002toilet_003toilet_004toilet_005 The mobile entry link includes deviceId and token: mobile.html?deviceId=toilet_001&token=user_test_001 The cloud stores the binding relationship between the token and the deviceId; when a regular user sends a query or control request, the cloud verifies the binding. Does the deviceId in the request match the deviceId bound to the token? If there is a discrepancy, the control request is rejected and no command is issued to the device; this prevents users from accidentally controlling other toilets by modifying the URL. Data storage and training data construction methods: The cloud server writes each device status report to the device_status_log table; the record fields include: device_idcreated_attemperaturehumiditynh3pm1pm25pm10people_currentfan_onfanspeeddisplay_speedfan_rpmmodemode_codestm32_telemetry_seenalarm_activeds18b20_temperature1ds18b20_temperature2ds18b20_fault_maskwa ter_leakpv_voltagepv_currentpv_powerpv_day_kwhbattery_voltagebattery_currentbattery_socbattery_remaining_kwhenergy_faultblanket_maskblanket_allowed_groupsload_power_wsolar_estimated_kwhenergy_runtime_hours The training data table ai_training_data is used to store machine learning training samples; the training data includes at least: temperaturehumiditynh3_levelpm1pm25pm10people_countfan_speed_percent When writing training data, invalid placeholder values are filtered out or left blank; for example, temperature placeholder value -99 and humidity, NH3 placeholder value -1 are not included in the training. Digital Twins and Remote Presentation: The system's web interface provides a digital twin display interface for showcasing: Current condition of the toilet environment; Fan switch, fan speed, and feedback rotation speed; Crowd statistics; Historical trends of environmental factors such as ammonia, humidity, and PM; Submerged in water; DS18B20 temperature status; Photovoltaic power generation, battery SOC, remaining power, and current load; Weather and photovoltaic power generation estimates; Alarm status and contacts; Status of multiple toilet facilities; The digital twin interface is not used as a separate control core, but rather as a human-machine interface for device status, prediction results, and remote control commands; Example 1: Normal Ventilation Control When the system is in automatic mode, the STM32 collects data on temperature, humidity, NH3, PM, and people flow in the toilet. When the NH3 concentration is within a safe range and the number of people is low, the system maintains a low fan PWM to reduce energy consumption. When an increase in people flow or a rise in NH3 concentration is detected, the system increases the fan PWM and uploads the new status to the cloud via the ESP32. The web page displays the fan speed, NH3 concentration, and environmental status simultaneously. Example 2: Ventilation in advance when NH3 is predicted to rise The cloud reads recent NH3, pedestrian traffic, humidity, and fan PWM data from the device_status_log and inputs them into the prediction model along with current weather and time characteristics. If the model predicts that the NH3 concentration will exceed the set threshold within the next 10 to 30 minutes, the cloud generates a recommended fan PWM in advance. After the ESP32 receives the command, it sends it to the STM32, which increases the fan output, thereby ventilating in advance before the NH3 concentration actually exceeds the limit. Example 3: Prioritize the protection of the fan when the power is low The photovoltaic controller provides the battery SOC to the STM32 via RS485 / Modbus; when the SOC drops below 45%, the STM32 reduces the number of electric blankets allowed from 2 or 3 to 1; when the SOC drops below 30%, all electric blankets are shut down, leaving only the fan, sensors, and communication module running; when the SOC drops below 15%, the system enters a low-power protection mode, retaining only the minimum operating capacity required for safe ventilation; Example 4: Remote control mode maintains the user's target wind speed The user switches to remote control mode on the web interface and drags the wind speed slider to 50%. The web interface maps percent=50 to approximately PWM=545 and sends it to the ESP32 via the cloud or local interface. The ESP32 sends the target PWM to the STM32. Even if the STM32's automatic strategy returns MODE=0 or other automatic wind speed values, the ESP32 and the web interface will maintain the user-set target wind speed until the remote control mode is actively switched, thus preventing the slider from being pulled by the automatic mode. Example 5: Simulated Alarm Dialing The administrator sets two alarm contacts for toilet_001 on the web interface; after saving, the cloud sends the contacts to the corresponding ESP32; when the administrator clicks to simulate an alarm, the cloud sends an alarm dialing command; after receiving the command, the ESP32 controls the SIM900A to dial the first contact; if no one answers within 50 seconds, the call is disconnected and the second contact is dialed; if the first contact refuses to answer or is busy, the dialing process ends and is not forwarded. Example 6: User Access Control for Multiple Toilets User A's mobile phone link is: mobile.html?deviceId=toilet_001&token=user_test_001 The cloud records user_test_001 are only bound to toilet_001; when user A manually changes the link to toilet_002, the cloud finds that the token and deviceId do not match, refuses the query or control request, and does not issue any commands to toilet_002.
[0030] Alternative implementation methods The STM32 can be replaced with other microcontrollers that have multi-channel acquisition and PWM output capabilities; The ESP32 can be replaced with a communication module that has WiFi, cellular or Ethernet communication capabilities; The SIM900A can be replaced with other cellular communication modules that support AT command dialing; The photovoltaic controller can be read via RS485 / Modbus, CAN, UART or other buses; Machine learning models can be deployed in the cloud or at the edge. The number of electric blanket sets is not limited to three and can be expanded according to the actual load. The PWM for fan startup can be adjusted according to the actual fan parameters, and is not limited to 100.
[0031] Those skilled in the art should understand that the discussion of any of the above embodiments is merely exemplary and is not intended to imply that the scope of protection of this application is limited to these examples; within the framework of this application, the technical features of the above embodiments or different embodiments can also be combined, the steps can be implemented in any order, and there are many other variations of different aspects of one or more embodiments of this application as described above, which are not provided in detail for the sake of brevity.
[0032] One or more embodiments in this application are intended to cover all such substitutions, modifications, and variations that fall within the broad scope of this application. Therefore, any omissions, modifications, equivalent substitutions, improvements, etc., made within the spirit and principles of one or more embodiments in this application should be included within the protection scope of this application.
Claims
1. An intelligent ventilation and energy dispatching system for ecological dry toilets, characterized in that, Includes the following modules: The multi-source sensor unit is used to collect data on temperature, humidity, ammonia concentration, particulate matter concentration, flow of people, water immersion status, auxiliary temperature, and fan feedback status inside the ecological dry toilet. The STM32 data acquisition and control unit is connected to the multi-source sensor unit, the fan speed control unit, the photovoltaic energy management unit, and the electric blanket group control unit, and is used to acquire status data and output fan data. Read photovoltaic cell data and control the electric blanket assembly; The ESP32 communication and edge control unit is connected to the STM32 acquisition control unit via serial communication. It is used to parse the status frames sent by the STM32, provide a local web interface, connect to the cloud server, execute remote commands, and control alarm dialing. The cloud server communicates with the ESP32 and the edge control unit to receive device status, save historical data, manage multiple toilet permissions, issue control commands and alarm contacts. A database storage unit, connected to the cloud server, is used to store real-time status logs and machine learning training data; The predictive control unit is used to predict ventilation demand based on historical environmental data, pedestrian flow data, weather data, and energy data, and to generate recommended fans. ; The energy dispatching unit is used to prioritize power supply to the wind turbine based on the battery state of charge and load power, and to reduce the power supply to the electric blanket group in stages. The web and mobile terminals connect to the cloud server to display the digital twin status, remotely control the fan, view historical data, and manage alarm contacts.
2. The intelligent ventilation and energy dispatching system for an ecological dry toilet according to claim 1, characterized in that, The fan speed control unit uses a percentage to... The start-up mapping, when the wind speed percentage is 0. =0; When the wind speed percentage is between 1 and 100 Calculate using the following formula: ; in, The wind speed percentage set by the user. =0 indicates that the fan is off. =100 indicates the minimum starting speed of the fan. , =1000 indicates the maximum output; The energy dispatching unit controls the number of electric blankets based on the battery state of charge: when the battery state of charge is greater than or equal to 60%, three electric blankets are allowed to work; when the battery state of charge is between 45% and 60%, two electric blankets are allowed to work; when the battery state of charge is between 30% and 45%, one electric blanket is allowed to work; when the battery state of charge is less than 30%, all electric blankets are turned off while the fan is kept running; when the battery state of charge is less than 15%, a low-battery protection mode is entered, and only safety ventilation is maintained.
3. The intelligent ventilation and energy dispatching system for an ecological dry toilet according to claim 1, characterized in that, The predictive control unit uses historical ammonia concentration, temperature, humidity, particulate matter concentration, pedestrian traffic, and fan speed data. The system takes weather data, photovoltaic power generation, and battery state of charge as inputs and outputs future ammonia concentration trends, ventilation requirements, battery availability, and recommended fan models. Recommended number of electric blanket sets; increase fan speed in advance when ammonia concentration is predicted to rise above the threshold. When the predicted remaining battery time is insufficient, reduce or turn off the number of electric blanket groups; The ESP32 communication and edge control unit is connected to the SIM900A alarm dialing module, and is controlled via UART communication and AT command set. After receiving an alarm command from the cloud, the ESP32 dials the first alarm contact. If the first alarm contact does not answer within a preset time, it automatically hangs up and dials the second alarm contact. If the first contact rejects the call, is busy, or actively hangs up, it does not automatically dial the second contact. The ESP32 periodically queries the call status using the AT+CLCC command to determine whether the call is connected or unanswered.
4. The intelligent ventilation and energy dispatching system for an ecological dry toilet according to claim 1, characterized in that, The cloud server assigns a unique device number to each toilet. The mobile terminal entry link contains the device number and an access token. The cloud stores the binding relationship between the access token and the device number. When a user sends a query or control request, the cloud verifies whether the device number in the request matches the device number bound to the access token. If they do not match, the control request is rejected and no command is issued to the device. The STM32 data acquisition and control unit periodically collects multi-source data and encapsulates it into STAT: status frames, which are then sent to the ESP32. The status frames include: temperature, humidity, ammonia concentration, PM1.0, PM2.5, PM10, current number of people, daily cumulative number of people, fan on / off status, control mode, fan target speed, displayed speed, fan feedback speed, two DS18B20 temperatures, DS18B20 fault bits, water immersion status, photovoltaic voltage, photovoltaic current, photovoltaic power, daily photovoltaic power generation, battery voltage, battery current, battery state of charge, remaining battery power, energy acquisition fault status, electric blanket group on / off status, number of electric blanket groups allowed to be turned on, current load power, and estimated uptime.
5. The intelligent ventilation and energy dispatching system for an ecological dry toilet according to claim 1, characterized in that, The fan control has three modes: automatic mode, where the system automatically calculates the fan speed based on environmental conditions and prediction results; voice mode, where the system temporarily sets the fan speed based on voice commands; and remote control mode, where users set the fan on / off and fan speed via a webpage or mobile device. In remote control mode, the user-set target fan speed has a hold characteristic; the STM32 automatic strategy feedback value, automatic mode status value, or temporary feedback value must not overwrite the user-set target fan speed unless the user actively switches back to automatic mode or turns off the fan.
6. The intelligent ventilation and energy dispatching system for an ecological dry toilet according to claim 1, characterized in that, The cloud server writes each device status report into the device status log table. The recorded fields include device number, time, temperature, humidity, ammonia concentration, PM1.0, PM2.5, PM10, current number of people, fan switch status, fan speed, displayed speed, fan feedback speed, control mode, water immersion status, photovoltaic voltage, photovoltaic current, photovoltaic power, daily photovoltaic power generation, battery voltage, battery current, battery state of charge, remaining battery power, electric blanket group switch status, number of electric blanket groups allowed to be turned on, current load power, and estimated operating time. The cloud server also writes temperature, humidity, ammonia concentration, particulate matter concentration, pedestrian traffic and fan speed into the training data table, and filters or emptys invalid placeholder values.
7. The intelligent ventilation and energy dispatching system for an ecological dry toilet according to claim 1, characterized in that, The system accesses the weather data for the past 7 days for the location of the toilet, including weather type, highest temperature, lowest temperature, rainfall, sunshine duration, and solar radiation; it then corrects the photovoltaic power generation estimate based on weather factors. ,in This refers to the daily power generation on a sunny day. The system determines the number of electric blankets based on weather conditions; when insufficient photovoltaic power generation is predicted in the future and the current state of battery charge is low, the system reduces the number of electric blanket sets in advance to ensure the continuous operation of the wind turbine.
8. The intelligent ventilation and energy dispatching system for an ecological dry toilet according to claim 1, characterized in that, When the machine learning prediction model is unavailable, the cloud is inaccessible, or training data is insufficient, the system automatically switches to rule-based threshold control. This rule-based threshold control includes at least: increasing the fan speed when the ammonia concentration exceeds a set threshold. Increase the number of fans when the current number of people increases. Reduce the number of electric blankets when the battery state of charge decreases; turn off the electric blankets and keep only the fan for safe ventilation when the battery state of charge is below the protection threshold; report the fault status when the fan feedback is abnormal.
9. The intelligent ventilation and energy dispatching system for an ecological dry toilet according to claim 1, characterized in that, The web interface provides a digital twin display interface to show the current toilet environment status, fan on / off status and speed and feedback rotation speed, people flow statistics, ammonia and humidity and PM environmental historical trends, water immersion status, DS18B20 temperature status, photovoltaic power generation and battery charge status and remaining power and current load, weather and photovoltaic power generation estimates, alarm status and contact persons, and the status of multiple toilet devices; the digital twin interface serves as the human-machine interaction entry point for device status, prediction results and remote control commands.
10. A method for intelligent ventilation and energy dispatching of an ecological dry toilet, comprising an intelligent ventilation and energy dispatching system for an ecological dry toilet according to any one of claims 1-9, characterized in that, The process includes the following steps: Step 1: The STM32 data acquisition and control unit periodically acquires multi-source environmental data, pedestrian flow data, fan feedback data, and energy data within the ecological dry toilet; Step 2: Encapsulate the collected data into a STAT: status frame and send it to the ESP32 communication and edge control unit via serial port; Step 3: After parsing the status frame, the ESP32 uploads the status data to the cloud server and provides a local web interface. Step 4: The cloud server writes the status data into the database and predicts future ventilation demand and energy status through the predictive control unit based on historical status data and weather data for the past 7 days. Step 5: Generate recommended wind turbines based on the prediction results. The number of electric blankets allowed to be turned on is determined based on the battery state of charge and the current load power. Step Six: Recommend the fan The control strategy for the electric blanket group is sent to the ESP32, and the ESP32 forwards the control commands to the STM32 for execution.
