Sensor system based on stm32 and sensor

By designing a sensor system based on STM32, the traditional gas sensor system is solved, and the problems of large size, complex operation and high environmental dependence are realized, efficient data transmission and intelligent processing are realized, and the needs of multiple scenarios are adapted to the needs of use in multiple scenarios.

CN120390025AInactive Publication Date: 2025-07-29DALIAN UNIV OF TECH
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202510463662.0
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-04-14
Publication Date
2025-07-29
Estimated Expiration
Not applicable · inactive patent

AI Technical Summary

Technical Problem

The traditional gas sensor system based on STM32 is huge in size, inconvenient to move, complex operation, high environmental requirements and limited measurement accuracy, making it difficult to meet the needs of multiple scenarios.

Method used

A sensor system based on STM32 is designed, including sensor data acquisition module, serial communication transmission module, network communication processing module, data processing and decision-making module, web service interface module and user interaction and display module to realize accurate data acquisition, reliable transmission, intelligent processing and visual display.

Benefits of technology

It realizes efficient, reliable transmission and intelligent processing of sensor data, supports multi-device access management, improves the flexibility and scalability of the system, simplifies the operation process, and adapts to the needs of different application scenarios.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120390025A_ABST
    Figure CN120390025A_ABST
Patent Text Reader

Abstract

The invention belongs to the technical field of sensors, and discloses an stm32-based sensor system, which comprises a sensor data acquisition module, a serial port communication transmission module, a network communication processing module, a data processing and decision module, a Web service interface module and a user interaction and display module. According to the invention, gas concentration information is accurately converted into a digital signal through the sensor data acquisition module, so that the accuracy and reliability of original data are ensured; the serial port communication transmission module establishes a reliable data transmission channel between embedded systems to ensure efficient transmission of real-time data, and the network communication processing module realizes interaction between equipment and a network environment and supports remote data transmission and monitoring; the data processing and decision-making module performs intelligent processing on the environment data, provides real-time decision-making support and improves the intelligent level of the system; and the Web service interface module constructs a network interaction interface of the Internet of Things equipment.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention belongs to the technical field of sensors, and specifically relates to a sensor system and a sensor based on STM32. Background Technique

[0002] The sensor system based on STM32 is an intelligent integrated system that integrates an STM32 microcontroller, a sensor module, and a communication module. As a detection device, the sensor can sense measured quantities such as temperature, humidity, and gas concentration and convert them into electrical signals. It generally consists of sensitive elements, conversion elements, etc. In this system, the sensor module collects environmental parameters and converts them into electrical signals. STM32, with its powerful computing power and rich interfaces, receives, samples, processes, and stores the signals. The processed data is transmitted to other devices, such as ESP32, through serial communication, etc. For example, in the gas sensor system based on STM32, after the gas-sensitive resistor detects the gas concentration, it is sampled by STM32 and processed by ESP32 to realize remote monitoring and analysis of data. Traditional instruments have many drawbacks. Their volume is usually very large, like a "giant", taking up a large amount of valuable space in the laboratory and making the laboratory layout appear crowded and messy. Moreover, the large volume makes it extremely inconvenient to move. When wanting to change the usage location or take it outdoors for measurement, it often takes a lot of manpower and time, greatly limiting the usage scenarios. More critically, most of these traditional devices need to be used in conjunction with a computer, and the operation process is cumbersome and complex, making it difficult for non-professionals to get started. At the same time, there are also high requirements for the usage environment. Slight changes in factors such as temperature and humidity may affect the measurement accuracy, and their use is very restricted. Summary of the Invention

[0003] The purpose of the present invention is to provide a sensor system and a sensor based on STM32 to solve the problems raised in the above background technique.

[0004] To achieve the above purpose, the present invention provides the following technical solution: A sensor system and a sensor based on STM32, the system includes a sensor data acquisition module, a serial communication transmission module, a network communication processing module, a data processing and decision-making module, a Web service interface module, and a user interaction and display module;

[0005] The sensor data acquisition module is responsible for accurately converting gas concentration information into digital signals available for transmission; the serial communication transmission module is mainly responsible for establishing a reliable data transmission channel between embedded systems; the network communication processing module is responsible for realizing the interaction between the device and the network environment; the data processing and decision-making module is responsible for the intelligent processing and real-time decision-making of environmental data; the Web service interface module is responsible for constructing the network interaction interface of Internet of Things devices; the user interaction and display module is mainly responsible for constructing the human-computer interaction interface and the responsibility of data visualization.

[0006] Preferably, the sensor data acquisition module includes a gas sensor unit and an STM32C8T6 main control unit;

[0007] The gas sensor unit is responsible for accurately converting chemical quantities into electrical signals for processing; the STM32C8T6 main control unit is mainly responsible for achieving high-precision signal acquisition and efficient data transmission.

[0008] Preferably, the serial communication transmission module includes a data encapsulation unit, a transmission control unit, a handshake protocol unit, a flow control management unit, an error handling unit, and a status synchronization unit;

[0009] The data encapsulation unit is mainly responsible for converting the original sensor data into a structured data packet that conforms to the communication standard; the transmission control unit is mainly responsible for establishing and maintaining a stable data transmission channel; the handshake protocol unit is responsible for establishing a reliable data transmission confirmation mechanism: the flow control management unit is responsible for implementing the flow control mechanism of data transmission; the error handling unit is responsible for ensuring the reliability of data transmission; the status synchronization unit is responsible for maintaining the consistency of the communication link status between devices.

[0010] Preferably, the network communication processing module includes a network connection management unit, a protocol transmission processing unit, and a secure communication guarantee unit;

[0011] The network connection management unit is responsible for establishing and maintaining a stable and reliable network connection; the protocol transmission processing unit is responsible for achieving efficient and reliable data transmission: the secure communication guarantee unit is responsible for building a secure communication environment.

[0012] Preferably, the data processing and decision-making module includes a data processing unit and a decision control unit;

[0013] The data processing unit is responsible for running the gas concentration algorithm, managing the circular buffer cache, compressing and storing historical data, and ensuring the integrity and reliability of the data;

[0014] The decision control unit establishes a multi-level alarm logic, monitors the alarm status, adjusts the system behavior, and outputs the decision result.

[0015] Preferably, the Web service interface module includes a Web server unit, an API service unit, a dynamic page generation unit, and a real-time communication unit;

[0016] The Web server unit is responsible for deploying and managing ESPAsyncWebServer; the API service unit is used to provide RESTful API interface services; the dynamic page generation unit is used to generate HTML / JSON pages in real time; and it is used to implement WebSocket two-way communication.

[0017] Preferably, the user interaction and display module includes an interface display unit and a configuration management unit;

[0018] The interface display unit is responsible for visualizing data presentation, including real-time curve rendering, multi-device status synchronization, and responsive layout adaptation;

[0019] The configuration management unit is responsible for handling system parameter settings, covering alarm thresholds, network parameters, device modes, and user permission management.

[0020] Preferably, a toggle switch is fixedly installed inside the rechargeable battery, a sensor socket is fixedly installed inside the rechargeable battery, a sensor is inserted into the sensor socket, and a screen is embedded inside the rechargeable battery.

[0021] The beneficial effects of the present invention are as follows:

[0022] In the present invention, the gas concentration information is accurately converted into a digital signal by the sensor data acquisition module to ensure the accuracy and reliability of the original data; the serial communication transmission module establishes a reliable data transmission channel between embedded systems to ensure the efficient transmission of real-time data, the network communication processing module realizes the interaction between the device and the network environment, supports remote data transmission and monitoring; the data processing and decision-making module intelligently processes environmental data, provides real-time decision support, and improves the intelligence level of the system; the Web service interface module constructs a network interaction interface for Internet of Things devices, facilitating users to manage devices and access data through standard network protocols; the user interaction and display module provides a human-computer interaction interface, through visual dashboards, historical data query interfaces, etc., enabling users to intuitively monitor the system status and data changes; the system supports multi-device access management, realizes the synchronous display of multi-device status, and centralized configuration and monitoring, improving management efficiency; the system has good flexibility and scalability, and users can flexibly configure system parameters through the configuration management unit to meet the needs of different application scenarios. BRIEF DESCRIPTION OF THE DRAWINGS

[0023] Figure 1 is the principle block diagram of the sensor of the present invention;

[0024] Figure 2 is the front three-dimensional external structure schematic diagram of the present invention;

[0025] Figure 3Schematic diagram of the explosion structure of the sensor of the present invention.

[0026] In the figure: 1. Rechargeable battery; 2. Toggle switch; 3. Sensor socket; 4. Sensor; 5. Screen. Detailed implementation manners

[0027] Next, the technical solutions in the embodiments of the present invention will be clearly and completely described in conjunction with the accompanying drawings in the embodiments of the present invention. Obviously, the described embodiments are only a part of the embodiments of the present invention, rather than all the embodiments. All other embodiments obtained by those of ordinary skill in the art based on the embodiments of the present invention without creative efforts shall fall within the protection scope of the present invention.

[0028] As Figures 1 to 3 shown, the embodiment of the present invention provides a sensor system and a sensor based on STM32. The system includes a sensor data acquisition module, a serial port communication transmission module, a network communication processing module, a data processing and decision-making module, a Web service interface module, and a user interaction and display module.

[0029] The sensor data acquisition module is responsible for accurately converting the gas concentration information into a digital signal that can be used for transmission.

[0030] Specific responsibilities include: This module converts the gas concentration into an analog voltage signal in real time through a gas-sensitive resistor, establishes the mapping relationship between environmental parameters and electrical signals, and STM32 samples the signal with a fixed frequency of 10Hz with high precision; uses a digital filtering algorithm to eliminate high-frequency noise, compensates for sensor drift through baseline calibration, and eliminates abnormal sampling values to optimize the signal quality; finally packages the original data into a standardized JSON format with a timestamp (such as {"voltage": 2.45, "timestamp": 1679432012}) to provide a standardized interface for subsequent transmission and processing, and realizes the accurate acquisition and structured output of environmental parameters.

[0031] The serial port communication transmission module is mainly responsible for establishing a reliable data transmission channel between embedded systems.

[0032] Specific responsibilities include: As the data transmission hub, this module encapsulates sensor data into UART standard frames through STM32, and uses a custom protocol (including data header, length, content, and CRC check) to ensure transmission reliability. The ESP32 slave parses the byte stream and verifies data integrity, and implements the ACK / NACK two-way confirmation protocol in combination with the hardware / software flow control mechanism, automatically retransmits in case of timeout, and triggers the reset mechanism for continuous errors. The transmission layer optimizes the balance between efficiency and stability at a baud rate of 115200bps, reduces the CPU load by combining DMA transmission, and uses double-buffer management to avoid data loss. It has the capabilities of frame error detection, buffer exception handling, and hardware-level recovery, maintains the link state through heartbeat packets, supports device status reporting and firmware remote upgrade, and constructs a highly reliable and efficient data transmission channel for the Internet of Things system.

[0033] The network communication processing module is responsible for implementing the interaction between the device and the network environment;

[0034] The network communication processing module realizes network connection management based on the ESP32-WROOM-32 hardware, supports Wi-Fi / Ethernet dual-mode connection, has an automatic reconnection mechanism to handle network fluctuations, and can be configured with multiple SSIDs / IP addresses. In terms of protocol data transmission, the module implements dual protocol stack communication of HTTP and MQTT, supports RESTful API data exchange and publish / subscribe message modes, and automatically completes the encapsulation and parsing of protocol packets. In addition, the module creates a TCP server instance, provides a front-end interface access interface, supports JSON format data interaction, and implements a session state retention mechanism. In terms of secure transmission guarantee, it integrates the SSL / TLS protocol, manages certificates, encrypts the data transmission channel, and effectively prevents man-in-the-middle attacks.

[0035] The data processing and decision-making module is responsible for the intelligent processing and real-time decision-making of environmental data;

[0036] The Web service interface module is responsible for constructing the network interaction interface of the Internet of Things device;

[0037] The Web service interface module deploys ESPAsyncWebServer, supports multi-client concurrent connection, SSL / TLS secure encrypted transmission, and server performance monitoring. It provides a RESTful API standard interface to implement device status query, configuration parameter modification, historical data acquisition, and remote instruction issuance. It can render HTML data dashboards, JSON format data streams, SVG dynamic charts, and multi-language interfaces in real time. It establishes a WebSocket two-way channel to support real-time data push, instant alarm notification, remote procedure call, and connection state heartbeat monitoring.

[0038] The user interaction and display module is mainly responsible for constructing the human-computer interaction interface and data visualization;

[0039] The user interaction and display module real - time displays key data through a visual dashboard, including a dynamic curve showing the concentration change trend, a digital meter intuitively presenting the current value, and multi - parameter comparison visualization. It provides an interactive historical data query interface, supporting time - range filtering, data comparison mode, abnormal data marking, and report export functions. It integrates a parameter setting panel for system configuration management, supporting multi - level alarm threshold configuration, network connection parameter setting, device working mode selection, and user permission management. It supports multi - device access, realizes responsive layout to adapt to different screens, synchronously displays the multi - device status, and centralized configuration and monitoring.

[0040] Among them, the sensor data acquisition module includes a gas - sensitive sensor unit and an STM32C8T6 main control unit;

[0041] The gas - sensitive sensor unit is responsible for accurately converting the chemical quantity (gas concentration) into an electrical signal for processing;

[0042] Specific responsibilities include:

[0043] The gas - sensitive sensor unit adsorbs target gas molecules through a metal - oxide semiconductor material, converts its concentration change into a resistance value, and realizes the conversion of chemical quantity to electrical signal. It uses a Wheatstone bridge circuit to convert the resistance change into a differential voltage output, realizes 10 - 100 - fold signal amplification through the bridge - arm resistance ratio, and compensates for the non - linear characteristics to improve linearity. It has a built - in heating element to control the working temperature (200 - 350 °C), accelerates the gas adsorption / desorption process, reduces humidity interference, and enhances detection stability. It provides a 0 - 5V / 0 - 3.3V analog voltage output, and the concentration and voltage have a monotonic function relationship. The full - range covers the detection range, and the low - impedance output is convenient for subsequent circuit driving, forming a complete gas detection and signal conversion system.

[0044] The STM32C8T6 main control unit is mainly responsible for realizing high - precision signal acquisition and efficient data transmission; specific responsibilities include:

[0045] The STM32 main control unit realizes dual - channel synchronous sampling through a 12 - bit ADC module, with a quantization accuracy of 4096 levels, and supports oversampling to improve the resolution. The timer generates a 10Hz stable sampling clock, realizes micro - second - level trigger synchronization, and dynamically adjusts the frequency to adapt to different scenarios. The DMA controller establishes a direct connection channel between the ADC buffer and the memory, realizes zero - CPU - load data transmission, and the double - buffer mechanism prevents data loss. The I / O interface controls the sensor power supply timing, provides status indication and hardware fault detection. The main control core coordinates the collaborative work of the ADC, timer, and DMA, manages memory allocation and interrupt priority, and supports the switching of low - power modes such as idle / stop / standby, realizing efficient and reliable system control.

[0046] Among them, the serial communication transmission module includes a data encapsulation unit, a transmission control unit, a handshake protocol unit, a flow control management unit, an error handling unit, and a status synchronization unit;

[0047] The data encapsulation unit is mainly responsible for converting the original sensor data into a structured data packet that conforms to the communication standard;

[0048] The data encapsulation unit adds a start bit, 8 data bits, a parity bit, and a stop bit to the sensor data according to the UART protocol to ensure physical layer compatibility. Build a custom protocol stack on the basis of the data frame, including a data header, a length field, a content field, and a CRC check field, to implement the application layer specification. Optimize the transmission efficiency through protocol design, use data compression to reduce redundancy, support the ACK / NACK error retransmission mechanism, and merge multi-packet transmissions to improve bandwidth utilization. This unit completes the conversion from the original data to the structured protocol frame to ensure communication reliability.

[0049] The transmission control unit is mainly responsible for establishing and maintaining a stable data transmission channel;

[0050] The transmission control unit is responsible for configuring the UART communication parameters, including the baud rate, data bits, stop bits, and parity method, to balance the transmission speed and stability; use a double-buffer or circular-buffer mechanism to manage the data stream, pre-allocate memory space and establish a send / receive buffer, monitor the buffer status in real time, and achieve seamless data transfer through the DMA or interrupt mechanism; in terms of optimizing the transmission efficiency, configure the DMA controller to achieve zero CPU load transmission, use hardware flow control to prevent data loss, and introduce a data compression algorithm to reduce the transmission volume to ensure the efficiency and reliability of data transmission.

[0051] The handshake protocol unit is responsible for establishing a reliable data transmission confirmation mechanism;

[0052] The handshake protocol unit defines the ACK / NACK protocol specification. After the receiver verifies the data, it returns an acknowledgment frame (ACK), and returns a negative acknowledgment frame (NACK) when the data is incorrect, and supports frame number matching to prevent duplicate acknowledgments. The sender sets a retransmission timer, triggers timeout retransmission when the ACK is not received, starts error handling when the continuous NACK reaches the threshold, and dynamically adjusts the retransmission times and waiting times. Implement a three-level error handling strategy: the first level automatically retransmits lost data packets, the second level requests to resynchronize the communication link, and the third level triggers a system-level reset operation to ensure the reliability of data transmission.

[0053] The flow control management unit is responsible for implementing the flow control mechanism of data transmission;

[0054] The flow control management unit supports two modes: hardware flow control (RTS / CTS) and software flow control (XON / XOFF). By monitoring the fill level of the receiver buffer, when the buffer is about to be full, it triggers a flow control signal, dynamically reduces the transmission rate to a safe threshold, and automatically increases the rate after the buffer recovers. At the same time, it implements three-level congestion prevention measures: the first level pauses the transmission of new data, the second level discards low-priority data packets, and the third level initiates a link renegotiation process, effectively preventing data loss and ensuring the stability of data transmission.

[0055] The error handling unit is responsible for ensuring the reliability of data transmission;

[0056] The error handling unit real-time detects frame errors, including parity errors and frame format errors, and automatically requests retransmission of damaged frames. At the same time, it monitors the buffer status, issues an overflow warning when the receive buffer exceeds the 80% threshold, pauses transmission when the transmit buffer is empty, and dynamically adjusts the buffer threshold parameters. In addition, it implements a three-level recovery strategy: the first level is a hardware watchdog reset, the second level is a protocol stack re-initialization, and the third level triggers a system safe restart, ensuring a quick recovery of the link in case of communication anomalies and guaranteeing the reliability of data transmission.

[0057] The state synchronization unit is responsible for maintaining the consistency of the communication link state between devices;

[0058] The state synchronization unit periodically sends heartbeat packets to confirm the alive status of the communication link, detects the network latency fluctuation range, and realizes two-way link quality assessment. It real-time feedbacks the device status, including ready, busy, and error status, and supports extended definition of status codes. In addition, it implements remote maintenance functions, such as firmware upgrade with differential / whole packet transmission, configuration update with parameter verification feedback, and log reading with cyclic buffer access, ensuring device state synchronization and system maintainability.

[0059] Among them, the network communication processing module includes a network connection management unit, a protocol transmission processing unit, and a secure communication guarantee unit;

[0060] The network connection management unit is responsible for establishing and maintaining a stable and reliable network connection;

[0061] The network connection management unit realizes dual-mode connection management based on the ESP32-WROOM-32 hardware, supports both Wi-Fi and Ethernet connections simultaneously, intelligently selects the optimal network access, and real-time monitors the status of the dual links. The automatic reconnection mechanism copes with network fluctuations, automatically detects disconnection (<5 seconds), adopts an exponential backoff retry strategy, and reports the status after successful reconnection. The multi-configuration support provides flexible options, including pre-storing and switching of multiple SSIDs, support for static / dynamic IP addresses, and custom configuration of DNS servers, ensuring stable connection of the device in different network environments.

[0062] The protocol transmission processing unit is responsible for achieving efficient and reliable data transmission:

[0063] The protocol transmission processing unit supports communication with both HTTP and MQTT dual protocol stacks simultaneously, realizes RESTful API standard data exchange and publish / subscribe asynchronous message mode, and automatically converts the data format between protocols. It automatically completes protocol message encapsulation (adding protocol headers / check information), parsing (extracting payload data), and detecting and discarding abnormal messages. By adopting mechanisms such as data compression algorithms (such as LZ4), packetized transmission strategies, and traffic shaping control, it optimizes the transmission efficiency and ensures efficient and reliable data transmission.

[0064] The secure communication guarantee unit is responsible for building a secure communication environment;

[0065] The secure communication guarantee unit supports the rapid deployment of self-signed certificates and the issuance by CA-certified authoritative institutions, and provides an automatic certificate update mechanism. It uses AES / RSA algorithms to implement end-to-end encryption of data messages, supports the key dynamic negotiation mechanism, and the encryption strength is configurable (128 / 256 bits). At the same time, it defends against network attacks, including man-in-the-middle attack detection, abnormal traffic monitoring, and intrusion behavior blocking, to ensure communication security.

[0066] Among them, the data processing and decision-making module includes a data processing unit and a decision control unit;

[0067] The data processing unit is responsible for running the gas concentration algorithm, managing the circular buffer cache, compressing and storing historical data to ensure the integrity and reliability of the data;

[0068] The decision control unit establishes a multi-level alarm logic, monitors the alarm status, adjusts the system behavior, and outputs the decision result.

[0069] The calibrated gas concentration data output by the data processing unit is used as the input of the decision control unit to trigger the multi-level alarm logic judgment. When the concentration value exceeds the preset threshold, the decision unit immediately starts the alarm process. At the same time, the alarm status instruction output by the decision control unit acts on the data processing unit in the reverse direction, triggering the buffer data protection mechanism, adjusting the data acquisition frequency, and starting the marked storage of historical data. The two units form a complete closed loop of "data acquisition - algorithm processing - decision judgment - behavior adjustment", enabling the system to autonomously adjust the working mode according to the environmental state. For example, when alarming, it automatically switches to high-sensitivity sensors, starts the device self-check program when the exceedance persists, and triggers remote notifications when the data is abnormal.

[0070] Among them, the Web service interface module includes a Web server unit, an API service unit, a dynamic page generation unit, and a real-time communication unit;

[0071] The Web server unit is responsible for deploying and managing ESPAsyncWebServer; the API service unit is used to provide RESTful API interface services; the dynamic page generation unit is used to generate HTML / JSON pages in real time; the [unit name] is used to implement WebSocket two-way communication;

[0072] After receiving HTTP / HTTPS requests, the Web server unit directly returns the requested files of static resources, forwards API requests to the API service unit, and triggers the dynamic page generation unit. After processing requests such as device status query / configuration modification, the API service unit obtains real-time data from the data processing module, returns the results to the dynamic page generation unit for rendering, and pushes updates through the WebSocket real-time communication unit. The dynamic page generation unit calls the API service unit to obtain JSON data, uses the SVG library to render dynamic charts, and switches the multi-language interface according to the request header information. The WebSocket real-time communication unit maintains a long connection with the client, receives alarm notifications from the API service unit, executes remote procedure call instructions, and periodically sends heartbeat packets to maintain the connection.

[0073] Among them, the user interaction and display module includes an interface display unit and a configuration management unit;

[0074] The interface display unit is responsible for visualizing data presentation, including real-time curve rendering, multi-device status synchronization, and responsive layout adaptation;

[0075] The configuration management unit is responsible for processing system parameter settings, covering alarm thresholds, network parameters, device modes, and user permission management.

[0076] The interface display unit and the configuration management unit are linked through data display and parameter configuration to achieve that the alarm threshold parameter determines the color warning status of the dashboard, and the network configuration parameter updates the device connection status indicator in real time. The interface is updated and the configuration is synchronized. When the user modifies the device working mode on the interface, the configuration management unit immediately saves the new settings. After the user permission is changed, the configuration management unit notifies the interface to refresh the accessible function modules. For multi-device collaborative management, the configuration management unit maintains the device list parameters to dynamically generate a multi-device status monitoring panel, and the multi-device data received by the interface is uniformly parameter-standardized and displayed through the configuration management unit.

[0077] Among them, a toggle switch 2 is fixedly installed inside the rechargeable battery 1, a sensor socket 3 is fixedly installed inside the rechargeable battery 1, a sensor 4 is inserted into the sensor socket 3, and a screen 5 is embedded inside the rechargeable battery 1.

[0078] It should 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 non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a series of elements includes not only those elements but also other elements not expressly listed, or elements inherent to such process, method, article, or apparatus.

[0079] Although the embodiments of the present invention have been shown and described, for those of ordinary skill in the art, it is understood that various changes, modifications, substitutions, and variations can be made to these embodiments without departing from the principles and spirit of the present invention, and the scope of the present invention is defined by the appended claims and their equivalents.

Claims

1. A sensor system based on STM32, characterized in that: The system includes a sensor data acquisition module, a serial communication transmission module, a network communication processing module, a data processing and decision-making module, a Web service interface module, and a user interaction and display module; The sensor data acquisition module is responsible for accurately converting gas concentration information into digital signals that can be used for transmission; The serial communication transmission module is mainly responsible for establishing a reliable data transmission channel between embedded systems; the network communication processing module is responsible for realizing the interaction between the device and the network environment; the data processing and decision-making module is responsible for the intelligent processing and real-time decision-making of environmental data; the Web service interface module is responsible for constructing the network interaction interface of Internet of Things devices; the user interaction and display module mainly undertakes the responsibilities of constructing the human-computer interaction interface and data visualization.

2. The sensor system based on STM32 according to claim 1, characterized in that: The sensor data acquisition module includes a gas sensor unit and an STM32C8T6 main control unit; The gas sensor unit is responsible for accurately converting chemical quantities into electrical signals that can be processed; the STM32C8T6 main control unit is mainly responsible for realizing high-precision signal acquisition and efficient data transmission.

3. The sensor system based on STM32 according to claim 1, characterized in that: The serial communication transmission module includes a data encapsulation unit, a transmission control unit, a handshake protocol unit, a flow control management unit, an error handling unit, and a status synchronization unit; The data encapsulation unit is mainly responsible for converting the original sensor data into a structured data packet that conforms to the communication standard; the transmission control unit is mainly responsible for establishing and maintaining a stable data transmission channel; the handshake protocol unit is responsible for establishing a reliable data transmission confirmation mechanism: the flow control management unit is responsible for realizing the flow control mechanism of data transmission; the error handling unit is responsible for ensuring the reliability of data transmission; the status synchronization unit is responsible for maintaining the consistency of the communication link status between devices.

4. A sensor system based on STM32 according to claim 1, characterized in that: The network communication processing module includes a network connection management unit, a protocol transmission processing unit, and a secure communication guarantee unit; The network connection management unit is responsible for establishing and maintaining a stable and reliable network connection; the protocol transmission processing unit is responsible for realizing efficient and reliable data transmission: the secure communication guarantee unit is responsible for constructing a secure communication environment.

5. A sensor system based on STM32 according to claim 1, characterized in that: The data processing and decision-making module includes a data processing unit and a decision control unit; The data processing unit is responsible for running the gas concentration algorithm, managing the circular buffer cache, compressing and storing historical data, and ensuring the integrity and reliability of the data; The decision control unit establishes a multi-level alarm logic, monitors the alarm status, adjusts the system behavior, and outputs the decision result.

6. A sensor system based on STM32 according to claim 1, characterized in that: The Web service interface module includes a Web server unit, an API service unit, a dynamic page generation unit, and a real-time communication unit; The Web server unit is responsible for deploying and managing the ESPAsyncWebServer: the API service unit is used to provide RESTful API interface services; the dynamic page generation unit is used to generate HTML / JSON pages in real time; the is used to realize WebSocket two-way communication.

7. A sensor system based on STM32 according to claim 1, characterized in that: The user interaction and display module includes an interface display unit and a configuration management unit; The interface display unit is responsible for visualizing data presentation, including real-time curve rendering, multi-device status synchronization, and responsive layout adaptation; The configuration management unit is responsible for processing system parameter settings, covering alarm thresholds, network parameters, device modes, and user privilege management.

8. A sensor based on STM32, comprising a rechargeable battery (1); characterized in that: A toggle switch (2) is fixedly installed inside the rechargeable battery (1), a sensor socket (3) is fixedly installed inside the rechargeable battery (1), a sensor (4) is inserted into the sensor socket (3), and a screen (5) is embedded inside the rechargeable battery (1).