A high-precision analog data conversion method using a software algorithm to replace an anti-interference circuit

CN122969575APending Publication Date: 2026-10-23BEIJING DONGFANG ZHIMING TECH CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202510502754.5
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-04-22
Publication Date
2026-10-23

AI Technical Summary

Benefits of technology

[0032]475微秒的时间增加在一般环境参数控制场景(如新风、智能通风、空调等)下尚可接受,但对于动作速度要求极高的场景,可通过调整采样相关参数平衡精度与速度。若需保证动作速度,可经测试把采样次数、历史融合数组的长度缩减到32以下;在具体的智能通风、新风等场景中,实际测试发现,采样次数达8次以上即可满足精度要求,但为避免偶发干扰未被检测到的风险,常扩大采样次数及数组长度。只要控制电路运行流畅且编译能通过,采样次数和数组长度就尽可能选择大一些。

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN122969575A_ABST
    Figure CN122969575A_ABST
Patent Text Reader

Abstract

The application discloses a high-precision analog data conversion method for replacing an anti-interference circuit with a software algorithm. The sensor data is accurately processed through the software algorithm, and the steps are as follows: ① multiple acquisition of sensor data is stored in an array; ② original data is sorted and a median value is obtained through a quick sorting algorithm; ③ a new median value is fused with historical data to generate a new array; ④ the new array is sorted again to obtain a final result; and ⑤ actual data such as temperature and humidity is obtained through table lookup. The system is cooperated by three modules: the acquisition module only regulates signals, the processing module executes algorithms and fusion, and the storage module provides historical data. Sampling is dynamically adjusted according to ripple, and the minimum number of times is 3, the maximum value of 32-64 times is taken when resources are limited, and the value is as large as possible when resources are sufficient. The beneficial effects are as follows: ① the anti-interference hardware is removed, and the cost is reduced and the efficiency is improved; ② the anti-interference performance is high, and the accuracy is still guaranteed under ±1.5V ripple of a 1.8V-5.5V single-chip microcomputer; ③ the time consumption of single conversion is 475 microseconds (8MHz single-chip microcomputer), and the adjustable parameters balance the accuracy and speed; and ④ the method is suitable for environmental control scenes.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of analog data conversion and processing technology, specifically to a high-precision analog data conversion method that uses software algorithms to replace anti-interference circuits, which is particularly suitable for analog data conversion and processing scenarios such as temperature measurement, humidity measurement, and air cleanliness measurement. Background Technology

[0002] In traditional analog data conversion processes, such as temperature measurement, humidity measurement, and air cleanliness measurement, the accuracy of analog data conversion depends not only on the precision and stability of the sensor, but also highly on the stability of the voltage and the anti-interference performance of the sampling circuit. A stable voltage supply is crucial for ensuring accurate acquisition of analog signals. Fluctuations in the switching power supply voltage and interference from grounded loads such as motors can directly cause changes in the amplitude of the analog signal, thus affecting the final data conversion result. Simultaneously, in complex electromagnetic environments, external interference signals can easily infiltrate the analog signal. The role of anti-interference circuits is to minimize the impact of power supply fluctuations and electromagnetic interference on the analog signal. However, anti-interference circuits not only increase hardware costs and system complexity, but their anti-interference effect also has certain limitations. Once the effectiveness of the anti-interference circuit deteriorates, power supply fluctuations and electromagnetic interference cannot be effectively filtered out, and the error in analog data conversion will increase sharply. Similarly, if the power supply precision deteriorates and cannot provide a stable and accurate voltage to the system, it will seriously affect the acquisition and processing of analog signals. In severe cases, both of these situations may lead to serious malfunctions or even complete failure of the entire device. Furthermore, the high-precision regulated power supplies used to ensure voltage stability are also very expensive. Therefore, how to improve the accuracy of analog data conversion while reducing hardware requirements has become an urgent problem to be solved in this field. Summary of the Invention

[0003] This invention aims to provide a high-precision analog data conversion method that replaces anti-interference circuits with software algorithms. In traditional analog data conversion, anti-interference circuits and high-precision voltage supplies have high hardware requirements and are expensive, and hardware failures can easily lead to equipment malfunctions. This invention, through a unique software algorithm, can effectively solve these problems.

[0004] A high-precision analog data conversion method that replaces anti-interference circuits with software algorithms is a multi-sampling median algorithm. Given that power fluctuations and electromagnetic interference are distributed around the power supply average value, the multi-sampling median removes various electromagnetic interferences and noises mixed into the signal, achieving or even surpassing the signal purification effect of traditional anti-interference circuits. This eliminates the inaccuracy caused by fluctuations in adjacent sample values, thus completely eliminating reliance on hardware anti-interference circuits and avoiding equipment failures caused by the failure or malfunction of the anti-interference function of the sampling circuit.

[0005] Regarding voltage accuracy, the multi-sample median algorithm is highly adaptable to power supply fluctuations. Since power supply fluctuations are distributed around the power supply average value, the multi-sample median algorithm yields an analog data conversion result of the power supply average value. This significantly reduces the voltage accuracy requirements during the analog data conversion process. Even if the power supply accuracy decreases within the range where the CPU can operate normally, it will not adversely affect equipment operation or cause equipment failure. This not only reduces the need for high-precision regulated power supplies but also extends the equipment's lifespan.

[0006] Through actual testing and comparison, compared with existing technologies, this invention, by employing a software algorithm for multiple sampling median values, eliminates the anti-interference circuit for analog data conversion sampling, reducing the hardware cost related to sampling anti-interference by 100%. The power supply filter circuit eliminates the filter inductor, and the filter capacitor is reduced from 1000μF to 22μF, reducing the hardware cost of the power supply filter circuit by approximately 50%. Comparative testing using the same temperature sensor: with the original anti-interference circuit and power supply filter, the collected temperature fluctuates by 0.5℃; with the original anti-interference circuit and power supply filter, the collected temperature fluctuates by 1℃ when the common-ground DC fan is running; using the technology of this invention, by removing the anti-interference circuit and the filter inductor, and reducing the filter capacitor from 1000μF to 22μF, the collected temperature does not fluctuate when the common-ground DC fan is running. The DC fan was continuously tested for 120 hours at high, medium and low speeds. The equipment operated stably and no abnormalities caused by hardware problems occurred. This fully demonstrates the significant advantage of the present invention in terms of stability and effectively solves the problems of high hardware dependence, high cost and limited accuracy in the prior art.

[0007] Technical solution of the present invention

[0008] A high-precision analog data conversion method that replaces anti-interference circuits with software algorithms, this software algorithm-based high-precision analog data conversion method aims to achieve accurate processing of sensor data, and is characterized by including the following closely linked steps:

[0009] 1. Continuous Multiple Data Acquisition: The system utilizes a dedicated data acquisition program to continuously acquire data from the sensor connected to the microcontroller's A / D converter port multiple times. After each acquisition, the acquired data is stored sequentially into an array, providing the foundation for subsequent processing.

[0010] 2. Initial Sorting and Median Selection: Subsequently, the collected raw data array is sorted using algorithms such as quicksort, bubble sort, and merge sort. After sorting, the middle data point is selected as the preliminary result based on the parity of the number of data points. If the number of data points is odd, the middle data point is directly selected; if it is even, the average of the two middle data points is taken. This step sorts the subarray so that the AD conversion values ​​of the interfering time periods are sorted before and after, and the AD conversion values ​​of the stable voltage time periods are sorted in the middle. The median value is selected as the preliminary result based on the parity of the number of data points in the array, thus achieving the purpose of discarding the AD conversion values ​​of the interfering time periods and obtaining the AD conversion values ​​of the stable voltage time periods. Through sorting and median selection, representative data is initially screened, providing a reliable basis for subsequent processing.

[0011] 3. Historical Data Fusion: Starting from the beginning of the historical data array dedicated to the corresponding sensor, each data point is shifted forward one position. The median value obtained in the previous step is then stored at the end of the historical data array dedicated to the corresponding sensor, forming a completely new fused data array. This step achieves the fusion of new and historical data, enriching the data dimensions and value.

[0012] 4. Re-sorting and median selection: The newly generated fused data array is sorted again using a suitable sorting algorithm. The median value of the data in the middle position is then selected as the final, more accurate analog data conversion result. The fused data array is re-sorted and median selected to obtain the final analog data conversion result. Considering that the AD conversion results for the stable voltage period could not be obtained in step 2 due to long-term interference caused by the operation of the common-ground DC motor, the AD conversion values ​​for the stable voltage period are selected again from the fused data array. This removes the influence of occasional high-energy interference signals (such as "voltage fluctuations" and "strong noise voltage signals") on the AD conversion results. After this step, the accuracy and stability of the data are further improved, and it can more realistically reflect the state of the sensor.

[0013] 5. Data lookup and conversion: Finally, the final accurate simulation data conversion result is used to perform a lookup operation on the sensor data to obtain the corresponding temperature, humidity or air quality data, realizing the key conversion from raw data to actual application data and completing the entire simulation data processing closed loop.

[0014] The software for a high-precision analog data conversion method that uses software algorithms to replace anti-interference circuits consists of multiple collaborative modules. Each module has its own function but is closely related to the others, working together to complete the high-precision conversion of analog data.

[0015] 1. Data Acquisition Module: As the system's data source, this module is responsible for acquiring analog signals from various sensors connected to the microcontroller's A / D converter port, including temperature sensors, humidity sensors, and air cleanliness sensors. The accompanying signal conditioning circuit, without anti-interference circuitry, primarily amplifies or attenuates the sensor output signals to ensure they meet the input requirements of the microcontroller's A / D converter port. After signal conditioning, the analog signal is converted to a digital signal using the microcontroller's analog-to-digital conversion mechanism, stored sequentially in the raw data array, and promptly transmitted to the data processing module.

[0016] 2. Data Processing Module: This module receives data from the data acquisition module and performs in-depth processing. First, it receives the raw data array stored in the data acquisition module and performs an initial sorting and median-value calculation algorithm. For example, it uses quicksort, bubble sort, or merge sort to sort the raw data, and then selects the middle data based on the parity of the data count to obtain a preliminary result. Next, it reads the corresponding sensor-specific historical data from the data storage module and merges the historical data with the preliminary result to form a new dataset. Here, the historical data provided by the data storage module serves as a reference for data processing. Then, it performs the sorting and median-value calculation step again to finally obtain the accurate simulated data conversion result. The processed data awaits the final table lookup and conversion operation.

[0017] 3. Data Storage Module: This module is mainly used to store historical data acquisition results, saving the data in the form of arrays specific to the corresponding sensors. This historical data provides important data support for the data processing module. When the data processing module performs the historical data fusion step, it can combine it with the newly acquired data, making the processed data more comprehensive and reliable, and meeting the needs of the entire analog data conversion system for accurate data processing.

[0018] A high-precision analog data conversion method that replaces anti-interference circuits with software algorithms is proposed. In traditional AD conversion circuits, the power supply is connected to a voltage divider resistor, which is then connected to a temperature sensor. The sensor is grounded, and the connection point serves as the A / D sampling point. This sampling point is connected to the A / D sampling port of a microcontroller via a wire. The microcontroller's power supply terminal is connected to the power supply, and its grounding terminal is directly grounded. An anti-interference circuit is required between the sampling connection and ground. Typically, strict power supply ripple requirements exist; for example, the ripple amplitude of a 3.3V power supply is generally no greater than ±0.05V.

[0019] This method eliminates the anti-interference hardware in traditional circuits and instead relies on software algorithms to achieve high-precision conversion. Taking a microcontroller with an operating voltage of 1.8V to 5.5V as an example, when the power supply is 3.3V, the A / D sampling accuracy can be maintained within a voltage range where 3.3V is the reference and the voltage fluctuation amplitude caused by power supply ripple or interference signals does not exceed 1.5V. The power supply ripple or interference signals include: a. Voltage ripple: periodic voltage fluctuations caused by the switching power supply, with a peak value not exceeding 1.5V; b. Noise interference: non-periodic voltage fluctuations caused by the common ground operation of a DC motor or environmental interference, with an equivalent input noise amplitude not exceeding 1.5V. Here, 3.3V minus 1.5V equals 1.8V (the lower limit of the microcontroller's operating voltage), and 3.3V plus 1.5V is less than 5.5V (the upper limit of the microcontroller's operating voltage), ensuring that the microcontroller operates within its normal voltage range under these ripple and interference signal conditions. Its core principle is that the software algorithm selects the A / D conversion value during the stable period of the power supply voltage by sampling and sorting multiple times. This avoids the influence of power supply ripple or interference signals and ensures the accuracy of the sampling results.

[0020] The number of samplings should be determined based on the principle of covering at least one voltage ripple cycle and ensuring at least one sample in a stable voltage phase, and the number of samplings should be at least 3. If the above sampling principle cannot be met, or the voltage ripple cycle cannot be determined or is unstable, the number of samplings should be set as large as possible.

[0021] If the duration of the steady voltage phase within the ripple period is ≥12 microseconds, the single sampling time is 6.25 microseconds, and the minimum number of samplings is set to (voltage ripple period / 6.25 + 0.9) rounded down, with less than 3 samplings counted as 3.

[0022] If the duration of the stable phase is less than 12 microseconds, or the voltage ripple period cannot be determined / is unstable (e.g., when a common-ground DC motor is the main source of interference and the motor speed is adjustable), first perform the same number of number-theoretic sampling sorts and take the median. Using the stability of the A / D conversion quantization value obtained from 3 / 4 rounds of sampling as a condition, test to determine the number of sampling rounds.

[0023] If the microcontroller resources are limited, prioritize the maximum value among 32 to 64 iterations.

[0024] If the microcontroller has sufficient resources, the value should be selected according to the principle of "not affecting the operation of other functions of the microcontroller and taking as many samples as possible";

[0025] By continuously sampling and sorting the data, the median value is taken to ensure that data for the stable voltage phase is obtained. If the number of data points in a single sampling is less than 3, sampling needs to be continuously supplemented until the minimum number of samplings is met.

[0026] Hypothetical scenario example:

[0027] Scenario 1: If the ripple period is 32 microseconds and the steady-state phase lasts 15 microseconds (≥12 microseconds), then at least 6 samples must be taken (6.25 microseconds per sample).

[0028] Scenario 2: The ripple period is 8 microseconds, and the steady phase is only 5 microseconds (<6.25 microseconds). After testing, it was determined that the sampling was repeated 36 times (6.25 microseconds per sampling, with a cumulative sampling time of 216.25 microseconds, which is within the range of 32 to 64 times).

[0029] After sampling and sorting, the data is merged with historical data to obtain accurate A / D conversion values.

[0030] Taking an 8-bit microcontroller with an 8MHz clock speed as an example, performing 36 consecutive samples, completing one 10-bit A / D conversion and storing the result in a long integer array takes 6.25 microseconds. The total time for 36 A / D conversions is 6.25 × 36 = 225 microseconds. Using quicksort to sort the array of 36 long integers and retrieve the median takes approximately 125 microseconds. Merging the array of 36 long integers using historical data (shifting historical data forward by one bit, storing the median in the last position of the sorted array, and then sorting again) takes approximately 125 microseconds. Therefore, the total time is approximately 475 microseconds.

[0031] Taking the original polling time of 5 milliseconds of the microcontroller as an example, after the software algorithm replaces the anti-interference circuit with a high-precision analog data conversion method, although the polling time increases by 475 microseconds, it can obtain a high-precision conversion value within 180 milliseconds.

[0032] An increase of 475 microseconds is acceptable in general environmental parameter control scenarios (such as fresh air, intelligent ventilation, and air conditioning), but for scenarios with extremely high response speed requirements, accuracy and speed can be balanced by adjusting sampling-related parameters. To ensure response speed, testing has shown that the number of samples and the length of the historical fusion array can be reduced to below 32. In specific intelligent ventilation and fresh air scenarios, actual testing has found that a sampling count of 8 or more is sufficient to meet accuracy requirements, but to avoid the risk of undetected occasional interference, the sampling count and array length are often increased. As long as the control circuit operates smoothly and compilation succeeds, the sampling count and array length should be chosen as large as possible. Attached Figure Description

[0033] Figure 1 Temperature sampling circuit diagram without anti-interference circuit. Figure 2 A temperature sampling circuit diagram with anti-interference circuitry. Figure 3 Normal power supply waveform diagram Figure 4 Interference power supply ripple diagram Figure 5 Software Flowchart

[0034] 1 Power supply, 2 Voltage divider resistor, 3 Sensor, 4 Ground, 5 Microcontroller, 6 Microcontroller A / D sampling port, 7 A / D sampling point, 8 Wiring, 9 Anti-interference circuit, 10 Software flow, 20 Ripple of normal power supply, 21 Stable voltage, 22 Power supply ripple or interference signal.

[0035] Specific operational steps and implementation methods

[0036] like Figure 1 , Figure 2 , Figure 3 , Figure 4 , Figure 4 As shown, this method removes the anti-interference circuit 9 from the traditional circuit and instead relies on software algorithms to achieve high-precision conversion. Taking a microcontroller 5 with an operating voltage of 1.8V to 5.5V as an example, even if... Figure 4 The power supply ripple or interference signal 22 shown has an amplitude as high as ±1.5V, yet the A / D sampling accuracy can still be guaranteed. The core principle is that the software algorithm selects the A / D conversion value during the stable power supply voltage period 22 by sampling and sorting multiple times and taking the median value. This avoids the influence of interference and ensures the accuracy of the sampling results.

[0037] I. Hardware Connection:

[0038] like Figure 1 , Figure 2 As shown, a high-precision analog data conversion method using software algorithms to replace anti-interference circuits is presented. In a traditional AD conversion circuit, power supply 1 is connected to a reference voltage divider resistor 2, which is connected to a temperature sensor 3. Sensor 3 is grounded 4, and the connection point serves as the A / D sampling point 7. This A / D sampling point 7 is connected to the microcontroller's A / D sampling port 6 via a connection line 8. The microcontroller 5's power supply is connected to power supply 1, and its grounding terminal is directly grounded 4. An anti-interference circuit 9 is required between the sampling connection line 8 and ground. This invention eliminates the anti-interference circuit 9 in the traditional circuit. Typically, traditional AD conversion circuits have strict requirements for power supply ripple, such as... Figure 3 As shown, the ripple amplitude of a normal 3.3V power supply is generally no greater than ±0.05V.

[0039] It should be specifically pointed out that, Figure 1 , Figure 2 The diagram shows a temperature sensor. Since the structures of humidity sensors and air quality sensors differ slightly from those of temperature sensors, it is necessary to adapt the sensor signals to the microcontroller's A / D sampling port 6, taking into account their characteristics. Due to space limitations and the focus on key content, the specific adaptation details will not be elaborated upon here.

[0040] II. Software Implementation:

[0041] like Figure 5 The flowchart shown below uses temperature measurement as an example:

[0042] 1. Multiple consecutive data collections

[0043] Software execution: Start the data acquisition module program, collect sensor data cyclically at the set number of sampling times, and store the data into the raw data array in sequence after each acquisition.

[0044] 2. Initial sorting by center

[0045] Software execution: The data processing module calls quicksort, bubble sort, or merge sort algorithms to sort the original data array.

[0046] Median calculation:

[0047] If the number of data points is odd, take the middle data point.

[0048] If the number of data points is even, take the average of the two middle data points and store it in a temporary variable as a preliminary result.

[0049] 3. Historical data fusion

[0050] Software execution:

[0051] (1) Shift each element of the historical data array corresponding to the sensor forward by one position;

[0052] (2) Store the preliminary results at the end of the historical data array to form a merged data array;

[0053] (3) Sort again and take the middle.

[0054] Software execution: The process of sorting and calculating the median of the fused data array is used to obtain the final simulated data transformation result.

[0055] 4. Data lookup and conversion

[0056] Software execution: Based on the final result, it converts it into actual physical quantities (temperature, humidity, air quality, etc.) through a preset lookup table algorithm (such as linear interpolation, piecewise mapping, etc.) and outputs them to the application variables.

[0057] III. Specific Implementation of Software Modules

[0058] 1. Data Acquisition Module

[0059] Function: Controls the A / D converter to acquire analog signals from the sensor, converts them into digital signals after signal conditioning, and stores them in the raw data array.

[0060] 2. Data Processing Module

[0061] Functions: Perform sorting and centering, historical data fusion, and final result calculation.

[0062] Key steps:

[0063] (1) Use a sorting algorithm to sort the original data array and calculate the preliminary median;

[0064] (2) Read the historical data array and perform data fusion;

[0065] (3) Sort the merged array again and calculate the final median.

[0066] 3. Data storage module

[0067] Function: Saves historical data in the form of sensor array, supports reading and writing by sensor type, and the sampling array is universal.

[0068] IV. Method for Determining the Number of Samples

[0069] 1. Typical Scenarios

[0070] Principle: Cover at least one voltage ripple cycle and obtain one stable voltage 21 sampling.

[0071] Calculation rules:

[0072] Taking a single sampling time of 6.25 microseconds as an example, if the duration of the steady voltage phase 21 is ≥12 microseconds:

[0073] Number of samplings = (voltage ripple period / single sampling time + 0.9), less than 3 times will be counted as 3 times.

[0074] If the duration of the 21-stage steady voltage is less than 12 microseconds or the ripple period is uncertain:

[0075] Through testing, it was determined that, under the condition that the A / D quantization value is stable after 3 / 4 rounds of sampling, the maximum value among 32 to 64 times should be selected first (when the microcontroller resources are limited), otherwise the value should be selected as "as large as possible".

[0076] 2. Special Scenarios

[0077] The interference source is an adjustable-speed common-ground DC motor: dynamic testing is required to determine the number of samplings to ensure coverage of interference cycles at all motor speeds.

[0078] V. Implementation Examples

[0079] 1. Scenario 1

[0080] Conditions: Ripple period 32 microseconds, steady phase 15 microseconds.

[0081] Calculation: Number of samplings = (32 / 6.25 + 0.9), rounded to 6.

[0082] 2. Scenario 2

[0083] Conditions: Ripple period 8 microseconds, steady phase 5 microseconds.

[0084] Calculation: After testing, it was determined that 36 samples were taken (6.25 microseconds per sample, total time 216.25 microseconds, which meets the range of 32-64 samples).

[0085] VI. Time and Performance Evaluation

[0086] Taking an 8-bit microcontroller with an 8MHz clock speed as an example (36 samples):

[0087] Total A / D conversion time: 6.25 microseconds × 36 = 225 microseconds

[0088] Sorting and finding the median takes approximately 125 microseconds.

[0089] Historical data fusion time: approximately 125 microseconds

[0090] Total processing time: approximately 475 microseconds

[0091] In comparison, the original polling time of 5 milliseconds was increased by 475 microseconds, but it still meets the needs of most scenarios (such as intelligent ventilation and air conditioning). The sorted A / D quantization value of 197.1 milliseconds was obtained after 36 rounds of fusion, which means that the accurate A / D quantization value of 197.1 milliseconds was obtained.

[0092] VII. Main Beneficial Effects

[0093] The beneficial effects of this invention are as follows:

[0094] 1. Achieve high-precision analog data conversion: Through continuous data acquisition, initial sorting and selection, historical data fusion, re-sorting and selection, and data lookup and conversion, the sensor's state can be more accurately reflected, realizing the key conversion from raw data to actual application data, completing the closed loop of analog data processing, and improving data accuracy and stability.

[0095] 2. Replaces anti-interference hardware: Eliminates the anti-interference circuit hardware in traditional circuits and instead relies on software algorithms to achieve high-precision conversion. Even if the power supply ripple or interference signal amplitude is as high as ±1.5V (taking the microcontroller power supply voltage of 3.3V with an operating voltage range of 1.8V to 5.5V as an example), the A / D sampling accuracy can still be guaranteed.

[0096] 3. Determine the sampling number reasonably: The sampling number is determined based on the principle of covering the voltage ripple period and ensuring sampling during the stable voltage stage. Specific methods are given for different ripple conditions to ensure that stable voltage stage data is obtained and accurate A / D conversion values ​​are obtained.

[0097] 4. Meeting the needs of different scenarios: In general environmental parameter control scenarios (such as fresh air, intelligent ventilation, air conditioning, etc.), although the polling time increases, high-precision conversion values ​​can be obtained, and the increase in time is still acceptable. For scenarios with extremely high action speed requirements, accuracy and speed can be balanced by adjusting sampling-related parameters, such as reducing the number of samplings and the length of the historical fusion array. Actual tests show that in scenarios such as intelligent ventilation and fresh air, a sampling number of 8 or more is sufficient to meet the accuracy requirements, and the sampling number and array length can be increased as needed to avoid occasional interference.

[0098] 5. Extend the actual service life of the equipment:

[0099] Removing the anti-interference circuit hardware from traditional circuits can avoid equipment downtime caused by hardware failures and reduce natural wear and tear on hardware. At the same time, software algorithms optimize data acquisition and processing, reducing the impact of switching power supply ripple and interference noise on equipment operation, thereby effectively extending the service life of the equipment.

[0100] 6. Enhanced resistance to transient interference: The sampling time has been extended from 6.25 microseconds to 191.7 milliseconds, significantly increasing the sampling duration. This allows for the shielding of data during more transient interference periods. By filtering effective signals through algorithms, the system's ability to resist transient interference is significantly enhanced, ensuring data reliability.

[0101] 7. Cost savings:

[0102] While cost savings may seem less important than improving accuracy and extending lifespan, the elimination of hardware anti-interference circuitry results in a 100% cost reduction. Simultaneously, the reduced requirements for switching power supply ripple accuracy allow for voltage ripple amplitude increases of several times or even tens of times, which also reduces design and manufacturing costs to some extent.

[0103] The above description is merely an exemplary description of the present invention and should not be construed as limiting the scope of protection of the present invention. The core technology of the present invention lies in achieving reliable processing of high-precision analog data conversion through an algorithm of continuous A / D conversion, storage, sorting, and median value extraction.

Claims

1. A high-precision analog data conversion method that replaces anti-interference circuits with software algorithms, characterized in that, include: a. First, the sensor (3) data connected to the microcontroller's A / D sampling port (6) is collected multiple times and stored in a digital array; b. Next, the digital array is sorted so that the AD conversion values ​​of the interference period are sorted at the beginning and end, and the AD conversion values ​​of the stable voltage period are sorted in the middle. The median value is selected as the preliminary result according to the parity of the number of data in the array, so as to discard the AD conversion values ​​of the interference period and obtain the AD conversion values ​​of the stable voltage period. c. Next, shift the data in the sensor data array one position to the left, and then assign the preliminary result to the end of the array to generate the fused data array; d. Sort the fused data array again and take the middle value to obtain the final analog data conversion result. Considering that the AD conversion result of the stable voltage period could not be obtained in step 2 due to long-term interference caused by the operation of the DC motor in the common ground, the AD conversion value of the stable voltage period is selected again from the fused data array to achieve the purpose of removing the influence of occasional high-energy interference signals (such as "voltage fluctuation" and "strong noise voltage signal") on the AD conversion result. e. Finally, by performing a lookup operation on the sensor data, the final result is converted into temperature, humidity, or air quality data.

2. A high-precision analog data conversion device based on software algorithms, characterized in that: a. Includes a data acquisition module. The data acquisition module is only equipped with a signal conditioning circuit and does not contain an anti-interference circuit (9). It adapts to the input requirements of the microcontroller's AD conversion port (6) by amplification or voltage division, reduces signal transmission delay, and transmits the analog signal output by the sensor (3) to the microcontroller (5) after conditioning. The microcontroller (5) then converts the analog signal to a digital value. b. The device achieves high-precision conversion of analog data through software algorithm, which includes the steps of continuous multiple sampling, sorting and centering, historical data fusion and table lookup as described in claim 1, discarding the AD conversion value of the interference time period (22); and obtaining the AD conversion value of the stable voltage (21) time period.

3. The high-precision analog data conversion method that replaces the anti-interference circuit (9) with a software algorithm according to claim 1, characterized in that, The sorting algorithms include quicksort, bubble sort, or merge sort.

4. The high-precision analog data conversion method using software algorithms to replace anti-interference circuits according to claim 1, characterized in that, The number of samples is determined according to the following rules: ①. Cover at least one voltage ripple cycle and obtain one stable voltage sample, with a minimum of 3 samples; ②. When the single sampling time is 6.25 microseconds and the duration of the steady phase within the voltage ripple period is ≥12 microseconds, the number of samplings is rounded up to (voltage ripple period / 6.25+0.9). If the result is less than 3 times, it is calculated as 3 times. ③. When conditions ① and ② above cannot be met: If the microcontroller (5) has limited resources such as memory and processing speed, the number of samplings should be the maximum value between 32 and 64. If the microcontroller (5) has sufficient resources, the sampling number should be taken as large as possible without affecting the operation of other functions of the microcontroller (5).

5. The high-precision analog data conversion method using software algorithms to replace anti-interference circuits according to claim 1, characterized in that, The data processing module retrieves historical data from the data storage module and performs two sorting and centering operations.

6. The high-precision analog data conversion method using software algorithms to replace anti-interference circuits according to claim 1, characterized in that, The data storage module stores historical data in the form of a dedicated array for the sensor (3), supporting data forwarding and fusion.

7. The high-precision analog data conversion method using software algorithms to replace anti-interference circuits according to claim 1, characterized in that, The microcontroller (5) operates in a voltage range of 1.8V-5.5V. When the power supply is 3.3V, and with 3.3V as the reference, the peak values ​​of the power supply ripple or interference signal, both individually and in combination, do not exceed 1.5V, thus maintaining A / D sampling accuracy. a. Voltage ripple: Periodic voltage fluctuations caused by the switching power supply, with both the upward and downward peak values ​​not exceeding 1.5V; b. Noise interference: Non-periodic voltage fluctuations caused by DC motor common-ground operation or environmental interference, the upward and downward peak values ​​of the equivalent input noise do not exceed 1.5V; Among them, 3.3V minus 1.5V equals 1.8V (which is the lower limit of the working voltage of the microcontroller (5)), and 3.3V plus 1.5V is less than 5.5V (which is the upper limit of the working voltage of the microcontroller (5)), ensuring that the microcontroller (5) is in the normal working voltage range and realizing the conversion of high-precision analog data by the software algorithm.

8. The high-precision analog data conversion method using software algorithms to replace anti-interference circuits according to claim 1, characterized in that, The method can balance accuracy and speed by adjusting the number of samplings and the length of the historical array, and is suitable for environmental parameter control scenarios.

9. A software system for implementing the method of any one of claims 1 to 8, characterized in that, It includes a data acquisition module, a data processing module, and a data storage module that work together.