A capacitance detection method and a capacitance detection device

By acquiring the measured values ​​of the capacitor under test and the reference capacitor, and combining PID control with integral and derivative compensation values, the problem of poor compensation effect of proximity sensors is solved, achieving higher detection accuracy and temperature adaptability.

CN115542015BActive Publication Date: 2026-01-30SHANGHAI AWINIC TECH CO LTD
View PDF 1 Cites 0 Cited by

Patent Information

Application Number
CN202211165277.0
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2022-09-23
Publication Date
2026-01-30
Estimated Expiration
2042-09-23

AI Technical Summary

Technical Problem

In existing technologies, the compensation effect of proximity sensors is not good, which makes the detection results susceptible to changes in temperature environment, and cannot effectively eliminate the fluctuation of parasitic capacitance, thus affecting the detection accuracy.

Method used

By acquiring the measured values ​​of the capacitor under test and the reference capacitor, the first and second reference compensation values ​​are determined. The proportional, integral, and derivative control terms in the PID control are used to compensate for the measured value of the capacitor under test, including updating the compensation coefficient when the measured value of the capacitor under test is stable. By combining the integral and derivative compensation values, the compensation effect is improved.

Benefits of technology

Without altering the circuit structure, the accuracy of capacitance detection is significantly improved, the adaptability to temperature changes is enhanced, and the accuracy of detection is increased.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN115542015B_ABST
    Figure CN115542015B_ABST
Patent Text Reader

Abstract

This application relates to the field of touch detection and discloses a capacitance detection method and apparatus. The detection method includes: acquiring a measured value of a capacitor under test; when the measured value of the capacitor under test is in a stable state, acquiring a measured value of a reference capacitor and determining a first reference compensation coefficient; determining a first reference compensation value based on the measured value of the reference capacitor and the first reference compensation coefficient; acquiring a reference effective measured value and a target capacitance value of the capacitor under test; determining a second reference compensation value based on the reference effective measured value and the target capacitance value of the capacitor under test; and compensating for the measured value of the capacitor under test based on the first reference compensation value and the second reference compensation value to obtain an effective measured value of the capacitor under test. This application achieves a more accurate compensation effect by using both the first reference compensation value and the second reference compensation value for compensation.
Need to check novelty before this filing date? Find Prior Art

Description

TECHNICAL FIELD

[0001] The present application relates to the field of touch sensing, and in particular, to a capacitance detection method and a capacitance detection device. BACKGROUND

[0002] As an important means of obtaining information in the field of production and nature, sensors are widely used in industrial production, intelligent equipment, space exploration, ocean exploration, environmental protection and other aspects. The working principle of a sensor can be simply understood as follows: a sensitive element in the sensor senses a measured quantity and outputs a physical quantity signal having a certain relationship with the measured quantity, and then a conversion element converts the physical quantity signal output by the sensitive element into an electrical signal to realize a detection function. A proximity sensor is a kind of sensor, which can convert the movement information and existence information of a detection object into an electrical signal to determine the proximity of the detection object according to the electrical signal, and is widely used in smart devices such as mobile phones, tablets and smart door locks.

[0003] With the miniaturization of smart devices, proximity sensors are limited in the size of smart devices, and some electronic devices in smart devices generate heat during operation. Electricity is easily affected by the environment, especially temperature. Therefore, changes in the temperature environment in the device can cause fluctuations in the parasitic capacitance between the sensor electrode and the traces on the PCB (Printed Circuit Board) on which the sensor electrode is disposed, thereby affecting the detection result. Therefore, in order to detect more accurately, the parasitic capacitance is generally compensated.

[0004] At present, a scheme of running a reference channel near the detection channel as an environmental reference of the detection channel is proposed, which compensates the detection channel data based on the reference channel data to mainly eliminate the influence of the temperature environment. However, due to the limitations of peripheral circuit design, the reference channel environment and the detection channel environment cannot be completely consistent, which reduces the correlation between the detection channel and the reference channel data, and causes the situation that effective compensation cannot be performed, thereby affecting the proximity detection result. SUMMARY

[0005] Based on this, the embodiments of the present application provide a capacitance detection method and a capacitance detection device to solve the problem of poor compensation effect and affecting proximity detection in the prior art.

[0006] In a first aspect, the embodiments of the present application provide a capacitance detection method, comprising:

[0007] obtaining a measurement value of a to-be-measured capacitance;

[0008] when the measurement value of the to-be-measured capacitance is in a stable state, obtaining a measurement value of a reference capacitance, determining a first reference compensation coefficient, determining a first reference compensation value according to the measurement value of the reference capacitance and the first reference compensation coefficient;

[0009] Obtain the reference effective measurement value and the target capacitance value of the capacitor under test, and determine the second reference compensation value based on the reference effective measurement value and the target capacitance value of the capacitor under test;

[0010] The measured value of the capacitor under test is compensated based on the first reference compensation value and the second reference compensation value to obtain the effective measured value of the capacitor under test.

[0011] Specifically, in this embodiment, the measured value of the capacitor under test is the scan data of the detection channel, which is connected between the capacitance detection device and the electrodes of the capacitor under test. The measured value of the reference capacitor is the scan data of the reference channel, with one end connected to the capacitance detection device and the other end floating. The capacitance detection method provided in this embodiment can adjust the first reference compensation value in a stable state to improve its compensation effect. Furthermore, a second reference compensation value is introduced to enhance the compensation effect, allowing compensation to be made based on the second reference compensation value if the first reference compensation value fails, thereby improving the accuracy of capacitance detection. In other words, the cooperation between the first and second reference compensation values ​​achieves a better compensation effect, thus improving detection accuracy.

[0012] In one possible implementation of the first aspect above, the second reference compensation value includes an integral compensation value; determining the second reference compensation value based on the reference effective measurement value and the target capacitance value of the capacitor under test includes:

[0013] The target error is determined based on the difference between the effective measured value of the reference and the target capacitance value of the capacitor under test.

[0014] The integral compensation value is determined based on the target error.

[0015] Specifically, the capacitor under test is easily affected by environmental factors (mainly temperature) and changes. The target error is the difference between the effective measured value and the target capacitance value of the capacitor under test, which contains information about the changing trend of the capacitor under test. Therefore, the integral compensation value determined based on the target error can be used to compensate for the measured value of the capacitor under test, which can better compensate for the influence of external environmental factors on the capacitance value of the capacitor under test, thereby achieving a better compensation effect.

[0016] In one possible implementation of the first aspect above, determining the integral compensation value based on the target error includes:

[0017] Obtain the baseline integral value;

[0018] The integral compensation value is determined based on the sum of the target error and the baseline integral value.

[0019] In a possible implementation of the above first aspect, the calculation formula for the integral compensation value is ki * ∑Err, where ki is a constant and 0 < ki < 1; ∑Err represents the integral value of the target error.

[0020] In a possible implementation of the above first aspect, the second reference compensation value includes a differential compensation value; determining the second reference compensation value according to the reference valid measurement value and the target capacitance value of the capacitance to be measured includes:

[0021] Determining the target error according to the difference between the reference valid measurement value and the target capacitance value of the capacitance to be measured;

[0022] Determining the differential compensation value according to the target error.

[0023] Specifically, the capacitance to be measured is susceptible to environmental factors (mainly temperature) and changes, and the target error is the difference between the valid measurement value and the target capacitance value of the capacitance to be measured, which contains information on the change trend of the capacitance to be measured. Therefore, the differential compensation value determined based on the target error can be used to compensate the measured value of the capacitance to be measured, better compensating for the influence of external environmental factors on the capacitance value of the capacitance to be measured, and thus achieving a better compensation effect.

[0024] In a possible implementation of the above first aspect, determining the differential compensation value according to the target error includes:

[0025] Obtaining the reference error;

[0026] Determining the differential compensation value according to the difference between the target error and the reference error.

[0027] In a possible implementation of the above first aspect, the calculation formula for the differential compensation value is kd * dErr; where kd is a constant, kd > 0; dErr represents the differential value of the target error, dErr = Err(n) - Err(n - 1), Err(n - 1) represents the reference error, and Err(n) represents the target error.

[0028] In a possible implementation of the above first aspect, the second reference compensation value includes an integral compensation value and a differential compensation value; compensating the measured value of the capacitance to be measured based on the first reference compensation value and the second reference compensation value to obtain the valid measurement value of the capacitance to be measured includes:

[0029] Compensating the measured value of the capacitance to be measured based on the first reference compensation value, the integral compensation value, and the differential compensation value using the following formula to obtain the valid measurement value of the capacitance to be measured:

[0030] Data_new = Data_raw - kp_item * Data_ref - ki * ∑Err + kd * dErr

[0031] Among them, Data_new represents the effective measurement value of the capacitor to be measured, Data_raw represents the measurement value of the capacitor to be measured, Data_ref represents the measurement value of the reference capacitor, kp_item represents the first reference compensation coefficient, ki and kd are both constants, and 0 < ki < 1, kd > 0, ∑Err represents the integral value of the target error, and dErr represents the differential value of the target error.

[0032] Among them, kp_item * Data_ref is the first compensation value, ki * ∑Err is the integral compensation value, and kd * dErr is the differential compensation value. The first compensation value, the integral compensation value, and the differential compensation value can be regarded as the proportional adjustment term, the integral adjustment term, and the differential adjustment term in the PID adjustment respectively. Through the mutual cooperation of the proportional adjustment term, the integral adjustment term, and the differential adjustment term, the compensation effect can be further improved and the detection accuracy can be increased.

[0033] In a possible implementation of the above first aspect, obtaining the measurement value of the reference capacitor and determining the first reference compensation coefficient, and determining the first reference compensation value according to the measurement value of the reference capacitor and the first reference compensation coefficient, includes:

[0034] Obtaining the measurement value of the reference capacitor and the first reference compensation coefficient;

[0035] Determining the first reference compensation coefficient according to the first reference compensation coefficient;

[0036] Determining the first reference compensation value according to the first reference compensation coefficient and the measurement value of the reference capacitor.

[0037] Specifically, in addition to the decrease in the correlation between the measurement value of the capacitor to be measured and the measurement value of the reference capacitor caused by the inconsistent influence of environmental factors on the detection channel and the reference channel, the approach / separation of the human body / object will also cause a decrease in the correlation between the measurement values of the detection channel and the reference capacitor. When the human body / object approaches / separates, the measurement value of the capacitor to be measured will change accordingly. At this time, if the first reference compensation coefficient is updated directly without judging whether the temperature changes, it may affect the compensation effect and reduce the detection accuracy. Based on this, in this embodiment, by judging the state of the measurement value of the capacitor to be measured, when the measurement value of the capacitor to be measured is in a stable state, the first reference compensation coefficient is determined based on the first reference compensation coefficient, and when the measurement value of the capacitor to be measured is unstable, the first reference compensation coefficient is not updated, and the first reference compensation coefficient is directly used as the first reference compensation coefficient until the state is stable and then the first reference compensation coefficient is updated. Such a setting can facilitate the exclusion of interference caused by changes in motion factors and further improve the detection accuracy.

[0038] In a possible implementation of the above first aspect, determining the first reference compensation coefficient according to the first reference compensation coefficient, includes:

[0039] Obtain the reference value of the reference capacitor;

[0040] Determine the relationship between the measured value of the reference capacitor and the reference value of the reference capacitor. Based on the relationship, the first reference compensation coefficient, and the target error, determine the first reference compensation coefficient.

[0041] The target error is the difference between the effective measured value of the reference and the target capacitance value of the capacitor under test.

[0042] Since the measured value of the reference capacitor can characterize the change in the measured value of the capacitor under test due to temperature, it is possible to determine whether the measured value of the reference capacitor has increased or decreased based on the relationship between the measured value of the reference capacitor and the reference value of the reference capacitor, and thus determine the temperature change. This can be used as a criterion for increasing or decreasing the first reference compensation coefficient. This scheme can achieve the function of adjusting the compensation coefficient to temperature without changing the circuit structure or adding circuit components, thus saving costs.

[0043] In one possible implementation of the first aspect above, determining the first reference compensation coefficient based on the magnitude relationship, the first benchmark compensation coefficient, and the target error includes:

[0044] When the measured value of the reference capacitor is greater than the reference value of the reference capacitor, the first reference compensation coefficient is determined based on the sum of the first reference compensation coefficient and the preset compensation coefficient increment.

[0045] When the measured value of the reference capacitor is less than the reference value of the reference capacitor, the first reference compensation coefficient is determined based on the difference between the first reference compensation coefficient and the reduced value of the preset compensation coefficient.

[0046] Because both the measured values ​​of the capacitor under test and the reference capacitor are affected by internal environmental factors (mainly temperature) of the electronic device, specifically, when the internal ambient temperature rises, the measured values ​​of both the capacitor under test and the reference capacitor will increase, and when the internal ambient temperature decreases, the measured values ​​of both the capacitor under test and the reference capacitor will decrease. Therefore, it is necessary to adjust the target capacitance value in a timely manner according to the changes in the internal ambient temperature of the electronic device to better compensate for the measured value of the capacitor under test. Specifically, when the measured value of the reference capacitor increases, that is, when the measured value of the reference capacitor is greater than the reference value, the internal environment is in a state of rising temperature, and the first reference compensation coefficient should be increased by a preset compensation coefficient increase value to obtain the first reference compensation coefficient; conversely, when the measured value of the reference capacitor decreases, that is, when the measured value of the reference capacitor is less than the reference value, the internal environment is in a state of cooling, and the first reference compensation coefficient should be decreased by a preset compensation coefficient decrease value to obtain the first reference compensation coefficient.

[0047] Specifically, the preset compensation coefficient increase and the preset compensation coefficient decrease can be fixed values ​​or not; they can be equal or unequal. In one possible implementation of the first aspect above, the preset compensation coefficient increase and the preset compensation coefficient decrease are equal, both being equal to the product of the target error and the set coefficient.

[0048] In one possible implementation of the first aspect above, the capacitance detection method further includes: when the measured value of the capacitor under test is in a stable state, determining the updated target capacitance value of the capacitor under test based on the acquired measured value of the capacitor under test.

[0049] In other words, the target capacitance value is not static. When the measured value of the capacitor under test is in a stable state, the target capacitance value can be updated based on the measured value of the capacitor under test. Specifically, the target capacitance value is equal to a valid measured value of the capacitor under test obtained in a stable state, or it can be equal to the average of n valid measured values ​​of the capacitor under test obtained in a stable state. The target capacitance value can be updated when the state of the measured value of the capacitor under test changes from unstable to stable, or it can be updated after a certain delay following the stabilization of the measured value. The purpose of the delay is to allow the capacitance data to reach a more ideal stable state.

[0050] In one possible implementation of the first aspect above, obtaining the measured value of the capacitor under test includes:

[0051] The measurement values ​​of the capacitor under test are acquired twice consecutively, and the absolute value of the difference between the two acquired measurement values ​​is calculated. If the absolute value of the difference is less than a set threshold, the measurement value of the capacitor under test is determined to be in a stable state.

[0052] or,

[0053] The measurement values ​​of the capacitor under test are acquired multiple times consecutively. The maximum and minimum values ​​among the acquired measurements are determined. The absolute value of the difference between the maximum and minimum values ​​is calculated. If the absolute value of the difference is less than a set threshold, the measurement value of the capacitor under test is determined to be in a stable state.

[0054] Secondly, embodiments of this application provide a capacitance detection device, comprising:

[0055] A capacitance sensor is used to acquire the measured value of the capacitance under test.

[0056] A reference capacitance sensor is used to obtain a measured value of a reference capacitance.

[0057] The processor is connected to the capacitor under test sensor and the reference capacitor sensor respectively. It is used to receive the measured value of the capacitor under test output by the capacitor under test sensor and determine whether the measured value of the capacitor under test received by it is in a stable state. When the measured value of the capacitor under test is in a stable state, the processor determines the target capacitance value based on the measured value of the capacitor under test, and determines the first reference compensation value based on the first reference compensation coefficient and the measured value of the reference capacitance output by the reference capacitor sensor.

[0058] The processor is also used to acquire a reference valid measurement value, determine a second reference compensation value based on the reference valid measurement value and the target capacitance value of the capacitor under test, and compensate the measurement value of the capacitor under test based on the first reference compensation value and the second reference compensation value to obtain the valid measurement value of the capacitor under test.

[0059] Specifically, in this embodiment, the measured value of the capacitor under test is the scan data of the detection channel, which is connected between the capacitance detection device and the electrodes of the capacitor under test. The measured value of the reference capacitor is the scan data of the reference channel, with one end connected to the capacitance detection device and the other end floating. The capacitance detection method provided in this embodiment can adjust the first reference compensation value in a stable state to improve its compensation effect. Furthermore, a second reference compensation value is introduced to enhance the compensation effect, allowing compensation to be made based on the second reference compensation value if the first reference compensation value fails, thereby improving the accuracy of capacitance detection. In other words, the cooperation between the first and second reference compensation values ​​achieves a better compensation effect, thus improving detection accuracy.

[0060] In one possible implementation of the second aspect above, the second reference compensation value includes an integral compensation value; determining the second reference compensation value based on the reference effective measurement value and the target capacitance value of the capacitor under test includes:

[0061] The target error is determined based on the difference between the effective measured value of the reference and the target capacitance value of the capacitor under test.

[0062] The integral compensation value is determined based on the target error.

[0063] Specifically, the capacitor under test is easily affected by environmental factors (mainly temperature) and changes. The target error is the difference between the effective measured value and the target capacitance value of the capacitor under test, which contains information about the changing trend of the capacitor under test. Therefore, the integral compensation value determined based on the target error can be used to compensate for the measured value of the capacitor under test, which can better compensate for the influence of external environmental factors on the capacitance value of the capacitor under test, thereby achieving a better compensation effect.

[0064] In one possible implementation of the second aspect above, determining the integral compensation value based on the target error includes:

[0065] Obtain a reference integral value;

[0066] Determine an integral compensation value according to the sum of the target error and the reference integral value.

[0067] In a possible implementation of the second aspect described above, the calculation formula for the integral compensation value is ki*∑Err, where ki is a constant and 0 < ki < 1, and ∑Err represents the integral value of the target error.

[0068] In a possible implementation of the second aspect described above, the second reference compensation value includes a differential compensation value; determining the second reference compensation value according to the reference effective measurement value and the target capacitance value of the capacitor under test includes:

[0069] Determine a target error according to the difference between the reference effective measurement value and the target capacitance value of the capacitor under test;

[0070] Determine a differential compensation value according to the target error.

[0071] Specifically, the capacitor under test is susceptible to environmental factors (mainly temperature) and changes occur. The target error is the difference between the effective measurement value and the target capacitance value of the capacitor under test, which contains information on the change trend of the capacitor under test. Therefore, compensating the measured value of the capacitor under test with the differential compensation value determined based on the target error can better compensate for the influence of external environmental factors on the capacitance value of the capacitor under test, and thus achieve a better compensation effect.

[0072] In a possible implementation of the second aspect described above, determining the differential compensation value according to the target error includes:

[0073] Obtain a reference error;

[0074] Determine a differential compensation value according to the difference between the target error and the reference error.

[0075] In a possible implementation of the second aspect described above, the calculation formula for the differential compensation value is kd*dErr; where kd is a constant and kd > 0; dErr represents the differential value of the target error, dErr = Err(n) - Err(n - 1), Err(n - 1) represents the reference error, and Err(n) represents the target error.

[0076] In a possible implementation of the second aspect described above, the second reference compensation value includes an integral compensation value and a differential compensation value; compensating the measured value of the capacitor under test based on the first reference compensation value and the second reference compensation value to obtain an effective measured value of the capacitor under test includes:

[0077] The measured value of the capacitance to be measured is compensated based on the first reference compensation value, the integral compensation value, and the differential compensation value using the following formula to obtain the effective measured value of the capacitance to be measured:

[0078] Data_new = Data_raw - kp_item * Data_ref - ki * ∑Err + kd * dErr

[0079] Where, Data_new represents the effective measured value of the capacitance to be measured, Data_raw represents the measured value of the capacitance to be measured, Data_ref represents the measured value of the reference capacitance, kp_item represents the first reference compensation coefficient, ki and kd are both constants, and 0 < ki < 1, kd > 0, ∑Err represents the integral value of the target error, and dErr represents the differential value of the target error.

[0080] Where, kp_item * Data_ref(n) is the first compensation value, ki * ∑Err is the integral compensation value, and kd * dErr is the differential compensation value. The first compensation value, the integral compensation value, and the differential compensation value can be regarded as the proportional adjustment term, the integral adjustment term, and the differential adjustment term in the PID adjustment respectively. Through the mutual cooperation of the proportional adjustment term, the integral adjustment term, and the differential adjustment term, the compensation effect can be further improved and the detection accuracy can be increased.

[0081] In a possible implementation of the second aspect above, obtaining the measured value of the reference capacitance and determining the first reference compensation coefficient, and determining the first reference compensation value according to the measured value of the reference capacitance and the first reference compensation coefficient includes:

[0082] Obtaining the measured value of the reference capacitance and the first reference compensation coefficient;

[0083] Determining the first reference compensation coefficient according to the first reference compensation coefficient;

[0084] Determining the first reference compensation value according to the first reference compensation coefficient and the measured value of the reference capacitance.

[0085] Specifically, besides the reduced correlation between the measured values ​​of the capacitor under test and the reference capacitor due to inconsistent environmental factors affecting the detection channel and the reference channel, the approach / movement of a person / object can also reduce the correlation between the measured values ​​of the detection channel and the reference capacitor. When a person / object approaches / moves away, the measured value of the capacitor under test will change accordingly. In this case, if the first reference compensation coefficient is updated directly without judging whether the temperature has changed, it may affect the compensation effect and reduce the detection accuracy. Based on this, this embodiment judges the state of the measured value of the capacitor under test. When the measured value of the capacitor under test is in a stable state, the first reference compensation coefficient is determined based on the first reference compensation coefficient. When the measured value of the capacitor under test is unstable, the first reference compensation coefficient is not updated, and the first reference compensation coefficient is directly used as the first reference compensation coefficient until the state stabilizes. Only then is the first reference compensation coefficient updated. This setting can easily eliminate the interference caused by changes in motion factors and further improve the accuracy of detection.

[0086] In one possible implementation of the second aspect above, determining the first reference compensation coefficient based on the first benchmark compensation coefficient includes:

[0087] Obtain the reference value of the reference capacitor;

[0088] Determine the relationship between the measured value of the reference capacitor and the reference value of the reference capacitor. Based on the relationship, the first reference compensation coefficient, and the target error, determine the first reference compensation coefficient.

[0089] The target error is the difference between the effective measured value of the reference and the target capacitance value of the capacitor under test.

[0090] Since the measured value of the reference capacitor can characterize the change in the measured value of the capacitor under test due to temperature, it is possible to determine whether the measured value of the reference capacitor has increased or decreased based on the relationship between the measured value of the reference capacitor and the reference value of the reference capacitor, and thus determine the temperature change. This can be used as a criterion for increasing or decreasing the first reference compensation coefficient. This scheme can achieve the function of adjusting the compensation coefficient to temperature without changing the circuit structure or adding circuit components, thus saving costs.

[0091] In one possible implementation of the second aspect above, determining the first reference compensation coefficient based on the magnitude relationship, the first benchmark compensation coefficient, and the target error includes:

[0092] When the measured value of the reference capacitor is greater than the reference value of the reference capacitor, the first reference compensation coefficient is determined based on the sum of the first reference compensation coefficient and the preset compensation coefficient increment.

[0093] When the measured value of the reference capacitor is less than the reference value of the reference capacitor, the first reference compensation coefficient is determined based on the difference between the first reference compensation coefficient and the reduced value of the preset compensation coefficient.

[0094] Because both the measured values ​​of the capacitor under test and the reference capacitor are affected by internal environmental factors (mainly temperature) of the electronic device, specifically, when the internal ambient temperature rises, the measured values ​​of both the capacitor under test and the reference capacitor will increase, and when the internal ambient temperature decreases, the measured values ​​of both the capacitor under test and the reference capacitor will decrease. Therefore, it is necessary to adjust the target capacitance value in a timely manner according to the changes in the internal ambient temperature of the electronic device to better compensate for the measured value of the capacitor under test. Specifically, when the measured value of the reference capacitor increases, that is, when the measured value of the reference capacitor is greater than the reference value, the internal environment is in a state of rising temperature, and the first reference compensation coefficient should be increased by a preset compensation coefficient increase value to obtain the first reference compensation coefficient; conversely, when the measured value of the reference capacitor decreases, that is, when the measured value of the reference capacitor is less than the reference value, the internal environment is in a state of cooling, and the first reference compensation coefficient should be decreased by a preset compensation coefficient decrease value to obtain the first reference compensation coefficient.

[0095] Specifically, the preset compensation coefficient increase and the preset compensation coefficient decrease can be fixed values ​​or not; they can be equal or unequal. In one possible implementation of the first aspect above, the preset compensation coefficient increase and the preset compensation coefficient decrease are equal, both being equal to the product of the target error and the set coefficient.

[0096] In one possible implementation of the second aspect described above, the processor is further configured to determine the updated target capacitance value of the capacitor under test based on the acquired measured value of the capacitor under test when the measured value of the capacitor under test is in a stable state.

[0097] In other words, the target capacitance value is not static. When the measured value of the capacitor under test is in a stable state, the target capacitance value can be updated based on the measured value of the capacitor under test. Specifically, the target capacitance value is equal to a valid measured value of the capacitor under test obtained in a stable state, or it can be equal to the average of n valid measured values ​​of the capacitor under test obtained in a stable state. The target capacitance value can be updated when the state of the measured value of the capacitor under test changes from unstable to stable, or it can be updated after a certain delay following the stabilization of the measured value. The purpose of the delay is to allow the capacitance data to reach a more ideal stable state.

[0098] In one possible implementation of the second aspect above, the sensor is used to acquire the measured value of the capacitor under test, and the processor is used to determine whether the measured value of the capacitor under test is in a stable state, including:

[0099] The sensor acquires the measured value of the capacitor under test twice consecutively. The processor calculates the absolute value of the difference between the two measured values. If the absolute value of the difference is less than a set threshold, it is determined that the measured value of the capacitor under test is in a stable state.

[0100] or,

[0101] The sensor acquires the measured values ​​of the capacitor under test multiple times. It then determines the maximum and minimum values ​​among the acquired measured values ​​and calculates the absolute value of the difference between the maximum and minimum values. If the absolute value of the difference is less than a set threshold, the sensor determines that the measured value of the capacitor under test is in a stable state. Attached Figure Description

[0102] Figure 1 According to some embodiments of this application, a circuit diagram of a capacitance detection device is shown;

[0103] Figure 2 According to some embodiments of this application, a schematic flowchart of a capacitance detection method is shown. Figure 1 ;

[0104] Figure 3 According to some embodiments of this application, a schematic flowchart of a capacitance detection method is shown. Figure 2 ;

[0105] Figure 4 According to some embodiments of this application, a graph showing the variation of the measured value of the capacitor under test and the measured value of the reference capacitor is shown;

[0106] Figure 5 According to some embodiments of this application, the effect diagram after compensating the measured value of the capacitor under test using conventional methods is shown;

[0107] Figure 6 According to some embodiments of this application, an effect diagram is shown after compensating the measured value of the capacitor under test using the capacitance detection method provided in one embodiment;

[0108] Figure 7 According to some embodiments of this application, a structural block diagram of a capacitance detection device is shown. Detailed Implementation

[0109] The present application will be further described below with reference to specific embodiments and accompanying drawings. It is understood that the illustrative embodiments of this disclosure include, but are not limited to, capacitance detection methods, apparatuses, electronic devices, media, and program products. The specific embodiments described herein are merely for explaining the present application and not for limiting it. Furthermore, for ease of description, the accompanying drawings show only the parts relevant to the present application, and not all of the structures or processes.

[0110] The following specific embodiments illustrate the implementation of this application. Those skilled in the art can easily understand other advantages and effects of this application from the content disclosed in this specification. Although the description of this application will be presented in conjunction with preferred embodiments, this does not mean that the features of this invention are limited to this embodiment. On the contrary, the purpose of describing the invention in conjunction with embodiments is to cover other options or modifications that may be derived based on the claims of this application. To provide a thorough understanding of this application, many specific details will be included in the following description. This application may also be implemented without using these details. Furthermore, to avoid confusion or obscuring the focus of this application, some specific details will be omitted in the description. It should be noted that, unless otherwise specified, the embodiments and features in the embodiments of this application can be combined with each other.

[0111] Proximity detection, achieved by detecting changes in capacitance, is a common method in electronic devices. For example, SAR (Specific Absorption Rate) sensors are used to distinguish the proximity of inanimate objects from that of humans and can be used in portable electronic devices such as smartphones and wearable devices. The main principle of capacitive proximity sensors, such as SAR sensors, is to measure the capacitance Cuser formed between a human or object and the sensor electrodes. The magnitude of Cuser indicates the presence of a human or object. In practical detection systems, the sensor's capacitive electrodes and the traces on the PCB board they are mounted on have a parasitic capacitance Cpara. Ideally, this parasitic capacitance Cpara can be eliminated by calibrating the settings when no human or object is nearby, resulting in a zero capacitance value when no human or object is present. When a human or object is near, a capacitance Cuser is formed between the human or object and the sensor electrodes, and the capacitance value measured by the capacitive sensor is Cuser.

[0112] However, the voltage of the sensor is easily affected by environmental factors, especially temperature. That is, the actual parasitic capacitance Cpara changes with temperature. Therefore, in order to more accurately detect the approach of a human body, it is necessary to further eliminate the change in parasitic capacitance Cpara caused by environmental changes. Usually, two sets of capacitance channel data are collected, and the coefficient relationship is used to use one set of data to compensate for the other set of data.

[0113] Figure 1A circuit diagram of a capacitance detection device is shown. The capacitance detection device 100 includes a capacitance sensing chip. A detection channel 101 is connected between the capacitance sensing chip and the electrode 200 of the capacitor under test for acquiring scan data of the detection channel. The capacitance sensing chip is also connected to a reference channel 102 for acquiring scan data of the reference channel. One end of the reference channel 102 is connected to the capacitance sensing chip of the capacitance detection device, and the other end is floating. Typically, two PCB traces with the same routing direction and similar length are used as the detection channel 101 and the reference channel 102, respectively. The scan data of the reference channel is used to compensate for the scan data of the detection channel to obtain the effective measurement value of the detection channel.

[0114] One compensation scheme according to some embodiments involves multiplying the scan data of the reference channel by a fixed compensation coefficient A to eliminate parasitic capacitance Cpara. That is, the effective measurement value of the detection channel is obtained by subtracting the product of the scan data of the reference channel and the compensation coefficient A from the scan data of the detection channel. The calculation formula is as follows:

[0115] Data_valid=Data_raw-A*Data_ref

[0116] Where Data_raw is the current scan data of the detection channel, Data_ref is the current scan data of the reference channel, and Data_valid is the valid measurement value of the detection channel.

[0117] The above process is the compensation process. Based on the current valid measurement value obtained after compensation, a judgment can be made to determine whether there is an object or human body approaching.

[0118] However, as the compensation research progresses, the above compensation scheme may have certain shortcomings: Due to limitations in the peripheral circuit design, when the external temperature changes rapidly, the conduction speed of temperature on the detection channel and the reference channel will be inconsistent. Alternatively, due to inconsistencies in the circuit structures of the detection channel and the reference channel, or due to differences in the temperature of their locations (e.g., the detection channel is closer to the device casing while the reference channel is closer to the device center), when the external environment changes, the detection channel will experience a capacitance change first, followed by the reference channel. All these factors will lead to a decrease in the correlation between the detection channel scanning data and the reference channel scanning data, making it impossible to use a uniform compensation coefficient A. Specifically: firstly, the optimal compensation coefficient differs across different temperature ranges; secondly, even within the same temperature range, the optimal compensation coefficient differs depending on the rate of temperature change. Therefore, it is difficult to accurately compensate the detection channel scanning data using a fixed compensation coefficient relationship.

[0119] Based on this, this application provides a capacitance detection method and apparatus to solve the problems found in the above research process, namely, to improve the compensation effect and thus improve the accuracy of detection.

[0120] According to an embodiment of this application, the capacitance detection method includes: acquiring a measured value of a capacitor under test; when the measured value of the capacitor under test is in a stable state, acquiring a measured value of a reference capacitor and determining a first reference compensation coefficient; determining a first reference compensation value based on the measured value of the reference capacitor and the first reference compensation coefficient; acquiring a reference effective measured value and a target capacitance value of the capacitor under test; determining a second reference compensation value based on the reference effective measured value and the target capacitance value of the capacitor under test; and compensating the measured value of the capacitor under test based on the first reference compensation value and the second reference compensation value to obtain an effective measured value of the capacitor under test.

[0121] This capacitance detection method can be applied to capacitance detection devices for electronic devices. Specifically, these electronic devices can be smartphones, tablets, laptops, smart bracelets, etc. This capacitance detection method can achieve accurate capacitance detection without changing the structure of the original detection circuit.

[0122] In some embodiments of the present invention, the second reference compensation value includes an integral compensation value and / or a differential compensation value; determining the second reference compensation value based on the reference effective measurement value and the target capacitance value of the capacitor under test includes determining a target error based on the difference between the reference effective measurement value and the target capacitance value of the capacitor under test, and determining the integral compensation value and / or the differential compensation value based on the target error.

[0123] This application can adjust the first reference compensation value in a stable state when the measured value of the capacitor under test is stable, so as to improve the compensation effect of the first reference compensation value on the measured value of the capacitor under test. In addition to the first compensation value, this application also introduces an integral compensation value and a derivative compensation value. The first compensation value, integral compensation value and derivative compensation value are regarded as the proportional control term, integral control term and derivative control term in PID control, respectively. Through the cooperation of the proportional control term, integral control term and derivative control term, the compensation effect can be further improved and the detection accuracy can be improved.

[0124] The embodiments of this application will now be described in further detail with reference to the accompanying drawings.

[0125] For ease of description, Err represents the error, Data_raw represents the measured value of the capacitor under test, Data_new represents the effective measured value of the capacitor under test, Data_ref represents the measured value of the reference capacitor, Data_tar represents the target capacitance value of the capacitor under test, and kp_item is the first reference compensation coefficient.

[0126] refer to Figure 2In one embodiment of this application, the capacitance detection method includes:

[0127] S101: Obtain the measured value of the capacitor under test, Data_raw.

[0128] The measured value Data_raw of the capacitor under test is the raw scan data of the detection channel, which can be capacitance data. Specifically, the measured value Data_raw of the capacitor under test includes the actual capacitance data and parasitic capacitance data of the capacitor under test. The acquisition process of the measured value Data_raw of the capacitor under test can be continuous or intermittent, and it must include at least the measured value Data_raw of the capacitor under test at the current moment.

[0129] S102: When the measured value Data_raw of the capacitor under test is in a stable state, obtain the measured value Data_ref of the reference capacitor, determine the first reference compensation coefficient kp_item, and determine the first reference compensation value based on the measured value Data_ref of the reference capacitor and the first reference compensation coefficient kp_item.

[0130] Specifically, the reference capacitance measurement value, Data_ref, is the raw scan data of the reference channel, which can be capacitance data or temperature data. One end of the reference channel is connected to the capacitance detection device, and the other end is floating. The reference capacitance measurement value, Data_ref, characterizes the influence of environmental factors such as temperature and humidity on the measured capacitance value, Data_raw. The acquisition of the reference capacitance measurement value, Data_ref, can be continuous or intermittent. The acquired reference capacitance measurement value, Data_ref, must include at least the measured value of the reference capacitance at the current moment.

[0131] In one embodiment of this application, the first reference compensation value can be represented as kp_item*Data_ref. Here, kp_item is the first reference compensation coefficient, and Data_ref is the measured value of the reference capacitor. That is, the first reference compensation value is used to compensate for the measured value Data_raw of the capacitor under test based on the measured value Data_ref of the reference capacitor. As mentioned above, the measured value Data_ref of the reference capacitor and the measured value Data_raw of the capacitor under test respond differently to temperature changes. Therefore, if the internal environment of the electronic device (mainly temperature) changes, it is often necessary to update the first reference compensation coefficient kp_item, and then use the updated first reference compensation coefficient kp_item to compensate for the measured value Data_raw of the capacitor under test. This is essential to ensure effective compensation.

[0132] However, besides environmental factors causing inconsistent effects on the detection and reference channels, leading to a decrease in the correlation between the measured value (Data_raw) of the capacitance under test in the detection channel and the measured value (Data_ref) of the reference capacitance in the reference channel, the approach / movement of a human body / object also reduces the correlation between the measured values ​​(Data_ref) of the detection channel and the reference capacitance. This is because the two ends of the detection channel are connected to the capacitance detection device and the capacitance electrode, respectively, while the reference channel is only connected to the capacitance detection device, and its other end is floating and not connected to the electrode of the capacitance under test. As a result, when a human body / object approaches / moves away from the electronic device, the data in the detection channel changes, while the data in the reference channel remains unchanged. This reduces the correlation between the measured value (Data_raw) of the capacitance under test in the detection channel and the measured value (Data_ref) of the reference capacitance in the reference channel.

[0133] This application aims to compensate for scenarios involving changes in environmental factors. If the electronic device moves or an object / person approaches or moves away from it, updating the first reference compensation coefficient kp_item will affect the compensation effect of the first reference compensation coefficient kp_item on the measured value Data_raw of the capacitor under test. Therefore, in order to achieve more accurate compensation based on the first reference compensation coefficient kp_item, the first reference compensation coefficient kp_item is only updated when the electronic device does not move or an object / person approaches or moves away from it. When the electronic device moves or an object / person approaches or moves away from it, the first reference compensation coefficient kp_item is not updated.

[0134] Specifically, to effectively eliminate the possibility of reduced correlation between the detection channel data and the reference channel data caused by the movement of the electronic device or the approach or movement of an object / person towards or away from the electronic device, this application uses the change in the measured value Data_raw of the capacitance under test in the detection channel to characterize whether the electronic device has moved and whether an object / person has approached or moved away from the electronic device. When the electronic device moves or an object / person approaches or moves away from the electronic device, the measured value Data_raw of the capacitance under test is in a changing state (i.e., an unstable state), while when the electronic device does not move and no object / person approaches or moves away from the electronic device, the measured value Data_raw of the capacitance under test is in a stable state.

[0135] Specifically, the measured value Data_raw of the capacitor under test can be determined in several ways to determine whether it is in a stable state.

[0136] Method 1: Acquire the measured value Data_raw of the capacitor under test twice consecutively, and calculate the absolute value of the difference between the two acquired measured values ​​Data_raw. If the absolute value of the difference is less than a set threshold, then the measured value Data_raw of the capacitor under test is determined to be in a stable state.

[0137] That is, calculate the absolute value of the difference between the measured value Data_raw(n) of the capacitor under test at the current moment and the measured value Data_raw(n-1) of the capacitor under test at the previous moment, |Data_raw(n)-Data_raw(n-1)|. If the absolute value of the difference is less than the set threshold Rth, it is determined that the measured value Data_raw of the capacitor under test is in a stable state; otherwise, it is determined that the measured value Data_raw of the capacitor under test is in an unstable state.

[0138] Method 2: Continuously acquire the measured value Data_raw of the capacitor under test multiple times, determine the maximum and minimum values ​​among the acquired measured values ​​Data_raw, calculate the absolute value of the difference between the maximum and minimum values, and if the absolute value of the difference is less than the set threshold Rth, then the measured value Data_raw of the capacitor under test is determined to be in a stable state.

[0139] Furthermore, the threshold value Rth can be a pre-set parameter, which can be set based on empirical values ​​of the variation range of the measured value Data_raw of the capacitor under test in both stable and unstable states. The range of the threshold value Rth can be obtained experimentally. For example, the detection chip can be placed in a temperature cycle test in a temperature chamber, cycling through temperatures of 25℃, 55℃, -10℃, 25℃, etc., to detect the variation range of |Data_raw(n)-Data_raw(n-1)| when an object or human body approaches. The threshold value Rth can be a value greater than the maximum value of |Data_raw(n)-Data_raw(n-1)| at each temperature, and the value of the threshold value Rth should be less than the additionally set maximum proximity judgment threshold to avoid the threshold value Rth being too large and failing to achieve an effective judgment effect.

[0140] Method 3: In addition to using the measured value Data_raw of the capacitor under test to determine the state as described above, instruments such as gyroscopes can be used to measure the motion parameters of electronic devices, such as speed. Based on the collected motion state parameters, it can be determined whether the measured value Data_raw of the capacitor under test is in a stable state. Specifically, if the motion state parameters are greater than a preset value, it is determined that the measured value Data_raw of the capacitor under test is in a stable state; otherwise, it is determined that the measured value Data_raw of the capacitor under test is in an unstable state.

[0141] Furthermore, when the measured value Data_raw of the capacitor under test is in a stable state, feedback adjustment is performed on the first reference compensation coefficient kp_item. In one embodiment, determining the first reference compensation coefficient kp_item includes:

[0142] Obtain the first baseline compensation coefficient kp_item_last;

[0143] The first reference compensation coefficient kp_item is determined based on the first baseline compensation coefficient kp_item_last.

[0144] Specifically, when the measured value Data_raw of the capacitor under test is in a stable state, it is updated according to the first reference compensation coefficient kp_item_last to obtain the first reference compensation coefficient kp_item; while when the measured value Data_raw of the capacitor under test is in an unstable state, the first reference compensation coefficient kp_item_last is directly used as the first reference compensation coefficient kp_item.

[0145] In one embodiment of this application, determining the first reference compensation coefficient kp_item based on the first benchmark compensation coefficient kp_item_last includes:

[0146] Obtain the reference value Data_ref0 of the reference capacitor, determine the relationship between the measured value Data_ref of the reference capacitor and the reference value Data_ref0 of the reference capacitor, and determine the first reference compensation coefficient kp_item based on the relationship, the first reference compensation coefficient kp_item_last and the target error Err.

[0147] When the measured value of the reference capacitor Data_ref is greater than the reference value Data_ref0, the first reference compensation coefficient kp_item is determined based on the sum of the first reference compensation coefficient kp_item_last and the preset compensation coefficient increment value Lp, that is, kp_item = kp_item_last + Lp.

[0148] When the measured value of the reference capacitor Data_ref is less than the reference value Data_ref0 of the reference capacitor, the first reference compensation coefficient kp_item is determined based on the difference between the first reference compensation coefficient kp_item_last and the preset compensation coefficient reduction value Lm, that is, kp_item = kp_item_last - Lm.

[0149] As mentioned above, since the measured value Data_ref of the reference capacitor can characterize the change in the measured value Data_raw of the capacitor under test due to temperature, it is possible to determine whether the measured value Data_ref of the reference capacitor is increasing or decreasing based on the relationship between the measured value Data_ref of the reference capacitor and the reference value Data_ref0 of the reference capacitor. This allows us to determine the temperature change and use it as a criterion for increasing or decreasing the first reference compensation coefficient kp_item. This scheme can achieve the function of adjusting the compensation coefficient to temperature without changing the circuit structure or adding circuit components, thus saving costs.

[0150] Specifically, the preset compensation coefficient increase value Lp and the preset compensation coefficient decrease value Lm can be fixed values, or they can be otherwise. The two can be equal or unequal. In an embodiment of the present application, the preset compensation coefficient increase value Lp and the preset compensation coefficient decrease value Lm are equal, and both are equal to the product of the target error Err and the setting coefficient.

[0151] For example, use the preset step L to represent the preset compensation coefficient increase value Lp and the preset compensation coefficient decrease value Lm, where L = kp * Err, kp is the setting coefficient, which is set according to empirical values and can be adjusted according to the detection effect. In some embodiments, the setting coefficient kp is related to the specific application scenario and is generally set to 10 -6 ~10 -4 within the range.

[0152] S103: Obtain the reference effective measurement value Data_new_last and the target capacitance value Data_tar of the capacitor to be measured, and determine the second reference compensation value according to the reference effective measurement value Data_new_last and the target capacitance value Data_tar of the capacitor to be measured.

[0153] Specifically, the second reference compensation value includes an integral compensation value and / or a differential compensation value.

[0154] Determining the second reference compensation value according to the reference effective measurement value Data_new_last and the target capacitance value Data_tar of the capacitor to be measured includes: determining the target error Err according to the difference between the reference effective measurement value Data_new_last and the target capacitance value Data_tar of the capacitor to be measured, that is, Err = Data_new_last - Data_tar; obtaining the reference integral value, and determining the integral compensation value according to the sum of the target error Err and the reference integral value; obtaining the reference error, and determining the differential compensation value according to the difference between the target error Err and the reference error.

[0155] Specifically, the calculation formula for the integral compensation value is ki * ∑Err, and the calculation formula for the differential compensation value is kd * dErr(n). Where ki and kd are both constants, and 0 < ki < 1, kd > 0, ∑Err represents the integral value of the target error Err, and dErr represents the differential value of the target error Err.

[0156] ∑Err = Sum_Err(n - 1) + Err(n) = Err(0) + Err(1) + Err(2) + …… + Err(n)

[0157] ki * ∑Err = ki * (Err(0) + Err(1) + Err(2) + …… + Err(n))

[0158] =ki*(Err(0)+Err(1)+Err(2)+……+Err(n-1))+ki*Err(n)

[0159] ki*(Err(0)+Err(1)+Err(2)+……+Err(n-1)) is the baseline integral compensation value, which is also the integral compensation value of the previous time step.

[0160] dErr=Err(n)-Err(n-1)

[0161] Err(n-1) represents the baseline error, which is the target error at the previous time step, and Err(n) represents the target error at the current time step.

[0162] Specifically, the reference valid measurement value Data_new_last and the first reference compensation coefficient kp_item_last are not static; they can be updated according to the state of the capacitor under test. The reference valid measurement value Data_new_last can be regarded as the valid measurement value of the capacitor under test at the previous moment. The first reference compensation coefficient kp_item_last can be regarded as the first reference compensation coefficient kp_item corresponding to the previous moment.

[0163] The target capacitance value Data_tar can also be updated based on the state of the measured value Data_raw of the capacitor under test. Specifically, when the measured value Data_raw of the capacitor under test is in a stable state, the updated target capacitance value Data_tar of the capacitor under test is determined based on the obtained measured value Data_raw of the capacitor under test.

[0164] Specifically, at the initial moment (generally when the chip is powered on or when a calibration command is received), since there is no relevant data from the previous moment, the first compensation coefficient kp_item(0) at the initial moment is equal to the first reference compensation coefficient kp_item_last(0) at the initial moment, which is represented by the preset compensation coefficient A1; and the measured value of the capacitor under test Data_raw(0) at the initial moment is assigned to the measured value of the capacitor under test Data_raw at the previous moment, and is used as the target capacitance value Data_tar(0) at the initial moment, that is, Data_raw(0) = Data_tar(0).

[0165] Further calculate the effective measured value of the capacitance under test at the initial moment, Data_new(0):

[0166] Data_new(0)=Data_raw(0)-kp_item(0)*Data_ref(0)-ki*∑Err+kd*dErr(0)

[0167] The initial target error Err(0) is 0. The specific calculation process is as follows:

[0168] Err(0)=Data_new(0-)-Data_tar(0)=Data_raw(0)-Data_raw(0)=0

[0169] Wherein, Data_new(0-) represents the valid measured value of the capacitor under test at the previous time step before the initial time step, and its value can be taken as the measured value of the capacitor under test at the initial time step, Data_raw(0).

[0170] At this point, ∑Err=Err(0)=0, dErr=0.

[0171] The further valid measured value of the capacitance under test at the initial moment, Data_new(0), is:

[0172] Data_new(0)=Data_raw(0)-kp_item(0)*Data_ref(0)

[0173] During the subsequent continuous measurement process, either during or after the detection, the compensated effective measurement value of the current capacitor under test can be assigned to the reference effective measurement value Data_new_last at the next moment to update the reference effective measurement value Data_new_last. Additionally, the updated current first reference compensation coefficient kp_item can be assigned to the first reference compensation coefficient kp_item_last to update the first reference compensation coefficient kp_item_last. Finally, the effective measurement value of the current capacitor under test can be assigned to the current target capacitance value Data_tar for subsequent compensation.

[0174] S104: Based on the first reference compensation value and the second reference compensation value, compensate for the measured value Data_raw of the capacitor under test to obtain the effective measured value of the capacitor under test.

[0175] Specifically, the measured value Data_raw of the capacitor under test can be compensated based on the first reference compensation value, integral compensation value, and differential compensation value using the following formula to obtain the effective measured value of the capacitor under test:

[0176] Data_new=Data_raw-kp_item*Data_ref-ki*∑Err+kd*dErr

[0177] Reference Appendix Figure 3 This is a schematic diagram of a specific process of a capacitance detection method according to an embodiment of this application.

[0178] In this embodiment, step S201 is first executed: acquiring detection data from two channels, namely the measured value of the capacitor under test and the measured value of the reference capacitor.

[0179] Calibration can be performed during the initial power-on startup, which is the initial moment for capacitance detection.

[0180] Additionally, if a "calibration" command is received in step S201, the current first reference compensation coefficient kp_item can be initialized. In this step, the current first reference compensation coefficient is initialized, i.e., a preset compensation coefficient A1 is used as the initial first reference compensation coefficient kp_item(0), kp_item(0) = A1; the currently acquired measured value of the capacitor under test (i.e., the measured value of the capacitor under test at the initial moment, Data_raw(0)) is assigned to the measured value of the capacitor under test at the previous moment, Data_raw(0-), and used as the initial target capacitance value, Data_tar(0).

[0181] Data_raw(0)=Data_raw(0-)=Data_tar(0)

[0182] Then, step S202 is executed: it is determined whether the measured value of the capacitor under test is stable (i.e., whether the absolute value of its difference is less than the set threshold Rth). If it is unstable (i.e., the absolute value of its difference is greater than or equal to the set threshold Rth), then step S206 is executed to directly calculate the target error, and then steps S207 and S208 are executed to calculate the first reference compensation value, integral compensation value and differential compensation value, so as to use the first reference compensation value, integral compensation value and differential compensation value for compensation; if the measured value of the capacitor under test is in a stable state, then steps S203 to S205 are executed first, and then steps S207 and S208 are executed.

[0183] That is, when the measured value of the capacitor under test is stable, the target capacitance value Data_tar is updated according to step S203. If the measured value of the capacitor under test is unstable, the target capacitance value is not updated, and the target capacitance value of the previous moment is directly used as the target capacitance value of the current moment.

[0184] Specifically, the target capacitance value is:

[0185] Data_tar(n) = Data_new(steady-state time)

[0186] For the first test after calibration, i.e. the initial moment of the test, kp_item(0) = A1, Data_ref = Data_ref0, Data_tar(0) = Data_raw(0), where Data_ref0 is the preset reference value of the reference capacitor.

[0187] Once the target capacitance value is determined, the target error Err(n) at the current moment is calculated based on the target capacitance value at the current moment and the reference effective measurement value (i.e., the effective measurement value of the capacitance to be measured at the previous moment):

[0188] Err(n)=Data_new_last-Data_tar.

[0189] Err(0) = 0 at the initial time.

[0190] Further execute step S205, which involves updating the first reference compensation coefficient kp_item. Specifically, the calculation formula for the first reference compensation coefficient kp_item is as follows:

[0191] kp_item=kp_item_last+kp*Err.

[0192] If the measured value of the capacitor under test is unstable, the first reference compensation coefficient kp_item_last will be directly used as the current first reference compensation coefficient kp_item.

[0193] Finally, after determining the target error and the first reference compensation coefficient, the current first reference compensation value, score compensation value, and differential compensation value are calculated, and the measured value of the capacitor under test at the current moment is updated and compensated based on the calculated first reference compensation value, score compensation value, and differential compensation value.

[0194] Specifically, with Figures 4 to 6 Taking an example, this embodiment's method is compared with that of a traditional compensation method to demonstrate the compensation effect. Figures 4 to 6 In the diagram, the horizontal axis represents the sampling time, and the vertical axis represents the signal quantity (i.e., the relative size of the capacitance).

[0195] Figure 4 This describes the trend of changes in the measured values ​​of the capacitor under test and the reference capacitor when the environment (mainly temperature) of the capacitor under test changes. Figure 4 As can be seen, due to the inconsistent temperature conduction rates, the linear relationship between the measured values ​​of the capacitor under test and the reference capacitor is inconsistent. If a traditional single-coefficient compensation scheme is used (i.e., using the product of the fixed compensation coefficient A and the measured value Data_ref of the reference capacitor to compensate for the measured value of the capacitor under test), the compensation effect is as follows: Figure 5 As shown. However, if the method provided in this embodiment is used, the compensation result is as follows. Figure 6 As shown. By Figure 5 and Figure 6 It can be seen that the compensation effect achieved by using the method in this embodiment is significantly better than that of the traditional solution.

[0196] like Figure 7As shown, some embodiments of this application also disclose a capacitance detection device, including:

[0197] The capacitance sensor 1 is used to acquire the measured value of the capacitance under test;

[0198] Reference capacitance sensor 2 is used to acquire the measured value of the reference capacitance;

[0199] The processor 3 is connected to the capacitor under test sensor 1 and the reference capacitor sensor 2 respectively. It is used to receive the measured value of the capacitor under test output by the capacitor under test sensor 1 and determine whether the measured value of the capacitor under test received by it is in a stable state. When the measured value of the capacitor under test is in a stable state, the processor 3 determines the target capacitance value according to the measured value of the capacitor under test, and determines the first reference compensation value according to the first reference compensation coefficient and the measured value of the reference capacitance output by the reference capacitor sensor 2.

[0200] The processor 3 is also used to acquire a reference valid measurement value, determine a second reference compensation value based on the reference valid measurement value and the target capacitance value of the capacitor under test, and compensate the measurement value of the capacitor under test based on the first reference compensation value and the second reference compensation value to obtain the valid measurement value of the capacitor under test.

[0201] In one embodiment of this application, the second reference compensation value includes an integral compensation value and / or a differential compensation value; determining the second reference compensation value based on the reference effective measurement value and the target capacitance value of the capacitor under test includes:

[0202] The target error is determined based on the difference between the effective measured value of the reference and the target capacitance value of the capacitor under test.

[0203] The integral compensation value and / or differential compensation value are determined based on the target error.

[0204] Specific limitations regarding the capacitance detection device can be found in the limitations of the capacitance detection method described above, and will not be repeated here. Each module in the aforementioned capacitance detection device can be implemented entirely or partially through software, hardware, or a combination thereof. These modules can be embedded in hardware or independent of the computing module in the computer device, or stored in software in the computer device's memory, so that the computer device's computing module can call and execute the operations corresponding to each module.

[0205] In the accompanying drawings, some structural or methodological features may be shown in a specific arrangement and / or order. However, it should be understood that such a specific arrangement and / or order may not be necessary. Rather, in some embodiments, these features may be arranged in a manner and / or order different from that shown in the illustrative drawings. Furthermore, the inclusion of structural or methodological features in a particular figure does not imply that such features are required in all embodiments, and in some embodiments, these features may be omitted or may be combined with other features.

[0206] It should be noted that all units / modules mentioned in the device embodiments of this application are logical units / modules. Physically, a logical unit / module can be a physical unit / module, a part of a physical unit / module, or a combination of multiple physical units / modules. The physical implementation of these logical units / modules themselves is not the most important factor; the combination of functions implemented by these logical units / modules is the key to solving the technical problems proposed in this application. Furthermore, to highlight the innovative aspects of this application, the above-described device embodiments of this application have not introduced units / modules that are not closely related to solving the technical problems proposed in this application. This does not mean that the above-described device embodiments do not contain other units / modules.

[0207] It should be noted that in the examples and description of this patent, relational terms such as "first" and "second" are used merely to distinguish one entity or operation from another, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Furthermore, the terms "comprising," "including," or any other variations thereof are intended to cover non-exclusive inclusion, such that a process, method, article, or apparatus 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 apparatus. 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 apparatus that includes the element.

[0208] Although this application has been illustrated and described with reference to certain preferred embodiments thereof, those skilled in the art should understand that various changes in form and detail may be made thereto without departing from the spirit and scope of this application.

Claims

1. A capacitance detection method characterized by, The method comprises the following steps: acquiring a measurement value of a to-be-measured capacitor; when the measurement value of the to-be-measured capacitor is in a stable state, acquiring a measurement value of a reference capacitor, determining a first reference compensation coefficient, determining a first reference compensation value according to the measurement value of the reference capacitor and the first reference compensation coefficient, wherein the first reference compensation coefficient is determined according to the measurement value of the reference capacitor and a first reference compensation coefficient corresponding to a previous time point, and the first reference compensation coefficient is a reference compensation coefficient corresponding to a previous time point; acquiring a reference effective measurement value and a target capacitor value of the to-be-measured capacitor, and determining a second reference compensation value according to the reference effective measurement value and the target capacitor value of the to-be-measured capacitor, wherein the reference effective measurement value represents an effective measurement value of the to-be-measured capacitor at a previous time point, and the target capacitor value is determined when the measurement value of the to-be-measured capacitor is in the stable state; compensating the measurement value of the to-be-measured capacitor based on the first reference compensation value and the second reference compensation value, and obtaining an effective measurement value of the to-be-measured capacitor at a current time point.

2. The capacitance detection method of claim 1, wherein, The second reference compensation value comprises an integral compensation value; determining the second reference compensation value according to the reference effective measurement value and the target capacitor value of the to-be-measured capacitor comprises: determining a target error according to a difference between the reference effective measurement value and the target capacitor value of the to-be-measured capacitor; determining the integral compensation value according to the target error.

3. The capacitance detection method of claim 2, wherein, Determining the integral compensation value according to the target error comprises: acquiring a reference integral value, the reference integral value being a sum of target errors at each time point before the current time point; determining the integral compensation value according to a sum of the target error at the current time point and the reference integral value.

4. The capacitance detection method of claim 3, wherein, The calculation formula of the integral compensation value is ki*∑Err; wherein ki is a constant, and 0<ki<1, and ∑Err represents an integral value of the target error at the current time point.

5. The capacitance detection method of claim 1, wherein, The second reference compensation value comprises a differential compensation value; determining the second reference compensation value according to the reference effective measurement value and the target capacitor value of the to-be-measured capacitor comprises: determining a target error according to a difference between the reference effective measurement value and the target capacitor value of the to-be-measured capacitor; determining the differential compensation value according to the target error.

6. The capacitance detection method of claim 5, wherein, Determining the differential compensation value according to the target error comprises: acquiring a reference error, the reference error being the target error at the previous time point; determining the differential compensation value according to a difference between the target error at the current time point and the reference error.

7. The capacitance detection method of claim 6, wherein, The calculation formula of the differential compensation value is kd*dErr; wherein kd is a constant, and kd>0, dErr represents a differential value of the target error at the current time point, dErr=Err(n)-Err(n-1), Err(n-1) represents the reference error, and Err(n) represents the target error.

8. The capacitance detection method of claim 1, wherein, The second reference compensation value comprises an integral compensation value and a differential compensation value; compensating the measurement value of the to-be-measured capacitor based on the first reference compensation value and the second reference compensation value, and obtaining an effective measurement value of the to-be-measured capacitor, comprises: Compensate the measured value of the to-be-measured capacitor based on the first reference compensation value, the integral compensation value and the differential compensation value by using the following formula to obtain the effective measured value of the to-be-measured capacitor: Data_new= Data_raw - kp_item* Data_ref - ki * ∑Err + kd * dErr Wherein, Data_new represents the effective measured value of the to-be-measured capacitor, Data_raw represents the measured value of the to-be-measured capacitor, Data_ref represents the measured value of the reference capacitor, kp_item represents the first reference compensation coefficient, ki and kd are both constants, and 0<ki<1, kd>0, ∑Err represents the integral value of the target error, and dErr represents the differential value of the target error.

9. The capacitance detection method of claim 1, wherein, Obtaining the measured value of the reference capacitor and determining the first reference compensation coefficient, determining the first reference compensation value according to the measured value of the reference capacitor and the first reference compensation coefficient, comprising: Obtaining the measured value of the reference capacitor and the first reference compensation coefficient; Determining the first reference compensation coefficient according to the first reference compensation coefficient; Determining the first reference compensation value according to the first reference compensation coefficient and the measured value of the reference capacitor.

10. The capacitance detection method of claim 9, wherein, Determining the first reference compensation coefficient according to the first reference compensation coefficient, comprising: Obtaining the reference value of the reference capacitor; Determining the size relationship between the measured value of the reference capacitor and the reference value of the reference capacitor, and determining the first reference compensation coefficient based on the size relationship, the first reference compensation coefficient and the target error; Wherein, the target error is the difference between the reference effective measured value and the target capacitor value of the to-be-measured capacitor.

11. The capacitance detection method of claim 10, wherein, Determining the first reference compensation coefficient based on the size relationship, the first reference compensation coefficient and the target error, comprising: When the measured value of the reference capacitor is greater than the reference value of the reference capacitor, determining the first reference compensation coefficient according to the sum of the first reference compensation coefficient and the preset compensation coefficient increase value; When the measured value of the reference capacitor is less than the reference value of the reference capacitor, determining the first reference compensation coefficient according to the difference between the first reference compensation coefficient and the preset compensation coefficient decrease value.

12. The capacitance detection method of claim 1, wherein, Further comprising: When the measured value of the to-be-measured capacitor is in a stable state, determining the updated target capacitor value of the to-be-measured capacitor according to the obtained measured value of the to-be-measured capacitor.

13. The capacitance detection method of claim 1, wherein, Obtaining the measured value of the to-be-measured capacitor, comprising: Obtaining the measured value of the to-be-measured capacitor twice continuously, calculating the absolute value of the difference between the measured values of the to-be-measured capacitor obtained twice, and if the absolute value of the difference is less than a set threshold, determining that the measured value of the to-be-measured capacitor is in a stable state; Or, Obtaining the measured value of the to-be-measured capacitor multiple times continuously, determining the maximum value and the minimum value in the obtained multiple measured values of the to-be-measured capacitor, calculating the absolute value of the difference between the maximum value and the minimum value, and if the absolute value of the difference is less than a set threshold, determining that the measured value of the to-be-measured capacitor is in a stable state.

14. A capacitance detection device, characterized by, Comprising: A to-be-measured capacitor sensor for obtaining the measured value of the to-be-measured capacitor; The reference capacitor sensor is configured to obtain a measurement value of a reference capacitor; The processor is connected with the to-be-measured capacitor sensor and the reference capacitor sensor respectively, configured to receive the measurement value of the to-be-measured capacitor output by the to-be-measured capacitor sensor, when the measurement value of the to-be-measured capacitor is in a stable state, determine a target capacitor value according to the measurement value of the to-be-measured capacitor, and determine a first reference compensation value according to a first reference compensation coefficient and the measurement value of the reference capacitor output by the reference capacitor sensor, wherein the first reference compensation coefficient is determined according to the measurement value of the reference capacitor and a first reference compensation coefficient corresponding to a previous time. The processor is further configured to obtain a reference effective measurement value, determine a second reference compensation value according to the reference effective measurement value and the target capacitor value of the to-be-measured capacitor, and compensate the measurement value of the to-be-measured capacitor based on the first reference compensation value and the second reference compensation value to obtain an effective measurement value of the to-be-measured capacitor at a current time, wherein the reference effective measurement value represents an effective measurement value of the to-be-measured capacitor at a previous time.

Citation Information

Patent Citations

  • Capacitance detection method and capacitance detection device

    CN114113801A