Noise reduction filtering methods, systems, devices, and storage media for dynamic capacitance sensing

By using a two-dimensional Kalman filter model and dual-mode state machine management, combined with a sliding window and slow integration calibration channel, the contradiction between noise suppression and response speed in capacitance detection is resolved, enabling high-precision capacitance detection in complex environments.

CN123074446APending Publication Date: 2026-11-10WUXI GUOXINWEI HIGH-TECH CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202611294896.8
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2026-08-25
Publication Date
2026-11-10

AI Technical Summary

Technical Problem

Existing capacitive sensing noise reduction and filtering techniques struggle to simultaneously achieve high noise suppression performance, rapid step response capability, and long-period baseline adaptive tracking capability against covariance saturation, thus limiting the application of capacitive sensing technology in complex electromagnetic environments and high-precision scenarios.

Method used

A two-dimensional Kalman filter model is adopted. By configuring differentiated process noise and using a sliding window to calculate the environmental noise variance in real time, combined with dual-mode state machine management and an external slow integration baseline calibration channel, the dynamic signal component and the DC baseline component are decoupled. The observation noise covariance is adaptively adjusted to match the environmental noise level.

Benefits of technology

It improves the sensitivity and stability of capacitance detection, and can achieve high noise suppression, extremely fast step response and long-period baseline adaptive tracking in complex electromagnetic environments, which significantly improves detection accuracy and operational reliability.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN123074446A_ABST
    Figure CN123074446A_ABST
Patent Text Reader

Abstract

This application discloses a noise reduction and filtering method, system, device, and storage medium for dynamic capacitance detection, relating to the field of signal processing technology. A two-dimensional Kalman filter model is established to decouple the capacitance measurement signal into a dynamic signal component after DC removal and a slowly varying DC baseline component, and differentiated process noise is configured. The environmental noise variance of the residual sequence is calculated through a sliding window, and the observation noise covariance is adaptively and dynamically adjusted. A dual-mode state machine is implemented based on the difference between the capacitance measurement value and the locked baseline value. When the signal changes abruptly, it enters a switching state and temporarily increases the process noise to force rapid signal tracking; when the signal stabilizes, it returns to a steady state. In the steady state, an external slow-integration baseline calibration channel is activated, and the locked baseline is updated by accumulating the deviation over a long period. This scheme effectively balances high anti-interference smoothness with extremely fast step response capability, completely avoids covariance saturation, and significantly improves the sensitivity and stability of dynamic capacitance detection.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the field of signal processing technology, and in particular to a noise reduction filtering method, system, device and storage medium for dynamic capacitance detection. Background Technology

[0002] Capacitive sensors, with their advantages of no mechanical wear, simple structure, and high sensitivity, have been widely used in consumer electronics (such as smartphones and touch panels), industrial control (such as liquid level monitoring and waterproof touchscreens), automotive electronics (such as central control interfaces and hand-off detection), and IoT devices (such as human presence sensors). During operation, the sensor determines physical events such as touching, approaching, or withdrawing by detecting minute changes in capacitance caused by changes in the dielectric constant or effective area between the capacitor plates.

[0003] However, in practical applications, the raw capacitance data acquired by capacitance sensors is typically extremely weak (at the pF or even fF level) and highly susceptible to complex out-of-band and in-band environmental interference. The main sources of interference include: power supply ripple interference, power frequency and harmonic interference, electromagnetic interference (EMI), and slow hardware baseline drift caused by temperature / humidity changes. To improve the accuracy and reliability of capacitance detection, a noise reduction and filtering algorithm is usually integrated after the front-end capacitance acquisition module.

[0004] Traditional capacitance signal filtering and baseline tracking schemes mainly employ univariate Kalman filtering, infinite impulse response (IIR) filtering, finite impulse response (FIR) filtering, or moving average filtering algorithms. However, when dealing with complex dynamic capacitance detection requirements, they generally suffer from the following significant drawbacks and technical bottlenecks: 1. The inherent contradiction between response speed and high-frequency noise suppression capability In traditional univariate Kalman filtering or low-pass filtering algorithms, the filtering parameters (such as the observation noise covariance in Kalman filtering) are... The cutoff frequency (or low-pass filter cutoff frequency) is usually set to a fixed calibration value. To effectively suppress high-frequency ambient noise and power supply ripple, a larger observation noise covariance must be set. Lowering the cutoff frequency could lead to significant group delay and phase shift in the filter, causing severe lag in the system's response to actual touch / proximity actions and impacting user experience. Conversely, reducing the cutoff frequency in pursuit of ultimate touch response speed could be counterproductive. If the cutoff frequency is raised, the system's noise suppression capability will decrease sharply, and high-frequency noise will easily penetrate the filter, causing false triggering or output jitter in the touch system.

[0005] 2. Baseline drift failure caused by AC / DC component aliasing and "covariance saturation" The raw measurement signal of a capacitive sensor is typically composed of a fast-changing AC component (i.e., the real dynamic signal caused by user touch / proximity) and a slow-changing DC component (i.e., the capacitive baseline formed by system hardware environment and temperature drift). Traditional filtering algorithms treat this measurement signal as a single observation for overall filtering, failing to physically decouple the fast dynamic touch response from the slow baseline drift at the state-space level. When the ambient temperature changes slowly, traditional Kalman filters are prone to misinterpreting slow baseline drift as low-frequency touch actions, leading to false touches. More seriously, when the system operates in a touchless steady-state state for an extended period, the state estimation covariance matrix of the standard Kalman filter... It will gradually converge and decay to a minimum value (i.e., the "covariance saturation" phenomenon). At this point, the filter will lose its ability to correct for small, slow changes in the subsequent input signal, causing the algorithm to completely lose its ability to track the environmental baseline drift.

[0006] 3. Step response delay and state tracking lag under abrupt signal When a user makes a rapid touch or release action, the capacitive signal exhibits a step change in the time domain (a steep rising or falling edge). Traditional Kalman or IIR filters have relatively fixed pole positions and lack an adaptive sensing mechanism for signal abrupt changes. When faced with step signals, they require a long convergence time to transition to a new stable state. This poor adaptability to abrupt changes directly leads to noticeable decision delays and edge jitter in touch systems during press and release.

[0007] In summary, existing capacitive sensing noise reduction and filtering techniques cannot simultaneously achieve high noise suppression performance, extremely fast step response capability, and long-period baseline adaptive tracking capability against covariance saturation, which greatly limits the further application of capacitive sensing technology in complex electromagnetic environments and high-precision scenarios. Summary of the Invention

[0008] This application provides a noise reduction filtering method, apparatus, device, and storage medium for dynamic capacitance detection, which has high anti-interference smoothness and extremely fast step response capability, completely avoids covariance saturation, and significantly improves the sensitivity and stability of dynamic capacitance detection.

[0009] On one hand, this application provides a noise reduction filtering method for dynamic capacitance detection, the method comprising: Establish a two-dimensional Kalman filter model and define a two-dimensional state vector. ,in This represents the dynamic signal component after DC removal. Represents a slowly changing DC baseline component; differentiated process noise is configured for the state vector, corresponding to the dynamic signal component. Signal process noise Greater than the DC baseline component DC process noise ; Obtain the capacitance measurement value at the current sampling time, calculate the residual between the capacitance measurement value and the filter prediction value, calculate the environmental noise variance in real time through a sliding window based on the residual sequence, and adaptively and dynamically adjust the observation noise covariance. ; Based on the difference between the measured capacitance value and the locked baseline value, a dual-mode state machine is executed to control the system to switch between a steady state and a switching state: when a sudden change in the touch signal is detected, the system enters the switching state and temporarily increases the process noise to force the two-dimensional Kalman filter model to quickly track the signal change. When the signal is determined to be in a stable state, it enters a steady state and updates the output filtering result based on the state of the Kalman filter. In the steady state, the external slow integration baseline calibration channel is activated to calculate and accumulate the deviation between the capacitance measurement value and the locked baseline value in each sampling period. When the steady-state sampling period reaches a preset long period threshold, the locked baseline value is finely adjusted and updated based on the cumulative average value of the deviation.

[0010] Specifically, the environmental noise variance is calculated in real time using a sliding window based on the residual sequence, and the observation noise covariance is adaptively and dynamically adjusted. ,include: Define a circular buffer of length N as a sliding window; Calculate the residual at the current time step ,in This is the current actual capacitance measurement value; Calculate the variance of N consecutive residual data within the sliding window. ; Based on formula Update the observation noise covariance at the current time, where, For the updated observation noise covariance, To observe the baseline noise value, This is the preset adjustment coefficient.

[0011] Specifically, the method also includes a power-on pre-stabilization mechanism: After power-on initialization, set the initial sampling window period; When the current number of samples taken by the system is less than the set threshold of the initial sampling window period, no adaptive dynamic adjustment of the observation noise covariance is performed, and the current observation noise covariance is forcibly locked to the baseline value of the observation noise. The system only performs cumulative updates of the covariance matrix in the two-dimensional Kalman filter model to guide the system into a stable operating state.

[0012] Specifically, in the dual-mode state machine management, the determination conditions and execution logic for entering the switching state include: Under the said steady state, the steady-state difference between the current capacitance measurement value and the locked baseline value is continuously calculated; If the absolute value of the steady-state difference is greater than the preset state switching threshold, and the condition is met for a first preset number of times, then it is determined that an external environment change has occurred and the system switches to the switching state. In the switching state, the operation of the slow integrating baseline calibration channel is temporarily disabled, and the signal is synchronously amplified at a preset magnification. and stated Simultaneously lock the observation noise covariance This is used as a base value to increase system bandwidth and accelerate filter convergence.

[0013] Specifically, in the dual-mode state machine management, the determination conditions and execution logic for reverting to the steady state include: In the switching state, calculate the DC baseline component at the current moment. The dynamic difference between the DC baseline component and the previous sampling time; If the absolute value of the dynamic difference is less than a preset state maintenance threshold, and this condition is met for a second preset number of consecutive times, then the signal is determined to have returned to stability, the system returns from the switching state to the steady state, and restores the state before the switching. and stated Configuration; When returning to the steady state, the current filtered output will be... The value is assigned to the locked baseline value as a reference for the next round of slow integration baseline calibration.

[0014] Specifically, the initialization process for establishing the two-dimensional Kalman filter model includes: The DC baseline component The initial measurement value is preset to the first power-on sampling value, and the dynamic signal components are... The default value is 0; Initialize the two-dimensional covariance matrix For the diagonal elements of the matrix representing the uncertainty of the DC baseline component, Assign initial values ​​greater than the preset calibration, and set the state transition matrix as the identity matrix and the observation matrix in the observation model. .

[0015] Specifically, during the Kalman filter update, the Kalman gain of the two-dimensional Kalman filter model is calculated. Then, an upper limit is set for the Kalman gain corresponding to the signal component. If the calculated gain is greater than the upper limit, it is set to be equal to the upper limit. The With the The ratio is set to 0.001 to 0.005; the length of the sliding window is set to 5 to 10; the long period threshold corresponds to 5000 sampling periods.

[0016] On the other hand, this application provides a noise reduction filtering system for dynamic capacitance detection, the system comprising: The parameter configuration module is used to build a two-dimensional Kalman filter model and define the two-dimensional state vector. ,in This represents the dynamic signal component after DC removal. Represents a slowly changing DC baseline component; differentiated process noise is configured for the state vector, corresponding to the dynamic signal component. Signal process noise Greater than the DC baseline component DC process noise ; The adaptive adjustment module is used to acquire the capacitance measurement value at the current sampling time, calculate the residual between the capacitance measurement value and the filter prediction value, calculate the environmental noise variance in real time through a sliding window based on the residual sequence, and adaptively and dynamically adjust the observation noise covariance. ; The state machine management module is used to perform dual-mode state machine control based on the difference between the capacitance measurement value and the locked baseline value, controlling the system to switch between a steady state and a switching state: when a sudden change in the touch signal is detected, the system enters the switching state, temporarily increasing the process noise to force the two-dimensional Kalman filter model to quickly track the signal change; when the signal is detected to be in a stable state, the system enters the steady state, and the filtering result is updated based on the state of the Kalman filter. The slow calibration module is used to activate the external slow integration baseline calibration channel in the steady state, calculate and accumulate the deviation between the capacitance measurement value and the locked baseline value in each sampling period, and finely update the locked baseline value based on the cumulative average value of the deviation when the steady-state sampling period reaches a preset long period threshold.

[0017] The beneficial effects of the technical solution provided in this application include at least the following: by introducing an external slow baseline integrator, the extremely low-frequency baseline tracking task is separated from the Kalman filter, fundamentally avoiding the impact of covariance saturation on baseline tracking. A dual-timescale filtering system is constructed, with the fast timescale loop dominated by the Kalman filter, responsible for millisecond-level touch signal response; and the slow timescale loop dominated by the baseline integrator, responsible for minute-level environmental drift compensation. The two loops are coupled and decoupled through a state machine, balancing the system's transient response and steady-state accuracy. Dynamic scaling of the Q value has a clear physical meaning: increasing the Q value in the switching state is equivalent to reducing system inertia and increasing bandwidth; decreasing it in the steady state... This is equivalent to increasing system damping and suppressing noise. This state-aware parameter scheduling mechanism achieves an approximately optimal estimate of the nonlinear capacitance signal. Attached Figure Description

[0018] Figure 1 This is a flowchart of a noise reduction filtering method for dynamic capacitance detection provided in an embodiment of this application; Figure 2 This is a flowchart of the noise reduction filtering algorithm for dynamic capacitance detection provided in an embodiment of this application; Figure 3 This is a schematic diagram of two-dimensional Kalman filtering and state machine switching logic; Figure 4 This is a comparison of the response waveforms of the noise reduction filtering method of this application at the moment of signal change; Figure 5 A schematic diagram of the structure of a noise reduction filtering system for dynamic capacitance detection provided in an embodiment of this application is shown; Figure 6 A structural block diagram of a computer device provided in an exemplary embodiment of this application is shown. Detailed Implementation

[0019] To make the objectives, technical solutions, and advantages of this application clearer, the embodiments of this application will be described in further detail below with reference to the accompanying drawings.

[0020] In this article, "multiple" refers to two or more. "And / or" describes the relationship between related objects, indicating that three relationships can exist. For example, A and / or B can represent: A alone, A and B simultaneously, or B alone. The character " / " generally indicates that the preceding and following related objects have an "or" relationship.

[0021] In traditional capacitance detection systems, raw capacitance measurement data is highly susceptible to interference from external environmental noise, power supply ripple, and DC baseline drift caused by temperature changes. Existing univariate filtering algorithms (such as standard Kalman filtering or infinite impulse response filtering) generally face an inherent contradiction between response speed and high-frequency noise suppression capability when processing such signals. Specifically, to effectively filter out high-frequency interference, a large observation noise covariance is usually required, but this inevitably leads to a significant lag in the system's response to actual touch actions. Furthermore, these conventional algorithms struggle to physically decouple the fast dynamic touch signal from the slow DC baseline drift at the state-space level, resulting in extremely slow convergence when faced with signal step changes. Moreover, the system is prone to covariance saturation after prolonged operation, ultimately losing its adaptive tracking capability to slowly changing environmental baselines.

[0022] For example, in applications such as outdoor smart door locks, automotive electronic steering wheel HODs, or industrial waterproof touch panels, these devices are exposed to environments with drastic temperature fluctuations and strong electromagnetic interference for extended periods. A sudden drop in ambient temperature at night can cause a continuous and slow drift in the physical baseline of the capacitive sensor. In this situation, a traditional single Kalman filter might misinterpret this slow drift as a continuous low-frequency touch event; or, due to the system being in a steady-state without touch for an extended period, the internal covariance matrix might gradually decay to near zero. When the user subsequently taps the touch panel quickly and accurately, because the covariance is already saturated and the filter maintains significant damping to combat high-frequency electromagnetic interference, the system cannot quickly respond to the resulting step change in the capacitive signal, leading to a severe delay in the recognition of the touch action or even its complete rejection.

[0023] Furthermore, without addressing the aforementioned technical shortcomings of baseline drift aliasing and poor adaptability to signal abrupt changes, dynamic capacitive touch devices will be unable to maintain long-term stable operation in complex electromagnetic and temperature-fluctuating environments. This will not only frequently trigger ghost touches (false triggers) or touch malfunctions (sluggish response), severely damaging the end-user's interactive experience, but will also require periodic hardware-forced resets after prolonged operation to restore the initial baseline tracking capability, significantly increasing the failure risk and operational unreliability of related electronic devices throughout their entire lifecycle.

[0024] Therefore, this embodiment provides a noise reduction filtering method for dynamic capacitance detection, such as... Figure 1 As shown, it includes the following steps: S1. Establish a two-dimensional Kalman filter model and define a two-dimensional state vector. ,in This represents the dynamic signal component after DC removal. Represents the slowly changing DC baseline component; configures differentiated process noise for the state vector, setting a value corresponding to the dynamic signal component. Signal process noise Greater than the DC baseline component DC process noise ; This embodiment decomposes the one-dimensional observation of "signal-baseline" aliasing in traditional capacitance detection into two independent subspaces at the state space level: the fast-changing subspace is composed of... Characterization is used to describe rapid capacitance changes caused by user actions such as touching, approaching, or releasing; the slowly varying subspace consists of... The characterization describes the slow drift of the capacitance baseline caused by factors such as changes in ambient temperature and device aging. By constructing this two-dimensional state vector, the system can simultaneously and independently estimate and track two signal components with distinctly different physical characteristics during the filtering process, achieving decoupling of the signal and the baseline at the state level.

[0025] Regarding process noise configuration, this embodiment assigns differentiated process noise parameters to the two state components. Specifically, it sets the signal process noise. Significantly greater than DC process noise The physical significance of this configuration is as follows: The bandwidth by which the filter tracks dynamic signal components is determined; a larger bandwidth is needed. This enables state estimation to respond quickly to signal abrupt changes caused by touch actions; and This determines the filter's tracking inertia for the DC baseline component; a smaller [inertia] This ensures that the baseline estimation maintains extremely high smoothness and effectively suppresses the interference of high-frequency noise on the baseline estimation. Through this differentiated configuration, the system simultaneously achieves sensitive response to fast-changing signals and stable tracking of slow-changing baselines within a single filtering framework.

[0026] S2. Obtain the capacitance measurement value at the current sampling time, calculate the residual between the capacitance measurement value and the filter prediction value, calculate the environmental noise variance in real time through a sliding window based on the residual sequence, and adaptively and dynamically adjust the observation noise covariance. ; Within each sampling period, the system first acquires the capacitance measurement value at the current moment. The residual between the measured value and the current prediction value of the filter is calculated. This residual reflects the degree of deviation between the filter prediction and the actual observation, and its statistical characteristics are directly related to the intensity level of the current environmental noise.

[0027] This embodiment maintains a sliding window to store residual data from multiple recent consecutive sampling periods and calculates the environmental noise variance in real time based on the residual sequence within this window. As environmental noise increases, the variance of the residuals within the window increases accordingly, and the system adaptively increases the observation noise covariance accordingly. This reduces the filter gain and suppresses noise interference with state estimation; conversely, when environmental noise decreases, the system adaptively reduces... This improves the filter gain and enhances the sensitivity to tracking real signals. Through this adaptive adjustment mechanism based on sliding window variance, the filter can automatically adjust its observation confidence under different noise environments, achieving a dynamic balance between noise suppression and signal tracking capabilities.

[0028] S3. Based on the difference between the capacitance measurement value and the locked baseline value, dual-mode state machine management is performed, and the control system switches between steady state and switching state: when a sudden change in the touch signal is detected, the system enters the switching state and temporarily increases the process noise to force the two-dimensional Kalman filter model to quickly track the signal change. Locking baseline value It is a fixed value obtained and locked during the device initialization phase, used to characterize the reference capacitance level under steady-state conditions, such as the measured value of the first power-on sampling.

[0029] like Figure 2 The flowchart shown is for the noise reduction filtering algorithm of dynamic capacitance detection. This embodiment introduces a dual-mode state machine mode. Manage the operating state of the filter, including steady state. and switching state Two operating modes. In steady state, the system continuously monitors the current capacitance measurement value and the locked baseline value. The difference between the two values ​​reflects the degree of deviation of the signal from the current reference. When the absolute value of this difference exceeds a preset state switching threshold, and this condition is met for a preset number of times, the system determines that a touch signal abrupt change has occurred (i.e., a signal step caused by a user's touch or release action), and then switches to the switching state. During the switching state, the system temporarily increases process noise (including...). and This is equivalent to reducing the system inertia of the filter, forcing the filter to converge quickly to the new signal level, thereby greatly shortening the response time to step signals. Through this state-aware parameter scheduling mechanism, the filter can automatically switch when the signal changes abruptly, achieving rapid tracking; while maintaining a low-bandwidth mode when the signal is stable, achieving noise suppression.

[0030] S4. When the judgment signal is in a stable state, it enters the steady state and updates the output filtering result based on the state of the Kalman filter; and in the steady state, the external slow integration baseline calibration channel is activated to calculate and accumulate the deviation between the capacitance measurement value and the locked baseline value in each sampling period. When the steady state sampling period reaches the preset long period threshold, the locked baseline value is finely adjusted and updated based on the cumulative average value of the deviation.

[0031] Specifically, when the system determines that the signal has returned to a steady state, it recovers from the switching state to the steady state and restores the process noise configuration before the switching. Simultaneously, at the instant of returning to steady state, the current capacitance detection value of the filtered output is reassigned to the locked baseline value as a new reference. In the steady state, the system updates the output filtering result based on the state of the two-dimensional Kalman filter, i.e. and The sum of these values ​​is used as the denoised capacitance measurement. Simultaneously, the system activates an external slow-integration baseline calibration channel, which operates independently of the Kalman filter's state update process. Within each sampling period, the system calculates the deviation between the current capacitance measurement and the locked baseline value, accumulating this deviation into a deviation accumulator. When the steady-state continuous sampling period reaches a preset long-period threshold, the system averages the accumulated total deviation and uses this average to fine-tune and update the locked baseline value. Through this long-period integral averaging calibration method, the system can automatically compensate for slow baseline variations caused by temperature drift or device aging over extremely long timescales, while effectively shielding the baseline calibration from transient noise interference.

[0032] In summary, this application physically decouples the dynamic signal components from the DC baseline components by constructing a two-dimensional state-space model, achieves parallel processing of fast-changing tracking and slow-changing hold by employing differentiated process noise configuration, introduces a sliding window variance adaptive mechanism to dynamically adjust the observation noise to match the environmental noise level, and utilizes a dual-mode state machine to achieve rapid tracking during signal abrupt changes and noise suppression under steady state. Furthermore, it fundamentally avoids the covariance saturation problem of the Kalman filter by using an external slow integration channel. Thus, it achieves a synergistic balance of high noise suppression performance, extremely fast step response capability, and long-period baseline adaptive tracking capability, significantly improving the detection accuracy and operational reliability of the capacitance detection system in complex electromagnetic environments.

[0033] In traditional schemes, if the initial value of the covariance matrix is ​​set too small, the filter will prematurely "trust" the initial state estimate, leading to slow convergence and significant output lag when the actual signal deviates from the initial value. Conversely, if the initial value is set too large, although convergence can be accelerated, it may cause initial output jitter. Furthermore, in traditional schemes, the observation noise covariance... Typically a fixed value, the Kalman gain cannot reflect real-time changes in environmental noise, resulting in insufficient suppression capability when noise increases or limited response speed when noise decreases. More critically, if the Kalman gain increases unrestrainedly during state estimation, it will cause the filter output to become overly sensitive to single measurements, leading to output jitter or even divergence.

[0034] To address these technical problems, this embodiment provides an adaptive observation noise, gain limiting, and initialization mechanism based on sliding window variance.

[0035] Specifically, after the system is powered on, the initial sampled capacitance measurement value is acquired and used as the DC baseline component. The initial value, which is to be The preset value is the initial measurement value for the first power-on sampling; at the same time, the dynamic signal components... The default value is 0. The physical significance of this initialization strategy is that: since there is no touch action at the moment of power-on, it is reasonable to estimate the dynamic signal component as zero initially; and the DC baseline component directly adopts the first measurement value, which allows the filter to obtain a rough estimate of the baseline level at the initial moment, avoiding blindly searching from zero.

[0036] After the state vector is initialized, the two-dimensional covariance matrix is ​​further processed. Perform initial configuration. Specifically, configure the diagonal elements of the matrix representing the uncertainty of the DC baseline component. Assign initial values ​​greater than the preset calibration, and set the state transition matrix as the identity matrix and the observation matrix in the observation model. .

[0037] The core design consideration for large initial value configuration lies in the fact that, during the initial power-on phase, the system lacks prior knowledge of the true location of the DC baseline component. A large initial value characterizes the "high uncertainty" state of the filter's DC baseline estimation. In this state, the calculated Kalman gain will tend to assign higher weights to the measured values, enabling the filter to quickly use measurement information to correct the baseline estimation in the initial stage and rapidly converge to the true baseline level. If... If the initial value is too small, the filter will over-rely on the initial estimate, requiring a longer convergence time when the true baseline position deviates from the initial measurement, thus affecting the system's fast response capability. Furthermore, in the observation model, the state transition matrix is ​​set as the identity matrix, and the observation matrix... This is done to maintain a linear mapping between state predictions and observation updates, ensuring the mathematical consistency of the filtering process.

[0038] After completing the initial configuration, this embodiment further refines the adaptive observation noise adjustment mechanism based on sliding window variance. The core of this mechanism lies in dynamically adjusting the observation noise covariance by estimating the statistical characteristics of environmental noise in real time. This ensures that the filter maintains optimal filtering performance under different noise environments.

[0039] In the specific implementation, a circular buffer of length N is defined as the sliding window, where the preferred value of N is between 5 and 10. The physical basis for choosing this window length is that if the window is too short (e.g., less than 5), the number of residual samples used to calculate the variance is insufficient, resulting in poor statistical reliability of the variance estimate and susceptibility to errors due to individual outlier residuals. The values ​​fluctuate wildly; when the window is too long (e.g., greater than 10), the variance estimation responds slowly to changes in noise and cannot reflect rapid changes in environmental noise in a timely manner. Experiments have verified that a window length of 5 to 10 can achieve a good balance between statistical reliability and response speed.

[0040] Within each sampling period, a circular buffer of length N is first defined as a sliding window, and the residual at the current time step is calculated. The calculation formula is as follows:

[0041] in This is the current actual capacitance measurement value. This represents the current state prediction of the filter (i.e., the predicted capacitance value). The residual reflects the deviation between the current measurement and the filter's prediction, and its statistical characteristics directly reflect the intensity of environmental noise. When environmental noise increases, the amplitude of the residual increases accordingly; when the environment is quiet, the residual tends to fluctuate slightly around the zero mean.

[0042] Subsequently, the variance of N consecutive residual data within the sliding window is calculated. The variance is calculated as follows: First, calculate the arithmetic mean of the N residual data within the window. Then, calculate the squared deviation of each residual from the mean. Finally, calculate the arithmetic mean of the squared deviations, which gives the variance of the residuals within the window. This variance value quantitatively characterizes the intensity of environmental noise fluctuations within the current time period.

[0043] Based on the calculated variance The observation noise covariance is dynamically updated according to the following formula. :

[0044] in, For the updated observation noise covariance, To observe the baseline noise value, This is the preset adjustment coefficient.

[0045] The physical meaning of this formula is: as environmental noise increases, the residual variance... Increase The corresponding increase makes the updated The value increases proportionally; observation noise covariance As the Kalman gain increases, the Kalman gain decreases accordingly, reducing the filter's confidence in the measured values ​​and thus effectively suppressing noise interference with the filter output. Conversely, when ambient noise decreases, Decrease The value fell back to near The filter restores its ability to respond quickly to measured values, ensuring the sensitivity of touch signal detection.

[0046] In some embodiments, to prevent observation noise covariance Infinitely increasing the filter gain under extreme noise conditions leads to excessive attenuation. This embodiment addresses the calculated... Set an upper limit threshold. When the calculated value is... When the value exceeds this upper threshold, it is forcibly truncated to the upper limit value to prevent filter gain divergence. This upper limit truncation protection mechanism ensures that the filter maintains basic signal tracking capability even in extremely harsh noise environments, avoiding the risk of signal loss due to noise. The value is too large, causing the filter to completely lose its response to the measured value.

[0047] During the Kalman filter update, this embodiment further adjusts the Kalman gain. Implement amplitude limiting protection. Specifically, this is done after calculating the Kalman gain of the two-dimensional Kalman filter model. Then, the Kalman gain corresponding to the signal component ( and Set an upper limit value. If the calculated gain is greater than the upper limit value, then set it to be equal to the upper limit value.

[0048] The underlying logic of this limiting protection is that the Kalman gain characterizes the filter's trust weight for the measured value; the larger the gain, the stronger the correction effect of the measured value during state updates. Under normal operating conditions, a moderate gain helps the filter quickly track signal changes; however, under certain abnormal conditions (such as instantaneous spike interference in the measured value), the gain may be calculated as an abnormally large value, causing the filter output to be overly sensitive to a single measured value, resulting in output jitter. By setting an upper limit on the gain, output jitter under such abnormal conditions can be effectively suppressed, ensuring the smoothness and stability of the filtered output.

[0049] Furthermore, this embodiment allows for possible settings of the ratio configuration for the noise in the differentiation process. Specifically, it can be... and The ratio is set to 0.001 to 0.005. The physical inhibition effect of this ratio setting is reflected in the following aspects: As dynamic signal components The process noise is relatively large, indicating that the filter has a high degree of tracking freedom for fast-changing touch signals, allowing... Significant changes can occur within a short period of time, thus ensuring a rapid response to touch actions; As DC baseline component The process noise is extremely small (only a fraction of the total noise). (0.001 to 0.005 times), characterizing that the filter has extremely high inertial constraints on DC baseline estimation. The allowable variation within a unit sampling period is strictly limited.

[0050] This differentiated configuration achieves decoupling of signal tracking and baseline maintenance at the state-space level: the fast-changing touch signal is generated by... Dimensional carrying capacity, through a larger Ensures fast tracking; slow baseline drift is caused by Dimensional carrying, through extremely small This ensures high smoothness and effectively suppresses jitter in baseline estimation. If and If the ratio is too large (e.g., exceeding 0.005), the tracking degrees of freedom of the baseline components increase, and environmental noise and touch signals may penetrate into the baseline estimation, leading to increased baseline jitter. If the ratio is too small (e.g., below 0.001), the inertia of the baseline components is too large, resulting in insufficient baseline tracking capability when the ambient temperature changes rapidly, which may cause baseline estimation lag. Therefore, setting the ratio to 0.001 to 0.005 achieves the best balance between baseline smoothness and slow-changing tracking capability.

[0051] In conclusion, this application is approved. A large initial value configuration ensures that the filter can quickly lock onto the DC baseline position during the initial power-on phase, shortening the initial convergence time; the ambient noise intensity is estimated in real time using sliding window variance, and the observation noise covariance is dynamically adjusted. This allows the filter to automatically reduce gain to suppress interference when noise increases and automatically increase sensitivity to speed up response when noise decreases; it also effectively prevents output jitter and divergence risks caused by excessive gain through Kalman gain cap cutoff protection; and The ratio is set between 0.001 and 0.005, achieving decoupling between fast-changing signal tracking and slow-changing baseline preservation at the state-space level. This ensures both rapid response of the touch signal and maintains the high inertial smoothness of the baseline estimation. These mechanisms together construct a capacitance detection noise reduction filtering scheme that combines fast convergence, adaptive noise suppression, and high stability.

[0052] Traditional methods treat rapidly changing touch signals and slowly changing baseline drift in a single observation dimension, which cannot physically decouple the two at the state space level, and also lacks a real-time perception of the dynamic characteristics of the signal and a parameter scheduling mechanism.

[0053] To address this, this embodiment provides a noise reduction filtering method using dual-mode state machine control and an external slow integral calibration channel. Based on a two-dimensional Kalman filter model, this method introduces a dual-mode state machine to dynamically schedule the filtering parameters and adds an external slow integral baseline calibration channel. This removes the extremely low-frequency baseline tracking task from the Kalman filter, thereby achieving decoupled and controllable signal tracking and baseline maintenance at the state space level.

[0054] like Figure 3 As shown, in this embodiment, the dual-mode state machine management includes two working modes: steady state and stable state. With switching state The switching logic between the two modes and the parameter scheduling logic are as follows.

[0055] I. Criteria for entering the switching state and underlying execution logic In steady state, the system continuously monitors the steady-state difference between the current capacitance measurement and the locked baseline value. Specifically, the steady-state difference is defined as the difference between the capacitance measurement at the current sampling time and the current locked baseline value. The absolute value of the difference 。 When the absolute value of the steady-state difference is greater than the preset state switching threshold And this condition is met for a first preset number of times. When the system determines that an external environmental change has occurred (i.e., a sudden change in signal caused by the user's touch or release action), it immediately switches from a steady state to a switching state.

[0056] The design considerations for the above judgment conditions are as follows: employing a dual judgment mechanism of "threshold + continuous counting" can effectively avoid erroneous switching caused by a single instantaneous noise spike. State switching threshold. The value should be greater than the normal noise fluctuation amplitude under steady state to ensure that switching is triggered only when a real touch signal occurs; first preset number of times. The setting further enhances the robustness of the judgment and prevents frequent mode switching caused by occasional interference.

[0057] When the system enters the switching state, the following low-level actions are performed: First, temporarily disable and stop the operation of the slow integration baseline calibration channel; Because the signal is undergoing rapid changes during the switching state, continuing to perform slow integration calibration at this time would incorrectly accumulate transient deviations into the baseline deviation accumulator, leading to severe errors in subsequent baseline updates. Therefore, during the switching state, the slow integration baseline calibration channel is completely frozen, and deviation accumulation and baseline update operations are no longer performed.

[0058] Second, synchronously amplify according to the preset magnification. and ; To correspond to dynamic signal components Signal process noise, For the corresponding DC baseline component DC process noise. In the switching state, synchronously amplifying the process noise of the two subspaces is equivalent to reducing the system inertia of the Kalman filter and increasing the filtering bandwidth, thereby forcing the filter to quickly track signal changes and greatly shortening the convergence time. It should be noted that the preset magnification affects... and Apply the same magnification ratio to maintain the relative inertial relationship between the two subspaces and avoid distortion of state estimation due to imbalance of the ratio.

[0059] Third, lock the observation noise covariance. The base value.

[0060] In the switching state, the system no longer performs adaptive adjustment of observation noise based on sliding window variance, but instead uses the observation noise covariance. Forced to lock to the baseline observation noise value The purpose is that during signal abrupt changes, the variance of the residual sequence increases sharply due to the step change in the signal itself. If adaptive testing is still performed under these circumstances... Adjusting the observation noise covariance will incorrectly amplify it, causing the filter gain to be excessively suppressed, which weakens the filter's fast tracking capability. Therefore, locking in the switching state... Based on the base value, ensure that the filter responds to signal abrupt changes with maximum gain.

[0061] II. Criteria for Determining Steady State and the Transition Process In the switching state, the system continuously monitors the DC baseline component. The changing trend. Specifically, calculate the DC baseline component at the current moment. Dynamic difference between the DC baseline component and the previous sampling time When the absolute value of the dynamic difference is less than the preset state maintenance threshold... And this condition is met for a second preset number of times. When the signal has returned to a stable state, the system determines that the signal has returned to a steady state from the switching state.

[0062] The physical meaning of the above regression judgment condition is that: after the touch or release action is completed, the capacitance signal has transitioned to a new stable level, at which point the DC baseline component... The rate of change should approach zero. This is achieved through monitoring... The change in each sampling point, rather than the absolute difference, can accurately capture whether the signal has entered a stable state, avoiding misjudgment that it has not yet stabilized due to a large absolute deviation between the new and old stable states.

[0063] When the system returns to steady state, the following handover process is performed: First, restore the state before the switchover. and Configuration; that is, canceling the amplification operation of process noise in the switching state, and... and Restore the original settings before switching, allowing the filter to re-enter a steady-state operating mode with high inertia and high smoothness.

[0064] Second, the current filter output Assign to the locked baseline value This serves as a reference for the new round of slow integral baseline calibration; the significance of this handover action lies in the fact that during the switching state, the Kalman filter has been temporarily increased... The value-based approach quickly converges to the new signal level, and the filtered output... This accurately reflects the capacitance value under the new steady state. Assign it to... This means that the baseline value is quickly updated, providing an accurate reference for subsequent slow integral calibration in steady state.

[0065] III. Accumulation Logic and Long-Period Calibration Mechanism of Slow Integral Channel under Steady-State Conditions When the system is in steady state, the algorithm does not rely entirely on the automatic tracking of the Kalman filter, but introduces an independent slow integration channel. The algorithm defines a baseline bias accumulator. A long-period steady-state counter .

[0066] When the system is in steady state, the external slow integral baseline calibration channel is activated. This channel operates independently of the Kalman filter's state update process, and its core logic is as follows: Within each sampling period, calculate the current capacitance measurement and the current locked baseline value. The deviation is calculated and accumulated into the baseline deviation accumulator. In the middle. Meanwhile, the steady-state counter... The number of sampling periods is increased sequentially to record the number of sampling periods during which the system continues to operate in steady state.

[0067] When the number of steady-state sampling periods reaches a preset long-period threshold, the locked baseline value is finely updated based on the cumulative average value of the deviation. Specifically, the baseline deviation accumulator... The cumulative total deviation is divided by the number of steady-state sampling periods to obtain the average deviation over that long period, and this is used to lock the baseline value. Perform a fine-tuning update. After the update is complete, clear the baseline deviation accumulator to zero and reset the steady-state counter to begin a new slow integration calibration cycle.

[0068] In this embodiment, the long period threshold is set to 5000 sampling periods. Based on a typical capacitive sensor sampling rate (e.g., 100Hz), 5000 sampling periods correspond to a calibration period of approximately 50 seconds. This long period setting provides the following low-frequency noise immunity: Firstly, through the cumulative averaging over an extremely long period, instantaneous noise and high-frequency interference are statistically fully offset by averaging, retaining only the slowly changing trend component with a definite direction (such as the baseline unidirectional slow shift caused by temperature drift), thereby achieving high-precision extraction and compensation for low-frequency slowly changing interference.

[0069] Secondly, the long-cycle threshold ensures that baseline updates are performed with extremely small steps and very low frequency, without interfering with normal touch detection. Between two calibration updates, the baseline value is locked constant, providing a stable and reliable reference for touch determination.

[0070] Third, the slow integration channel and the fast timescale response of the Kalman filter form a complementary dual-timescale system: the fast timescale loop is dominated by the Kalman filter and is responsible for millisecond-level touch signal response; the slow timescale loop is dominated by the baseline integrator and is responsible for environmental drift compensation in the tens of seconds to minutes range. The two loops are coupled and decoupled through a state machine, taking into account both the transient response and steady-state accuracy of the system.

[0071] Furthermore, in this embodiment, and The ratio is set to 0.001 to 0.005. This ratio setting ensures the DC baseline component... It exhibits extremely high inertia and is virtually unaffected by transient noise in steady state, thus maintaining the long-term stability of the baseline estimate. The sliding window length is set to 5 to 10 for real-time estimation of the environmental noise variance, achieving a balance between response speed and estimation accuracy.

[0072] Figure 4 The diagram shows a comparison of the response waveforms of the noise reduction filtering method of this application at the moment of signal abrupt change. The diagram includes the original capacitance measurement signal waveform (dashed line), the traditional Kalman filter output waveform (dotted line), and the filtered output waveform of the method of this application (solid line). When a touch or release action (signal step) occurs, the sensor senses the touch action, and the original capacitance signal undergoes a sharp step change. Traditional Kalman filtering algorithms suffer from process noise covariance... With a fixed and relatively small value, the system has a large inertia, resulting in a significant group delay (delay time is...) after a mutation occurs. This results in slow signal convergence, causing a lag in touch response. The method in this application, however, accurately identifies this signal abrupt change using a dual-mode state machine and instantly enters a switching state, temporarily amplifying the process noise at a preset rate. and This significantly increases the tracking bandwidth of the filter, allowing the filtering curve of the method in this application to closely match the original step signal with almost no delay. This waveform directly demonstrates the outstanding technical effect of the method in terms of extremely fast step response capability.

[0073] By combining the dual-mode state machine scheduling and external slow integral calibration mechanisms described above, this embodiment achieves the following significant technical effects: First, by employing a dual judgment condition of "threshold + continuous counting," accurate perception and rapid response to sudden changes in touch signals are achieved, with synchronous amplification during switching states. and And lock Using the base value, the filter bandwidth is instantly increased, greatly shortening the convergence time of the step signal and effectively eliminating the judgment delay and edge jitter at the moment of touch press and release.

[0074] Second, by separating the extremely low-frequency baseline tracking task from the Kalman filter and entrusting it to an external slow integration channel, the "covariance saturation" problem of the standard Kalman filter after long-term operation is fundamentally avoided, enabling the system to maintain accurate tracking capability of slow-changing environmental drift over time scales of several minutes or even longer.

[0075] Third, through a long threshold cumulative averaging mechanism with 5000 sampling periods, instantaneous noise is statistically fully canceled out, retaining only the slow-changing trend component in a definite direction. This achieves high-precision compensation for low-frequency interference such as temperature drift and device aging, while ensuring extremely high stability of the baseline output and reliability of touch detection under steady state.

[0076] Fourth, the construction of the dual-timescale system enables fast timescale response (millisecond-level touch detection) and slow timescale calibration (tens of seconds-level baseline compensation) to work together without interference. At the state space level, signal tracking and baseline maintenance are decoupled and controllable, which comprehensively improves the adaptability and detection accuracy of the capacitance detection system in complex electromagnetic environments.

[0077] In some embodiments, this application also provides a power-on startup pre-stabilization and error-proof mechanism. This is because if the filtering instability problem during the power-on startup phase is not effectively resolved, a series of serious negative consequences will occur. First, if the filter output oscillates or jumps during the initial startup phase, and the system executes touch detection logic based on this unreliable filtering result, it is highly likely to generate false touch event reports, causing the device to be falsely triggered at the moment of power-on. For example, a smart door lock might mistakenly identify someone touching the screen upon power-on and perform an unlocking operation, or a vehicle central control screen might falsely trigger a function button upon startup, severely impacting user experience and device security. Second, even if the system does not perform touch detection during the initial startup phase, the abnormal convergence process of the filter will consume valuable startup time resources, significantly lengthening the waiting time between power-on and normal touch operation responsiveness. In application scenarios with high real-time response requirements, such as automotive electronics and industrial control, this delay may trigger more serious chain reactions. Furthermore, if the abnormal state during the startup phase causes the DC baseline component in the filter state vector to... If the system is incorrectly locked to a value deviating from the true baseline, the subsequent steady-state baseline slow integration calibration mechanism will require an extremely long time period to gradually correct the erroneous baseline to the correct position. During this period, the system's touch detection sensitivity and accuracy will be continuously affected. Therefore, a special pre-stabilization and error-proofing mechanism must be designed for the special operating condition of power-on startup to ensure that the filtering algorithm can quickly and smoothly transition to normal operating conditions after the system is powered on.

[0078] The power-on pre-stabilization mechanism provided in this embodiment is based on the following core design idea: after the system is powered on and initialized, an initial sampling window is set, during which the observation noise covariance is temporarily masked. The adaptive dynamic adjustment function forces the adjustment to... Locked to the baseline value of observation noise At the same time, only the covariance matrix in the two-dimensional Kalman filter model is allowed. Normal accumulation and updates are performed to guide the filter to smoothly pass through the startup blind zone, laying a reliable convergence foundation for the subsequent adaptive adjustment phase.

[0079] Specifically, after the system completes power-on initialization and begins the sampling and filtering process, it is first necessary to establish a counting mechanism for the initial sampling window period. The core of this mechanism lies in defining a threshold value for the initial sampling window period. This threshold is used to define the duration of the power-on startup pre-stabilization phase. (Based on the current number of system samples...) When the value is below the set threshold, the system is determined to be still in the pre-stabilization phase of power-on startup, and the pre-stabilization and error-proofing logic is executed. It should be noted that the specific value of this set threshold can be flexibly configured according to the different application scenarios. The selection principle is to ensure that the system power supply, acquisition front-end, and filtering status can complete the basic establishment and convergence process within the window period. During the pre-stabilization phase, the algorithm explicitly prohibits adaptive observation noise covariance adjustment based on the variance of the sliding window residuals; that is, it no longer adjusts the noise based on the variance of the residual data within the current sliding window. To calculate the updated observation noise covariance Instead, the observation noise covariance... Forced to be locked to the baseline observation noise value ,Right now This avoids the impact of unreliable residual data in the early stages of startup. The value resulted in a misleading adjustment.

[0080] In the aforementioned forced locking At the same time, the covariance matrix in the two-dimensional Kalman filter model The update process is allowed to proceed normally. Specifically, within each sampling period of the pre-stabilization phase, the filter still performs the prediction step according to the standard Kalman filtering procedure, that is, based on the state transition matrix (the identity matrix in this embodiment) and the process noise matrix. For covariance matrix Perform prior update, i.e. Since this embodiment corresponds to dynamic signal components. Signal process noise It was set to be much larger than the component corresponding to the DC baseline. DC process noise Therefore, during the covariance accumulation process in the pre-stabilization phase, the covariance element corresponding to the dynamic signal component will grow at a relatively fast rate, while the covariance element corresponding to the DC baseline component will maintain a slow growth trend. This differentiated covariance accumulation process has a clear physical meaning: it enables the filter to establish a priori cognitive structure with high uncertainty about the dynamic signal component and high confidence about the DC baseline component in the early stage of startup, laying the foundation for the reasonable allocation of Kalman gain in the subsequent filter update phase. Simultaneously, due to the observation noise covariance... Locked at the base value Kalman gain in the filter update step The calculation will be based on a stable and reasonable Value is performed to avoid [the following]: Gain oscillation caused by abnormal fluctuations in value.

[0081] During the pre-stabilization phase, although the observation noise covariance The adaptive adjustment is temporarily disabled, but the filter still performs the state update step normally, that is, it updates the state vector based on the capacitance measurement at the current sampling time. The filter is then corrected. Specifically, it calculates the residual between the current measurement and the predicted value. Subsequently, based on the above locking, Calculation of Kalman gain from observation noise covariance And use this gain to analyze the dynamic signal components in the state vector. and DC baseline component The filter is updated. Through this process, during the pre-stabilization phase, the filter can gradually correct the deviation of the initial state estimate using actual measurement data, so that the state vector gradually approaches the actual physical signal level. Simultaneously, the covariance matrix... The process of alternating prediction and updates accumulates and gradually converges, preparing for adaptive execution after exiting the pre-stabilization phase. The adjustment provides a reliable basis for covariance.

[0082] When the current number of samples reaches or exceeds the set threshold of the initial sampling window period, the pre-stabilization phase ends, and the system automatically switches to normal adaptive adjustment mode. At this time, a sufficient amount of steady-state residual data has accumulated within the sliding window, and the environmental noise variance is calculated based on this data. It can accurately reflect the disturbance level of the current environment, thus allowing for safe resumption of the adaptive observation noise covariance adjustment logic based on sliding window residual variance. Since the pre-stabilization phase has already ensured the basic convergence of the state vector and covariance matrix, subsequent adaptive... The adjustment will be carried out under reasonable initial conditions, and will not cause abnormal adjustments due to transient disturbances in the early stage of startup, thus ensuring that the entire filter system can smoothly and quickly enter a stable working state after power-on.

[0083] In summary, this application sets an initial sampling window after power-on initialization, forcibly locks the observation noise covariance as the base value within the window, and only allows the covariance matrix to accumulate and update. This effectively avoids the misleading influence of unreliable residual data on the adaptive adjustment mechanism in the early stages of startup, ensuring that the two-dimensional Kalman filter model can converge quickly and smoothly to a stable working state after power-on. This provides a reliable filtering foundation for subsequent touch detection and baseline tracking, and significantly improves the robustness and reliability of the system under special operating conditions.

[0084] This invention provides a noise reduction filtering system for dynamic capacitance detection, such as... Figure 5 The system shown, based on the method implementation examples, constructs a complete modular implementation scheme at the system architecture level. Through data flow and collaborative cooperation between various functional modules, the aforementioned noise reduction and filtering method is transformed into a practically deployable engineering system. This includes: Parameter configuration module 510 is used to establish a two-dimensional Kalman filter model and define a two-dimensional state vector. ,in This represents the dynamic signal component after DC removal. Represents the slowly changing DC baseline component; configures differentiated process noise for the state vector, setting a value corresponding to the dynamic signal component. Signal process noise Greater than the DC baseline component DC process noise ; The adaptive adjustment module 520 is used to acquire the capacitance measurement value at the current sampling time, calculate the residual between the capacitance measurement value and the filter prediction value, calculate the environmental noise variance in real time through a sliding window based on the residual sequence, and adaptively and dynamically adjust the observation noise covariance. ; The state machine management module 530 is used to perform dual-mode state machine control based on the difference between the capacitance measurement value and the locked baseline value. The control system switches between steady state and switching state: when a sudden change in the touch signal is detected, it enters the switching state and temporarily increases the process noise to force the two-dimensional Kalman filter model to quickly track the signal change; when the signal is detected to be in a stable state, it enters the steady state and outputs the filtering result based on the state update of the Kalman filter. The slow calibration module 540 is used to activate the external slow integration baseline calibration channel in steady state, calculate and accumulate the deviation between the capacitance measurement value and the locked baseline value in each sampling period, and finely update the locked baseline value based on the cumulative average value of the deviation when the steady-state sampling period reaches the preset long period threshold.

[0085] Furthermore, this application also provides a computer device, the computer device including a processor and a memory, the memory storing at least one instruction, at least one program, code set or instruction set, the at least one instruction, the at least one program, the code set or instruction set being loaded and executed by the processor to implement the noise reduction filtering method for dynamic capacitance detection described above.

[0086] Furthermore, this application also provides a computer-readable storage medium storing at least one instruction, at least one program, code set, or instruction set, wherein the at least one instruction, the at least one program, the code set, or the instruction set is loaded and executed by a processor to implement the noise reduction filtering method for dynamic capacitance detection described above.

[0087] The noise reduction filtering device for dynamic capacitance detection provided in this application embodiment can be applied to the noise reduction filtering method for dynamic capacitance detection provided in the above embodiment. For relevant details, please refer to the above method embodiment. The implementation principle and technical effect are similar, and will not be repeated here.

[0088] It should be noted that the noise reduction filtering device for dynamic capacitance detection provided in this embodiment is only illustrated by the above-described division of functional modules / units during calibration operations. In practical applications, the functions can be assigned to different functional modules / units as needed, that is, the internal structure of the noise reduction filtering device for dynamic capacitance detection can be divided into different functional modules / units to complete all or part of the functions described above. Furthermore, the implementation methods of the noise reduction filtering method for dynamic capacitance detection provided in the above-described method embodiments and the implementation methods of the noise reduction filtering device for dynamic capacitance detection provided in this embodiment belong to the same concept. The specific implementation process of the noise reduction filtering device for dynamic capacitance detection provided in this embodiment is detailed in the above-described method embodiments and will not be repeated here.

[0089] Figure 6 This illustration shows a structural block diagram of a computer device provided in an exemplary embodiment of this application. The device can be a desktop computer, laptop computer, handheld computer, or cloud server, etc. The computer device may include, but is not limited to, a processor and memory. The processor and memory can be connected via a bus or other means. The processor can be a Central Processing Unit (CPU). The processor can also be other general-purpose processors, digital signal processors (DSPs), application-specific integrated circuits (ASICs), field-programmable gate arrays (FPGAs) or other programmable logic devices, graphics processing units (GPUs), embedded neural network processing units (NPUs) or other dedicated deep learning coprocessors, discrete gate or transistor logic devices, discrete hardware components, or combinations of the above types of chips.

[0090] This application also discloses a computer-readable storage medium. Specifically, the computer-readable storage medium is used to store a computer program, which, when executed by a processor, implements the methods described in the above-described method embodiments. Those skilled in the art will understand that implementing all or part of the processes in the methods described in the above-described embodiments of this application can be accomplished by a computer program instructing related hardware. The program can be stored in a computer-readable storage medium, and when executed, it can include the processes of the embodiments described above. The storage medium can be a magnetic disk, optical disk, read-only memory (ROM), random access memory (RAM), flash memory, hard disk drive (HDD), or solid-state drive (SSD), etc.; the storage medium can also include combinations of the above types of memory.

[0091] This specific embodiment is merely an explanation of the present invention and is not intended to limit the invention. After reading this specification, those skilled in the art can make modifications to this embodiment without contributing any inventive step, but such modifications are protected by patent law as long as they fall within the scope of the claims of the present invention.

Claims

1. A noise reduction filtering method for dynamic capacitance detection, characterized in that, include: Establish a two-dimensional Kalman filter model and define a two-dimensional state vector. ,in This represents the dynamic signal component after DC removal. Represents a slowly varying DC baseline component; Differentiated process noise is configured for the state vector, and a corresponding dynamic signal component is set. Signal process noise Greater than the DC baseline component DC process noise ; Obtain the capacitance measurement value at the current sampling time, calculate the residual between the capacitance measurement value and the filter prediction value, and calculate the environmental noise variance in real time through a sliding window based on the residual sequence, and adaptively and dynamically adjust the observation noise covariance. ; Based on the difference between the measured capacitance value and the locked baseline value, a dual-mode state machine is executed to control the system to switch between a steady state and a switching state: when a sudden change in the touch signal is detected, the system enters the switching state and temporarily increases the process noise to force the two-dimensional Kalman filter model to quickly track the signal change. When the signal is determined to be in a stable state, it enters a steady state, and the output filtering result is updated based on the state of the Kalman filter. In the steady state, the external slow integration baseline calibration channel is activated to calculate and accumulate the deviation between the capacitance measurement value and the locked baseline value in each sampling period. When the steady-state sampling period reaches a preset long period threshold, the locked baseline value is finely adjusted and updated based on the cumulative average value of the deviation.

2. The method according to claim 1, characterized in that, The environmental noise variance is calculated in real time using a sliding window based on the residual sequence, and the observation noise covariance is adaptively and dynamically adjusted. ,include: Define a circular buffer of length N as a sliding window; Calculate the residual at the current time step ,in This is the current actual capacitance measurement value; Calculate the variance of N consecutive residual data within the sliding window. ; Based on formula Update the observation noise covariance at the current time, where, For the updated observation noise covariance, To observe the baseline noise value, This is the preset adjustment coefficient.

3. The method according to claim 2, characterized in that, The method also includes a power-on pre-stabilization mechanism: After power-on initialization, set the initial sampling window period; When the current number of samples taken by the system is less than the set threshold of the initial sampling window period, no adaptive dynamic adjustment of the observation noise covariance is performed, and the current observation noise covariance is forcibly locked to the baseline value of the observation noise. The system only performs cumulative updates of the covariance matrix in the two-dimensional Kalman filter model to guide the system into a stable operating state.

4. The method according to claim 1, characterized in that, In the dual-mode state machine management, the determination conditions and execution logic for entering the switching state include: Under the said steady state, the steady-state difference between the current capacitance measurement value and the locked baseline value is continuously calculated; If the absolute value of the steady-state difference is greater than the preset state switching threshold, and the condition is met for a first preset number of times, then it is determined that an external environment change has occurred and the system switches to the switching state. In the switching state, the operation of the slow integrating baseline calibration channel is temporarily disabled, and the signal is synchronously amplified at a preset magnification. and stated Simultaneously lock the observation noise covariance This is used as a base value to increase system bandwidth and accelerate filter convergence.

5. The method according to claim 4, characterized in that, In the dual-mode state machine management, the determination conditions and execution logic for reverting to the steady state include: In the switching state, calculate the DC baseline component at the current moment. The dynamic difference between the DC baseline component and the previous sampling time; If the absolute value of the dynamic difference is less than a preset state maintenance threshold, and this condition is met for a second preset number of consecutive times, then the signal is determined to have returned to stability, the system returns from the switching state to the steady state, and restores the state before the switching. and stated Configuration; When returning to the steady state, the current filtered output will be... The value is assigned to the locked baseline value as a reference for the next round of slow integration baseline calibration.

6. The method according to claim 1, characterized in that, The initialization process for establishing the two-dimensional Kalman filter model includes: The DC baseline component The initial measurement value is preset to the first power-on sampling value, and the dynamic signal components are... The default value is 0; Initialize the two-dimensional covariance matrix For the diagonal elements of the matrix representing the uncertainty of the DC baseline component, Assign initial values ​​greater than the preset calibration, and set the state transition matrix as the identity matrix and the observation matrix in the observation model. .

7. The method according to claim 1, characterized in that, When performing the Kalman filter update, the Kalman gain of the two-dimensional Kalman filter model is calculated. Then, an upper limit is set for the Kalman gain corresponding to the signal component. If the calculated gain is greater than the upper limit, it is set to be equal to the upper limit. The With the The ratio is set to 0.001 to 0.005; the length of the sliding window is set to 5 to 10; the long period threshold corresponds to 5000 sampling periods.

8. A noise reduction filtering system for dynamic capacitance detection, characterized in that, The system includes: The parameter configuration module is used to build a two-dimensional Kalman filter model and define the two-dimensional state vector. ,in This represents the dynamic signal component after DC removal. Represents a slowly changing DC baseline component; differentiated process noise is configured for the state vector, corresponding to the dynamic signal component. Signal process noise Greater than the DC baseline component DC process noise ; The adaptive adjustment module is used to acquire the capacitance measurement value at the current sampling time, calculate the residual between the capacitance measurement value and the filter prediction value, calculate the environmental noise variance in real time through a sliding window based on the residual sequence, and adaptively and dynamically adjust the observation noise covariance. ; The state machine management module is used to perform dual-mode state machine control based on the difference between the capacitance measurement value and the locked baseline value, controlling the system to switch between a steady state and a switching state: when a sudden change in the touch signal is detected, the system enters the switching state, temporarily increasing the process noise to force the two-dimensional Kalman filter model to quickly track the signal change; when the signal is detected to be in a stable state, the system enters the steady state, and the filtering result is updated based on the state of the Kalman filter. The slow calibration module is used to activate the external slow integration baseline calibration channel in the steady state, calculate and accumulate the deviation between the capacitance measurement value and the locked baseline value in each sampling period, and finely update the locked baseline value based on the cumulative average value of the deviation when the steady-state sampling period reaches a preset long period threshold.

9. A computer device, characterized in that, The computer device includes a processor and a memory, the memory storing at least one instruction, at least one program, a code set, or an instruction set, the at least one instruction, the at least one program, the code set, or the instruction set being loaded and executed by the processor to implement the noise reduction filtering method for dynamic capacitance detection as described in any one of claims 1 to 7.

10. A computer-readable storage medium, characterized in that, The readable storage medium stores at least one instruction, at least one program, code set, or instruction set, wherein the at least one instruction, the at least one program, the code set, or the instruction set is loaded and executed by a processor to implement the noise reduction filtering method for dynamic capacitance detection as described in any one of claims 1 to 7.