Software filtering method for class-f weak current signal, electronic device and storage medium
By employing a two-stage filtering method and outlier monitoring, the problem of noise interference in weak current signals at the fA level was solved, achieving high accuracy and stability of the signal and improving the filtering effect.
Patent Information
- Application Number
- CN202211505720.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-11-28
- Publication Date
- 2026-08-25
- Estimated Expiration
- 2042-11-28
AI Technical Summary
Existing technologies struggle to effectively filter out noise interference in weak fA-level current signals, especially system thermal noise and pulse interference. Furthermore, traditional software filtering algorithms cannot balance signal smoothness and accuracy.
A two-stage filtering method is adopted. First, the arithmetic average filtering algorithm is used to filter out periodic interference. Then, the recursive average filtering algorithm is used to filter out system thermal noise and impulse interference. Signal changes are judged by monitoring the dispersion of the data queue and the outlier count to ensure signal smoothness and accuracy.
It significantly improves the accuracy and stability of fA-level weak current signals, and the measured signal fitting curve has a better overlap with the actual curve. It can capture signal changes in a timely manner and preserve signal fluctuation characteristics to the greatest extent.
Smart Images

Figure CN115882823B_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of weak current signal technology, specifically to a software filtering method, electronic device, and storage medium for fA-level weak current signals. Background Technology
[0002] The detection of micro-current signals has wide applications in cutting-edge technology fields such as instrumentation and sensors. fA-level current signal detection represents the current pinnacle of micro-current testing. Weak current signals are highly susceptible to external interference, such as circuit interference, power supply noise, electromagnetic interference, and random environmental interference. The original acquired signal is superimposed with various periodic or non-periodic interference signals, resulting in a low signal-to-noise ratio. Therefore, effectively filtering out noise from weak current signals is one of the challenges in this field. In the hardware circuit design of weak current signal detection systems, electromagnetic shielding circuits can be optimized to shield some interference, but this is generally costly and lacks flexibility. Furthermore, power frequency interference signals with similar low-frequency characteristics to the signal, system thermal noise, and random environmental pulse interference are difficult to remove through hardware circuit design, resulting in unsatisfactory filtering effects that cannot meet the filtering requirements of weak current signals. Compared to hardware filtering, software filtering offers advantages such as low cost and high flexibility, and is widely used in data acquisition.
[0003] In the field of signal acquisition, traditional software filtering algorithms include arithmetic average filtering, amplitude limiting filtering, and recursive average filtering. Traditional filtering algorithms cannot simultaneously filter out both periodic and non-periodic noise. For example, recursive average filtering and arithmetic average filtering have good suppression effects on periodic interference signals, but their response speed is slow, signal sensitivity is low, and they waste a lot of RAM, and they cannot effectively suppress pulse interference. Amplitude limiting filtering can effectively filter out pulse interference, but its filtering effect on periodic interference is poor, and the signal smoothness is also poor. Meanwhile, for weak signals, the interference of system thermal noise is not negligible, and the aforementioned conventional software filtering methods cannot effectively filter out the system thermal noise submerged in weak signals, and they cannot simultaneously maintain both the dispersion and smoothness of the signal, thus failing to meet the filtering requirements of high-accuracy weak current signals. Summary of the Invention
[0004] In view of the above-mentioned technical problems, the purpose of this invention is to provide a software filtering method, electronic device and storage medium for fA-level weak current signals, which can effectively extract and filter out system thermal noise in micro current signals, and retain the signal dispersion to the greatest extent, thereby effectively improving the measurement accuracy.
[0005] The technical solution to achieve the purpose of this invention is: a software filtering method for fA-level weak current signals, comprising the following steps:
[0006] Step S1: Set sampling parameters and calculate the preset target value for the number of sampling points;
[0007] Step S2: Start AD data acquisition. When the number of sampling points reaches the preset target value, the data processing software is interrupted and first-level filtering is performed.
[0008] Step S3: Call back the secondary filtering function to perform secondary filtering and obtain the filtered voltage value.
[0009] The first-level filtering uses an arithmetic average filtering algorithm, and the second-level filtering uses a recursive average filtering algorithm.
[0010] According to one technical solution of the present invention, it further includes:
[0011] Step S4: Calculate the original weak current signal value based on the conversion resistor value.
[0012] According to one technical solution of the present invention, step S2 includes:
[0013] Step S21: According to the sampling order, starting from the first number of the array, store the AD acquisition data read in this sampling period into the original signal array AD_buf_Data[] in sequence, and count the number of sampling points;
[0014] Step S22: When the number of sampling points equals the preset target value, the data processing software is interrupted to calculate the average value of the original sampled data in AD_buf_Data[] and obtain the signal value data_avg after the first-level filtering.
[0015] According to one technical solution of the present invention, step S3 specifically includes:
[0016] Step S34: Define the secondary filter array AD_buf_normal[];
[0017] Step S35: Determine whether the newly input first-level filtered signal value data_avg is between [n-kδ, n+kδ];
[0018] Step S36: If yes, discard the first data in the array AD_buf_normal[], shift the remaining data forward in sequence, update data_avg to the end of the array AD_buf_normal[], and update the data_avg to the array AD_buf_orig[] at the same time;
[0019] Step S37: If data_avg > n + kδ, then replace data_avg with n + kδ and update the array AD_buf_normal[].
[0020] Step S38: If data_avg < n - kδ, then replace data_avg with n - kδ and update it to the array AD_buf_normal[].
[0021] Step S39: Calculate the arithmetic mean of the array AD_buf_normal[] and determine that the arithmetic mean is the final signal value after two - stage filtering.
[0022] According to a technical solution of the present invention, in step S3, before defining the two - stage filtering array, it further includes:
[0023] Step S30: Callback the two - stage filtering processing function and pass the signal value data_avg after the first - stage filtering as a parameter into the two - stage filtering processing program.
[0024] Step S31: Define the array AD_buf_orig[] as the two - stage filtering original data storage array.
[0025] Step S32: Determine whether there is 0 in the data of the original data storage array AD_buf_orig[].
[0026] Step S33: If the data in the array AD_buf_orig[] are all non - zero, calculate the mean n and the standard deviation δ of the original data array AD_buf_orig[].
[0027] According to a technical solution of the present invention, in step S32, if there is 0 in the data of the array AD_buf_orig[], then discard the first data of the array AD_buf_orig[], move the other data forward in sequence, and store the sampling value data_avg obtained by the first - stage filtering at the end of the array AD_buf_orig[].
[0028] According to a technical solution of the present invention, in step S3, it further includes:
[0029] Judge whether it is a normal change of the signal according to the number of occurrences that the newly incoming signal value data_avg after the first - stage filtering is not within [n - kδ, n + kδ].
[0030] According to a technical solution of the present invention, the judgment of whether it is a normal change of the signal according to the number of occurrences that the newly incoming signal value data_avg after the first - stage filtering is not within [n - kδ, n + kδ] specifically includes:
[0031] Step S351: Define the data over - limit number as Y.
[0032] Step S352: If data_avg > n + kδ or data_avg < n - kδ, increment the count value Y by 1;
[0033] Step S353: If data_avg is within the range of n - kδ to n + kδ, check if Y is greater than 0. If so, decrement the value of Y by 1; if not, do nothing;
[0034] Step S354: If the data overrun count value Y is greater than 5, determine that this is a normal signal change and not an interference value. At this time, clear the AD_buf_orig[] and AD_buf_normal[] arrays, clear the overrun count value Y, and restart the secondary filtering program.
[0035] According to one aspect of the present invention, there is provided an electronic device, including: one or more processors, one or more memories, and one or more computer programs; wherein, the processor is connected to the memory, and the above-mentioned one or more computer programs are stored in the memory. When the electronic device runs, the processor executes the one or more computer programs stored in the memory, so that the electronic device executes the software filtering method for fA-level weak current signals described in any one of the above technical solutions.
[0036] According to one aspect of the present invention, there is provided a computer-readable storage medium for storing computer instructions, which, when executed by a processor, implement the software filtering method for fA-level weak current signals described in any one of the above technical solutions.
[0037] According to the concept of the present invention, there is proposed a software filtering method, an electronic device, and a storage medium for fA-level weak current signals. The original signal effectively filters out the periodic power frequency interference of the power supply in the system through the first-level periodic arithmetic average filtering algorithm, improving the smoothness of the signal. The signal after the first-level filtering is then filtered through the second-level filtering, effectively filtering out the system thermal noise and random pulse interference from the environment. During the processing, first, the dispersion of the original data queue is calculated, and the new data entering the data queue is limited according to the dispersion, effectively shielding the pulse interference while separating the system thermal noise that satisfies the normal distribution law. The system thermal noise is effectively filtered out through arithmetic average calculation, and the outliers are monitored and counted. When the outlier count reaches the threshold, it is determined that the signal has jumped, and the signal change is timely fed back. While ensuring the smoothness of the signal, the real-time change of the weak current signal can be timely captured, and the signal fluctuation is restored to the greatest extent. After actual measurement, compared with the traditional software filtering algorithm, after applying this filtering algorithm, the measured signal fitting curve coincides better with the actual curve, effectively improving the accuracy and stability of the weak current signal. BRIEF DESCRIPTION OF THE DRAWINGS
[0038] Figure 1A flowchart illustrating a software filtering method for fA-level weak current signals according to an embodiment of the present invention;
[0039] Figure 2 The flowchart schematically illustrates a software filtering method for fA-level weak current signals according to another embodiment of the present invention. Detailed Implementation
[0040] To more clearly illustrate the technical solutions in the embodiments of the present invention or the prior art, the accompanying drawings used in the embodiments will be briefly described below. Obviously, the drawings described below are merely some embodiments of the present invention, and those skilled in the art can obtain other drawings based on these drawings without any creative effort.
[0041] The present invention will now be described in detail with reference to the accompanying drawings and specific embodiments. The embodiments cannot be described in detail here, but the embodiments of the present invention are not limited to the following embodiments.
[0042] like Figures 1 to 2 As shown, a software filtering method for weak current signals at the fA level according to the present invention includes the following steps:
[0043] Step S1: Set sampling parameters and calculate the preset target value for the number of sampling points;
[0044] Step S2: Start AD data acquisition. When the number of sampling points reaches the preset target value, the data processing software is interrupted and first-level filtering is performed.
[0045] Step S3: Call back the secondary filtering function to perform secondary filtering and obtain the filtered voltage value.
[0046] The first-level filtering uses an arithmetic average filtering algorithm, and the second-level filtering uses a recursive average filtering algorithm.
[0047] In this embodiment, the original signal is effectively filtered by a first-stage periodic arithmetic average filtering algorithm to remove periodic power frequency interference from the power supply in the system, improving signal smoothness. The signal after the first-stage filtering is then filtered by a second-stage filtering algorithm to effectively remove system thermal noise and random pulse interference from the environment. In the processing, the dispersion of the original data queue is first calculated, and the new data entering the data queue is limited according to the dispersion. This effectively shields pulse interference while separating system thermal noise that meets the normal distribution law. The system thermal noise is effectively filtered out by arithmetic average calculation. Outliers are monitored and counted. When the outlier count reaches a threshold, it is determined that the signal has changed, and the signal change is fed back in time. While ensuring signal smoothness, it can capture the real-time changes of weak current signals in a timely manner, restoring signal fluctuations to the greatest extent. According to actual measurements, compared with traditional software filtering algorithms, the measured signal fitting curve has a better overlap with the actual curve after applying this filtering algorithm, effectively improving the accuracy and stability of weak current signals.
[0048] Furthermore, the use of software and hardware interrupts combined with callback functions optimizes software threads to the greatest extent, effectively improving the response speed of filtering operations.
[0049] In one embodiment of the present invention, preferably, it further includes:
[0050] Step S4: Calculate the original weak current signal value based on the conversion resistor value.
[0051] In one embodiment of the present invention, preferably, step S2 includes:
[0052] Step S21: According to the sampling order, starting from the first number of the array, store the AD acquisition data read in this sampling period into the original signal array AD_buf_Data[] in sequence, and count the number of sampling points;
[0053] Step S22: When the number of sampling points equals the preset target value, the data processing software is interrupted to calculate the average value of the original sampled data in AD_buf_Data[] and obtain the signal value data_avg after the first-level filtering.
[0054] In one embodiment of the present invention, preferably, step S3 specifically includes:
[0055] Step S34: Define the secondary filter array AD_buf_normal[];
[0056] Step S35: Determine whether the newly input first-level filtered signal value data_avg is between [n-kδ, n+kδ];
[0057] Step S36: If so, discard the first data of the array AD_buf_normal[], move the remaining data forward in sequence, update data_avg to the end of the array AD_buf_normal[], and at the same time update the data data_avg to the array AD_buf_orig[];
[0058] Step S37: If data_avg > n + kδ, replace data_avg with n + kδ and update it to the array AD_buf_normal[];
[0059] Step S38: If data_avg < n - kδ, replace data_avg with n - kδ and update it to the array AD_buf_normal[];
[0060] Step S39: Calculate the arithmetic mean of the AD_buf_normal[] array and determine that the arithmetic mean is the final signal value after two - stage filtering.
[0061] In this embodiment, the system thermal noise is effectively filtered by arithmetic - mean calculation. At the same time, the outliers are monitored and counted. When the outlier count reaches the threshold, it is determined that the signal has a jump, and the signal change is fed back in time. While ensuring the signal smoothness, the real - time change of the weak current signal can be captured in time, and the signal fluctuation is restored to the greatest extent. After actual measurement, compared with the traditional software filtering algorithm, after applying this filtering algorithm, the measured signal fitting curve coincides better with the actual curve, effectively improving the accuracy and stability of the weak current signal. On the basis of effectively filtering the system thermal noise, the discrete characteristics of the signal are retained to the greatest extent, making the fitting curve after filtering coincide more with the actual curve, and effectively improving the measurement accuracy of the fA micro - current signal.
[0062] In an embodiment of the present invention, preferably, in step S3, before defining the two - stage filtering array, it further includes:
[0063] Step S30: Callback the two - stage filtering processing function and pass the signal value data_avg after the first - stage filtering as a parameter into the two - stage filtering processing program;
[0064] Step S31: Define the AD_buf_orig[] array as the two - stage filtering original data storage array;
[0065] Step S32: Determine whether there is 0 in the data of the original data storage array AD_buf_orig[];
[0066] Step S33: When the data in the array AD_buf_orig[] are all non - zero, calculate the mean n and the standard deviation δ of the original data array AD_buf_orig[];
[0067] In this embodiment, by calculating the average value and variance of the original data array, the ideal fluctuation range after the thermal noise is superimposed on the original micro-current signal can be judged, and the signal data data_avg after the first-stage filtering entering the AD_buf_orig[] array is limited by this range interval.
[0068] In an embodiment of the present invention, preferably, in step S32, if there is a 0 in the data of the array AD_buf_orig[], the first data of the array AD_buf_orig[] is discarded, and the other data are moved forward in turn, and the sampled value data_avg obtained by the first-stage filtering is stored at the end of the array AD_buf_orig[].
[0069] In an embodiment of the present invention, in step S3, it further includes:
[0070] According to the number of times that the newly incoming signal value data_avg after the first-stage filtering is not within [n - kδ, n + kδ], it is judged whether it is a normal change of the signal.
[0071] In an embodiment of the present invention, according to the number of times that the newly incoming signal value data_avg after the first-stage filtering is not within [n - kδ, n + kδ], it is judged whether it is a normal change of the signal, which specifically includes:
[0072] Step S351: Define the data overrun number as Y;
[0073] Step S352: If data_avg > n + kδ or data_avg < n - kδ, then add 1 to the count value Y;
[0074] Step S353: If data_avg is within the range of n - kδ to n + kδ, judge whether Y is greater than 0. If so, subtract 1 from the value of Y. If not, do not process;
[0075] Step S354: If the data overrun count value Y is greater than 5, judge that this is a normal change of the signal and is a non-interference value. At this time, clear the AD_buf_orig[] and AD_buf_normal[] arrays, and clear the overrun count value Y, and restart the second-stage filtering program.
[0076] In this embodiment, using this method to limit the signal will be insensitive to the change of the original micro-current signal and reduce the sensitivity of the signal. According to the number of times that the newly incoming signal value data_avg after the first-stage filtering is not within [n - kδ, n + kδ], judging whether it is a normal change of the signal can effectively avoid the above problems.
[0077] According to one aspect of the present invention, an electronic device is provided, comprising: one or more processors, one or more memories, and one or more computer programs; wherein the processor is connected to the memory, and the one or more computer programs are stored in the memory; when the electronic device is running, the processor executes the one or more computer programs stored in the memory to cause the electronic device to perform the software filtering method for fA-level weak current signals as described in any of the above technical solutions.
[0078] According to one aspect of the present invention, a computer-readable storage medium is provided for storing computer instructions, which, when executed by a processor, implement a software filtering method for fA-level weak current signals as described in any of the above technical solutions.
[0079] In summary, this invention proposes a software filtering method, electronic device, and storage medium for fA-level weak current signals. The original signal is filtered through a first-stage periodic arithmetic average filtering algorithm to effectively remove periodic power frequency interference from the system's power supply, improving signal smoothness. The signal after the first-stage filtering then undergoes a second-stage filtering to effectively filter out system thermal noise and random pulse interference from the environment. During processing, the dispersion of the original data queue is first calculated, and new data entering the queue is limited based on this dispersion, effectively shielding pulse interference while separating system thermal noise that follows a normal distribution. Arithmetic averaging effectively filters out system thermal noise. Outliers are monitored and counted; when the outlier count reaches a threshold, a signal jump is detected, and the signal change is promptly reported. While ensuring signal smoothness, this invention can capture real-time changes in weak current signals, restoring signal fluctuations to the greatest extent possible. Actual measurements show that, compared with traditional software filtering algorithms, the measured signal fitting curve of this algorithm has a better overlap with the actual curve, effectively improving the accuracy and stability of weak current signals.
[0080] Furthermore, it should be noted that the present invention can be provided as a method, electronic device, storage medium, or computer program product. Therefore, embodiments of the present invention can take the form of a completely hardware embodiment, a completely software embodiment, or an embodiment combining software and hardware aspects. Moreover, embodiments of the present invention can take the form of a computer program product implemented on one or more computer-usable storage media containing computer-usable program code.
[0081] It should also be noted that, in this document, the terms "comprising," "including," or any other variations thereof are intended to cover non-exclusive inclusion, such that a process, method, article, or terminal device that comprises a list of elements includes not only those elements but also other elements not expressly listed, or elements inherent to such a process, method, article, or terminal device. Without further limitations, an element defined by the phrase "comprising one..." does not exclude the presence of other identical elements in the process, method, article, or terminal device that includes said element.
[0082] Finally, it should be noted that the above description represents a preferred embodiment of the present invention. It should be pointed out that although preferred embodiments have been described, those skilled in the art, once they understand the basic inventive concept of the present invention, can make various improvements and modifications without departing from the principles described herein. These improvements and modifications should also be considered within the scope of protection of the present invention. Therefore, the appended claims are intended to be interpreted as including both the preferred embodiments and all changes and modifications falling within the scope of the embodiments of the present invention.
Claims
1. A software filtering method for weak current signals at the fA level, characterized in that, Includes the following steps: Step S1: Set sampling parameters and calculate the preset target value for the number of sampling points; Step S2: Start AD data acquisition. When the number of sampling points reaches the preset target value, the data processing software is interrupted and first-level filtering is performed. Step S3: Call back the secondary filtering function to perform secondary filtering and obtain the filtered voltage value. The first-level filtering uses an arithmetic average filtering algorithm, and the second-level filtering uses a recursive average filtering algorithm. Step S3 specifically includes: Step S30: Call back the secondary filtering function and pass the signal value data_avg after primary filtering as a parameter to the secondary filtering program; Step S31: Define the AD_buf_orig[] array as the raw data storage array for the second-level filter; Step S32: Determine whether there are 0s in the original data storage array AD_buf_orig[]. If there are 0s in the array AD_buf_orig[], discard the first data in the array AD_buf_orig[], shift the other data forward in sequence, and store the sampled value data_avg obtained by the first-level filter at the end of the array AD_buf_orig[]. Step S33: If all the data in the array AD_buf_orig[ ] are not 0, calculate the mean n and the standard deviation δ of the original data array AD_buf_orig[ ]. Step S34: Define the secondary filter array AD_buf_normal[ ]; Step S35: Determine whether the newly input first-level filtered signal value data_avg is between [n-kδ, n+kδ]; Step S36: If yes, discard the first data in the array AD_buf_normal[], shift the remaining data forward in sequence, update data_avg to the end of the array AD_buf_normal[], and update the data_avg to the array AD_buf_orig[]. Step S37: If data_avg > n+kδ, then replace data_avg with n+kδ and update the array AD_buf_normal[]. Step S38: If data_avg < n-kδ, then replace data_avg with n-kδ and update the array AD_buf_normal[]. Step S39: Calculate the arithmetic mean of the AD_buf_normal[] array and determine that the arithmetic mean is the final signal value after two stages of filtering.
2. The method according to claim 1, characterized in that, Also includes: Step S4: Calculate the original weak current signal value based on the conversion resistor value.
3. The method according to claim 1, characterized in that, Step S2 includes: Step S21: According to the sampling order, the AD acquisition data read in this sampling period is stored into the original signal array AD_buf_Data[] starting from the first number of the array, and the number of sampling points is counted. Step S22: When the number of sampling points equals the preset target value, the data processing software is interrupted to calculate the average value of the original sampled data in AD_buf_Data[] and obtain the signal value data_avg after the first-level filtering.
4. The method according to claim 3, characterized in that, Step S3 further includes: Based on the number of times the newly input first-level filtered signal value data_avg is not in the range [n-kδ, n+kδ], determine whether it is a normal change in the signal.
5. The method according to claim 4, characterized in that, The step of determining whether a signal change is normal based on the number of times the newly input first-level filtered signal value data_avg is not within the range [n-kδ, n+kδ] specifically includes: Step S351: Define the number of data exceeding the limit as Y; Step S352: If data_avg > n+kδ or data_avg < n-kδ, then increment the count value Y by 1; Step S353: If data_avg is in the range of n-kδ to n+kδ, determine whether Y is greater than 0. If yes, decrement the value of Y by 1. If no, do not process it. Step S354: If the number of times the data exceeds the limit Y is greater than 5, it is determined that this is a normal signal change and a non-interference value. At this time, the AD_buf_orig[] and AD_buf_normal[] arrays are cleared, the over-limit count value Y is cleared to zero, and the secondary filtering program is restarted.
6. An electronic device, characterized in that, include: One or more processors, one or more memories, and one or more computer programs; wherein the processor is connected to the memory, the one or more computer programs are stored in the memory, and when the electronic device is running, the processor executes the one or more computer programs stored in the memory to cause the electronic device to perform the software filtering method for fA-level weak current signals as described in any one of claims 1 to 5.
7. A computer-readable storage medium, characterized in that, Used to store computer instructions, which, when executed by a processor, implement a software filtering method for fA-level weak current signals as described in any one of claims 1 to 5.
Citation Information
Patent Citations
ADC filtering method for small signal de-noising
CN106656187A
Composite software filtering method and system applied to AD collection
CN109450405A