Method and device for automatically identifying sensor type based on protocol packet polling and time sequence

By using protocol packet polling and time series analysis, the sensor type is automatically identified, solving the problems of cumbersome and error-prone sensor identification configuration. This enables plug-and-play functionality and adaptive management, improving identification accuracy and system stability.

CN121531049APending Publication Date: 2026-02-13SHENZHEN DANGKANG TECH CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202511650913.2
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-11-12
Publication Date
2026-02-13

AI Technical Summary

Technical Problem

Existing sensor recognition and management technologies are cumbersome to configure, prone to errors, and lack adaptability, resulting in low deployment efficiency and an inability to achieve plug-and-play recognition and self-learning expansion of the feature library.

Method used

An automatic identification method based on protocol packet polling and time series is adopted. The protocol parsing module extracts protocol features, the sequence number management module performs range matching, and the time series analysis module performs similarity comparison. Combined with an adaptive polling scheduling unit and feature library self-learning, automatic identification and dynamic management of sensor types are realized.

Benefits of technology

It enables plug-and-play identification of sensor types, improves identification accuracy and system stability, supports dynamic environments with frequent sensor replacements, enhances deployment efficiency, and reduces manual configuration steps.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN121531049A_ABST
    Figure CN121531049A_ABST
Patent Text Reader

Abstract

The invention provides a method and device for automatically identifying sensor types based on protocol packet polling and time series, and relates to the technical field of data acquisition and sensor management, and the device comprises a data acquisition device which integrates a plurality of sensors to be identified and is connected with a system through an RS485 unified communication interface; the protocol analysis module is connected with the data acquisition device, and is configured to capture a protocol packet returned by a sensor to be identified, execute field extraction, extract protocol features including a start character, a length, a function code, a data field and a check bit, and output structured protocol features; unified field extraction of the protocol analysis module is matched with automatic range of the serial number management module, and sensor types do not need to be configured in advance; the newly-added sensor only needs to input protocol characteristics, a sequence number range, a time sequence template and a sampling interval to a sensor type library on line, and the system can automatically identify and input periodic data acquisition without restarting or code modification.
Need to check novelty before this filing date? Find Prior Art

Description

TECHNICAL FIELD

[0001] The present application relates to the technical field of data acquisition and sensor management, in particular to a method and device for automatically identifying sensor types based on protocol packet polling and time series. BACKGROUND

[0002] With the rapid development of industrial automation, Internet of Things and intelligent acquisition systems, it has become a typical requirement to integrate multiple sensors to be identified (such as temperature and humidity sensors, gas sensors, pressure sensors, etc.) on the same data acquisition device, and to realize real-time monitoring and unified management of multiple parameters through a unified RS485 communication interface. In particular, in industrial sites, environmental monitoring or dynamic deployment scenarios, the types of sensors are diverse, the protocols are heterogeneous, and the access is frequently changed, which has become the norm. The traditional approach relies on manual configuration of sensor slave addresses or manual input of type information at system startup.

[0003] However, the existing sensor identification and management technology has the following shortcomings when dealing with the above-mentioned requirements:

[0004] Complicated configuration: each time a sensor is added or replaced, the configuration file or host computer software needs to be manually modified, such as manually setting the protocol fields (start symbol, function code, data field structure), serial number range and sampling interval, resulting in low deployment efficiency.

[0005] Error-prone: manual input is prone to errors such as model mismatch and communication protocol mismatch, such as misconfiguring the function code of a gas sensor as a temperature and humidity sensor or the serial number field exceeding the legal range, causing protocol parsing failure or type misjudgment.

[0006] Lack of adaptability: the system cannot dynamically identify newly connected sensors during operation, the polling strategy is fixed and cannot be automatically adjusted according to the identification success rate or RS485 bus load, new sensor types need to be recompiled or updated offline, and the device cannot achieve plug-and-play identification and feature library self-learning expansion.

[0007] Therefore, a method and device for automatically identifying sensor types based on protocol packet polling and time series are needed to solve the above problems. SUMMARY

[0008] Technical problems solved

[0009] In view of the deficiencies of the prior art, the present application provides a method and device for automatically identifying sensor types based on protocol packet polling and time series, which solves the problems of the prior art.

[0010] Technical solution

[0011] In order to achieve the above object, the present application is realized by the following technical scheme: a device for automatically identifying sensor types based on protocol packet polling and time series, comprising:

[0012] A data acquisition device integrates a plurality of sensors to be identified and is connected with the system through an RS485 unified communication interface;

[0013] A protocol analysis module is connected with the data acquisition device, configured to capture the protocol packet returned by the sensor to be identified and perform field extraction, extract the protocol characteristics including start symbol, length, function code, data field and check bit, and output the structured protocol characteristics;

[0014] A polling control module is connected with the protocol analysis module, and an adaptive polling scheduling unit is built-in, configured to send query instructions to each sensor to be identified in turn according to a preset time sequence, and capture the returned protocol packet in real time;

[0015] A serial number management module is connected with the protocol analysis module, configured to perform range matching in the sensor type library according to the extracted serial number field, and preliminarily screen the candidate sensor types;

[0016] A time series analysis module is connected with the data acquisition device, configured to construct a time series for continuous multiple frames of acquisition data, extract the fluctuation amplitude, response delay and periodicity characteristics, and perform similarity comparison with the pre-stored time series template corresponding to the candidate type to determine the final sensor type;

[0017] A sensor type library is bidirectionally connected with the serial number management module and the time series analysis module, and stores the protocol characteristics, serial number range, time series template and self-learning expansion data;

[0018] A periodic data acquisition control unit is connected with the time series analysis module and the data acquisition device, configured to switch to a periodic data acquisition mode after confirming the sensor type, continuously acquire the sensor output data according to the sampling interval exclusive to the type, and dynamically record the confirmed sensor type, corresponding serial number and measured time series characteristics into the sensor type library, so as to realize self-learning expansion of the feature library.

[0019] Preferably, the adaptive polling scheduling unit of the polling control module is further configured to:

[0020] Comprise a success rate monitoring subunit, an interval adjustment subunit and a load evaluation subunit; the success rate monitoring subunit accumulates the ratio of the number of valid response frames to the total number of query frames in a single polling period in real time; the interval adjustment subunit automatically shortens or lengthens the polling interval according to the success rate; and the load evaluation subunit monitors the RS485 bus occupancy rate, and when the occupancy rate exceeds a preset upper limit, forces to enter a low-frequency polling mode to ensure system stability.

[0021] Preferably, the time series analysis module further comprises:

[0022] a sequence buffer unit for buffering recent multiple frames of sensor data; a feature extraction unit configured to calculate mean, variance, peak-to-peak value, and periodic component as a feature vector;

[0023] a template matching unit supporting multiple template parallel comparison and outputting the type corresponding to the highest similarity;

[0024] an anomaly detection unit marking as "unknown type" and triggering a feature library expansion process when the similarity of the measured sequence to all templates is below a threshold.

[0025] Preferably, the sensor type library is further configured to store and manage the following information:

[0026] protocol field features including start symbol, function code, data field structure; sequence number legal range; exclusive time series template and similarity threshold; adaptive polling history parameters including average success rate and optimized interval; when supporting online addition of sensor types, only the above information is entered to achieve plug-and-recognize, without the need to modify the protocol analysis module or polling control module code.

[0027] Preferably, the protocol analysis module adopts a unified multi-protocol compatible framework, specifically configured as:

[0028] maintaining protocol general field mapping rules; uniformly performing capture, slicing, mapping, and output flow for different manufacturers and different types of sensor protocol packets; submitting the analysis results in a standardized structure to the sequence number management module and the time series analysis module to realize "one-stop" recognition logic decoupling and avoid repeated development caused by protocol differences.

[0029] Preferably, the method comprises the following steps:

[0030] an initialization step: integrating multiple sensors to be identified through the data acquisition device, using an RS485 communication interface to access the system through a hardware platform integrating multiple sensors to be identified as the data acquisition device;

[0031] a polling query step: performing adaptive polling scheduling strategy based on protocol packet polling by the polling control module, sending query instructions to each sensor to be identified in a predetermined time sequence, and capturing the returned protocol packet in real time;

[0032] a protocol analysis step: extracting fields from the captured protocol packet by the protocol analysis module, extracting protocol features including start symbol, length, function code, data field, and check bit;

[0033] Serial number matching step: the serial number management module extracts the serial number field and performs range matching in the sensor type library to preliminarily screen candidate sensor types;

[0034] Time series analysis step: the time series analysis module constructs a time series from continuous multiple frames of collected data, extracts fluctuation amplitude, response delay, and periodicity characteristics, and performs similarity comparison with a pre-stored time series template corresponding to the candidate type to determine the final sensor type;

[0035] Periodic data collection step: after confirming the sensor type, the periodic data collection control unit switches to a periodic data collection mode and continuously collects sensor output data according to a type-specific sampling interval;

[0036] Type confirmation and library expansion step: the confirmed sensor type, corresponding serial number, and measured time series characteristics are dynamically entered into the sensor type library to realize self-learning expansion of the feature library.

[0037] Preferably, the adaptive polling scheduling strategy specifically includes the following in the polling query step:

[0038] Real-time statistics of the recognition success rate in the current polling period; when the recognition success rate is higher than a first preset threshold for multiple times in succession, the next polling interval is dynamically shortened; when the recognition success rate is lower than a second preset threshold for multiple times in succession, the next polling interval is dynamically lengthened; and the dynamic adjustment realizes closed-loop optimization balance between recognition speed and RS485 bus load.

[0039] Preferably, the construction and application of the time series template in the time series analysis step include the following:

[0040] In the offline stage, continuous packet capture is performed on known type sensors to establish a typical output time sequence model, including a stable response interval, a transient rise time, and noise distribution characteristics; a dedicated timeout time and a sampling interval are set for each type of sensor; in the online identification stage, multiple frames of continuous data are collected to form a measured sequence, and the similarity between the measured sequence and the template sequence is calculated; when the similarity is the highest and exceeds a preset threshold, the corresponding sensor type is confirmed.

[0041] Preferably, the sensor type library stores and manages the following information in the serial number matching step, time series analysis step, and type confirmation and library expansion step:

[0042] Protocol field characteristics, including a start symbol, a function code, and a data field structure; a serial number legal range; a dedicated time series template and a similarity threshold; adaptive polling historical parameters, including an average success rate and an optimized interval; when supporting online addition of a sensor type, only the above information is entered to realize plug-and-identify without modifying the protocol analysis module or the polling control module code.

[0043] Advantages

[0044] The application provides a method and device for automatically identifying sensor types based on protocol packet polling and time series. The following advantages are provided:

[0045] 1. The application uses a protocol analysis module to extract fields uniformly and an automatic range matching module, without the need for pre-configuring sensor types; new sensors only need to be online to input protocol characteristics, serial number ranges, time series templates, and sampling intervals into the sensor type library, and the system can automatically identify and put into periodic data collection without restarting or modifying the code, completely eliminating the manual configuration link and improving deployment efficiency.

[0046] 2. The application uses a double insurance mechanism of serial number screening + time series deep comparison: the serial number management module quickly locks the candidate type, and the time series analysis module compares the similarity (including an abnormal detection unit marking unknown types) between the fluctuation amplitude, response delay, and periodic characteristics of continuous multiple frames of data and the pre-stored template, improving the identification accuracy and eliminating analysis errors caused by function code and data domain structure differences, and greatly enhancing the system stability.

[0047] 3. The application integrates an adaptive polling scheduling unit (including success rate monitoring, interval adjustment, and load evaluation sub-unit), adjusts the polling interval in real time according to the identification success rate and RS485 bus occupancy rate (such as shortening to 350ms when the success rate is >80%, and forcing a low-frequency mode when the load is >70%), and supports feature library self-learning expansion - automatically writes the measured time series characteristics back to the library after successful identification, without the need for downtime to support the access of any new type of sensor, perfectly adapting to dynamic environments such as industrial sites, agricultural greenhouses, cold chain transportation, and frequent sensor replacement. BRIEF DESCRIPTION OF DRAWINGS

[0048] Fig. 1 The device composition framework diagram of the application is shown in the figure;

[0049] Fig. 2 The method flowchart of the application is shown in the figure;

[0050] Fig. 3 The module data flow interaction diagram of the application is shown in the figure. DETAILED DESCRIPTION

[0051] The technical solutions in the embodiments of the application will be described clearly and completely below with reference to the accompanying drawings in the embodiments of the application. Obviously, the described embodiments are only a part of the embodiments of the application, rather than all the embodiments. Based on the embodiments in the application, all other embodiments obtained by those skilled in the art without creative labor fall within the scope of the application. Embodiment one:

[0053] As shown in Figs. 1-3 A device for automatically identifying sensor types based on protocol packet polling and time series, comprising:

[0054] A data acquisition device integrated with multiple sensors to be identified, connected to the system through a unified RS485 communication interface;

[0055] A protocol analysis module connected to the data acquisition device, configured to capture the protocol packet returned by the sensor to be identified and perform field extraction, extract the protocol features including start symbol, length, function code, data field, and check bit, and output structured protocol features;

[0056] A polling control module connected to the protocol analysis module, with an adaptive polling scheduling unit built-in, configured to send query instructions to each sensor to be identified in turn according to a preset timing sequence, and capture the returned protocol packet in real time;

[0057] A serial number management module connected to the protocol analysis module, configured to perform range matching in the sensor type library according to the extracted serial number field, and preliminarily screen the candidate sensor types;

[0058] A time series analysis module connected to the data acquisition device, configured to construct a time series for continuous multiple frames of acquisition data, extract the fluctuation amplitude, response delay, and periodicity characteristics, and perform similarity comparison with the pre-stored time series template corresponding to the candidate type to determine the final sensor type;

[0059] A sensor type library bidirectionally connected to the serial number management module and the time series analysis module, storing protocol features, serial number ranges, time series templates, and self-learning expansion data;

[0060] A periodic data acquisition control unit connected to the time series analysis module and the data acquisition device, configured to switch to a periodic data acquisition mode after confirming the sensor type, continuously acquire sensor output data according to the sampling interval specific to the type, and dynamically record the confirmed sensor type, corresponding serial number, and measured time series characteristics into the sensor type library, realizing self-learning expansion of the feature library.

[0061] The adaptive polling scheduling unit of the polling control module is further configured to:

[0062] Include a success rate monitoring subunit, an interval adjustment subunit, and a load evaluation subunit; the success rate monitoring subunit accumulates the ratio of the number of valid response frames to the total number of query frames within a single polling period in real time; the interval adjustment subunit automatically shortens or lengthens the polling interval according to the success rate; the load evaluation subunit monitors the RS485 bus occupancy rate, and when it exceeds the preset upper limit, it is forced to enter a low-frequency polling mode to ensure system stability.

[0063] The time series analysis module further comprises:

[0064] a sequence buffer unit for buffering recent multiple frames of sensor data; a feature extraction unit configured to calculate mean, variance, peak-to-peak value, and periodic component as a feature vector;

[0065] a template matching unit supporting multi-template parallel comparison and outputting the type corresponding to the highest similarity;

[0066] an anomaly detection unit marking as "unknown type" and triggering a feature library expansion process when the similarity of the measured sequence to all templates is below a threshold.

[0067] The sensor type library is further configured to store and manage the following information:

[0068] protocol field features including start symbol, function code, data field structure; sequence number legal range; exclusive time series template and similarity threshold; adaptive polling history parameters including average success rate and optimized interval; when supporting online addition of sensor types, only the above information needs to be entered to achieve plug-and-recognize, without modifying the protocol analysis module or polling control module code.

[0069] The protocol analysis module adopts a unified multi-protocol compatible framework, and is specifically configured as:

[0070] maintaining protocol general field mapping rules; uniformly performing capture, slicing, mapping, and output flow for different manufacturers and different types of sensor protocol packets; submitting the analysis results in a standardized structure to the sequence number management module and the time series analysis module to realize "one-stop" recognition logic decoupling and avoid repeated development caused by protocol differences.

[0071] The method comprises the following steps:

[0072] an initialization step: integrating multiple sensors to be identified through a data acquisition device, using an RS485 communication interface to access the system through a hardware platform integrating multiple sensors to be identified as the data acquisition device;

[0073] a polling query step: performing an adaptive polling scheduling strategy based on protocol packets by a polling control module, sending query instructions to each sensor to be identified in a predetermined time sequence, and capturing the returned protocol packets in real time;

[0074] a protocol analysis step: extracting fields of the captured protocol packets by a protocol analysis module, extracting protocol features including start symbol, length, function code, data field, and check bit;

[0075] a sequence number matching step: performing range matching in the sensor type library according to the extracted sequence number field by a sequence number management module to preliminarily screen candidate sensor types;

[0076] Time series analysis step: Construct time series from continuous multi-frame acquisition data by time series analysis module, extract fluctuation amplitude, response delay, periodicity characteristics, and compare with pre-stored time series template corresponding to candidate type to determine the final sensor type;

[0077] Periodic data acquisition step: After confirming the sensor type, switch to periodic data acquisition mode by periodic data acquisition control unit, and continuously acquire sensor output data according to the sampling interval specific to this type;

[0078] Type confirmation and library expansion step: dynamically record the confirmed sensor type, corresponding serial number and measured time series characteristics into the sensor type library to realize self-learning expansion of the feature library.

[0079] The adaptive polling scheduling strategy specifically includes:

[0080] Real-time statistics of the recognition success rate in the current polling period; when the recognition success rate is higher than the first preset threshold for consecutive multiple times, dynamically shorten the next polling interval; when the recognition success rate is lower than the second preset threshold for consecutive multiple times, dynamically lengthen the next polling interval; through dynamic adjustment, realize closed-loop optimization and balance between recognition speed and RS485 bus load.

[0081] The construction and application of time series template in time series analysis step includes:

[0082] In the offline stage, continuously capture packets of known type sensors to establish typical output time sequence model, including stable response interval, transient rise time and noise distribution characteristics; set exclusive timeout time and sampling interval for each type of sensor; in the online identification stage, acquire multiple continuous data to form measured sequence, calculate the similarity between the measured sequence and the template sequence; when the similarity is the highest and exceeds the preset threshold, confirm the corresponding sensor type.

[0083] The sensor type library stores and manages the following information in the serial number matching step, time series analysis step and type confirmation and library expansion step:

[0084] Protocol field characteristics, including start symbol, function code, data field structure; serial number legal range; exclusive time series template and similarity threshold; adaptive polling history parameters, including average success rate and optimized interval; when supporting online addition of sensor type, only the above information is recorded to realize plug-and-identify, without modifying the protocol analysis module or polling control module code. Specific embodiment two:

[0086] As shown in Figs. 1-3 , the following is the complete workflow of the method:

[0087] Firstly, the system in the foregoing is composed of a data acquisition device and a host system, and unified communication is realized through an RS485 bus. The data acquisition device is a hardware platform integrated with multiple sensors to be identified, and each sensor has a unique physical address, i.e., a serial number field. After the data acquisition device is powered on, a physical connection is established with the host system through an RS485 communication interface, and the communication parameters are uniformly configured as a baud rate of 9600 bps, 8 data bits, no check, and 1 stop bit. The host system is responsible for running all identification and control logic, and has built-in protocol analysis modules, polling control modules, serial number management modules, time series analysis modules, sensor type libraries, periodic data acquisition control units, and other functional modules.

[0088] When the system is started, an initialization step is first performed. After the host system is powered on, each functional module is loaded and initialized in turn. The protocol analysis module loads the general field mapping rule, and is ready to perform the capture, slicing, mapping, and output processes. The polling control module initializes the polling queue, sets the initial polling interval, for example, 500 milliseconds, and activates the adaptive polling scheduling unit. The serial number management module reads the serial number legal range of all known sensor types from the sensor type library. The time series analysis module preloads the exclusive time series template of the known type sensor, and starts the sequence buffer. The sensor type library enters the read-write ready state, supporting online expansion. The periodic data acquisition control unit is in standby state, ready to take over the data acquisition task after identification is completed. After all modules are initialized, the system automatically switches to the automatic sensor identification mode, and starts to poll and identify all sensors to be identified on the RS485 bus.

[0089] After entering the identification mode, the polling control module traverses in a preset order, for example, from 1 to N according to the physical address, sends a standard query instruction to each sensor to be identified, and the instruction format is a start symbol, length, address, function code, and CRC check. The function code is usually 0x03, indicating reading data. After sending each query instruction, the polling control module listens to the RS485 bus in real time to capture the complete protocol package returned by the sensor. At the same time, the adaptive polling scheduling unit is also running synchronously, and the success rate monitoring subunit of the adaptive polling scheduling unit real-time statistics the ratio of the number of valid response frames to the total number of query frames in the current polling period. The interval adjustment subunit dynamically adjusts the polling interval for the next time according to the identification success rate. Specifically, if the identification success rate is higher than a first preset threshold, for example, 80%, for a plurality of times, for example, 3 times in a row, the polling interval for the next time is shortened, for example, from 500 milliseconds to 350 milliseconds. If the identification success rate is lower than a second preset threshold, for example, 50%, for a plurality of times, for example, 3 times in a row, the interval is extended, for example, to 750 milliseconds. The load evaluation subunit continuously monitors the occupancy rate of the RS485 bus, and if the occupancy rate exceeds a preset upper limit, for example, 70%, it immediately enters a low-frequency polling mode with a fixed polling interval of 2 seconds to ensure the stability of the bus.

[0090] After the protocol parsing module receives the original protocol packet, it immediately executes the unified multi-protocol compatible framework processing flow. First, it detects the start symbol to lock the complete data frame, then divides each segment according to the length field, then extracts the general fields including the start symbol such as 0x68, the length field, the function code such as 0x03, the data field, i.e., the sensor measurement value, the check bit, i.e., CRC16, and the serial number field, and finally generates a structured protocol feature such as output in JSON format, containing the start symbol, length, address, function code, data, check, serial number, etc. fields. This structured feature is sent to the serial number management module and the time series analysis module at the same time.

[0091] After the serial number management module receives the structured feature, it extracts the serial number field and performs range matching in the sensor type library. The serial number that matches successfully corresponds to one or more candidate sensor types, and the candidate type list is output to the time series analysis module.

[0092] The time series analysis module processes continuous multiple frames of data from the same sensor, such as the last 5 frames. First, the sequence buffer unit caches the latest data to form a measured time series, such as S_real = d1, d2, d3, d4, d5, where di is the measurement value after data field parsing. Then the feature extraction unit calculates the mean, variance, peak-to-peak value, response delay, i.e., the time difference from query to response, the main frequency extracted by fast Fourier transform, the fluctuation amplitude, and the stable interval, etc. characteristic vector. Then the template matching unit loads the corresponding exclusive time series template of the candidate type from the sensor type library. These templates are established by continuously capturing packets from known type sensors in the offline stage, containing stable response interval, transient rise time, noise distribution characteristics, etc. Typical output time sequence model, the template matching unit performs multi-template parallel comparison, calculates the similarity between the measured sequence and each template, such as using cosine similarity or dynamic time warping distance, selects the type corresponding to the template with the highest similarity and exceeding the preset threshold as the final sensor type, and the anomaly detection unit simultaneously judges whether all templates are below the threshold, triggering the feature library expansion process, otherwise output the final recognition result.

[0093] After successful recognition, the system switches to periodic data acquisition mode. The periodic data acquisition control unit takes over the data acquisition task, loads the exclusive sampling interval recorded in the library for this sensor type, sends periodic query instructions to the identified sensor, continuously acquires and stores the returned data, and the storage format includes timestamp, sensor type, serial number, and measurement value. At the same time, perform type confirmation and library expansion steps, dynamically write the recognition results of this time including the final sensor type, the corresponding serial number, and the measured time series characteristics into the sensor type library, update the content including protocol field characteristics if there are minor differences, merge and normalize, serial number legal range expansion or correction, measured time series template for subsequent self-learning optimization, adaptive polling historical parameters including average success rate and optimized interval.

[0094] The system supports self-learning and dynamic expansion of the feature library. When a new sensor is added, no code needs to be modified. Only by entering the protocol field features, serial number legal range, and exclusive time series template through the online entry interface to the sensor type library, the recommended sampling interval and timeout time can be generated by offline packet capture. After the entry is completed, the system takes effect immediately, and the next polling can identify it. When the abnormal detection unit triggers the expansion process, the system caches 100 frames of continuous data of the sensor, generates a new template and writes it into the library, and realizes continuous evolution.

[0095] The system supports multiple state switching during operation. When the system starts or the sensor is replaced, it enters the identification mode to perform the polling identification process. After all the sensors are identified, it enters the acquisition mode and is dominated by the periodic data acquisition control unit. When the bus load is too high, it enters the low-frequency mode to forcibly extend the polling interval to ensure stability. When the expansion process is triggered, it enters the expansion mode to perform library entry or self-learning. This workflow forms a closed loop from power-on initialization to identification, acquisition, and expansion, realizing unified multi-protocol compatibility, adaptive polling scheduling, time series accurate identification, plug-and-identify, self-learning expansion, and other core functions. It can be directly applied to industrial sites, environmental monitoring, intelligent buildings, and other fields. Specific embodiment three:

[0097] As shown in Figs. 1-3 The following is a detailed description of the hardware and modules of the present application:

[0098] The host system uses an STM32H743 high-performance ARM Cortex-M7 microcontroller as the core processor, with a main frequency of 480MHz, 1MB Flash and 1MB SRAM built-in, supporting hardware floating point operation unit FPU, meeting the real-time calculation requirements of time series analysis.

[0099] The data acquisition device adopts a customized PCB mainboard with a size of 120mmx80mm, integrates an RS485 transceiver chip SP3485, supports a maximum of 32-node bus expansion, has a built-in TVS transient suppression diode array SM712 to protect the interface from static and surge impact, uses DC 24V wide voltage input for power supply, is stabilized to 5V and 3.3V dual-channel output through an LM2596S voltage reduction module, 5V is used for RS485 driving, and 3.3V is used for STM32 and peripheral circuits. The mainboard reserves 8-way sensor wiring terminals, each way has an independent pull-up resistor and a terminal matching resistor 120Ω switch, and supports hot plug. The protocol analysis module is solidified in the Flash partition A (0x08000000-0x0801FFFF) of the STM32 in the form of software, runs a bare machine real-time task scheduling, uses a DMA double-buffering mechanism to receive RS485 serial port data, the input is an original byte stream, the output is a structured protocol feature JSON string, and is sent to the serial number management module and the time series analysis module through a message queue. The polling control module runs in the RTOS task with the highest priority, the input is a sensor address list and a current polling interval parameter, the output is a query instruction byte stream sent to RS485 through UART4, and after a return packet is captured, it is forwarded to the protocol analysis module. The serial number management module uses the Flash partition B (0x08020000-0x0803FFFF) to store a sensor type library table, uses a binary search algorithm to match the serial number range, the input is a serial number field after protocol analysis, and the output is a candidate type ID list.

[0100] The time series analysis module runs in the interrupt service triggered by DMA, the sequence buffer is allocated in the first 256KB of SRAM as a ring queue, the feature extraction uses the ARM CMSIS-DSP library to calculate the mean, variance and FFT, the template matching uses a dynamic time warping DTW algorithm, the input is a continuous 5-frame measurement value sequence, and the output is a final type ID and a similarity score. The sensor type library uses an external SPI Flash chip W25Q256 (32MB capacity) to store protocol feature vectors, serial number ranges, time series template files and adaptive parameters, the read-write interface is realized through a FATFS file system, and online expansion is supported.

[0101] The periodic data acquisition control unit runs in a low-priority timer task, the input is an identification completion signal and a sampling interval parameter, the output is a periodic query instruction and a data storage instruction, and the data is stored to an SD card FAT32 partition. Synchronization is achieved between modules through a lightweight message queue and a semaphore, the message format from the protocol analysis module to the sequence number management module is {seq: 5, crc_ok: 1}, the message from the sequence number management module to the time series analysis module is {candidates: [1, 2]}, and the message from the time series analysis module to the periodic data acquisition control unit is {type_id: 3, seq: 5, interval: 1000}, so that the data flow is clear and unblocked. Embodiment four:

[0103] As shown in Figs. 1-3 the following is a detailed description of the key steps in the present application:

[0104] The adaptive polling scheduling strategy specifically operates as follows: the polling interval is initialized as 500 milliseconds, the high threshold of success rate is 0.8, the low threshold of success rate is 0.5, the shortening coefficient is 0.7, the lengthening coefficient is 1.5, and the following steps are cyclically executed: (1) a query instruction is sent to all sensors in the current polling period, and the number of valid response frames is counted; (2) the success rate is calculated as the number of valid response frames divided by the total number of sensors; (3) if the success rate is higher than 0.8 for three consecutive times, the polling interval of the next time is multiplied by 0.7 to shorten; if the success rate is lower than 0.5 for three consecutive times, the polling interval of the next time is multiplied by 1.5 to lengthen; (4) if the RS485 bus occupancy rate exceeds 70% (through serial port idle time statistics), the polling interval is forcibly set to 2000 milliseconds; (5) the next polling uses the adjusted interval value. The time series template construction and comparison process is as follows: 1000 frames of data are continuously collected for known sensors in the offline stage, and the feature vectors including mean, standard deviation, peak-to-peak value and main frequency component are calculated and stored as template files; in the online identification stage, 5 consecutive frames of data are collected to form a measured sequence, the same feature vectors are calculated, and the dynamic time warping distance is used for similarity comparison, specifically, a cost matrix is constructed, the sum of the current difference and the minimum values of the left, upper and left upper directions is accumulated element by element, and finally the end value of the matrix is taken as the distance, if the distance is less than 0.15 and is the minimum value among all candidates, the corresponding sensor type is confirmed. The unified multi-protocol compatible framework analysis process example: input the original byte stream 0x68 0A 05 03 01 02 03 04 AB CD, the steps are: (1) detect the start symbol 0x68 to lock the frame header; (2) read the length field 0A to determine the frame length; (3) slice and extract the address 0x05, function code 0x03, data field [01, 02, 03, 04], and check bit [AB, CD] in turn; (4) perform CRC16-MODBUS check; (5) output the structured JSON format containing the start symbol, length, address, function code, data, checksum and serial number fields. The operation steps of the dynamic feature library expansion mechanism: when a new sensor is added, send an entry instruction such as "ADD_TYPE seq_min=41 seq_max=50 interval=2000" through the upper computer or the serial port, the system creates a new type entry after parsing the instruction, receives the uploaded template file and writes it to the specified offset address of the external SPI Flash, triggers the library update broadcast after completion, and all modules reload the serial number range table and the time series template, so that the system can be plugged and recognized without restarting. All parameters and thresholds can be adjusted online through the configuration file without recompiling the firmware. Embodiment five

[0106] As Figs. 1-3 shown, the following is a practical application description of the present application:

[0107] In an industrial environment monitoring system, the data acquisition device is installed in the central control cabinet of the production workshop, and 8 sensors to be identified are accessed through the RS485 bus, including 4 temperature and humidity sensors, 2 gas concentration sensors and 2 pressure sensors. After the system is powered on, the host system automatically enters the identification mode, and the polling control module sends query instructions to addresses 1 to 8 in turn with an initial interval of 500 milliseconds. The protocol analysis module captures the return protocol package, extracts the structured features, and the serial number management module matches the temperature and humidity type according to serial number fields 1 to 4, the gas type according to fields 5 to 6, and the pressure type according to fields 7 to 8. The time series analysis module caches 5 consecutive frames of data for each sensor, calculates the mean, standard deviation, peak-to-peak value and other features, and compares them with the pre-stored templates in the library to confirm that all sensor types are correct. After identification is completed, the periodic data acquisition control unit takes over, the temperature and humidity sensor collects data every 5 seconds, the gas sensor collects data every 1 second, and the pressure sensor collects data every 2 seconds. The data is stored in real time to the SD card and uploaded to the upper computer. During operation, the bus load rises to 65%, the adaptive polling scheduling unit detects that the success rate is higher than 80% for 3 times in a row, and the polling interval in the identification mode is automatically shortened to 350 milliseconds, improving the identification speed when replacing the sensor. When a new light sensor is accessed at address 9, the operator enters the serial number range 9 to 10, the sampling interval 10 seconds and the template file generated by offline packet capture through the upper computer, and the system takes effect immediately. The next identification cycle automatically identifies the light type and switches to the corresponding collection frequency without the need to stop or modify the code. The whole process realizes sensor plug-and-play identification and continuous and stable operation, meeting the needs of flexible expansion and real-time monitoring in industrial field.

[0108] In an intelligent building energy management system, the data acquisition device is deployed in the floor distribution room, and 12 sensors to be identified are accessed through the RS485 bus, including 6 temperature and humidity sensors, 3 light sensors and 3 CO2 concentration sensors. After the system is started, the polling control module sends query instructions with an initial interval of 500 milliseconds, the protocol analysis module captures the return package and extracts the structured features, and the serial number management module matches the temperature and humidity according to serial numbers 1 to 6, the light according to serial numbers 7 to 9, and the CO2 according to serial numbers 10 to 12. The time series analysis module confirms all types through 5 consecutive frame data feature comparison. After identification is completed, the periodic data acquisition control unit collects data at intervals of 10 seconds, 5 seconds and 2 seconds respectively according to the configuration in the library, which is used for air conditioning linkage and energy consumption analysis. When a new wind speed sensor is accessed at address 13, the operation and maintenance personnel enter the serial number range 13 to 14, the sampling interval 1 second and the template file through the upper computer. The system takes effect in real time and is included in the collection period, realizing dynamic expansion monitoring of building environmental parameters.

[0109] In the agricultural greenhouse automation control system, the data acquisition device is installed in the greenhouse central control box, and 10 sensors are connected, including 4 soil humidity sensors, 3 air temperature and humidity sensors, 2 light sensors and 1 CO2 sensor. The system is powered on to enter the identification mode, the polling control module queries in address order, the protocol analysis module processes the return package, the serial number management module completes the range matching, and the time series analysis module confirms the type by comparing the fluctuation amplitude and periodicity characteristics. After successful identification, the periodic data acquisition control unit is started, the soil humidity is collected every 30 seconds, the air temperature and humidity are collected every 10 seconds, the light and CO2 are collected every 5 seconds, and the data drive irrigation and light supplement actuators are executed. When a new leaf humidity sensor is added, the operator enters the corresponding serial number range and template, the system completes the identification without restarting and collects at an interval of 15 seconds, realizing precise closed-loop control of crop growth environment.

[0110] In the cold chain transport vehicle monitoring system, the data acquisition device is integrated in the vehicle-mounted cold box, and 6 sensors are connected through RS485, including 3 temperature sensors, 2 humidity sensors and 1 vibration sensor. After the vehicle starts, the system automatically identifies, the polling control module dynamically adjusts the interval to respond to communication jitter under bumpy road conditions, the protocol analysis and serial number matching are quickly completed, and the time series analysis module confirms the type by responding to the delay and periodicity characteristics. After identification, the periodic data acquisition control unit collects temperature every 10 seconds, humidity every 20 seconds, and vibration every 1 second, and the data is uploaded to the cloud platform in real time. When a door switch sensor is replaced during the journey, the driver enters the new serial number range and template through the tablet, and the system automatically identifies and monitors the door opening state at an interval of 5 seconds in the next polling period, ensuring the traceability of the cold chain throughout the journey.

[0111] In the factory equipment predictive maintenance system, the data acquisition device is deployed in the motor control cabinet of the production line, and 9 sensors are connected, including 4 vibration sensors, 3 temperature sensors and 2 current sensors. After the system is powered on, it completes fast identification, the polling control module automatically enters low-frequency mode to protect the bus under high load, and the time series analysis module accurately distinguishes the type by peak-to-peak value and main frequency component. After identification is completed, the periodic data acquisition control unit collects vibration every 0.5 seconds, temperature every 2 seconds, and current every 1 second at high frequency, which is used for abnormal early warning. When a new acoustic sensor is added, the maintenance engineer enters the serial number range and voiceprint template, the system immediately identifies and collects noise data at an interval of 0.2 seconds, realizing predictive maintenance of multi-dimensional state of equipment.

[0112] It is to be understood that the terminology used herein is for the purpose of describing particular embodiments only and is not intended to be limiting; it is not intended to exclude myriad other embodiments of the present application that other inventors can develop based on the same general inventive concepts embodied by the described embodiments. That is, although the present application is described in terms of particular embodiments and implementations, it is to be understood that the terminology used is for the purpose of descriptive clarity and that it is intended to be limited only by the words of the patent claims. A reference to an aspect of the present application employing a particular aspect, feature or structure of the described embodiments is not to be interpreted as an indication that all or even any aspects of the present application have such feature or structure in some way.

[0113] While the embodiments of the application have been shown and described herein, it is to be understood that the application is not limited to these embodiments. Rather, many modifications, changes, substitutions, and alterations can be made to the embodiments of the application without departing from the spirit and scope of the application as defined by the appended claims and their equivalents.

Claims

1. A device for automatically identifying sensor types based on protocol packet polling and time series analysis, characterized in that, include: The data acquisition device integrates the sensor to be identified and connects to the system via an RS485 unified communication interface. The protocol parsing module is connected to the data acquisition device and is configured to capture the protocol packets returned by the sensor to be identified and perform field extraction, extracting protocol features including start character, length, function code, data field, and check bit, and outputting structured protocol features. The polling control module, connected to the protocol parsing module, has a built-in adaptive polling scheduling unit configured to send query commands to each sensor to be identified in sequence according to a preset time order, and to capture the returned protocol packets in real time; The serial number management module is connected to the protocol parsing module and is configured to perform range matching in the sensor type library based on the extracted serial number field to initially filter candidate sensor types. The time series analysis module is connected to the data acquisition device and is configured to construct a time series from multiple consecutive frames of acquired data, extract fluctuation amplitude, response delay, and periodic features, and compare the similarity with the pre-stored time series templates corresponding to the candidate types to determine the final sensor type. A sensor type library is bidirectionally connected to the sequence number management module and the time series analysis module, storing protocol features, sequence number ranges, time series templates, and self-learning extended data. The periodic data acquisition control unit is connected to the time series analysis module and the data acquisition device. It is configured to switch to the periodic data acquisition mode after confirming the sensor type, continuously acquire sensor output data according to the sampling interval specific to that type, and dynamically record the confirmed sensor type, corresponding serial number and measured time series characteristics into the sensor type library to realize the self-learning expansion of the feature library.

2. The device for automatically identifying sensor types based on protocol packet polling and time series as described in claim 1, characterized in that, The adaptive polling scheduling unit of the polling control module is further configured as follows: It includes a success rate monitoring subunit, an interval adjustment subunit, and a load assessment subunit; the success rate monitoring subunit accumulates the ratio of the number of valid response frames to the total number of query frames in a single polling cycle in real time; the interval adjustment subunit automatically shortens or extends the polling interval according to the success rate; the load assessment subunit monitors the RS485 bus occupancy rate and forces it to enter a low-frequency polling mode when it exceeds a preset upper limit.

3. The device for automatically identifying sensor types based on protocol packet polling and time series as described in claim 1, characterized in that, The time series analysis module further includes: The sequence buffer unit is used to cache the most recent multiple frames of sensor data; the feature extraction unit is configured to calculate the mean, variance, peak-to-peak value, and periodic components as feature vectors. The template matching unit supports parallel comparison of multiple templates and outputs the type corresponding to the template with the highest similarity. The anomaly detection unit marks the actual sequence as "unknown type" and triggers the feature library expansion process when the similarity between the actual sequence and all templates is below the threshold.

4. The device for automatically identifying sensor types based on protocol packet polling and time series as described in claim 1, characterized in that, The sensor type library is further configured to store and manage the following information: Protocol field features include start character, function code, data field structure; valid sequence number range; dedicated time series template and similarity threshold; Adaptive polling of historical parameters, including average success rate and optimized interval.

5. The device for automatically identifying sensor types based on protocol packet polling and time series as described in claim 1, characterized in that, The protocol parsing module adopts a unified multi-protocol compatible framework, and its specific configuration is as follows: Maintain common field mapping rules for the protocol; uniformly execute the capture, slicing, mapping, and output process for protocol packets from different manufacturers and of different types; and submit the parsing results to the sequence number management module and the time series analysis module in a standardized structure.

6. A method for automatically identifying sensor types based on protocol packet polling and time series, corresponding to the device for automatically identifying sensor types based on protocol packet polling and time series as described in any one of claims 1-5, characterized in that, The method includes the following steps: Initialization steps: The sensor to be identified is integrated through the data acquisition device and connected to the system using an RS485 communication interface; Polling query steps: The polling control module executes an adaptive polling scheduling strategy based on protocol packet polling, sends query instructions to each sensor to be identified in sequence according to a preset time sequence, and captures the returned protocol packets in real time; Protocol parsing steps: The protocol parsing module extracts fields from the captured protocol packets, including protocol features such as start character, length, function code, data field, and checksum. Serial number matching step: The serial number management module performs range matching in the sensor type library based on the extracted serial number field to initially filter candidate sensor types; Time series analysis steps: The time series analysis module constructs a time series from multiple consecutive frames of acquired data, extracts fluctuation amplitude, response delay, and periodic features, and compares the similarity with the pre-stored time series templates corresponding to the candidate types to determine the final sensor type; Periodic data acquisition steps: After confirming the sensor type, the periodic data acquisition control unit switches to the periodic data acquisition mode and continuously acquires sensor output data according to the sampling interval specific to this type. Type confirmation and library expansion steps: The confirmed sensor type, corresponding serial number and measured time series features are dynamically entered into the sensor type library to realize the self-learning expansion of the feature library.

7. The method for automatically identifying sensor types based on protocol packet polling and time series as described in claim 6, characterized in that, The adaptive round-robin scheduling strategy specifically includes the following in the round-robin query step: The system continuously monitors the recognition success rate within the current polling cycle. When the recognition success rate exceeds the first preset threshold multiple times, the system dynamically shortens the next polling interval. When the recognition success rate falls below the second preset threshold multiple times, the system dynamically extends the next polling interval. This dynamic adjustment achieves a closed-loop optimization balance between recognition speed and RS485 bus load.

8. The method for automatically identifying sensor types based on protocol packet polling and time series as described in claim 6, characterized in that, The construction and application of the time series template in the time series analysis step includes: In the offline phase, packet capture is continuously performed on known sensor types to establish typical output timing models, including stable response intervals, transient rise times, and noise distribution characteristics. A dedicated timeout and sampling interval are set for each type of sensor. In the online identification phase, multiple frames of continuous data are collected to form a measured sequence, and its similarity to the template sequence is calculated. When the similarity is the highest and exceeds a preset threshold, the corresponding sensor type is confirmed.

9. The method for automatically identifying sensor types based on protocol packet polling and time series as described in claim 6, characterized in that, The sensor type library stores and manages the following information during the sequence number matching step, the time series analysis step, and the type confirmation and library expansion step: Protocol field features include start character, function code, data field structure; valid sequence number range; dedicated time series template and similarity threshold; Adaptive polling of historical parameters, including average success rate and optimized interval.