Capacitance detection method, chip and electronic device
By using temperature compensation and baseline processing in the capacitance detection method, the problem of misjudgment by capacitance sensors caused by changes in ambient temperature is solved, and more accurate judgment of human body status is achieved.
Patent Information
- Application Number
- PCT/CN2024/098266
- Authority / Receiving Office
- WO · WO
- Patent Type
- Applications
- Current Assignee / Owner
- Filing Date
- 2024-06-07
- Publication Date
- 2025-12-11
AI Technical Summary
Changes in ambient temperature can cause capacitive sensors to misjudge when a person is approaching or moving away.
By using the temperature compensation data corresponding to the nth capacitance sampling data and the baseline value corresponding to the (n-1)th capacitance sampling data, the capacitance change corresponding to the nth capacitance sampling data is determined. Combined with the approach threshold and trend change, the state of the human body relative to the electronic device is determined.
It effectively overcomes the influence of ambient temperature, improves the accuracy of human judgment of the state of electronic devices, reflects long-term changes in capacitance, and enhances the accuracy of judgment.
Smart Images

Figure CN2024098266_11122025_PF_FP_ABST
Abstract
Description
Capacitance detection method, chip and electronic device TECHNICAL FIELD
[0001] The present application relates to the technical field of capacitance detection, and in particular to a capacitance detection method, a chip and an electronic device. BACKGROUND
[0002] At present, a capacitance sensor is widely used in electronic devices such as mobile phones and earphones. The change amount of capacitance detected by the capacitance sensor can be used to identify whether a human body or other conductor is close to the electronic device (for example, a mobile phone). However, the capacitance detected by the capacitance sensor may also change due to changes in the ambient temperature, thereby causing misjudgment of the approaching state and the away state of the human body.
[0003] SUMMARY
[0004] Therefore, the present application provides a capacitance detection method, a chip and an electronic device to solve the problem of misjudgment of the approaching state and the away state of the human body due to changes in the ambient temperature.
[0005] In a first aspect, the present application provides a capacitance detection method, which includes: when n is a positive integer greater than or equal to 2, determining a capacitance change amount corresponding to the n th capacitance sampling data based on temperature compensation data corresponding to the n th capacitance sampling data and a baseline value corresponding to the (n-1) th capacitance sampling data; when n is 1, the capacitance change amount corresponding to the n th capacitance sampling data is 0; determining the state of the human body relative to the electronic device based on the size relationship between the capacitance change amount corresponding to the n th capacitance sampling data and an approaching threshold; determining a trend change amount corresponding to the n th capacitance sampling data based on the temperature compensation data of the previous n capacitance sampling data; and determining a baseline value corresponding to the n th capacitance sampling data based on the size relationship between the capacitance change amount and the approaching threshold and the trend change amount corresponding to the n th capacitance sampling data.
[0006] In the present application, the capacitance change amount is determined based on the temperature compensation data obtained by temperature compensation of the current capacitance sampling data and the baseline value corresponding to the previous capacitance sampling data, rather than based on the original capacitance sampling data, which can effectively overcome the influence of the ambient temperature and improve the accuracy of the judgment of the state of the human body relative to the electronic device.
[0007] In addition, in the present application, the trend change amount corresponding to the current capacitance sampling data is determined based on the temperature compensation data corresponding to all historical capacitance sampling data, which can reflect the long-term change information of the capacitance and further improve the accuracy of the judgment of the state of the human body relative to the electronic device, compared with the scheme of determining the trend change amount based on the current capacitance sampling data and the previous capacitance sampling data or based on the capacitance sampling data within a limited time window in some comparative embodiments.
[0008] In a possible implementation of the first aspect, the temperature compensation data corresponding to the n-th capacitance sampling data is determined based on the trend change amount of the n-th capacitance sampling data and the size relationship between the capacitance change amount of the n-th capacitance sampling data and the proximity threshold value, and the baseline value corresponding to the n-th capacitance sampling data is determined based on the trend change amount of the n-th capacitance sampling data and the size relationship between the capacitance change amount of the n-th capacitance sampling data and the proximity threshold value.
[0009] wherein delta[n] is the trend change amount corresponding to the n-th capacitance sampling data, delta[n-1] is the trend change amount corresponding to the (n-1)-th capacitance sampling data, comp[n] is the temperature compensation data corresponding to the n-th capacitance sampling data, comp[n-1] is the temperature compensation data corresponding to the (n-1)-th capacitance sampling data, and detcoef is a first adjustment coefficient, and the value range of detcoef is 0<detcoef<1.
[0010] In a possible implementation of the first aspect, the baseline value corresponding to the n-th capacitance sampling data is determined based on the trend change amount of the n-th capacitance sampling data and the size relationship between the capacitance change amount of the n-th capacitance sampling data and the proximity threshold value, and the baseline value corresponding to the n-th capacitance sampling data is determined based on the baseline value corresponding to the (n-1)-th capacitance sampling data and the capacitance compensation data corresponding to the n-th capacitance sampling data.
[0011] In a possible implementation of the first aspect, the baseline value corresponding to the n-th capacitance sampling data is determined based on the baseline value corresponding to the (n-1)-th capacitance sampling data and the capacitance compensation data corresponding to the n-th capacitance sampling data, and the baseline value corresponding to the n-th capacitance sampling data is determined based on the following formula:
[0012] basic[n]=basic[n-1]+basiccoef*(comp[n]-basic[n-1])
[0013] Wherein, basic[n] is the baseline value corresponding to the n-th capacitive sampling data, basic[n-1] is the baseline value corresponding to the (n-1)-th capacitive sampling data, comp[n] is the capacitive compensation data corresponding to the n-th capacitive sampling data, basiccoef is a second adjustment coefficient, and the value range of basiccoef is 0≤basiccoef≤1.
[0014] In a possible implementation of the first aspect, the baseline value corresponding to the n-th capacitive sampling data is determined based on the size relationship between the capacitive change amount and the proximity threshold and the trend change amount corresponding to the n-th capacitive sampling data, and the determination further includes: when the capacitive change amount corresponding to the n-th capacitive sampling data is greater than or equal to the proximity threshold, and the trend change amount corresponding to the n-th capacitive sampling data is greater than or equal to a second threshold and less than or equal to a third threshold, or the trend change amount corresponding to the n-th capacitive sampling data is greater than or equal to a fourth threshold and less than or equal to a fifth threshold, the baseline value corresponding to the (n-1)-th capacitive sampling data is taken as the baseline value corresponding to the n-th capacitive sampling data; and the third threshold is less than the fourth threshold.
[0015] In a possible implementation of the first aspect, the baseline value corresponding to the n-th capacitive sampling data is determined based on the size relationship between the capacitive change amount and the proximity threshold and the trend change amount corresponding to the n-th capacitive sampling data, and the determination further includes: when the capacitive change amount corresponding to the n-th capacitive sampling data is greater than or equal to the proximity threshold, and the trend change amount corresponding to the n-th capacitive sampling data is greater than the fifth threshold, the baseline value corresponding to the (n-1)-th capacitive sampling data is subjected to first correction processing to obtain the baseline value corresponding to the n-th capacitive sampling data; and when the capacitive change amount corresponding to the n-th capacitive sampling data is greater than or equal to the proximity threshold, and the trend change amount corresponding to the n-th capacitive sampling data is less than the second threshold, the baseline value corresponding to the (n-1)-th capacitive sampling data is subjected to second correction processing to obtain the baseline value corresponding to the n-th capacitive sampling data.
[0016] In a possible implementation of the first aspect, the first correction processing on the baseline value corresponding to the (n-1)-th capacitive sampling data to obtain the baseline value corresponding to the n-th capacitive sampling data includes: the baseline value corresponding to the n-th capacitive sampling data is obtained based on the following formula:
[0017] basic[n]=basic[n-1]+limitcoef*limit1
[0018] Wherein, basic[n] is the baseline value corresponding to the nth capacitance sampling data, basic[n-1] is the baseline value corresponding to the (n-1)th capacitance sampling data, limitcoef is the third adjustment coefficient, limit1 is the first preset parameter, the range of the third adjustment coefficient is 0≤limitcoef≤1, and the range of the first preset parameter is -32768≤limit1≤32768;
[0019] The second correction process for the baseline value corresponding to the (n-1)th capacitance sampling data, to obtain the baseline value corresponding to the nth capacitance sampling data, includes: obtaining the baseline value corresponding to the nth capacitance sampling data based on the following formula:
[0020] basic[n]=basic[n-1]+limitcoef*limit2
[0021] Wherein, basic[n] is the baseline value corresponding to the nth capacitance sampling data, basic[n-1] is the baseline value corresponding to the (n-1)th capacitance sampling data, limitcoef is the third adjustment coefficient, limit2 is the second preset parameter, the range of the third adjustment coefficient is 0≤limitcoef≤1, and the range of the second preset parameter is -32768≤limit2≤32768.
[0022] In one possible implementation of the first aspect above, determining the baseline value corresponding to the nth capacitance sampling data based on the relationship between the capacitance change and the proximity threshold, and the trend change corresponding to the nth capacitance sampling data, further includes: when the capacitance change corresponding to the nth capacitance sampling data is greater than the proximity threshold, and the trend change corresponding to the nth capacitance sampling data is greater than the third threshold and less than the fourth threshold, then determining the baseline value corresponding to the nth capacitance sampling data based on the baseline value corresponding to the (n-1)th capacitance sampling data and the trend change corresponding to the nth capacitance sampling data.
[0023] In one possible implementation of the first aspect above, determining the baseline value corresponding to the nth capacitance sampling data based on the baseline value corresponding to the (n-1)th capacitance sampling data and the trend change amount corresponding to the nth capacitance sampling data includes: obtaining the baseline value corresponding to the nth capacitance sampling data based on the following formula:
[0024] basic[n]=basic[n-1]+coef*delta[n]
[0025] Wherein, basic[n] is the baseline value corresponding to the n-th capacitance sampling data, basic[n-1] is the baseline value corresponding to the n-1-th capacitance sampling data, and coef is a fourth adjustment coefficient, and the value range of the fourth adjustment coefficient is 0≤coef≤1.
[0026] The second aspect of the present application provides a chip, which is used to execute the capacitance detection method mentioned in the present application.
[0027] The third aspect of the present application provides an electronic device, which comprises the chip mentioned in the present application. BRIEF DESCRIPTION OF DRAWINGS
[0028] FIG. 1 shows a flowchart of a capacitance detection method according to some embodiments of the present application.
[0029] FIG. 2 shows a detailed flowchart of a capacitance detection method according to some embodiments of the present application. DETAILED DESCRIPTION
[0030] The illustrative embodiments of the present application include, but are not limited to, a capacitance detection method, a chip and an electronic device.
[0031] It can be understood that the electronic device of the embodiments of the present application can include, but is not limited to, any device with a capacitance sensor, such as a mobile phone, a tablet computer, a notebook computer, a camera, an ultra-mobile personal computer, a handheld computer, a television, a walkie-talkie, a POS machine, a personal digital assistant (PDA), a wearable device, a virtual reality device, a smart vehicle, a smart robot, etc., and the present application does not limit this.
[0032] To solve the above problems, the embodiments of the present application provide a capacitance detection method, which comprises: determining a capacitance change amount corresponding to the n-th capacitance sampling data based on temperature compensation data corresponding to the n-th capacitance sampling data and a baseline value corresponding to the n-1-th capacitance sampling data; wherein the baseline value corresponding to the n-1-th capacitance sampling data is determined based on trend change amounts corresponding to the previous n-1 capacitance sampling data, and the trend change amounts corresponding to the n-1-th capacitance sampling data are determined based on temperature compensation data corresponding to the previous n-1 capacitance sampling data, and n is a positive integer greater than or equal to 3; and determining a state of a human body relative to an electronic device based on the capacitance change amount corresponding to the n-th capacitance sampling data and a proximity threshold.
[0033] In the embodiments of the present application, the capacitance change amount is determined based on the temperature compensation data obtained by temperature compensation on the current capacitance sampling data and the baseline value corresponding to the last capacitance sampling data, instead of based on the original capacitance sampling data, which can effectively overcome the influence of the environmental temperature and improve the accuracy of the judgment of the human body relative to the electronic device.
[0034] In addition, in the embodiment of the present application, the trend change amount corresponding to the current capacitive sampling data is determined based on the temperature compensation data corresponding to all historical capacitive sampling data, which can reflect the long-time change information of the capacitor and further improve the accuracy of the relative state of the human body to the electronic device compared with the scheme of determining the trend change amount by using the current capacitive sampling data and the previous capacitive sampling data or using the capacitive sampling data in a limited time window.
[0035] The capacitive detection method provided in the embodiment of the present application is described in detail below.
[0036] FIG. 1 shows a flowchart of a capacitive detection method. As shown in FIG. 1, the capacitive detection method can include:
[0037] 101: determining a capacitive change amount corresponding to the n th capacitive sampling data of the to-be-detected capacitor based on temperature compensation data corresponding to the n th capacitive sampling data and a baseline value corresponding to the (n-1) th capacitive sampling data.
[0038] It can be understood that when n is a positive integer greater than or equal to 2, the capacitive change amount corresponding to the n th capacitive sampling data can be determined based on the difference between the temperature compensation data corresponding to the n th capacitive sampling data and the baseline value corresponding to the (n-1) th capacitive sampling data. When n is 1, the capacitive change amount corresponding to the n th capacitive sampling data is 0.
[0039] For example, as shown in formula 1:
[0040] Wherein, cap[n] is the capacitive change amount corresponding to the n th capacitive sampling data, comp[n] is the temperature compensation data corresponding to the n th capacitive sampling data, and basic[n-1] is the baseline value corresponding to the (n-1) th capacitive sampling data.
[0041] In some embodiments, in the embodiment of the present application, the capacitive sampling data can be compensated based on a temperature compensation coefficient to obtain compensated temperature compensation data. For example, the temperature difference data can be multiplied by a fixed temperature compensation coefficient, and the product obtained is taken as the capacitive compensation value. The capacitive sampling data is subtracted by the capacitive compensation value to obtain the temperature compensation data. Wherein, the temperature difference data can be the difference between the current temperature data and the preset temperature data. It can be understood that the above-mentioned way of obtaining temperature compensation data is only an example, and any temperature compensation method can be applied in the present application, which is not limited herein.
[0042] 102: determining the state of the human body relative to the electronic device based on the size relationship between the capacitive change amount corresponding to the n th capacitive sampling data and the proximity threshold (for example, Prox).
[0043] In some embodiments, when the capacitance change corresponding to the nth capacitance sampling data is less than the approaching threshold, it is determined that the state of the human body relative to the electronic device is the state that the human body is away from the electronic device.
[0044] In some embodiments, when the capacitance change corresponding to the nth capacitance sampling data is greater than or equal to the approaching threshold, it is determined that the state of the human body relative to the electronic device is the state that the human body is close to the electronic device.
[0045] 103: Determine the trend change corresponding to the nth capacitance sampling data based on the temperature compensation data of the previous n capacitance sampling data.
[0046] In some embodiments, the determination method of the trend change corresponding to the nth capacitance sampling data can be shown in formula 2:
[0047] Wherein, delta[n] is the trend change corresponding to the nth capacitance sampling data, delta[n-1] is the trend change corresponding to the (n-1)th capacitance sampling data, comp[n] is the temperature compensation data corresponding to the nth capacitance sampling data, comp[n-1] is the temperature compensation data corresponding to the (n-1)th capacitance sampling data, and detcoef is the first adjustment coefficient, the value range of detcoef is 0<detcoef<1.
[0048] Based on the above formula 2, the calculation formula of the trend change corresponding to the second capacitance sampling data can be shown in formula 3:
[0049] delta[2]=(1-detcoef)*delta[1]+detcoef*(comp[2]-comp[1]) Formula 3
[0050] Wherein, delta[2] is the trend change corresponding to the second capacitance sampling data, delta[2] is the trend change corresponding to the second capacitance sampling data, comp[2] is the temperature compensation data corresponding to the second capacitance sampling data, and comp[1] is the temperature compensation data corresponding to the first capacitance sampling data.
[0051] It can be shown from formula 3 that the trend change corresponding to the second capacitance sampling data is related to the temperature compensation data corresponding to the first capacitance sampling data and the temperature compensation data corresponding to the second capacitance sampling data.
[0052] The calculation of the trend change corresponding to the third capacitance sampling data is shown in formula 4:
[0053] delta[3] = (1 - detcoef) * delta[2] + detcoef * (comp[3] - comp[2]) = (1 - detcoef) * (1 - detcoef) * delta[1] + detcoef * (1 - detcoef) * (comp[2] - comp[1])
[0054] + detcoef * (comp[3] - comp[2]) Formula 4
[0055] Wherein, delta[3] is the trend change quantity corresponding to the third capacitance sampling data, and comp[3] is the temperature compensation data corresponding to the third capacitance sampling data.
[0056] It can be shown from Formula 4 that the trend change quantity corresponding to the third capacitance sampling data is related to the temperature compensation data corresponding to the first capacitance sampling data, the temperature compensation data corresponding to the second capacitance sampling data, and the temperature compensation data corresponding to the third capacitance sampling data.
[0057] The calculation formula of the trend change quantity corresponding to the n-1th capacitance sampling data is shown in Formula 5:
[0058] delta[n-1] = (1 - detcoef) * delta[n-2] + detcoef * (comp[n-1] - comp[n-2]) Formula 5
[0059] Wherein, delta[n-1] is the trend change quantity corresponding to the n-1th capacitance sampling data.
[0060] In summary, by analogy, the n th trend change quantity delta[n] is related to the temperature compensation data corresponding to the 1st, 2nd, …, n th capacitance sampling data. In this way, the trend change quantity can reflect the long-time change information of the capacitance, further improving the accuracy of the relative electronic device state judgment of the human body.
[0061] In some embodiments, the value of detcoef is determined based on the change quantity of the temperature compensation data corresponding to the n th capacitance sampling data relative to the temperature compensation data corresponding to the previous n-1th capacitance sampling data. The change quantity of the temperature compensation data corresponding to the n th capacitance sampling data relative to the temperature compensation data corresponding to the previous n-1th capacitance sampling data can reflect the jitter of the temperature compensation data corresponding to the n th capacitance sampling data.
[0062] For example, a first difference value between the temperature compensation data corresponding to the n-th capacitance sampling data and the temperature compensation data corresponding to the (n-1)-th capacitance sampling data can be obtained. If the absolute value of the first difference value is greater than a first preset value, it is determined that the jitter is large. If the absolute value of the first difference value is less than the first preset value, it is considered that the jitter is small.
[0063] In some embodiments, a second difference value between the temperature compensation data corresponding to the n-th capacitance sampling data and the temperature compensation data corresponding to the (n-1)-th capacitance sampling data can also be obtained. If the absolute value of the second difference value is greater than a second preset value, it is determined that the jitter is large. If the absolute value of the second difference value is less than the second preset value, it is considered that the jitter is small. The second preset value is greater than the first preset value.
[0064] If the jitter of the temperature compensation data corresponding to the n-th capacitance sampling data is large, detcoef can be appropriately reduced to realize the reduction of the trend change amount. If the jitter of the temperature compensation data corresponding to the n-th capacitance sampling data is small, detcoef can be appropriately increased to increase the corresponding trend change amount. In this way, a more accurate trend change amount can be obtained, and the accuracy of the relative electronic device state judgment of the human body is further improved.
[0065] 104: determining a baseline value corresponding to the n-th capacitance sampling data based on the size relationship between the capacitance change amount corresponding to the n-th capacitance sampling data and the approach threshold and the trend change amount corresponding to the n-th capacitance sampling data.
[0066] The manner of determining the baseline value corresponding to the n-th capacitance sampling data based on the size relationship between the capacitance change amount and the approach threshold and the trend change amount corresponding to the n-th capacitance sampling data can be referred to steps 204-212 shown in FIG. 2, and will not be described here.
[0067] FIG. 2 shows a detailed flowchart of a capacitance detection method according to the present application. As shown in FIG. 2, the method comprises:
[0068] 201: determining a capacitance change amount corresponding to the n-th capacitance sampling data based on the temperature compensation data corresponding to the n-th capacitance sampling data and the baseline value corresponding to the (n-1)-th capacitance sampling data.
[0069] Step 201 is similar to step 101, and will not be described here.
[0070] 202: determining a trend change amount corresponding to the n-th capacitance sampling data based on the temperature compensation data of the previous n capacitance sampling data.
[0071] Step 202 is similar to step 102, and will not be described here.
[0072] 203: determining whether the capacitance change corresponding to the nth capacitance sampling data is less than the approaching threshold value.
[0073] If yes, go to 204, determining whether the trend change corresponding to the continuous y times of capacitance sampling data is greater than the first threshold value. If no, go to the steps of 207, 209, and 211.
[0074] In some embodiments, it can be determined whether the capacitance change corresponding to the nth capacitance sampling data is less than the approaching threshold value. If yes, it can be indicated that the state of the human body relative to the electronic device corresponding to the current nth capacitance sampling data is the away state, and the steps of 204-206 are executed. If no, that is, the capacitance change corresponding to the nth capacitance sampling data is greater than or equal to the approaching threshold value, it can be indicated that the state of the human body relative to the electronic device corresponding to the current nth capacitance sampling data is the approaching state, and the steps of 207-212 are executed.
[0075] 204: determining whether the trend change corresponding to the continuous y times of capacitance sampling data is greater than the first threshold value (for example, th0), wherein y is a positive integer greater than or equal to 1.
[0076] If yes, go to 205, taking the baseline value corresponding to the (n-1)th capacitance sampling data as the baseline value corresponding to the nth capacitance sampling data; if no, go to 206, determining the baseline value corresponding to the nth capacitance sampling data based on the baseline value corresponding to the (n-1)th capacitance sampling data and the capacitance compensation data corresponding to the nth capacitance sampling data.
[0077] In some embodiments, when it is determined that the capacitance change corresponding to the nth capacitance sampling data is less than the approaching threshold value, it can be continuously determined whether the trend change corresponding to the continuous y times of capacitance sampling data is greater than the first threshold value, and y is a positive integer greater than or equal to 1, for example, y can be 1, or a positive integer greater than or equal to 2. The value of y can be set according to actual requirements, which is not limited here.
[0078] In the embodiments of the present application, when y is a positive integer greater than or equal to 2, that is, by determining whether the trend change corresponding to the continuous multiple times of capacitance sampling data is greater than the first threshold value, the accuracy of the state of the human body relative to the electronic device can be improved.
[0079] It can be understood that for the nth capacitance sampling data, the trend change corresponding to the continuous y times of capacitance sampling data being greater than the first threshold value can mean that the trend change corresponding to the (n-y+1)th capacitance sampling data to the nth capacitance sampling data is greater than the first threshold value.
[0080] It can be understood that when the trend change amount corresponding to the continuous y times of capacitive sampling data is greater than the first threshold value, it is considered that a reliable human body is about to approach, at this time, the baseline can be in a frozen state, that is, the baseline value corresponding to the n-1th capacitive sampling data is taken as the baseline corresponding to the nth capacitive sampling data, to prevent baseline error tracking from causing the proximity state to be unable to be triggered, that is, to cause the electronic device to be unable to accurately identify the human body proximity state when the human body approaches the electronic device, and to improve the accuracy of the human body relative to the electronic device state identification.
[0081] If it is judged that the trend change amount corresponding to the continuous y times of capacitive sampling data is not greater than the first threshold value, it can be determined that the trend change amount greater than the first threshold value is caused by external noise, at this time, the baseline value corresponding to the n-1th capacitive sampling data and the capacitive compensation data corresponding to the n-1th capacitive sampling data can be used to determine the baseline value corresponding to the n-1th capacitive sampling data, so that the baseline error caused by noise can be effectively prevented.
[0082] In some embodiments, for the n-1th capacitive sampling, judging that the trend change amount corresponding to the continuous y times of capacitive sampling data is not greater than the first threshold value can be that at least one of the trend change amounts corresponding to the n-1th capacitive sampling data to the n-1th capacitive sampling data is less than or equal to the first threshold value, for example, the trend change amounts corresponding to the n-1th capacitive sampling data to the n-1th capacitive sampling data are all less than or equal to the first threshold value, or one or more (not all times) of the trend change amounts corresponding to the n-1th capacitive sampling data to the n-1th capacitive sampling data is less than or equal to the first threshold value, and the like.
[0083] It can be understood that when y is 1, the response of the electronic device to capacitive detection is the fastest, and the greater y is, the stronger the anti-noise ability of the electronic device to capacitive detection is.
[0084] 205: Taking the baseline value corresponding to the n-1th capacitive sampling data as the baseline value corresponding to the n-1th capacitive sampling data.
[0085] It can be understood that taking the baseline value corresponding to the n-1th capacitive sampling data as the baseline value corresponding to the n-1th capacitive sampling data is to make the baseline in a frozen state.
[0086] 206: Determining the baseline value corresponding to the n-1th capacitive sampling data based on the baseline value corresponding to the n-1th capacitive sampling data and the capacitive compensation data corresponding to the n-1th capacitive sampling data.
[0087] The way of determining the baseline value corresponding to the n-1th capacitive sampling data based on the baseline value corresponding to the n-1th capacitive sampling data and the capacitive compensation data corresponding to the n-1th capacitive sampling data can be as shown in formula 6:
[0088] basic[n] = basic[n-1] + basiccoef * (comp[n] - basic[n-1]) Equation 6
[0089] Wherein, basic[n] is the baseline value corresponding to the n-th capacitive sampling data, basic[n-1] is the baseline value corresponding to the (n-1)-th capacitive sampling data, comp[n] is the capacitive compensation data corresponding to the n-th capacitive sampling data, basiccoef is the second adjustment coefficient, and the value range of basiccoef is 0≤basiccoef≤1.
[0090] In some embodiments, the second adjustment coefficient can be adjusted based on the required speed of temperature compensation data corresponding to baseline tracking capacitive sampling data, so as to adapt to different application scenarios.
[0091] For example, in a scenario where it is required to reduce the jitter of the amount of capacitive change, the speed of temperature compensation data corresponding to baseline tracking capacitive sampling data needs to be accelerated, at which time the second adjustment coefficient can be increased, so as to reduce the jitter of the amount of capacitive change.
[0092] Wherein, the scenario where the amount of capacitive change needs to be reduced and the speed of baseline tracking capacitive sampling needs to be accelerated can include a scenario where the speaker volume of the electronic device is greater than a preset volume value. In this scenario, since the speaker volume of the electronic device is greater than the preset volume value, the electronic device will generate jitter, causing the collected capacitance to change. In order to avoid too much jitter of the amount of capacitive change, the speed of temperature compensation data corresponding to baseline tracking capacitive sampling data can be accelerated, so as to reduce the jitter of the amount of capacitive change.
[0093] 207: Determine that the trend change amount corresponding to the n-th capacitive sampling data is greater than or equal to a second threshold (such as th2) and less than or equal to a third threshold (such as th3), and the trend change amount corresponding to the n-th capacitive sampling data is greater than or equal to a fourth threshold (such as th4) and less than or equal to a fifth threshold (such as th5), wherein the third threshold is less than the fourth threshold.
[0094] When the trend change amount corresponding to the n-th capacitive sampling data is greater than or equal to the second threshold and less than or equal to the third threshold, it indicates that the trend change amount is moderate, and at this time, the human body can be in a state of moving away, or the trend change amount can be caused by environmental changes. In this state of uncertainty, the baseline can be frozen. For example, the baseline value corresponding to the (n-1)-th capacitive sampling data is taken as the baseline value corresponding to the n-th capacitive sampling data, so as to avoid false baseline update.
[0095] When the trend change amount corresponding to the n th capacitance sampling data is greater than or equal to the fourth threshold value and less than or equal to the fifth threshold value, it indicates that the trend change amount is moderately increased, and at this time, it can be a human body approaching state or a trend change amount increase caused by environmental changes. In this uncertain state, the baseline can be kept frozen. For example, the baseline value corresponding to the n-1 th capacitance sampling data is taken as the baseline value corresponding to the n th capacitance sampling data, so as to avoid false baseline update.
[0096] 208: Taking the baseline value corresponding to the n-1 th capacitance sampling data as the baseline value corresponding to the n th capacitance sampling data.
[0097] 209: Determining that the trend change amount corresponding to the n th capacitance sampling data is less than the second threshold value or greater than or equal to the fifth threshold value.
[0098] When the capacitance change amount corresponding to the n th capacitance sampling data is greater than or equal to the approaching threshold value, and the trend change amount corresponding to the capacitance sampling data corresponding to the n th capacitance sampling data is less than the second threshold value, it indicates that the trend change amount is greatly decreased, and it is considered that at this time, the human body is away.
[0099] At this time, the baseline value corresponding to the n-1 th capacitance sampling data can be subjected to first correction processing to obtain a corrected first corrected baseline value, and the first corrected baseline value is taken as the baseline value corresponding to the n th capacitance sampling data, so as to reduce the baseline abnormal drift amount. The correction mode can be as shown in formula 7:
[0100] basic[n]=basic[n-1]+limitcoef*limit2 Formula 7
[0101] Wherein, limitcoef is a third adjustment coefficient, and limit2 is a first preset parameter.
[0102] In some embodiments, the value range of the third adjustment coefficient can be 0≤limitcoef≤1, and the value range of the first preset parameter can be -32768≤limit2≤32768.
[0103] In some embodiments, the third adjustment coefficient can be adjusted based on the required speed of temperature compensation data corresponding to the baseline tracking capacitance sampling data. When it is required to speed up the temperature compensation data corresponding to the baseline tracking capacitance sampling data, the third adjustment coefficient can be increased at this time, and when it is required to reduce the speed of the temperature compensation data corresponding to the baseline tracking capacitance sampling data, the third adjustment coefficient can be reduced at this time. Through the adjustment of the third adjustment coefficient and the first preset parameter, appropriate correction amount can be set in the case that the human body is away, and the baseline abnormal drift amount is reduced.
[0104] When the capacitance change corresponding to the n-th capacitance sampling data is greater than or equal to the approaching threshold, and the trend change corresponding to the capacitance sampling data corresponding to the n-th capacitance sampling data is greater than the fifth threshold, it is considered that the human body is further approaching.
[0105] At this time, the baseline value corresponding to the n-1-th capacitance sampling data can be subjected to a second correction processing to obtain a corrected second correction baseline value, and the second correction baseline value is taken as the baseline value corresponding to the n-th capacitance sampling data, so as to reduce the baseline abnormal drift.
[0106] basic[n] = basic[n-1] + limitcoef * limit1 Formula 8
[0107] Wherein, limit1 is a second preset parameter, and the value range of the second preset parameter can be -32768≤limit2≤32768.
[0108] Through the adjustment of the third adjustment coefficient and the second preset parameter, a suitable correction amount can be set in the case that the human body is further approaching, so as to reduce the baseline abnormal drift.
[0109] 210: The baseline value corresponding to the n-1-th capacitance sampling data is subjected to a correction processing to obtain a corrected correction baseline value, and the correction baseline value is taken as the baseline value corresponding to the n-th capacitance sampling data.
[0110] It can be understood that in the embodiments of the present application, the correction processing can include first correction processing and second correction processing, and the correction baseline value can include first correction baseline value and second correction baseline value.
[0111] When the trend change corresponding to the capacitance sampling data corresponding to the n-th capacitance sampling data is less than the second threshold, the baseline value corresponding to the n-1-th capacitance sampling data can be subjected to a first correction processing to obtain a corrected first correction baseline value, and the first correction baseline value is taken as the baseline value corresponding to the n-th capacitance sampling data, so as to reduce the baseline abnormal drift.
[0112] When the trend change corresponding to the capacitance sampling data corresponding to the n-th capacitance sampling data is greater than the fifth threshold, the baseline value corresponding to the n-1-th capacitance sampling data can be subjected to a second correction processing to obtain a corrected second correction baseline value, and the second correction baseline value is taken as the baseline value corresponding to the n-th capacitance sampling data, so as to reduce the baseline abnormal drift.
[0113] In some embodiments, the first correction processing and the second correction processing can be the same processing, or can be different processing, which is not limited here.
[0114] 211: determining that the trend change amount corresponding to the n-th capacitance sampling data is greater than the third threshold value and less than the fourth threshold value.
[0115] It can be understood that, in the embodiments of the present application, when the trend change amount corresponding to the n-th capacitance sampling data is greater than the third threshold value and less than the fourth threshold value, it means that the rising amount or the falling amount of the trend change amount is in a reasonable middle range, and it is considered that there is an environmental change and no human behavior change at this time.
[0116] 212: determining the baseline value corresponding to the n-1-th capacitance sampling data based on the baseline value corresponding to the n-1-th capacitance sampling data and the trend change amount corresponding to the n-th capacitance sampling data.
[0117] In some embodiments, the manner of determining the baseline value corresponding to the n-th capacitance sampling data based on the baseline value corresponding to the n-1-th capacitance sampling data and the trend change amount corresponding to the n-th capacitance sampling data can be as shown in formula 9:
[0118] basic[n] = basic[n-1] + coef*delta[n] formula 9
[0119] Wherein, coef is a fourth adjustment coefficient, and the value range of the fourth adjustment coefficient can be 0≤coef≤1.
[0120] In the embodiments of the present application, when it is determined that there is an environmental change, the baseline follows the trend change amount, that is, the baseline value corresponding to the n-th capacitance sampling data changes based on the trend change amount corresponding to the n-th capacitance sampling data. In some embodiments, the coef coefficient can be adjusted to adjust the strength of the baseline following the trend change amount, so as to avoid long-term drift of the baseline due to too large or too small following strength. When it is needed to speed up the speed of the baseline tracking the trend change amount, the fourth adjustment coefficient can be adjusted to be large at this time, and when it is needed to reduce the speed of the baseline tracking the trend change amount, the fourth adjustment coefficient can be adjusted to be small at this time.
[0121] In summary, based on the capacitance detection method mentioned in the present application, the capacitance change amount is determined based on the temperature compensation data obtained by temperature compensation on the current capacitance sampling data and the baseline value corresponding to the last capacitance sampling data, instead of based on the original capacitance sampling data, which can effectively overcome the influence of environmental temperature and improve the accuracy of human relative state judgment.
[0122] In addition, in the embodiment of the present application, the trend change quantity corresponding to the current capacitive sampling data is determined based on the temperature compensation data corresponding to all historical capacitive sampling data, compared with the scheme of determining the trend change quantity by using the current capacitive sampling data and the previous capacitive sampling data and using the capacitive sampling data in a limited time window in some comparative embodiments, the long-time change information of the capacitor can be reflected, and the accuracy of the human body relative to the electronic device state judgment is further improved.
[0123] In addition, for the baseline tracking logic in the far-away state, the pre-proximity judgment is performed using the comparison results of the consecutive y trend change quantities and the first threshold value, compared with the scheme of performing the pre-proximity judgment by comparing a single trend change quantity with a corresponding threshold value in some comparative embodiments, the anti-interference capability of the pre-proximity judgment can be improved, and the accuracy of the human body relative to the electronic device state judgment is further improved. When the trend change quantity is less than the first threshold value, the speed of the baseline following comp can be adjusted by the coefficient to adapt to different scenes.
[0124] For the baseline tracking logic in the proximity state, two threshold values are added, that is, four threshold values are used, compared with the judgment scheme using only two threshold values in some comparative embodiments, the human body far-away behavior, environmental change, and human body further proximity behavior are more finely distinguished, and when the human body far-away behavior and the proximity behavior are determined, the correction quantity adjustment can be performed by the correction quantity and the correction coefficient, so as to reduce the baseline drift. When the human body far-away behavior or the environmental change and the human body further proximity behavior or the environmental change cannot be determined, that is, in the intermediate unstable state, the baseline is frozen to prevent the baseline from following errors, and the accuracy of the human body relative to the electronic device state judgment is further improved.
[0125] In the embodiment of the present application, a chip can be included for executing the capacitive detection method mentioned in the present application. In some embodiments, the chip can include a processor and a memory, the memory is used to store computer program instructions, and the processor is used to call the computer program instructions stored in the memory, so that the chip executes the capacitive detection method mentioned in the present application.
[0126] The present embodiment is a chip implementation corresponding to the above-mentioned capacitive detection method embodiment, and the present embodiment can be implemented in cooperation with the capacitive detection method embodiment. The related technical details mentioned in the capacitive detection method embodiment are still valid in the present embodiment. In order to reduce repetition, they will not be described here. Accordingly, the related technical details mentioned in the present embodiment can also be applied in the capacitive detection method implementation.
[0127] In the embodiment of the present application, an electronic device can be included, which is characterized by including the chip mentioned in the present application.
[0128] This embodiment is an electronic device implementation corresponding to the above-mentioned capacitor detection method embodiment, and can be implemented in cooperation with the capacitor detection method embodiment. The related technical details mentioned in the capacitor detection method embodiment are still valid in this embodiment. In order to reduce repetition, they will not be described here. Correspondingly, the related technical details mentioned in this embodiment can also be applied in the capacitor detection method implementation.
[0129] It should be noted that each unit / module mentioned in each device embodiment of the present application is a logical unit / module. In the physical aspect, one logical unit / module can be one physical unit / module, or a part of one physical unit / module, or a combination of multiple physical unit / modules. The physical implementation of the logical unit / module itself is not the most important. The combination of the functions implemented by these logical units / modules is the key to solving the technical problems proposed in the present application. In addition, in order to highlight the innovative part of the present application, the above-mentioned each device embodiment of the present application does not introduce the units / modules that are not closely related to solving the technical problems proposed in the present application, which does not mean that the above-mentioned device embodiments do not have other units / modules.
[0130] It should be noted that in the examples and descriptions of the present patent, the relationship terms such as first and second are only used to distinguish one entity or operation from another entity or operation, and do not necessarily require or imply any such actual relationship or order between the entities or operations. Moreover, the terms "include", "contain" or any other variants thereof are intended to cover non-exclusive inclusion, so that the process, method, article or device including a series of elements not only includes those elements, but also includes other elements not explicitly listed or inherent to such process, method, article or device. Without more limitations, the element defined by the statement "including one" does not exclude the presence of another identical element in the process, method, article or device including the element.
[0131] Although the present application has been illustrated and described with reference to certain embodiments thereof, it should be understood that various changes in form and detail can be made therein without departing from the spirit and scope of the application.
Claims
1. A capacitance detection method characterized by, The method comprises: when n is a positive integer greater than or equal to 2, determining a capacitance change corresponding to the n th capacitance sampling data based on temperature compensation data corresponding to the n th capacitance sampling data and a baseline value corresponding to the (n-1) th capacitance sampling data; when n is 1, the capacitance change corresponding to the n th capacitance sampling data is 0; determining a state of a human body relative to the electronic device based on a size relationship between the capacitance change corresponding to the n th capacitance sampling data and a proximity threshold value; determining a trend change corresponding to the n th capacitance sampling data based on temperature compensation data of the previous n capacitance sampling data; determining a baseline value corresponding to the n th capacitance sampling data based on the size relationship between the capacitance change and the proximity threshold value, and the trend change corresponding to the n th capacitance sampling data.
2. The capacitance detection method according to claim 1, wherein The determination of the trend change corresponding to the n th capacitance sampling data based on the temperature compensation data of the previous n capacitance sampling data comprises: The trend change amount corresponding to the nth capacitive sampling data is determined based on the following formula: wherein delta[n] is the trend change corresponding to the n th capacitance sampling data, delta[n-1] is the trend change corresponding to the (n-1) th capacitance sampling data, comp[n] is the temperature compensation data corresponding to the n th capacitance sampling data, comp[n-1] is the temperature compensation data corresponding to the (n-1) th capacitance sampling data, and detcoef is a first adjustment coefficient, and the value range of detcoef is 0<detcoef<1.
3. The capacitance detection method according to claim 2, wherein The determination of the baseline value corresponding to the n th capacitance sampling data based on the size relationship between the capacitance change and the proximity threshold value, and the trend change corresponding to the n th capacitance sampling data comprises: when the capacitance change corresponding to the n th capacitance sampling data is less than the proximity threshold value, and the trend changes corresponding to the previous y capacitance sampling data are all greater than a first threshold value, the baseline value corresponding to the (n-1) th capacitance sampling data is taken as the baseline value corresponding to the n th capacitance sampling data; when the capacitance change corresponding to the n th capacitance sampling data is less than the proximity threshold value, and there is no trend change corresponding to the previous y capacitance sampling data that is greater than the first threshold value, the baseline value corresponding to the n th capacitance sampling data is determined based on the baseline value corresponding to the (n-1) th capacitance sampling data and the capacitance compensation data corresponding to the n th capacitance sampling data; wherein y is a positive integer greater than or equal to 1.
4. The capacitance detection method according to claim 3, wherein The determination of the baseline value corresponding to the n th capacitance sampling data based on the baseline value corresponding to the (n-1) th capacitance sampling data and the capacitance compensation data corresponding to the n th capacitance sampling data comprises: the baseline value corresponding to the n th capacitance sampling data is determined based on the following formula: basic[n]=basic[n-1]+basiccoef*(comp[n]-basic[n-1]) Wherein, basic[n] is the baseline value corresponding to the n-th capacitance sampling data, basic[n-1] is the baseline value corresponding to the n-1-th capacitance sampling data, comp[n] is the capacitance compensation data corresponding to the n-th capacitance sampling data, basiccoef is a second adjustment coefficient, and the value range of basiccoef is 0≤basiccoef≤1.
5. The capacitance detection method according to claim 3 or 4, wherein The baseline value corresponding to the n-th capacitance sampling data is determined based on the size relationship between the capacitance change amount and the proximity threshold and the trend change amount corresponding to the n-th capacitance sampling data, and the baseline value corresponding to the n-th capacitance sampling data is determined based on the size relationship between the capacitance change amount and the proximity threshold and the trend change amount corresponding to the n-th capacitance sampling data. When the capacitance change amount corresponding to the n-th capacitance sampling data is greater than or equal to the proximity threshold, and the trend change amount corresponding to the n-th capacitance sampling data is greater than or equal to a second threshold and less than or equal to a third threshold, or the trend change amount corresponding to the n-th capacitance sampling data is greater than or equal to a fourth threshold and less than or equal to a fifth threshold, the baseline value corresponding to the n-1-th capacitance sampling data is taken as the baseline value corresponding to the n-th capacitance sampling data; wherein the third threshold is less than the fourth threshold. The baseline value corresponding to the n-th capacitance sampling data is determined based on the size relationship between the capacitance change amount and the proximity threshold and the trend change amount corresponding to the n-th capacitance sampling data, and the baseline value corresponding to the n-th capacitance sampling data is determined based on the size relationship between the capacitance change amount and the proximity threshold and the trend change amount corresponding to the n-th capacitance sampling data.
6. The capacitance detection method according to claim 3 or 4, wherein When the capacitance change amount corresponding to the n-th capacitance sampling data is greater than or equal to the proximity threshold, and the trend change amount corresponding to the n-th capacitance sampling data is greater than the fifth threshold, the baseline value corresponding to the n-1-th capacitance sampling data is corrected to obtain the baseline value corresponding to the n-th capacitance sampling data. When the capacitance change amount corresponding to the n-th capacitance sampling data is greater than or equal to the proximity threshold, and the trend change amount corresponding to the n-th capacitance sampling data is less than the second threshold, the baseline value corresponding to the n-1-th capacitance sampling data is corrected to obtain the baseline value corresponding to the n-th capacitance sampling data. The first correction processing of the baseline value corresponding to the n-1-th capacitance sampling data to obtain the baseline value corresponding to the n-th capacitance sampling data comprises:
7. The capacitance detection method according to claim 6, wherein The baseline value corresponding to the n-th capacitance sampling data is obtained based on the following formula: basic[n]=basic[n-1]+limitcoef*limit1 Wherein, basic[n] is the baseline value corresponding to the n-th capacitance sampling data, basic[n-1] is the baseline value corresponding to the n-1-th capacitance sampling data, limitcoef is a third adjustment coefficient, limit1 is a first preset parameter, the range of the third adjustment coefficient is 0≤limitcoef≤1, and the value range of the first preset parameter is -32768≤limit1≤32768. The second correction processing of the baseline value corresponding to the n-1-th capacitance sampling data to obtain the baseline value corresponding to the n-th capacitance sampling data comprises: The baseline value corresponding to the n-th capacitance sampling data is obtained based on the following formula: basic[n] = basic[n-1] + limitcoef*limit2 Wherein, basic[n] is the baseline value corresponding to the n-th capacitance sampling data, basic[n-1] is the baseline value corresponding to the (n-1)-th capacitance sampling data, limitcoef is a third adjustment coefficient, limit2 is a second preset parameter, the range of the third adjustment coefficient is 0≤limitcoef≤1, and the value range of the second preset parameter is -32768≤limit2≤32768.
8. The capacitance detection method according to claim 3 or 4, wherein The method further includes: When the capacitance change amount corresponding to the n-th capacitance sampling data is greater than the proximity threshold, and The trend change amount corresponding to the n-th capacitance sampling data is greater than the third threshold and less than the fourth threshold, the baseline value corresponding to the n-th capacitance sampling data is determined based on the baseline value corresponding to the (n-1)-th capacitance sampling data and the trend change amount corresponding to the n-th capacitance sampling data.
9. The capacitance detection method according to claim 8, wherein, The baseline value corresponding to the n-th capacitance sampling data is determined based on the baseline value corresponding to the (n-1)-th capacitance sampling data and the trend change amount corresponding to the n-th capacitance sampling data, including: The baseline value corresponding to the n-th capacitance sampling data is obtained based on the following formula: basic[n] = basic[n-1] + limitcoef*limit2 Wherein, basic[n] is the baseline value corresponding to the n-th capacitance sampling data, basic[n-1] is the baseline value corresponding to the (n-1)-th capacitance sampling data, limitcoef is a third adjustment coefficient, limit2 is a second preset parameter, the range of the third adjustment coefficient is 0≤limitcoef≤1, and the value range of the second preset parameter is -32768≤limit2≤32768.
10. A chip, characterized by The chip is used to execute the capacitance detection method according to any one of claims 1 to 9.
11. An electronic device, comprising: The chip according to claim 10 is included.
Citation Information
Patent Citations
Wearing state detection method of wearable device and wearable device
CN106291121A
Methods and apparatus for processing temperature drift
CN111707295A
Capacitance baseline updating method, chip and capacitance detection device
CN112986693A
Operation method of capacitance sensing device
CN113497617A
Baseline updating method and system, relative state detection method and system and electronic equipment
CN113566852A