STM32-based portable indoor environment detector

Through the STM32-based portable indoor environment detector, combined with a variety of sensors and intelligent scheduling systems, the existing equipment has solved the problems of low detection accuracy, single functions and slow response, and the accurate detection and remote control of a variety of gases are realized, which improves the equipment's response speed and user experience.

CN120275461APending Publication Date: 2025-07-08CHONGQING UNIV OF TECH
View PDF 0 Cites 3 Cited by

Patent Information

Application Number
CN202510575633.3
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-05-06
Publication Date
2025-07-08

AI Technical Summary

Technical Problem

The existing portable indoor gas detection equipment has limited detection accuracy, is easily disturbed by environmental factors, has a single function, and cannot fully monitor the indoor environment, data transmission is not real-time, can not be remotely controlled, has a slow response speed, and cannot detect changes in gas concentration in time.

Method used

The STM32 main control module, multiple sensor modules, OLED display modules, communication modules and client control modules are adopted, combined with Kalman filtering technology and adaptive intelligent task scheduling system, realize accurate detection of multiple gases, real-time display and remote control, improve gas transmission efficiency through the small gas chamber structure, and use spectrum monitoring circuits to ensure data transmission stability, and integrate buzzer modules to alarm.

Benefits of technology

It realizes accurate detection of various gases such as formaldehyde, benzene and alcohol, reduces equipment energy consumption, improves response speed and detection accuracy, ensures the stability and accuracy of data transmission, provides convenient multimodal interaction and intuitive information display, and supports remote monitoring and control.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120275461A_ABST
    Figure CN120275461A_ABST
Patent Text Reader

Abstract

The invention discloses a portable indoor environment detector based on STM32. The portable indoor environment detector comprises a hardware module and a software module, the hardware module comprises a main control module, a sensor module and a display module; the software module comprises a communication module and a client control module; the sensor and gas molecules are subjected to physical and chemical reaction to generate electric signal change, and electric signals with different amplitudes are generated according to different concentrations and transmitted to the main control module; the main control module obtains a target gas concentration value through an analog-to-digital conversion function and through preprocessing and mode recognition of the electric signal, and transmits the target gas concentration value to the display module and the client control module through the communication module; and after receiving the target concentration value, the client control module transmits the target concentration value to the Ali cloud platform, displays data and a real-time curve on a Web visual interface for a user to check, and can control the start and stop of a gas detection function at the same time. According to the invention, high-precision detection of a plurality of common harmful gases is realized, and the rapid response capability is realized.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the technical field of indoor environment detection, and particularly to a portable indoor environment detector based on STM32. Background Art

[0002] In modern life, the safety of the indoor environment is crucial for people's health. Many common gases, such as formaldehyde, benzene, and alcohol, can cause serious harm to the human body if their concentrations exceed the standard in the indoor environment. As a common indoor pollutant, long-term exposure to formaldehyde can lead to respiratory diseases, cancer, etc.; benzene series substances can affect the human hematopoietic system and cause blood diseases; alcohol poses a fire hazard in specific scenarios, such as when there are a large number of flammable items indoors and the alcohol volatilization concentration is too high. However, it is often difficult for people to intuitively understand the concentration of these gases in the room and take effective measures in a timely manner to ensure their own safety.

[0003] Traditional indoor gas detection technologies mainly rely on professional large-scale detection equipment. These devices usually use complex chemical analysis methods or high-precision instruments for detection, such as gas chromatography-mass spectrometry (GC-MS) instruments. Their advantage is high detection accuracy, which can accurately analyze the components and concentrations of multiple gases and is widely used in laboratories or professional testing institutions. However, this technical solution has many disadvantages. First, the equipment is large in size and expensive, making it difficult for ordinary families and small places to afford. Second, the operation is complex and requires professional technicians for operation and maintenance, which limits its use in ordinary scenarios. Moreover, these devices usually do not have portability and cannot detect the indoor environment at any time and place, failing to meet people's daily needs for real-time monitoring of the indoor environment. In addition, the detection time is long and the detection results cannot be given quickly, resulting in a poor user experience for users who need to know the indoor gas conditions in a timely manner.

[0004] With the development of technology, some existing portable gas detection devices have gradually entered the market. Compared with traditional large-scale devices, these devices are smaller in size and more convenient to carry. Some products can also detect common indoor harmful gases, such as formaldehyde and benzene. For example, some portable detectors based on electrochemical sensors or semiconductor sensors can quickly detect the concentration of specific gases and display the data through a simple display screen. Their advantages are relatively low price and relatively simple operation, making them suitable for ordinary users. However, the existing technology also has obvious deficiencies. On the one hand, the detection accuracy is limited and is easily affected by environmental factors. For example, changes in temperature and humidity will affect the performance of the sensors, resulting in inaccurate detection results. On the other hand, most portable devices have relatively single functions and can only detect one or a few gases, unable to comprehensively monitor the indoor environment. Moreover, there are defects in data transmission and remote monitoring, and the detection data cannot be uploaded to the cloud in real time, making it difficult for users to remotely view and control, and unable to meet the needs of modern people for intelligent and convenient life. In addition, the response speed of existing devices also needs to be improved. They cannot detect changes in gas concentration in a timely manner and cannot quickly respond to some emergency situations such as sudden gas leaks.

[0005] Therefore, neither traditional technology nor existing technology can fully meet the needs of indoor environment detection. Summary of the Invention

[0006] Based on the above content, the present application discloses a portable indoor environment detector based on STM32, including a hardware module and a software module;

[0007] The hardware module includes: a main control module, a sensor module and a display module; the software module includes a communication module and a client control module;

[0008] Obtain the change in the electrical signal generated by the physical and chemical reaction between the sensor and gas molecules. Different concentrations generate electrical signals with different amplitudes and transmit them to the main control module;

[0009] The main control module receives the concentration electrical signal transmitted by the sensor module, converts it into an actual concentration value through the analog-to-digital conversion function, removes noise through Kalman filter processing to obtain the target concentration value, and transmits it to the display module and the client control module through the communication module;

[0010] After receiving the target concentration value, the display module displays the target concentration value in real time on the OLED screen, and the OLED screen supports blue, white and yellow three-color display;

[0011] After receiving the target concentration value, the client control module transmits the target concentration value to the Alibaba Cloud platform to control the start and stop of the gas detection function, and displays the data and real-time curve on the Web visualization interface for users to view.

[0012] Preferably, the sensor module includes, but is not limited to, a formaldehyde sensor module, a benzene sensor module, and an alcohol sensor module;

[0013] The sensor module detects gas molecules in the environment through a low-power sensor. The gas molecules are adsorbed on SnO2 on the surface of the sensor, and the adsorbed gas molecules react with the SnO2 surface in an oxidation-reduction reaction, causing the conductivity of the sensor to increase with the increase in gas concentration. The gas concentration is converted into a concentration electrical signal for real-time sampling.

[0014] Preferably, the conversion of the obtained gas concentration into a concentration electrical signal is specifically as follows:

[0015] Gas molecules in the environment detected by the sensor are adsorbed on SnO2 on the surface of the sensor, triggering an oxidation-reduction reaction and changing the conductivity of the sensor. By obtaining the voltage signal V of the sensor out a concentration electrical signal is obtained, and the formula is: where V CC is the circuit supply voltage, R s is the resistance value of the sensor at the current gas concentration, R s is the load resistance, R L is the series load resistance, R X is the adjustable resistance. The dynamic change of the adjustable resistance R X can compensate for the influence of environmental factors on the detection result in real time by dynamically adjusting according to the environmental temperature and humidity.

[0016] Preferably, the portable indoor environment detector further includes a gas collection module; the gas collection module adopts a small air chamber structure; the small air chamber structure adds a section of air chamber between the sensor probe and the air hole. Before the gas molecules enter the sensor, they will first gather in the small air chamber, forming a certain concentration gradient. Through the aggregation effect, the sensor can detect enough gas molecules in a shorter time, which helps to trigger the sensor response faster.

[0017] Preferably, the small air chamber structure uses a Teflon tube as the small air chamber material; the Teflon tube has a smooth surface and no pores, a very low friction coefficient, and a very low surface energy, making the interaction force between the gas molecules and the Teflon tube surface weak, and it is difficult for gas molecules to gather and adsorb on the tube wall surface, improving the gas transmission efficiency.

[0018] Preferably, the main control module performs multitasking scheduling of hardware and software through an adaptive intelligent task scheduling system;

[0019] In terms of hardware, by connecting the sensor module, communication module, display module and client control module, the operating status and power consumption requirements of each module are monitored, and the dynamic power consumption adjustment circuit is used to automatically adjust the working frequency and voltage between modules;

[0020] At the software level, the task priorities are dynamically allocated through the task priority dynamic allocation mechanism of the adaptive intelligent task scheduling system; when multiple task requests are to be processed, the task priority dynamic allocation mechanism dynamically allocates task priorities according to the urgency of the tasks, the amount of data processing, and the resource occupancy of the adaptive intelligent task scheduling system. When the gas concentration data acquisition and transmission tasks occur simultaneously, if it is detected that the gas concentration is approaching the threshold, the priority of the acquisition task will be increased and processed first to ensure the timeliness of the data.

[0021] Preferably, the communication module can scan the signal strength and interference of the surrounding WiFi bands in real time through the spectrum monitoring circuit, and automatically select the optimal communication channel; the communication module ensures the integrity and accuracy of data transmission through the data caching and retransmission mechanism. When the network has a short-term fluctuation or packet loss, the communication module automatically caches the data that has not been successfully transmitted and retransmits it according to the priority after the network recovers, realizing a stable, efficient and secure communication connection with the Alibaba Cloud server and the Web visualization application.

[0022] Preferably, the display module includes an ambient light sensor and a touch sensing module; the ambient light sensor can automatically adjust the brightness and contrast of the OLED screen according to the ambient light intensity collected by the sensor to ensure clear display under different lighting conditions; when the touch sensing module detects a user operation, it quickly switches the display page according to the touch position and gesture instructions, realizing the switch from the real-time concentration display page to the historical data comparison page. At the same time, for the display of gas concentration data, through the color gradient coding mechanism, according to different gas concentration ranges, continuous color gradients are used to visually distinguish, enabling users to intuitively obtain gas concentration information.

[0023] Preferably, the client control module issues control instructions through the Alibaba Cloud platform for remote control. The user transmits the control instructions to the main control module to control the gas collection of the sensor module.

[0024] Preferably, the hardware module further includes a buzzer module. The buzzer module receives the gas concentration exceeding standard signal transmitted from the main control module and outputs an alarm signal to the display module; when the gas concentration is approaching the safety threshold, the buzzer emits intermittent sounds at a lower frequency; when the gas concentration seriously exceeds the standard, the driving frequency is quickly increased to achieve an accurate match between the sound frequency and the gas danger level.

[0025] Compared with the prior art, the technical solution of this application has the following technical effects:

[0026] The present invention realizes the accurate detection of various gases such as formaldehyde, benzene and alcohol. By means of the oxidation-reduction reaction between gas molecules and the surface of SnO2 through the sensor, combined with a unique voltage signal conversion formula, the gas concentration can be accurately converted into a concentration electrical signal. The main control module uses advanced analog-to-digital conversion and Kalman filtering technologies to further remove noise interference and obtain an accurate target concentration value. The display module then presents this data in real time on an OLED screen that supports three-color display, and automatically adjusts the screen brightness and contrast in conjunction with the ambient light sensor to ensure that users can clearly obtain information under different lighting conditions.

[0027] The adaptive intelligent task scheduling system of the main control module of the present invention greatly improves the overall performance of the device. At the hardware level, by connecting each module and monitoring its operating status and power consumption requirements, it uses a dynamic power consumption adjustment circuit to automatically adjust the operating frequencies and voltages between modules, effectively reducing the device's power consumption and extending the battery life. At the software level, the task priority dynamic allocation mechanism intelligently allocates task priorities according to the urgency of tasks, the amount of data processing, and the system resource occupancy, enabling each module to work in coordination, improving the device's operating efficiency, avoiding resource waste, and enabling the detector to operate stably and efficiently in a complex working environment.

[0028] The spectrum monitoring circuit and data caching and retransmission mechanism of the communication module of the present invention ensure the stability, integrity and accuracy of data transmission. It can real-time scan the signal strength and interference situation of the surrounding WiFi frequency bands, automatically screen the optimal communication channel to ensure that data transmission is not interfered. When network fluctuations or packet losses occur, it automatically caches the data that has not been successfully transmitted and retransmits it according to the priority after the network recovers. At the same time, in combination with the Alibaba Cloud platform, the client control module realizes the remote control function. Users can view real-time data and curves through the Web visualization interface and also issue control commands to remotely control the gas collection of the sensor module.

[0029] The multi-modal interaction design of the touch sensing module integrated in the display module of the present invention and the client control module brings a convenient operation experience to users. The touch sensing module can quickly switch the display page according to the user's touch position and gesture commands, switching from the real-time concentration display page to the historical data comparison page, facilitating users to view the gas concentration changes at different times. For gas concentration data, a color gradient coding mechanism is adopted to intuitively distinguish different concentration ranges, enabling users to quickly understand the danger level of gas concentration without complex interpretation. This multi-modal interaction and intuitive information display method improve the usability of the device, enabling users of different ages and technical levels to easily operate and understand the detection results.

[0030] The above description is only an overview of the technical solution of this application. In order to understand the technical means of this application more clearly, so that it can be implemented according to the content of the specification, and in order to make the above and other purposes, features and advantages of this application more obvious and understandable, the following takes the preferred embodiments of this application and combines the drawings to describe in detail as follows.

[0031] Based on the following detailed description of the specific embodiments of this application in combination with the drawings, those skilled in the art will be more clear about the above and other purposes, advantages and features of this application. Brief Description of the Drawings

[0032] In order to more clearly illustrate the technical solutions in the embodiments of this application or in the prior art, the following will briefly introduce the drawings required for use in the description of the embodiments or the prior art. Obviously, the drawings in the following description are some embodiments of this application. For those of ordinary skill in the art, without creative efforts, other drawings can also be obtained based on these drawings. In all the drawings, similar elements or parts are generally identified by similar reference numerals. In the drawings, the elements or parts are not necessarily drawn to scale.

[0033] Figure 1 It is a structural diagram of a portable indoor environment detector based on STM32;

[0034] Figure 2 It is a data upload flow chart of the portable indoor environment detector;

[0035] Figure 3 It is a sensor response curve graph and a sensor sensitivity characteristic curve graph;

[0036] Figure 4 It is a comparison graph of the Kalman filtering results of the alcohol gas concentration of the present invention;

[0037] Figure 5 It is an OLED screen display diagram of the portable indoor environment detector of the present invention;

[0038] Figure 6 It is a Web visualization interface diagram of the portable indoor environment detector of the present invention. Detailed Description of the Specific Embodiments

[0039] To make the objectives, technical solutions, and advantages of the embodiments of this application clearer, the technical solutions in the embodiments of this application will be clearly and completely described below with reference to the accompanying drawings in the embodiments of this application. Apparently, the described embodiments are some, but not all, of the embodiments of this application. In the following description, specific details such as specific configurations and components are provided only to assist in a comprehensive understanding of the embodiments of this application. Therefore, those skilled in the art should clearly understand that various changes and modifications can be made to the embodiments described here without departing from the scope and spirit of this application. Additionally, descriptions of known functions and configurations are omitted for clarity and conciseness in the embodiments.

[0040] It should be understood that the term "one embodiment" or "this embodiment" mentioned throughout the specification means that a specific feature, structure, or characteristic related to the embodiment is included in at least one embodiment of this application. Therefore, the appearances of the term "one embodiment" or "this embodiment" throughout the specification do not necessarily refer to the same embodiment. Furthermore, these specific features, structures, or characteristics can be combined in one or more embodiments in any suitable manner.

[0041] In addition, this application may repeat reference numerals and / or letters in different instances. This repetition is for the purpose of simplicity and clarity and does not in itself indicate the relationship between the various embodiments and / or arrangements discussed.

[0042] The term "and / or" in this document is merely a description of the associated relationship of the associated objects, indicating that three relationships can exist. For example, A and / or B can represent: A exists alone, B exists alone, and both A and B exist simultaneously. The term " / and" in this document describes another associated object relationship, indicating that two relationships can exist. For example, A / and B can represent: A exists alone, and both A and B exist. Additionally, the character " / " in this document generally indicates that the associated objects before and after are in an "or" relationship.

[0043] The term "at least one" in this document is merely a description of the associated relationship of the associated objects, indicating that three relationships can exist. For example, at least one of A and B can represent: A exists alone, both A and B exist simultaneously, and B exists alone.

[0044] It should also be noted that in this document, relational terms such as first and second are only used to distinguish one entity or operation from another entity or operation, and do not necessarily require or imply any actual relationship or order between these entities or operations. Moreover, the terms "comprises," "comprising," or any other variation thereof are intended to cover a non-exclusive inclusion.

[0045] Embodiment 1

[0046] This embodiment mainly describes a portable indoor environment detector based on STM32, such as Figure 1 shown, which includes a hardware module and a software module; the hardware module includes: a main control module, a sensor module and a display module; the software module includes a communication module and a client control module;

[0047] The sensor module converts the obtained gas concentration into a concentration electrical signal and transmits it to the main control module; the sensor module includes but is not limited to the MQ138 formaldehyde sensor module, the MS1100 benzene sensor module and the MQ3 alcohol sensor module;

[0048] The sensor module detects the gas molecules in the environment through a low-power sensor. The gas molecules are adsorbed on the SnO2 on the surface of the sensor. The adsorbed gas molecules react with the SnO2 surface to cause a redox reaction, resulting in an increase in the conductivity of the sensor as the gas concentration increases. The gas concentration is converted into a concentration electrical signal for real-time sampling;

[0049] The main control module uses the STM32F103ZET6 chip. The main control module receives the concentration electrical signal transmitted by the sensor module, converts it into an actual concentration value through the analog-to-digital conversion function, removes the noise through Kalman filter processing to obtain the target concentration value, and transmits it to the display module and the client control module through the communication module. The communication module is ESP8266WiFi communication;

[0050] After receiving the target concentration value, the display module displays the target concentration value on the OLED screen in real time. The OLED screen supports blue, white and yellow color displays;

[0051] After receiving the target concentration value, the client control module transmits the target concentration value to the Alibaba Cloud platform to control the start and stop of the gas detection function, and displays the data and real-time curve on the Web visualization interface for users to view;

[0052] The client control module includes an MQTT proxy server, which receives, stores and forwards the messages published by the client to achieve reliable message communication between different devices and applications;

[0053] The ESP8266 in the communication module communicates with the main control module STM32 via USART, configures the Wi-Fi connection of the communication module using AT commands, initiates a connection request to the MQTT broker server according to the MQTT protocol, and completes the connection; the MQTT broker server can be adaptively connected to the Alibaba Cloud platform and Web visualization. The Alibaba Cloud platform integrates MQTT communication capabilities, can establish a connection with the MQTT broker server, receive and store the device data forwarded by it, and Web visualization obtains data from the Alibaba Cloud platform and displays the real-time and historical gas concentration data to users in an intuitive chart. Users can also send control instructions through Web visualization, which are transmitted to the communication module via the Alibaba Cloud platform and MQTT broker server to achieve remote control of the hardware device.

[0054] Further, the conversion of the obtained gas concentration into a concentration electrical signal is specifically as follows:

[0055] Gas molecules in the environment detected by the sensor adsorb on the SnO2 on the surface of the sensor, triggering a redox reaction, changing the conductivity of the sensor. By obtaining the voltage signal V of the sensor out the concentration electrical signal is obtained, and the formula is: where V CC is the circuit supply voltage, R s is the resistance value of the sensor at the current gas concentration, R s is the load resistance, R L is the series load resistance, P X is the adjustable resistance. The dynamic change of the adjustable resistance R X can compensate for the influence of environmental factors on the detection result in real time, and is dynamically adjusted according to the environmental temperature and humidity.

[0056] Further, the portable indoor environment detector further includes a gas collection module; the gas collection module adopts a small air chamber structure; the small air chamber structure adds an air chamber between the sensor probe and the air hole. Before the gas molecules enter the sensor, they will first gather in the small air chamber, forming a certain concentration gradient. Through the aggregation effect, the sensor can detect enough gas molecules in a shorter time, which helps to trigger the sensor response faster.

[0057] Further, the small air chamber structure uses a Teflon tube as the small air chamber material; the surface of the Teflon tube is smooth and pore-free, with an extremely low friction coefficient and surface energy, making the interaction force between gas molecules and the surface of the Teflon tube weak, and gas molecules are difficult to gather and adsorb on the tube wall surface, improving the gas transmission efficiency.

[0058] Further, the main control module performs multi-task scheduling of hardware and software through an adaptive intelligent task scheduling system;

[0059] In terms of hardware, by connecting the sensor module, communication module, display module and client control module, the operating status and power consumption requirements of each module are monitored, and the dynamic power consumption adjustment circuit is used to automatically adjust the working frequencies and voltages between modules;

[0060] At the software level, the task priorities are dynamically allocated through the task priority dynamic allocation mechanism of the adaptive intelligent task scheduling system; when multiple task requests are to be processed, the task priority dynamic allocation mechanism dynamically allocates task priorities according to the urgency of the tasks, the amount of data to be processed, and the resource occupancy of the adaptive intelligent task scheduling system. When the gas concentration data acquisition and transmission tasks occur simultaneously, if it is detected that the gas concentration is approaching the threshold, the priority of the acquisition task will be raised and processed first to ensure the timeliness of the data.

[0061] Furthermore, the communication module can, through the spectrum monitoring circuit, continuously scan the signal strength and interference conditions of the surrounding WiFi frequency bands, and automatically select the optimal communication channel; the communication module ensures the integrity and accuracy of data transmission through the data caching and retransmission mechanism. When there is a short-term network fluctuation or packet loss, the communication module automatically caches the data that has not been successfully transmitted and retransmits it according to the priority after the network recovers, realizing a stable, efficient and secure communication connection with the Alibaba Cloud server and the Web visualization application.

[0062] Furthermore, the display module includes an ambient light sensor and a touch sensing module; the ambient light sensor can automatically adjust the brightness and contrast of the OLED screen according to the ambient light intensity collected by the sensor, ensuring clear display under different lighting conditions; when the touch sensing module detects a user operation, it quickly switches the display page according to the touch position and gesture instructions, realizing the switching from the real-time concentration display page to the historical data comparison page. At the same time, for the display of gas concentration data, through the color gradient coding mechanism, according to different gas concentration ranges, continuous color gradients are used to visually distinguish, enabling users to intuitively obtain gas concentration information.

[0063] Furthermore, the client control module issues control instructions through the Alibaba Cloud platform for remote control. The user transmits the control instructions to the main control module to control the gas collection of the sensor module.

[0064] Furthermore, the hardware module also includes a buzzer module. The buzzer module receives the gas concentration exceeding standard signal transmitted from the main control module and outputs an alarm signal to the display module; when the gas concentration is approaching the safety threshold, the buzzer emits intermittent sounds at a lower frequency; when the gas concentration seriously exceeds the standard, the driving frequency rapidly increases, realizing an accurate match between the sound frequency and the degree of gas danger.

[0065] This implementation details the realization of high-precision detection of multiple common harmful gases by a portable indoor environment detector based on STM32. It has the ability of rapid response. At the same time, by integrating a communication module and an intelligent software system, it realizes real-time data transmission, remote monitoring and intelligent control functions, providing people with more comprehensive, accurate and convenient indoor environment detection services, and meeting the urgent needs of modern society for indoor environment safety monitoring.

[0066] Based on Embodiment 1, this embodiment details the data uploading method of this application, as Figure 2 shown, specifically:

[0067] Hardware initialization: Initialize and set each hardware component such as the main control module STM32, the communication module ESP8266, and the sensor module to ensure that they are in a normal working state; Clear the cache of the communication module to clear the residual data before to avoid interference with subsequent data transmission and processing; Configure the parameters of ESP8266 through control commands to enable it to communicate with the MQTT server; After the configuration is completed, judge whether it is connected to the node of the MQTT server; If the connection is not successful, return to the "Hardware initialization" step to start over, and perform initialization, cache clearing, and AT command configuration operations again until successfully connected to the MQTT server. By preparing the hardware and setting the communication parameters, continuously try to establish a connection with the MQTT server;

[0068] When successfully connected to the MQTT server, use mqtt.fx to simulate the MQTT client to publish and subscribe messages, and use the mqtt.fx tool to simulate the behavior of the client to test whether the message publishing and subscribing functions are normal and to preview the actual data transmission; Control ESP826 to publish and subscribe messages through AT commands, and use AT commands to make ESP8266 perform message publishing and subscribing operations according to the set rules on the basis of establishing a connection with the MQTT server to achieve data interaction with the server; Write an STM32 program to control ESP826 to publish and subscribe messages through AT commands. By writing a program on STM32, control the message publishing and subscribing behavior of ESP8266 to make the data transmission more in line with the requirements and design logic of the system; Judge whether data is received. If no data is received, the process will return to using mqtt.fx to simulate the MQTT client to publish and subscribe messages, and perform related operations of message publishing and subscribing again, continuously trying to receive data; If data is successfully received, the process ends, indicating that the data uploading task is successfully completed.

[0069] This embodiment describes in detail the message interaction operations after the MQTT server establishes a connection, ensures that data can be published and received accurately and timely through various means, and embodies the system's multi-link verification and guarantee mechanism during the data transmission process.

[0070] Based on Example 1, this example describes in detail the method for improving the sensitivity of the portable indoor environment detector of this application, specifically:

[0071] When the portable indoor environment detector is started, the heating voltage is set to 6V and preheated for half an hour to give the sensor a "stimulation" to optimize the microstructure and activity inside the sensor; Figure 3 From the sensor response curve (a), it can be seen that when the heating voltage is maintained at 6V for half an hour of preheating, the ambient temperature is 20℃, and the heating voltage is 5V, the heating voltage has a significant effect on the sensor response; when the heating voltage is maintained at different values, the response curves of the sensor are obviously different. Using 6V voltage in the preheating stage can promote a more complete chemical reaction in the sensor, accelerate the interaction between gas molecules and sensitive materials, and lay a good foundation for subsequent detection; after half an hour, the voltage is adjusted to 5V to enter normal working state. At this time, after the initial "stimulation", the sensor's gas adsorption and reaction efficiency are improved, and it can more keenly sense changes in gas concentration in the environment. This method of preheating with a higher voltage and then switching to a normal working voltage greatly improves the sensitivity of the sensor compared to the traditional fixed voltage working mode.

[0072] Further integration Figure 3 (b) Analysis of the sensor sensitivity characteristic curve under different conditions. The new voltage regulation method has significant advantages. Under the same ambient temperature and gas concentration changes, the sensor sensitivity characteristic curve using the new method performs better. The figure shows the curve comparison under various conditions, which clearly shows that the sensor with special voltage treatment has a faster response speed and can detect gas concentration changes in a shorter time and generate obvious response signals. Moreover, from the slope and fluctuation of the curve, it can be seen that the sensor has a higher degree of discrimination for gases of different concentrations under the new method. For example, when detecting low-concentration gases, the response of the traditional sensor may not be obvious, and the curve is relatively flat; while the sensor curve using the new method will have obvious changes, more accurately reflecting the slight changes in gas concentration. This enables the portable indoor environment detector to complete tasks more accurately and efficiently in actual use, whether it is detecting low-concentration harmful gases or monitoring the dynamic changes in gas concentration, greatly improving the practicality and reliability of the equipment.

[0073] In this embodiment, it is described in detail that the sensitivity of the portable indoor environment detector is improved by changing the heating voltage, and the effect is remarkable. When starting up, it preheats at 6V for half an hour, which can optimize the internal structure and activity of the MOS sensor, accelerate the interaction between gas molecules and sensitive materials. After switching to 5V for normal operation, the adsorption and reaction efficiency of the sensor to gas is improved, the response speed of the sensor is accelerated and the discrimination is higher. It can accurately detect low-concentration gases, is more sensitive to changes in gas concentration, and greatly improves the detection accuracy and practicability of the detector.

[0074] Based on Embodiment 1, this embodiment details the best design of the small gas chamber structure of this application, specifically:

[0075] Alcohol is selected as the gas raw material because alcohol is relatively common in daily life and industrial scenarios, and its volatility is relatively stable, which is convenient for control and measurement; the experiment is carried out in a closed environment of 18L, and this closed environment can effectively avoid interference from external gases and ensure the accuracy and reliability of experimental data; 0.5 ml of 75% alcohol solution is added each time, and this fixed addition amount ensures the consistency of the alcohol gas concentration at the start of each experiment, providing a fair basis for comparing the performance of different sensor structures.

[0076] Five different sensor structures are set for comparison, namely 1.5 cm, 2 cm, and 3 cm small gas chamber structures, the sensor is close to the air hole and the distance between the sensor probe and the air hole is 5 mm. Multiple repeated experiments are carried out on these five structures respectively. By taking the average value through multiple measurements and other methods, the experimental error is reduced and more persuasive data is obtained. This method of multiple-group comparison and multiple experiments can comprehensively and systematically analyze the influence of different structures on the performance of the sensor, laying a solid foundation for drawing scientific conclusions later.

[0077] After experimental operations and data collection, as shown in the following table:

[0078]

[0079] The experimental results show that increasing the small gas chamber structure has a significant impact on the performance of the sensor. Among them, adding a 1.5 cm small gas chamber structure shows the best response range, which means that this structure can make the sensor respond to alcohol gas more quickly and detect changes in gas concentration in a timely manner.

[0080] In terms of the accuracy of the detected concentration, according to theoretical calculations, 20.833 ppm of alcohol gas will be generated during the experiment. After adding the small gas chamber structure, the detected concentrations can all be stabilized within the error range of the theoretical calculated value, which fully shows that the small gas chamber structure can effectively improve the accuracy of sensor detection. Among all the designs with the added small gas chamber structure, the detection value of the 1.5 cm gas chamber structure is the most accurate, with the smallest deviation from the theoretical value, further highlighting its advantage in optimizing the sensor performance. In contrast, there is a large difference between the response value without the gas chamber structure and the real result, which clearly indicates that the presence or absence of the gas chamber structure and the difference in the gas chamber size will have a crucial impact on the detection performance of the sensor. Through these experimental results, the researchers clarified the superiority of the 1.5 cm small gas chamber structure in improving the detection performance of the sensor for alcohol gas, providing an important reference basis for the subsequent optimized design of the sensor.

[0081] This embodiment details multiple comparative experiments on five sensor structures by using 0.5 ml of 75% alcohol solution, achieving significant technical effects. The reaction rate of the 1.5 cm small gas chamber structure is the best, and the detected concentration can be stabilized within the error range of the theoretical calculated value and is the most accurate. Compared with the case without the gas chamber structure, it effectively solves the problem of the large deviation between the response value and the real result, provides a reliable basis for the optimized design of the sensor, and helps to improve the detection performance of the sensor for alcohol gas.

[0082] Based on Embodiment 1, this embodiment details the Kalman filter simulation experiment of this application, specifically:

[0083] The alcohol gas concentration is simulated and verified. Since the change of alcohol concentration shows a simple linear change and there is no additional state transition effect, the state transition matrix A is set to 1; in the current system model, the alcohol concentration does not change complexly during the state transition and maintains a relatively stable linear relationship; the control input matrix B and the control input U are both set to 0, indicating that in this simulation model, the influence of external control input on the change of alcohol concentration is not considered, and the focus is on studying the characteristics of the system itself.

[0084] Considering that the internal uncertainty of the system is relatively small, the process noise covariance Q is taken as 0.1. The selection of this parameter reflects the evaluation of the degree of internal noise interference of the system. The smaller Q value indicates that the influence of internal uncertainty factors on the change of alcohol concentration is relatively weak; at the same time, by referring to the MQ3 data manual, the measurement noise covariance R is determined to be 1. This parameter reflects the noise level existing in the sensor measurement process. Obtain the Kalman filter result, as Figure 4 shown Figure 4The blue star-striped line (real) represents the actual alcohol concentration value, which is the alcohol concentration that actually exists at a specific time point and serves as the benchmark for measuring the accuracy of the sensor measurement. The black plus line (measure) represents the alcohol concentration value directly measured by the sensor. However, due to the inevitable presence of noise or other error factors in the sensor, these measured values often deviate from the true value to some extent. It can be seen that the black plus line deviates from the blue star-striped line at some time points, which intuitively reflects the inaccuracy of the sensor measurement; while the red circular line (kalmanestimate) is the estimated alcohol concentration value processed using the Kalman filter, which exhibits unique advantages throughout the process. Compared with the black plus line, the red circular line follows the change trend of the blue star-striped line more closely, indicating that the Kalman filter effectively processes the sensor measurement data, reduces the influence of noise and errors, and makes the estimated value closer to the true alcohol concentration value. Through Kalman filtering, the measurement deviation of the sensor can be corrected to a certain extent, improving the accuracy and reliability of alcohol concentration measurement.

[0085] This embodiment not only verifies the effectiveness of the Kalman filtering algorithm in processing alcohol gas concentration measurement data, but also provides a successful example for subsequent similar simulation verification of the concentration data of other gases, which helps to further optimize the measurement performance of the sensor and improve the accuracy of detecting the concentration of various gases.

[0086] Based on Embodiment 1, this embodiment details the Web visualization technical solution of this application, specifically

[0087] Web visualization is a technical service based on the Alibaba Cloud platform, which provides various types of visualization components, such as line charts, bar charts, and pie charts; it allows users to display various data in intuitive chart, graphic, map and other visualization forms on the Web page through simple operations without writing a large amount of complex code, and can be integrated with various data sources of Alibaba Cloud, including relational databases (such as RDS), non-relational databases (such as MongoDB), log services (such as SLS), message queues (such as MQ); if custom interactions or advanced visualizations are required, further development can be carried out on platforms such as IOT-studio or DataV.

[0088] As Figures 5-6 shown, the visualization interface designed in this application includes the concentration display and real-time curve interface of three sensors, namely formaldehyde, benzene, and alcohol, which can remotely view the concentration of the detected gas at any time and set the switch button to start and stop the gas detection function.

[0089] In this embodiment, Web visualization presents the indoor environment detection data in real time with the help of intuitive charts and an interactive interface. Users can view it remotely, and it can display the gas concentration change curve, which is convenient for trend analysis. It also supports multi-modal interactions such as touch and voice, facilitating operation, breaking through the spatial limitations, and realizing efficient monitoring and convenient management of the indoor environment conditions.

[0090] The above are only the preferred embodiments of the present invention, and they do not limit the protection scope of the present invention. For those skilled in the art, various changes and modifications can be made to the present invention. All changes, modifications, substitutions, integrations, and parameter changes made to these embodiments within the spirit and principle of the present invention by means of conventional substitutions or capable of achieving the same functions without departing from the principle and spirit of the present invention fall within the protection scope of the present invention.

Claims

1. A portable indoor environment detector based on STM32, characterized in that, It includes a hardware module and a software module; the hardware module includes: a main control module, a sensor module, and a display module; the software module includes a communication module and a client control module; Obtain the change in the electrical signal generated by the physical and chemical reaction between the sensor and gas molecules. Different concentrations generate electrical signals with different amplitudes and transmit them to the main control module; The main control module receives the concentration electrical signal transmitted by the sensor module, converts it into the actual concentration value through the analog-to-digital conversion function, removes noise through Kalman filtering processing to obtain the target concentration value, and transmits it to the display module and the client control module through the communication module; After receiving the target concentration value, the display module displays the target concentration value on the OLED screen in real time. The OLED screen supports three-color display of blue, white, and yellow; After receiving the target concentration value, the client module transmits the target concentration value to the Alibaba Cloud platform to control the start and stop of the gas detection function, and displays the data and real-time curve on the Web visualization interface for users to view.

2. The portable indoor environment detector based on STM32 according to claim 1, characterized in that, The sensor module includes, but is not limited to, a formaldehyde sensor module, a benzene sensor module, and an alcohol sensor module; The sensor module detects the gas molecules in the environment through a low-power sensor. The gas molecules are adsorbed on the SnO2 on the surface of the sensor, and the adsorbed gas molecules react with the SnO2 surface to cause a redox reaction, resulting in an increase in the conductivity of the sensor with the increase of the gas concentration. The gas concentration is converted into a concentration electrical signal for real-time sampling.

3. The portable indoor environment detector based on STM32 according to claim 2, characterized in that, The conversion of the obtained gas concentration into a concentration electrical signal is specifically: Gas molecules in the environment detected by the sensor are adsorbed on the SnO2 on the sensor surface, triggering a redox reaction and changing the conductivity of the sensor. By obtaining the voltage signal V of the sensor out a concentration electrical signal is obtained, and the formula is: where V CC is the power supply voltage of the circuit, R s is the resistance value of the sensor at the current gas concentration, R s is the load resistance, R L is the series load resistance, R X is the adjustable resistance. The dynamic change of the adjustable resistance R X can compensate for the influence of environmental factors on the detection result in real time by dynamically adjusting according to the environmental temperature and humidity.

4. The portable indoor environment detector based on STM32 according to claim 2, characterized in that, The portable indoor environment detector further includes a gas collection module; the gas collection module adopts a small gas chamber structure; the small gas chamber structure adds a gas chamber between the sensor probe and the air hole. Before the gas molecules enter the sensor, they will first gather in the small gas chamber to form a certain concentration gradient. Through the aggregation effect, the sensor can detect enough gas molecules in a short time, which helps to trigger the sensor response faster.

5. The portable indoor environment detector based on STM32 according to claim 2, characterized in that, The small gas chamber structure uses a Teflon tube as the small gas chamber material; the surface of the Teflon tube is smooth and pore-free, with an extremely low friction coefficient and surface energy, making the interaction force between the gas molecules and the surface of the Teflon tube weak, and it is difficult for the gas molecules to gather and adsorb on the tube wall surface, improving the gas transmission efficiency.

6. The portable indoor environment detector based on STM32 according to claim 1, wherein, The main control module performs multi-task scheduling of hardware and software through an adaptive intelligent task scheduling system; In terms of hardware, by connecting the sensor module, communication module, display module, and client control module, it monitors the operating status and power consumption requirements of each module, and uses a dynamic power consumption adjustment circuit to automatically adjust the working frequency and voltage between modules; At the software level, the task priority is dynamically allocated through the task priority dynamic allocation mechanism of the adaptive intelligent task scheduling system; when multiple task requests are to be processed, the task priority dynamic allocation mechanism dynamically allocates task priorities according to the task urgency, data processing volume, and resource occupancy of the adaptive intelligent task scheduling system. When the gas concentration data collection and transmission tasks occur simultaneously, if it is detected that the gas concentration is close to the threshold, the collection task priority will be increased and processed first to ensure the timeliness of the data.

7. The portable indoor environment detector based on STM32 according to claim 1 or 6, characterized in that, The communication module can, through the spectrum monitoring circuit, scan the signal strength and interference situation of the surrounding WiFi bands in real time, and automatically screen out the optimal communication channel. Through the data caching and retransmission mechanism, the communication module ensures the integrity and accuracy of data transmission. When there are brief fluctuations or packet losses in the network, the communication module automatically caches the data that has not been successfully transmitted and retransmits it according to the priority after the network recovers, achieving a stable, efficient, and secure communication connection with the Alibaba Cloud server and the Web visualization application.

8. The portable indoor environment detector based on STM32 according to claim 1, characterized in that The display module includes an ambient light sensor and a touch sensing module. The ambient light sensor can automatically adjust the brightness and contrast of the OLED screen according to the ambient light intensity collected by the sensor, ensuring clear display under different lighting conditions. When the touch sensing module detects a user operation, it quickly switches the display page according to the touch position and gesture instructions, realizing the switch from the real-time concentration display page to the historical data comparison page. At the same time, for the display of gas concentration data, through the color gradient coding mechanism, according to different gas concentration ranges, continuous color gradients are used to visually distinguish, enabling users to intuitively obtain gas concentration information.

9. The portable indoor environment detector based on STM32 according to claim 1, characterized in that, The client control module performs remote control by sending output control instructions through the Alibaba Cloud platform. Users send control instructions to the main control module to control the gas collection of the sensor module.

10. The portable indoor environment detector based on STM32 according to claim 1, characterized in that, The hardware module also includes a buzzer module. The buzzer module receives the gas concentration exceeding standard signal transmitted from the main control module and outputs an alarm signal to the display module. When the gas concentration is close to the safety threshold, the buzzer emits intermittent sounds at a lower frequency. When the gas concentration seriously exceeds the standard, the driving frequency quickly increases, achieving an accurate match between the sound frequency and the gas danger level.

Citation Information

Cited By

  • Chromatographic data monitoring management method and system

    CN121141922A

  • Chromatographic data monitoring management method and system

    CN121141922B

  • Gas concentration detection method and system for ring main unit

    CN121878143A