Capacitance detection method, chip and electronic equipment

By performing temperature compensation and baseline value determination methods on capacitance sampling data, the problem of misjudgment of capacitance caused by environmental temperature changes is solved, and the accuracy of human body's proximity state judgment is improved.

CN119923576APending Publication Date: 2025-05-02SHANGHAI AWINIC MICROELECTRONIC TECH CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202480001186.4
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-06-07
Publication Date
2025-05-02

AI Technical Summary

Technical Problem

Changes in ambient temperature lead to changes in capacitance detected by the capacitance sensor, resulting in misjudgment of the human body approaching and away from the state.

Method used

The capacitance change amount is determined by the temperature compensation data obtained after temperature compensation of the current capacitor sampling data and the baseline value corresponding to the previous capacitor sampling data, and the trend change amount is determined based on the temperature compensation data of the previous n capacitor sampling data to improve the accuracy of the judgment.

Benefits of technology

It effectively overcomes the influence of ambient temperature, improves the accuracy of human body's judgments relative to electronic equipment, and reduces misjudgment.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119923576A_ABST
    Figure CN119923576A_ABST
Patent Text Reader

Abstract

The invention relates to the technical field of capacitance detection, and discloses a capacitance detection method, a chip and electronic equipment. The method comprises the following steps: when n is a positive integer greater than or equal to 2, determining a capacitance variation corresponding to nth capacitance sampling data based on temperature compensation data corresponding to the nth capacitance sampling data of a capacitor to be detected and a baseline value corresponding to (n-1) th capacitance sampling data; when n is 1, the capacitance variation corresponding to the nth capacitance sampling data is 0; determining the state of the human body relative to the electronic equipment based on the capacitance variable quantity and the proximity threshold value corresponding to the nth capacitance sampling data; determining a trend variation corresponding to the nth capacitance sampling data based on the temperature compensation data of the first n capacitance sampling data; and determining a baseline value corresponding to the nth capacitance sampling data based on the magnitude relationship between the capacitance variation and the proximity threshold and the trend variation corresponding to the nth capacitance sampling data. Based on the scheme, the judgment accuracy of the human body relative to the electronic equipment can be improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of capacitance detection technology, and in particular to a capacitance detection method, a chip and an electronic device. Background Art

[0002] At present, capacitive sensors are widely used in electronic devices such as mobile phones and headphones. The change in capacitance detected by the capacitive sensor can be used to identify whether a human body or other conductor is close to an electronic device (such as a mobile phone). However, changes in ambient temperature may cause the capacitance detected by the capacitive sensor to change, resulting in misjudgment of the human body approaching or far away. Summary of the invention

[0003] In view of this, the embodiments of the present application provide a capacitance detection method, a chip, and an electronic device to solve the problem of misjudgment of the human body's approach state and distance state due to changes in ambient temperature.

[0004] In a first aspect, an embodiment of the present application provides a capacitance detection method, the method comprising: when n is a positive integer greater than or equal to 2, based on the temperature compensation data corresponding to the nth capacitance sampling data of the capacitor to be detected and the baseline value corresponding to the n-1th capacitance sampling data, determining the capacitance change corresponding to the nth capacitance sampling data; when n is 1, the capacitance change corresponding to the nth capacitance sampling data is 0; based on the size relationship between the capacitance change corresponding to the nth capacitance sampling data and a proximity threshold, determining the state of the human body relative to the electronic device; determining the trend change corresponding to the nth capacitance sampling data based on the temperature compensation data of the previous n capacitance sampling data; determining the baseline value corresponding to the nth capacitance sampling data based on the size relationship between the capacitance change and the proximity threshold and the trend change corresponding to the nth capacitance sampling data.

[0005] In the embodiment of the present application, the capacitance change is determined by using the temperature compensation data obtained after 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. This can effectively overcome the influence of ambient temperature and improve the accuracy of human body's judgment relative to electronic devices.

[0006] In addition, in an embodiment of 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. Compared with some comparative embodiments that use the current capacitance sampling data and the previous capacitance sampling data and the capacitance sampling data within a limited time window to determine the trend change amount, it can reflect the long-term change information of capacitance and further improve the accuracy of human body's judgment of the state of electronic equipment.

[0007] In a possible implementation of the first aspect, determining the trend change amount corresponding to the nth capacitance sampling data based on the temperature compensation data of the previous n capacitance sampling data includes: determining the trend change amount corresponding to the nth capacitance sampling data based on the following formula:

[0008]

[0009] Among them, 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, detcoef is the first adjustment coefficient, and the value range of detcoef is 0<detcoef<1.

[0010] In a possible implementation of the first aspect, the determining the baseline value corresponding to the nth capacitance sampling data based on the magnitude relationship between the capacitance change amount and the proximity threshold and the trend change amount corresponding to the nth capacitance sampling data includes: when the capacitance change amount corresponding to the nth capacitance sampling data is less than the proximity threshold, and the trend change amounts corresponding to y consecutive capacitance sampling data are all greater than a first threshold, then taking the baseline value corresponding to the n-1th capacitance sampling data as the baseline value corresponding to the nth capacitance sampling data; when the capacitance change amount corresponding to the nth capacitance sampling data is less than the proximity threshold, and there is no trend change amount corresponding to y consecutive capacitance sampling data that is greater than the first threshold, then determining the baseline value corresponding to the nth capacitance sampling data based on the baseline value corresponding to the n-1th capacitance sampling data and the capacitance compensation data corresponding to the nth capacitance sampling data; wherein y is a positive integer greater than or equal to 1.

[0011] In a possible implementation of the first aspect, determining the baseline value corresponding to the n-th capacitance sampling data based on the baseline value corresponding to the n-1th capacitance sampling data and the capacitance compensation data corresponding to the n-th capacitance sampling data includes: determining the baseline value corresponding to the n-th capacitance sampling data based on the following formula:

[0012] basic[n]=basic[n-1]+basiccoef*(comp[n]-basic[n-1])

[0013] Among them, 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 the second adjustment coefficient, and the value range of basiccoef is 0≤basiccoef≤1.

[0014] In a possible implementation of the first aspect above, the determining the baseline value corresponding to the n-th capacitance sampling data based on the magnitude relationship between the capacitance change amount and the proximity threshold and the trend change amount corresponding to the n-th capacitance sampling data further includes: 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 the second threshold and less than or equal to the third threshold, or the trend change amount corresponding to the n-th capacitance sampling data is greater than or equal to the fourth threshold and less than or equal to the fifth threshold, then 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; wherein the third threshold is less than the fourth threshold.

[0015] In a possible implementation of the first aspect above, the determining the baseline value corresponding to the nth capacitance sampling data based on the magnitude relationship between the capacitance change amount and the proximity threshold value and the trend change amount corresponding to the nth capacitance sampling data further includes: when the capacitance change amount corresponding to the nth capacitance sampling data is greater than or equal to the proximity threshold value, and the trend change amount corresponding to the nth capacitance sampling data is greater than the fifth threshold value, performing a first correction processing on the baseline value corresponding to the n-1th capacitance sampling data to obtain the baseline value corresponding to the nth capacitance sampling data; when the capacitance change amount corresponding to the nth capacitance sampling data is greater than or equal to the proximity threshold value, and the trend change amount corresponding to the nth capacitance sampling data is less than the second threshold value, performing a second correction processing on the baseline value corresponding to the n-1th capacitance sampling data to obtain the baseline value corresponding to the nth capacitance sampling data.

[0016] In a possible implementation of the first aspect, performing a first correction process on 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:

[0017] basic[n]=basic[n-1]+limitcoef*limit1

[0018] 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 the third adjustment coefficient, limit1 is the 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;

[0019] The performing a second correction process on 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] Among them, 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 the third adjustment coefficient, limit2 is the 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.

[0022] In a possible implementation of the first aspect above, the determining the baseline value corresponding to the nth capacitance sampling data based on the magnitude relationship between the capacitance change amount and the proximity threshold and the trend change amount corresponding to the nth capacitance sampling data further includes: when the capacitance change amount corresponding to the nth capacitance sampling data is greater than the proximity threshold, and the trend change amount corresponding to the nth capacitance sampling data is greater than the third threshold and less than the fourth threshold, determining the baseline value corresponding to the nth capacitance sampling data based on the baseline value corresponding to the n-1th capacitance sampling data and the trend change amount corresponding to the nth capacitance sampling data.

[0023] In a possible implementation of the first aspect, determining the baseline value corresponding to the nth capacitance sampling data based on the baseline value corresponding to the n-1th 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] Among them, 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, coef is the fourth adjustment coefficient, and the value range of the fourth adjustment coefficient is 0≤coef≤1.

[0026] A second aspect of the present application provides a chip, which is used to execute the capacitance detection method mentioned in the present application.

[0027] A third aspect of the present application provides an electronic device, comprising the chip mentioned in the present application. BRIEF DESCRIPTION OF THE DRAWINGS

[0028] Figure 1 According to some embodiments of the present application, a flow chart of a capacitance detection method is shown.

[0029] Figure 2 According to some embodiments of the present application, a detailed flow chart of a capacitance detection method is shown. 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 devices of the embodiments of the present application may include but are not limited to mobile phones, tablet computers, laptops, cameras, super mobile personal computers, handheld computers, televisions, walkie-talkies, netbooks, POS machines, personal digital assistants (PDAs), wearable devices, virtual reality devices, smart vehicles, smart robots, and any other devices equipped with capacitive sensors, and the present application does not impose any restrictions on this.

[0032] To solve the above problems, an embodiment of the present application provides a capacitance detection method, the method comprising: determining a capacitance change amount corresponding to the nth capacitance sampling data based on temperature compensation data corresponding to the nth capacitance sampling data of the capacitor to be detected and a baseline value corresponding to the n-1th capacitance sampling data; wherein the baseline value corresponding to the n-1th capacitance sampling data is determined based on a trend change amount corresponding to the previous n-1 capacitance sampling data, and the trend change amount corresponding to the n-1th capacitance sampling data is 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; based on the capacitance change amount corresponding to the nth capacitance sampling data and a proximity threshold, determining a state of a human body relative to an electronic device.

[0033] In the embodiment of the present application, the capacitance change is determined by using the temperature compensation data obtained after 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. This can effectively overcome the influence of ambient temperature and improve the accuracy of human body's judgment relative to electronic devices.

[0034] In addition, in an embodiment of 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. Compared with some comparative embodiments that use the current capacitance sampling data and the previous capacitance sampling data and the capacitance sampling data within a limited time window to determine the trend change amount, it can reflect the long-term change information of capacitance and further improve the accuracy of human body's judgment of the state of electronic equipment.

[0035] The following is a detailed description of a capacitance detection method provided in an embodiment of the present application.

[0036] Figure 1 FIG. 1 is a flow chart of a capacitance detection method. Figure 1 As shown, the capacitance detection method may include:

[0037] 101: Determine a capacitance change corresponding to the nth capacitance sampling data based on temperature compensation data corresponding to the nth capacitance sampling data of the capacitor to be detected and a baseline value corresponding to the (n-1)th capacitance sampling data.

[0038] It can be understood that when n is a positive integer greater than or equal to 2, the capacitance change amount corresponding to the nth capacitance sampling data can be determined based on the difference between the temperature compensation data corresponding to the nth capacitance sampling data of the capacitance to be detected and the baseline value corresponding to the n-1th capacitance sampling data. When n is 1, the capacitance change amount corresponding to the nth capacitance sampling data is 0.

[0039] For example, it can be shown as formula 1:

[0040]

[0041] Wherein, cap[n] is the capacitance change corresponding to the n-th capacitance sampling data, comp[n] is the temperature compensation data corresponding to the n-th capacitance sampling data, and basic[n-1] is the baseline value corresponding to the n-1-th capacitance sampling data.

[0042] In some embodiments, in the embodiments of the present application, the capacitance sampling data can be compensated based on the temperature compensation coefficient to obtain compensated temperature compensation data. For example, the temperature differential data can be multiplied by a fixed temperature compensation coefficient, the obtained product can be used as the capacitance compensation value, and the capacitance sampling data can be subtracted from the capacitance compensation value to obtain the temperature compensation data. Among them, the temperature differential data can be the difference between the current temperature data and the preset temperature data. It can be understood that the above-mentioned method of obtaining temperature compensation data is only an example, and any temperature compensation method can be applied to the present application, and the present application is not limited here.

[0043] 102: Determine the state of the human body relative to the electronic device based on the relationship between the capacitance change amount corresponding to the n-th capacitance sampling data and the proximity threshold value (eg, Prox).

[0044] In some embodiments, when the capacitance change corresponding to the n-th capacitance sampling data is less than the proximity threshold, it is determined that the state of the human body relative to the electronic device is a state where the human body is far away from the electronic device.

[0045] In some embodiments, when the capacitance variation corresponding to the n-th capacitance sampling data is greater than or equal to the proximity threshold, it is determined that the state of the human body relative to the electronic device is the state of the human body approaching the electronic device.

[0046] 103: Determine a trend change amount corresponding to the nth capacitance sampling data based on the temperature compensation data of the previous n capacitance sampling data.

[0047] In some embodiments, the determination method of the trend change amount corresponding to the n-th capacitance sampling data can be as shown in Formula 2:

[0048]

[0049] Among them, 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, detcoef is the first adjustment coefficient, and the value range of detcoef is 0<detcoef<1.

[0050] Based on the above formula 2, the calculation formula for the trend change amount corresponding to the second capacitance sampling data can be obtained as shown in formula 3:

[0051] delta[2]=(1-detcoef)*delta[1]+detcoef*(comp[2]-comp[1]) Formula 3

[0052] Wherein, delta[2] is the trend change amount corresponding to the second capacitance sampling data, delta[2] is the trend change amount 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.

[0053] Formula 3 shows that the trend change amount 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.

[0054] The calculation of the trend change corresponding to the third capacitance sampling data is shown in Formula 4:

[0055] delta[3]=(1-detcoef)*delta[2]+detcoef*(comp[3]-comp[2])

[0056] =(1-detcoef)*(1-detcoef)*delta[1]+detcoef*(1-detcoef)*(comp[2]-comp[1])+detcoef*(comp[3]-comp[2]) Formula 4

[0057] Wherein, delta[3] is the trend change corresponding to the third capacitance sampling data, and comp[3] is the temperature compensation data corresponding to the third capacitance sampling data.

[0058] Formula 4 shows that the trend change 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.

[0059] The calculation formula for the trend change corresponding to the n-1th capacitance sampling data is shown in Formula 5:

[0060] delta[n-1]=(1-detcoef)*delta[n-2]+detcoef*(comp[n-1]-comp[n-2]) Formula 5

[0061] Wherein, delta[n-1] is the trend change corresponding to the n-1th capacitance sampling data.

[0062] In summary, by analogy, the nth trend change delta[n] is related to the temperature compensation data corresponding to the 1st, 2nd, ...nth capacitance sampling data. In this way, the trend change can reflect the long-term change information of the capacitance, further improving the accuracy of the human body's relative judgment of the state of the electronic device.

[0063] In some embodiments, the value of detcoef is determined based on the change in temperature compensation data corresponding to the nth capacitance sampling data relative to the temperature compensation data corresponding to the previous n-1 capacitance sampling data. The change in temperature compensation data corresponding to the nth capacitance sampling data relative to the temperature compensation data corresponding to the previous n-1 capacitance sampling data can reflect the jitter of the temperature compensation data corresponding to the nth capacitance sampling data.

[0064] For example, a first difference between the temperature compensation data corresponding to the nth 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 is greater than a first preset value, it is determined that the jitter is large. If the absolute value of the first difference is less than the first preset value, it is considered that the jitter is small.

[0065] In some embodiments, a second difference between the temperature compensation data corresponding to the nth capacitance sampling data and the temperature compensation data corresponding to the (n-1)th capacitance sampling data may also be obtained, and if the absolute value of the second difference is greater than a second preset value, it is determined that the jitter is large, and if the absolute value of the second difference is less than the second preset value, it is determined that the jitter is small. The second preset value is greater than the first preset value.

[0066] If the jitter of the temperature compensation data corresponding to the nth capacitance sampling data is large, detcoef can be appropriately reduced to reduce the trend change. If the jitter of the temperature compensation data corresponding to the nth capacitance sampling data is small, detcoef can be appropriately increased to increase the corresponding trend change. In this way, a more accurate trend change can be obtained, further improving the accuracy of the human body's relative judgment of the state of the electronic device.

[0067] 104: Determine a baseline value corresponding to the nth capacitance sampling data based on a magnitude relationship between a capacitance change amount corresponding to the nth capacitance sampling data and a proximity threshold and a trend change amount corresponding to the nth capacitance sampling data.

[0068] The method of determining the baseline value corresponding to the nth capacitance sampling data based on the magnitude relationship between the capacitance change amount and the proximity threshold value and the trend change amount corresponding to the nth capacitance sampling data can refer to Figure 2 The steps are shown in the figure and will not be repeated here.

[0069] Figure 2 A detailed flow chart of a capacitance detection method of the present application is shown, such as Figure 2 As shown, the method includes:

[0070] 201: Determine a capacitance change corresponding to the nth capacitance sampling data based on temperature compensation data corresponding to the nth capacitance sampling data of the capacitor to be detected and a baseline value corresponding to the (n-1)th capacitance sampling data.

[0071] Step 201 is similar to step 101 and will not be described again here.

[0072] 202: Determine a trend change amount corresponding to the nth capacitance sampling data based on the temperature compensation data of the previous n capacitance sampling data.

[0073] Step 202 is similar to step 102 and will not be described again here.

[0074] 203: Determine whether the capacitance change corresponding to the nth capacitance sampling data is less than a proximity threshold.

[0075] If yes, go to step 204 to determine whether there are y consecutive capacitance sampling data whose trend changes are all greater than the first threshold. If no, go to steps 207, 209, and 211.

[0076] In some embodiments, it can be determined whether the capacitance change corresponding to the nth capacitance sampling data is less than a proximity threshold. If so, it can be indicated that the state of the human body corresponding to the current nth capacitance sampling data relative to the electronic device is a far state, and steps 204-206 are executed. If not, that is, the capacitance change corresponding to the nth capacitance sampling data is greater than or equal to the proximity threshold, it can be indicated that the state of the human body corresponding to the current nth capacitance sampling data relative to the electronic device is a close state, and steps 207-212 are executed.

[0077] 204: Determine whether there are y consecutive capacitance sampling data corresponding to a trend change amount greater than a first threshold (eg, th0), where y is a positive integer greater than or equal to 1.

[0078] If so, go to 205 and use the baseline value corresponding to the (n-1)th capacitance sampling data as the baseline value corresponding to the nth capacitance sampling data; if not, go to 206 and determine 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.

[0079] In some embodiments, after determining that the capacitance change amount corresponding to the nth capacitance sampling data is less than the proximity threshold, it can be further determined whether the trend change amounts corresponding to y consecutive capacitance sampling data are all greater than the first threshold, where y is a positive integer greater than or equal to 1, for example, y can be 1, or can be a positive integer greater than or equal to 2. The value of y can be set according to actual needs and is not limited here.

[0080] In the embodiment of the present application, when y is a positive integer greater than or equal to 2, that is, by judging whether there are multiple consecutive capacitance sampling data corresponding to a trend change greater than a first threshold, the accuracy of judging the state of the human body relative to the electronic device can be improved.

[0081] It can be understood that for the nth capacitance sampling data, the trend change amounts corresponding to y consecutive capacitance sampling data are all greater than the first threshold, which means that the trend change amounts corresponding to the (n-y+1)th capacitance sampling data to the nth capacitance sampling data are all greater than the first threshold.

[0082] It can be understood that when there are y consecutive times that the trend change corresponding to the capacitance sampling data is greater than the first threshold, it is considered that there is a reliable movement of a human body approaching. At this time, the baseline can be frozen, that is, the baseline value corresponding to the n-1th capacitance sampling data is used as the baseline corresponding to the nth capacitance sampling data to prevent the baseline from being tracked incorrectly and causing the approaching state to fail to be triggered, that is, when the human body approaches the electronic device, the electronic device cannot accurately identify the approaching state of the human body, which can improve the accuracy of identifying the state of the human body relative to the electronic device.

[0083] If it is determined that there is no trend change corresponding to y consecutive capacitance sampling data that is greater than the first threshold, it can be determined that the trend change caused by external noise is greater than the first threshold. At this time, the baseline value corresponding to the nth capacitance sampling data can be determined based on the baseline value corresponding to the nth capacitance sampling data and the capacitance compensation data corresponding to the nth capacitance sampling data. In this way, the tracking of baseline errors caused by noise can be effectively prevented.

[0084] In some embodiments, for the nth capacitance sampling, determining that there is no trend change amount corresponding to y consecutive capacitance sampling data greater than the first threshold value can be: there is at least one trend change amount less than or equal to the first threshold value among the trend change amounts corresponding to the n-y+1th capacitance sampling data to the nth capacitance sampling data, for example, the trend change amounts corresponding to the n-y+1th capacitance sampling data to the nth capacitance sampling data are all less than or equal to the first threshold value, or there is one or more (not all times) sampling data less than or equal to the first threshold value among the trend change amounts corresponding to the n-y+1th capacitance sampling data to the nth capacitance sampling data, etc.

[0085] It can be understood that when y is 1, the electronic device responds most quickly to capacitance detection, and when y is larger, the electronic device has a stronger anti-noise capability for capacitance detection.

[0086] 205: Using the baseline value corresponding to the (n-1)th capacitance sampling data as the baseline value corresponding to the nth capacitance sampling data.

[0087] It can be understood that using the baseline value corresponding to the (n-1)th capacitance sampling data as the baseline value corresponding to the nth capacitance sampling data means that the baseline is in a frozen state.

[0088] 206 : Determine a 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.

[0089] 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, the method of determining the baseline value corresponding to the (n-1)th capacitance sampling data may be as shown in Formula 6:

[0090] basic[n]=basic[n-1]+basiccoef*(comp[n]-basic[n-1]) Formula 6

[0091] Among them, 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 the second adjustment coefficient, and the value range of basiccoef is 0≤basiccoef≤1.

[0092] In some embodiments, the second adjustment coefficient may be adjusted based on the speed of the temperature compensation data corresponding to the required baseline tracking capacitance sampling data to adapt to different application scenarios.

[0093] For example, in a scenario where the jitter of the capacitance variation needs to be reduced, the speed of the baseline tracking temperature compensation data corresponding to the capacitance sampling data needs to be increased. In this case, the second adjustment coefficient can be increased to reduce the jitter of the capacitance variation.

[0094] Among them, the scenario where the jitter of the capacitance change amount needs to be reduced and the baseline tracking capacitance sampling speed needs to be accelerated can include the scenario where the speaker playback volume of the electronic device is greater than the preset volume value. In this scenario, since the speaker playback 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 in the acquired capacitance change amount, the speed of the temperature compensation data corresponding to the baseline tracking capacitance sampling data can be accelerated at this time to reduce the jitter of the capacitance change amount.

[0095] 207: Determine that the trend change amount corresponding to the n-th capacitance sampling data is greater than or equal to the second threshold (for example, th2) and less than or equal to the third threshold (for example, th3), and the trend change amount corresponding to the n-th capacitance sampling data is greater than or equal to the fourth threshold (for example, th4) and less than or equal to the fifth threshold (for example, th5), wherein the third threshold is less than the fourth threshold.

[0096] When the trend change amount corresponding to the nth capacitance sampling data is greater than or equal to the second threshold value and less than or equal to the third threshold value, it indicates that the trend change amount has decreased moderately. At this time, it may be a state where the human body is away, or it may be a decrease in the trend change amount caused by environmental changes. In this uncertain state, the baseline can be kept frozen. For example, the baseline value corresponding to the n-1th capacitance sampling data is used as the baseline value corresponding to the nth capacitance sampling data to avoid incorrect baseline updates.

[0097] When the trend change amount corresponding to the nth 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 has increased moderately. At this time, it may be a human body approaching state, or it may be an increase in the trend change amount caused by environmental changes. In this uncertain state, the baseline can be kept frozen. For example, the baseline value corresponding to the n-1th capacitance sampling data is used as the baseline value corresponding to the nth capacitance sampling data to avoid incorrect baseline updates.

[0098] 208: Using the baseline value corresponding to the (n-1)th capacitance sampling data as the baseline value corresponding to the nth capacitance sampling data.

[0099] 209: Determine whether the trend change amount corresponding to the n-th capacitance sampling data is less than the second threshold, or greater than or equal to the fifth threshold.

[0100] When the capacitance change corresponding to the nth capacitance sampling data is greater than or equal to the approach threshold, and the trend change corresponding to the capacitance sampling data corresponding to the nth capacitance sampling data is less than the second threshold, indicating that the trend change decreases significantly, it is considered that the human body is away from the human body at this time.

[0101] At this time, the first correction processing can be performed on the baseline value corresponding to the capacitance sampling data of the n-1th time to obtain the first correction baseline value after correction, and the first correction baseline value is used as the baseline value corresponding to the capacitance sampling data of the nth time to reduce the abnormal baseline drift. The correction method can be shown in Formula 7:

[0102] basic[n]=basic[n-1]+limitcoef*limit2 Formula 7

[0103] Among them, limitcoef is the third adjustment coefficient, and limit2 is the first preset parameter.

[0104] In some embodiments, the value range of the third adjustment coefficient may be 0≤limitcoef≤1, and the value range of the first preset parameter may be -32768≤limit2≤32768.

[0105] In some embodiments, the third adjustment coefficient can be adjusted based on the speed of the temperature compensation data corresponding to the required baseline tracking capacitance sampling data. When it is necessary to speed up the speed of the temperature compensation data corresponding to the baseline tracking capacitance sampling data, the third adjustment coefficient can be increased, and when it is necessary to reduce the speed of the temperature compensation data corresponding to the baseline tracking capacitance sampling data, the third adjustment coefficient can be reduced. By adjusting the third adjustment coefficient and the first preset parameter, a suitable correction amount can be set to reduce the abnormal baseline drift when the human body is away.

[0106] When the capacitance change corresponding to the nth capacitance sampling data is greater than or equal to the approach threshold, and the trend change corresponding to the capacitance sampling data corresponding to the nth capacitance sampling data is greater than the fifth threshold, indicating that the trend change has increased significantly, it is considered that there is a situation where the human body is further approaching.

[0107] At this time, a second correction process can be performed on the baseline value corresponding to the capacitance sampling data of the n-1th time to obtain the corrected second correction baseline value, and the second correction baseline value is used as the baseline value corresponding to the capacitance sampling data of the nth time to reduce the abnormal baseline drift. The correction method can be shown in Formula 8:

[0108] basic[n]=basic[n-1]+limitcoef*limit1 Formula 8

[0109] Among them, limit1 is the second preset parameter, and the value range of the second preset parameter can be -32768≤limit2≤32768.

[0110] By adjusting the third adjustment coefficient and the second preset parameter, a suitable correction amount can be set to reduce the abnormal baseline drift when the human body gets closer.

[0111] 210: Correct the baseline value corresponding to the capacitance sampling data of the n-1th time, obtain the corrected baseline value, and use the corrected baseline value as the baseline value corresponding to the capacitance sampling data of the nth time.

[0112] It can be understood that in the embodiment of the present application, the correction process may include a first correction process and a second correction process, and the correction baseline value may include a first correction baseline value and a second correction baseline value.

[0113] When the trend change amount corresponding to the capacitance sampling data corresponding to the nth capacitance sampling data is less than the second threshold, the first correction processing can be performed on the baseline value corresponding to the (n-1)th capacitance sampling data to obtain the corrected first correction baseline value, and the first correction baseline value is used as the baseline value corresponding to the nth capacitance sampling data to reduce the abnormal baseline drift.

[0114] When the trend change amount corresponding to the capacitance sampling data corresponding to the nth capacitance sampling data is greater than the fifth threshold, a second correction processing can be performed on the baseline value corresponding to the n-1th capacitance sampling data to obtain the corrected second correction baseline value, and the second correction baseline value is used as the baseline value corresponding to the nth capacitance sampling data to reduce the abnormal baseline drift.

[0115] In some embodiments, the first correction process and the second correction process may be the same process or different processes, which is not limited here.

[0116] 211: Determine whether the trend change amount corresponding to the n-th capacitance sampling data is greater than a third threshold and less than a fourth threshold.

[0117] It can be understood that in the embodiment of the present application, when the trend change amount corresponding to the nth capacitance sampling data is greater than the third threshold and less than the fourth threshold, it means that the increase or decrease amount of the trend change amount is in a reasonable middle range, and it is considered that there is an environmental change at this time, but no change in human behavior.

[0118] 212: Determine a 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.

[0119] In some embodiments, the method of determining the baseline value corresponding to the nth capacitance sampling data based on the baseline value corresponding to the n-1th capacitance sampling data and the trend change amount corresponding to the nth capacitance sampling data can be as shown in Formula 9:

[0120] basic[n]=basic[n-1]+coef*delta[n] Formula 9

[0121] Wherein, coef is the fourth adjustment coefficient, and the value range of the fourth adjustment coefficient can be 0≤coef≤1.

[0122] In the embodiment 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 nth capacitance sampling data changes based on the trend change amount corresponding to the nth capacitance sampling data. In some embodiments, the coef coefficient can be adjusted to adjust the intensity of the baseline following the trend change amount to avoid long-term baseline drift due to excessive or insufficient baseline following intensity. When it is necessary to speed up the speed of the baseline tracking trend change amount, the fourth adjustment coefficient can be increased at this time, and when it is necessary to reduce the speed of the baseline tracking trend change amount, the fourth adjustment coefficient can be reduced at this time.

[0123] In summary, based on the capacitance detection method mentioned in this application, the capacitance change is determined by using the temperature compensation data obtained after 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. This can effectively overcome the influence of ambient temperature and improve the accuracy of judging the relative state of the human body.

[0124] In addition, in an embodiment of 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. Compared with some comparative embodiments that use the current capacitance sampling data and the previous capacitance sampling data and the capacitance sampling data within a limited time window to determine the trend change amount, it can reflect the long-term change information of capacitance and further improve the accuracy of human body's judgment of the state of electronic equipment.

[0125] In addition, for the baseline tracking logic in the away state, the comparison result of y consecutive trend changes with the first threshold is used to make a pre-proximity judgment. Compared with the scheme of making a pre-proximity judgment by comparing a single trend change with the corresponding threshold in some comparative embodiments, the anti-interference ability of the pre-proximity judgment can be improved, and the accuracy of judging the state of the human body relative to the electronic device can be further improved. And when the trend change is less than the first threshold, the speed of the baseline following comp can be adjusted by the coefficient to adapt to different scenarios.

[0126] For the baseline tracking logic in the approaching state, two thresholds are added, that is, four thresholds are used. Compared with some comparative embodiments, the judgment scheme using only two thresholds can more finely distinguish the human body's moving away behavior, environmental changes, and human body's further approaching behavior. When determining the human body's moving away behavior and approaching behavior, the correction amount and correction coefficient can be used to adjust the correction amount to reduce the baseline drift. When the human body's moving away behavior or environmental changes, the human body's further approaching behavior or environmental changes cannot be determined, that is, it is in an intermediate unstable state, the baseline is frozen to prevent the baseline from following incorrectly, and further improve the accuracy of the judgment of the human body relative to the electronic device state.

[0127] In an embodiment of the present application, a chip may be included for executing the capacitance detection method mentioned in the present application. In some embodiments, the chip may include: a processor and a memory, the memory being used to store computer program instructions; the processor being used to call the computer program instructions stored in the memory so that the chip executes the capacitance detection method mentioned in the present application.

[0128] This embodiment is a chip implementation method corresponding to the above-mentioned capacitance detection method embodiment, and this embodiment can be implemented in conjunction with the capacitance detection method embodiment. The relevant technical details mentioned in the capacitance detection method embodiment are still valid in this embodiment, and in order to reduce repetition, they are not repeated here. Accordingly, the relevant technical details mentioned in this embodiment can also be applied in the capacitance detection method implementation method.

[0129] An embodiment of the present application may include an electronic device, characterized in that it includes the chip mentioned in the present application.

[0130] This embodiment is an electronic device implementation method corresponding to the above-mentioned capacitance detection method embodiment, and this embodiment can be implemented in conjunction with the capacitance detection method embodiment. The relevant technical details mentioned in the capacitance detection method embodiment are still valid in this embodiment, and in order to reduce repetition, they are not repeated here. Accordingly, the relevant technical details mentioned in this embodiment can also be applied in the capacitance detection method implementation method.

[0131] It should be noted that the units / modules mentioned in the various device embodiments of the present application are all logical units / modules. Physically, a logical unit / module can be a physical unit / module, or a part of a physical unit / module, or can be implemented as a combination of multiple physical units / modules. The physical implementation method of these logical units / modules themselves is not the most important. The combination of functions implemented by these logical units / modules is the key to solving the technical problems proposed by the present application. In addition, in order to highlight the innovative part of the present application, the above-mentioned device embodiments of the present application do not introduce units / modules that are not closely related to solving the technical problems proposed by the present application, which does not mean that there are no other units / modules in the above-mentioned device embodiments.

[0132] It should be noted that in the examples and description of this patent, relational terms such as first and second, etc. 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 these entities or operations. Moreover, the terms "include", "comprise" or any other variants thereof are intended to cover non-exclusive inclusion, so that a process, method, article or device including a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such process, method, article or device. In the absence of further restrictions, the elements defined by the sentence "including one" do not exclude the existence of other identical elements in the process, method, article or device including the elements.

[0133] Although the present application has been illustrated and described with reference to certain embodiments thereof, it will be apparent to those skilled in the art that various changes in form and details may be made therein without departing from the spirit and scope of the present application.

Claims

1. A capacitance detection method, characterized in that: The method comprises: When n is a positive integer greater than or equal to 2, the capacitance change corresponding to the nth capacitance sampling data of the capacitor to be detected is determined based on the temperature compensation data corresponding to the nth capacitance sampling data and the baseline value corresponding to the n-1th capacitance sampling data; when n is 1, the capacitance change corresponding to the nth capacitance sampling data is 0; Determine the state of the human body relative to the electronic device based on the relationship between the capacitance change amount corresponding to the n-th capacitance sampling data and the proximity threshold; Determine the trend change amount corresponding to the nth capacitance sampling data based on the temperature compensation data of the previous n capacitance sampling data; The baseline value corresponding to the nth capacitance sampling data is determined based on the magnitude relationship between the capacitance change amount and the proximity threshold value and the trend change amount corresponding to the nth capacitance sampling data.

2. The capacitance detection method according to claim 1, characterized in that: The determining of the trend change amount corresponding to the nth capacitance sampling data based on the temperature compensation data of the previous n capacitance sampling data includes: The trend change amount corresponding to the n-th capacitance sampling data is determined based on the following formula: Among them, 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, detcoef is the first adjustment coefficient, and the value range of detcoef is 0<detcoef<1.

3. The capacitance detection method according to claim 2, characterized in that: The determining the baseline value corresponding to the nth capacitance sampling data based on the magnitude relationship between the capacitance change amount and the proximity threshold value and the trend change amount corresponding to the nth capacitance sampling data includes: When the capacitance change corresponding to the n-th capacitance sampling data is less than the approach threshold, and the trend change corresponding to the y consecutive capacitance sampling data is greater than the first threshold, the baseline value corresponding to the (n-1)-th capacitance sampling data is used as 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 less than the approach threshold value, and there is no trend change amount corresponding to y consecutive capacitance sampling data that is greater than the first threshold value, the baseline value corresponding to the n-1-th capacitance sampling data is determined based on the baseline value corresponding to the n-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, characterized in that: The determining the baseline value corresponding to the n-th capacitance sampling data based on the baseline value corresponding to the n-1th capacitance sampling data and the capacitance compensation data corresponding to the n-th capacitance sampling data includes: 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]) Among them, 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 the second adjustment coefficient, and the value range of basiccoef is 0≤basiccoef≤1.

5. The capacitance detection method according to claim 3 or 4, characterized in that: The determining of the baseline value corresponding to the nth capacitance sampling data based on the magnitude relationship between the capacitance change amount and the proximity threshold value and the trend change amount corresponding to the nth capacitance sampling data further includes: When the capacitance change corresponding to the nth capacitance sampling data is greater than or equal to the proximity threshold, and, If the trend change amount corresponding to the n-th capacitance sampling data is greater than or equal to the second threshold and less than or equal to the third threshold, or the trend change amount corresponding to the n-th capacitance sampling data is greater than or equal to the fourth threshold and less than or equal to the fifth threshold, the baseline value corresponding to the (n-1)-th capacitance sampling data is used as the baseline value corresponding to the n-th capacitance sampling data; wherein the third threshold is less than the fourth threshold.

6. The capacitance detection method according to claim 3 or 4, characterized in that: The determining of the baseline value corresponding to the nth capacitance sampling data based on the magnitude relationship between the capacitance change amount and the proximity threshold value and the trend change amount corresponding to the nth capacitance sampling data further includes: 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, a first correction process is performed on 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; When the capacitance change corresponding to the nth capacitance sampling data is greater than or equal to the proximity threshold, and the trend change corresponding to the nth capacitance sampling data is less than the second threshold, a second correction process is performed on the baseline value corresponding to the n-1th capacitance sampling data to obtain the baseline value corresponding to the nth capacitance sampling data.

7. The capacitance detection method according to claim 6, characterized in that: The performing a first correction process on 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*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 the third adjustment coefficient, limit1 is the 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 performing a second correction process on 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 includes: 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 Among them, 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 the third adjustment coefficient, limit2 is the 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, characterized in that: The determining of the baseline value corresponding to the nth capacitance sampling data based on the magnitude relationship between the capacitance change amount and the proximity threshold value and the trend change amount 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 If the trend change amount corresponding to the nth capacitance sampling data is greater than the third threshold and less than the fourth threshold, the baseline value corresponding to the nth 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 nth capacitance sampling data.

9. The capacitance detection method according to claim 8, characterized in that: The determining the baseline value corresponding to the n-th capacitance sampling data based on the baseline value corresponding to the n-1th capacitance sampling data and the trend change amount corresponding to the n-th capacitance sampling data includes: The baseline value corresponding to the n-th capacitance sampling data is obtained based on the following formula: basic[n]=basic[n-1]+coef*delta[n] Among them, 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, coef is the fourth adjustment coefficient, and the value range of the fourth adjustment coefficient is 0≤coef≤1.

10. A chip, characterized in that: The chip is used to execute the capacitance detection method according to any one of claims 1 to 9.

11. An electronic device, characterized in that: Comprising the chip as claimed in claim 10.