CN117687535B - Capacitance touch key reference value correction method, device, equipment and readable medium - Google Patents

Capacitance touch key reference value correction method, device, equipment and readable medium Download PDF

Info

Publication number
CN117687535B
CN117687535B CN202410138098.0A CN202410138098A CN117687535B CN 117687535 B CN117687535 B CN 117687535B CN 202410138098 A CN202410138098 A CN 202410138098A CN 117687535 B CN117687535 B CN 117687535B
Authority
CN
China
Prior art keywords
value
capacitive touch
touch key
reference value
current
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Active
Application number
CN202410138098.0A
Other languages
Chinese (zh)
Other versions
CN117687535A (en
Inventor
崔亚男
江猛
韩红娟
雷红军
徐君怡
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
SUZHOU HUAXIN MICRO-ELECTRONICS CO LTD
Original Assignee
SUZHOU HUAXIN MICRO-ELECTRONICS CO LTD
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by SUZHOU HUAXIN MICRO-ELECTRONICS CO LTD filed Critical SUZHOU HUAXIN MICRO-ELECTRONICS CO LTD
Priority to CN202410138098.0A priority Critical patent/CN117687535B/en
Publication of CN117687535A publication Critical patent/CN117687535A/en
Application granted granted Critical
Publication of CN117687535B publication Critical patent/CN117687535B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Abstract

The invention discloses a capacitance touch key reference value correction method, a device, equipment and a readable medium, wherein the method comprises the following steps: acquiring a capacitance value of a capacitive touch key according to a preset frequency to obtain a sampling value array consisting of a plurality of sampling values; filtering the sampling value array, and determining the noise value of the sampling value array based on the filtering sampling value array; and correcting the reference value of the capacitive touch key based on the magnitude relation among the current reference value, the current sampling value, the touch threshold value and the noise value of the capacitive touch key. The capacitance touch key reference value correction method, the device, the equipment and the readable medium can correct the reference value in real time, so that the system can more accurately respond to a real touch event, and the influence of environmental change is reduced.

Description

Capacitance touch key reference value correction method, device, equipment and readable medium
Technical Field
The invention belongs to the technical field of data processing, and particularly relates to a capacitance type touch key reference value correction method, device and equipment and a readable medium.
Background
With rapid development of electronic science and technology, touch keys are widely used in a plurality of fields as an input mode of a feedback mode. The development of touch input technology has gone through several stages, covering various types of touch sensor technology, including resistive, electrical wave, electromagnetic, optical, inductive, capacitive, and so on. These touch technologies are each featured and are applied to different situations depending on their unique properties and characteristics.
Among the many types, capacitive touch key technology is widely adopted due to its high sensitivity and ease of integration. The working principle of the technology is based on the current sensing mechanism of the human body. Because the human body has the zero potential characteristic, when the finger of a user touches the capacitive key, a coupling capacitor is formed by the contact surface of the finger and the key. At this time, the high frequency signal on the working surface causes the finger to absorb a minute current. Therefore, by detecting the change of the induced current, the singlechip main control can judge whether a user operates a specific key or not.
However, the application of capacitive touch key technology is accompanied by some challenges. Whether the touch key is triggered or not is obtained by comparing and analyzing the currently acquired numerical value with the reference value. When the surrounding environment of the touch key changes, the acquired touch key value changes along with the change of the environment, but if the reference value is fixed, the problems of misjudgment triggering or triggering failure and the like can be caused.
Therefore, in view of the above technical problems, it is necessary to provide a new solution.
Disclosure of Invention
The invention aims to provide a capacitance touch key reference value correction method, device, equipment and readable medium, which can correct a reference value in real time, so that a system can respond to a real touch event more accurately and reduce the influence of environmental change.
In a first aspect, the present invention provides a method for correcting a reference value of a capacitive touch key, including:
Acquiring a capacitance value of a capacitive touch key according to a preset frequency to obtain a sampling value array consisting of a plurality of sampling values;
Filtering the sampling value array, and determining a noise value of the sampling value array based on the filtered sampling value array, wherein the noise value is a difference value between a maximum sampling value and a minimum sampling value in the filtered sampling value array;
and correcting the reference value of the capacitive touch key based on the magnitude relation among the current reference value, the current sampling value, the touch threshold value and the noise value of the capacitive touch key.
In one or more embodiments, correcting the reference value of the capacitive touch key based on the magnitude relation of the current reference value, the current sampling value and the noise value of the capacitive touch key specifically includes:
When the current reference value of the capacitive touch key is larger than the current sampling value and the difference value between the current reference value and the current sampling value is smaller than the noise value, maintaining the reference value of the capacitive touch key as the current reference value; or when the current reference value of the capacitive touch key is smaller than the current sampling value and the difference value between the current sampling value and the current reference value is smaller than the noise value, maintaining the reference value of the capacitive touch key as the current reference value.
In one or more embodiments, correcting the reference value of the capacitive touch key based on the magnitude relation of the current reference value, the current sampling value and the noise value of the capacitive touch key specifically includes:
and when the current reference value of the capacitive touch key is smaller than the current sampling value and the difference value between the current sampling value and the current reference value is larger than the noise value, the current reference value of the capacitive touch key is up-regulated by a first correction value and then used as a new reference value.
In one or more embodiments, correcting the reference value of the capacitive touch key based on the magnitude relation of the current reference value, the current sampling value and the noise value of the capacitive touch key specifically includes:
When the current reference value of the capacitive touch key is larger than the current sampling value, and the difference value between the current reference value and the current sampling value is continuously larger than the noise value and smaller than the touch threshold value for a plurality of times, the current reference value of the capacitive touch key is downwards regulated by a second correction value to serve as a new reference value.
In one or more embodiments, correcting the reference value of the capacitive touch key based on the magnitude relation of the current reference value, the current sampling value and the noise value of the capacitive touch key specifically includes:
When the current reference value of the capacitive touch key is larger than the current sampling value, and the difference value between the current reference value and the current sampling value is larger than the touch threshold value and smaller than the touch threshold value by 2 times, the reference value of the capacitive touch key is maintained to be the current reference value.
In one or more embodiments, correcting the reference value of the capacitive touch key based on the magnitude relation of the current reference value, the current sampling value and the noise value of the capacitive touch key specifically includes:
and when the current reference value of the capacitive touch key is larger than the current sampling value and the difference value between the current reference value and the current sampling value is larger than the touch threshold value which is 2 times, adjusting the reference value of the capacitive touch key to be the sum of the current sampling value and the touch threshold value which is 2 times.
In one or more embodiments, the method further comprises:
Sampling the capacitance values of the capacitive touch keys, and calculating the difference between the reference value and the sampling value of each capacitive touch key to obtain a difference sequence formed by the difference between the reference value and the sampling value of each capacitive touch key; when the difference value between the maximum difference value and the next largest difference value in the difference value sequence is larger than the touch threshold value, marking a sampling value corresponding to the maximum difference value as a touch effective value; and when at least n-1 sampling values in the continuous n times of sampling of the same capacitive touch key are touch effective values, determining that the capacitive touch key is in a touch state.
In a second aspect, the present invention provides a capacitive touch key reference value correction apparatus, comprising:
The acquisition module is used for acquiring the capacitance value of the capacitive touch key according to a preset frequency to obtain a sampling value array consisting of a plurality of sampling values;
The filtering module is used for carrying out filtering processing on the sampling value array, and determining a noise value of the sampling value array based on the filtering processed sampling value array, wherein the noise value is a difference value between a maximum sampling value and a minimum sampling value in the filtering processed sampling value array;
And the correction module is used for correcting the reference value of the capacitive touch key based on the magnitude relation among the current reference value, the current sampling value, the touch threshold value and the noise value of the capacitive touch key.
In a third aspect, the present invention provides an electronic device comprising a memory, a processor, and a computer program stored on the memory and executable on the processor, the processor implementing the capacitive touch key reference value correction method as described above when executing the program.
In a fourth aspect, the present invention provides a computer readable medium carrying computer executable instructions thereon, which when executed by a processor are configured to implement a capacitive touch key reference value correction method as described above.
Compared with the prior art, the capacitance type touch key reference value correction method, device, equipment and readable medium provided by the invention have the advantages that the capacitance value is acquired through the preset frequency, a sampling value array formed by a plurality of sampling values is generated, the sampling values are filtered to determine the noise value, and the reference value is corrected in real time based on the magnitude relation among the current reference value, the sampling values, the touch threshold value and the noise value, so that the system can respond to the real touch event more accurately, and the influence of environmental change is reduced.
Drawings
In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the drawings used in the description of the embodiments or the prior art will be briefly described below. It is obvious that the drawings in the following description are only some embodiments of the present invention, and that other drawings may be obtained from these drawings without inventive effort for a person of ordinary skill in the art.
FIG. 1 is a flowchart of a method for calibrating reference values of capacitive touch keys according to an embodiment of the invention;
FIG. 2 is a schematic diagram of a capacitive touch key reference value calibration apparatus according to an embodiment of the present invention;
fig. 3 is a schematic structural diagram of an electronic device according to an embodiment of the invention.
Detailed Description
In order to enable those skilled in the art to better understand the technical solution of the present invention, the technical solution of the present invention will be clearly and completely described below with reference to the accompanying drawings in the embodiments of the present invention. It will be apparent that the described embodiments are only some, but not all, embodiments of the invention. All other embodiments, which can be made by those skilled in the art based on the embodiments of the present invention without making any inventive effort, shall fall within the scope of the present invention.
In existing capacitive touch key technology, a major limitation is its sensitivity to environmental changes. Since the capacitive touch key operates on the principle that a touch is detected based on a change in capacitance, environmental factors (e.g., temperature, humidity, electromagnetic interference, etc.) may cause erroneous judgment or failure of touch detection. This is mainly because in the conventional capacitive touch key system, the reference value (threshold value for judging occurrence of a touch) is generally fixed. When environmental conditions change, natural fluctuations in capacitance values may be misinterpreted as touch events, resulting in false operations, although touches do not occur. Therefore, there is a need for improvements in this technology to increase its accuracy and reliability under different environmental conditions.
In view of the limitation of the prior art, the invention provides a capacitance type touch key reference value correction method. The method has the core thought of dynamically adjusting the reference value of the capacitive touch key to adapt to environmental changes. In particular, the invention firstly collects capacitance values through preset frequency to generate a sampling value array composed of a plurality of sampling values. These samples are then filtered to improve the accuracy of the data and reduce the effects of noise. By this processing step, the noise value, i.e. the difference between the maximum and minimum values in the array of filtered sample values, is determined. Finally, based on the magnitude relation among the current reference value, the sampling value, the touch threshold value and the noise value, the system can correct the reference value in real time. Such correction enables the system to respond more accurately to real touch events while reducing the effects of environmental changes.
Referring to fig. 1, a flowchart of a capacitive touch key reference value correction method according to an embodiment of the invention specifically includes the following steps:
s101: and acquiring the capacitance value of the capacitive touch key according to a preset frequency to obtain a sampling value array consisting of a plurality of sampling values.
It should be noted that, the capacitance value of the capacitive touch key may be detected at a set time interval, i.e. "preset frequency". These capacitance values reflect the capacitance states of the keys at different points in time. All of these successively measured capacitance values are collected and saved as a list or array for later analysis and processing.
For example, one capacitive touch key requires detection of a touch every millisecond. The system measures the capacitance values of the keys every millisecond and records these values. For example, within 10 milliseconds, the system may record the following sequence of capacitance values: [100, 102, 101, 103, 102, 105, 104, 106, 107, 109]. This sequence represents the capacitance change of the key within 10 milliseconds.
The measurement of the capacitance value can be achieved by specially designed circuits that are able to detect and record the voltage change across the capacitor. These circuits typically include a sense capacitive element that, when a touch occurs, the human body forms a coupling with the capacitor, changing the overall capacitance of the capacitor. The capacitance changes result in voltage or current changes in the circuit that can be converted to digital signals by a conversion circuit (e.g., an analog-to-digital converter) for subsequent processing and analysis. After the capacitance value is converted into a digital signal, the digital signal can be sent to a microcontroller or a processor, the data are collected and recorded according to preset frequency, and the data are subjected to preliminary processing according to the requirement. The collected data may be stored in a memory to form an array of sample values.
S102: and carrying out filtering processing on the sampling value array, and determining a noise value of the sampling value array based on the filtering processed sampling value array, wherein the noise value is the difference value between the maximum sampling value and the minimum sampling value in the filtering processed sampling value array.
It should be noted that the collected capacitance values (i.e., array of sample values) are filtered to reduce or eliminate noise (unnecessary or misleading data). And after the filtering is finished, calculating the difference between the maximum value and the minimum value in the processed data, wherein the difference is the noise value. The noise value can reflect the fluctuation range in the data, thereby more accurately judging the touch event in the subsequent step.
Specifically, an average filter, an Infinite Impulse Response (IIR) filter, a median filter, etc. may be sampled, and the sampling value array may be subjected to filtering processing to remove noise and interference in the data, so that the data is more similar to a real signal.
S103: and correcting the reference value of the capacitive touch key based on the magnitude relation among the current reference value, the current sampling value, the touch threshold value and the noise value of the capacitive touch key.
It should be noted that, how to adjust the standard (reference value) for judging the occurrence of the touch can be determined according to the actually measured capacitance value (current sampling value), the set touch response threshold value (touch threshold value) and the fluctuation range (noise value) of the data, so that the system can be helped to more accurately identify the actual touch action, and misjudgment caused by environmental interference or equipment noise can be avoided.
In this embodiment, the sampling value may be tk_sample [ ch ], the reference value may be tk_base [ ch ], the Touch Threshold may be finger_threshold, the Noise value may be tk_noise, the difference between the reference value and the sampling value may be touch_max [ ch ], and the difference between the sampling value and the reference value may be touch_min [ ch ]. Wherein ch is the serial number of the Touch key, the Touch Threshold value finger_threshold is at least 5 times larger than the Noise value TK_noise, and when the reference value is larger than the sampling value, the touch_Max [ ch ] operation is executed, namely, touch_Max [ ch ] =TK_Baseline [ ch ] -TK_sample [ ch ]; and when the reference value is smaller than the sampling value, executing a touch_Min [ ch ] operation, namely, touch_Min [ ch ] =TK_sample [ ch ] -TK_Baseline [ ch ].
In an exemplary embodiment, when the current reference value of the capacitive Touch key is greater than the current sampling value and the difference between the current reference value and the current sampling value is smaller than the Noise value, i.e., touch_max [ ch ] < tk_noise, the reference value of the capacitive Touch key is maintained as the current reference value. Or when the current reference value of the capacitive Touch key is smaller than the current sampling value and the difference value between the current sampling value and the current reference value is smaller than the Noise value, namely, touch_Min [ ch ] < TK_noise, the reference value of the capacitive Touch key is maintained to be the current reference value.
It should be noted that when the touch_max [ ch ] and the touch_min [ ch ] are both smaller than the Noise value tk_noise, it means that the current environment is relatively stable and there is no finger Touch. At this time, the background value does not need to be updated. This design avoids unnecessary background value adjustments under steady no-operation conditions, reducing the response burden of the system.
For example, one capacitive touch key has a reference value of 200 units (TK_Baseline [ ch ]), a current sample value of 195 units (TK_sample [ ch ]), and a Noise value of 10 units (TK_noise). In this case, touch_Max [ ch ] (i.e., difference between the reference value and the sampling value) is 5 units, which is smaller than the noise value of 10 units. This suggests that the current capacitance change may be caused by ambient noise only, not a real touch. Thus, the system will keep the reference value 200 units unchanged.
In an exemplary embodiment, when the current reference value of the capacitive Touch key is smaller than the current sampling value and the difference between the current sampling value and the current reference value is greater than the Noise value, that is, touch_min [ ch ] > tk_noise, the current reference value of the capacitive Touch key is up-regulated by the first correction value and then used as a new reference value.
It should be noted that when touch_Min [ ch ] > TK_noise, the sampled value is significantly larger than the background value, possibly due to environmental changes (e.g., humidity, temperature changes). At this time, the background value needs to be gradually increased to be close to the sampling value. The updating method can adopt a successive approximation method, and the current reference value is up-regulated once by a first correction value every time sampling values are generated and in the condition that touch_Min [ ch ] > TK_noise. The successive approximation updating method can smoothly adapt to environmental changes and avoid erroneous judgment caused by mutation. The first correction value may be set according to actual needs.
For example, the current reference value of one capacitive touch key is 100 units, the current sampling value is 115 units, and the noise value is 5 units. The touch_min [ ch ] (i.e., the difference between the sampling value and the reference value) is 15 units, which is greater than the noise value of 5 units. According to the scheme, the system can adjust the reference value to be up to 102 units, so as to better reflect the actual touch operation, and can more accurately identify the actual touch operation, and avoid missing effective touch due to too low reference value setting.
If the reference value is not updated within a reasonable range after n times of updating, the reference value may be updated directly to the current sampling value, that is, tk_base [ ch ] =tk_sample [ ch ]. The sampling value > the reference value is the reverse condition of the touch, and the condition exists for many times continuously, so that the background value can be updated rapidly, the response speed of the touch system is improved, the reference value can be updated directly to the sampling value, the mode belongs to one of the modes of updating the reference value rapidly, and the condition usually occurs when the power is on or occurs when the touch medium is replaced.
In an exemplary embodiment, when the current reference value of the capacitive Touch key is greater than the current sampling value, and the difference between the current reference value and the current sampling value is greater than the Noise value and less than the Touch Threshold value continuously for a plurality of times, that is, when finger_threshold > touch_max [ ch ] > tk_noise continuously sampled for a plurality of times, the current reference value of the capacitive Touch key is adjusted downward by a second correction value to be used as a new reference value.
It should be noted that, when the current reference value of the capacitive touch key is higher than the actually measured capacitance value, and the difference value of the higher value exceeds the ambient noise level but is lower than the threshold value of touch recognition, the system can adjust the reference value down to prevent the actual slight touch action from being ignored due to the excessively high reference value setting.
In this case, there may be a trend of touching, where the reference value needs to be updated slowly to an order of magnitude close to the sampling value, and the updating method also samples the successive approximation method, but the successive approximation coefficients are different, and when the finger_threshold > touch_Max [ ch ] > TK_noise needs to be detected n (n is greater than or equal to 2) times successively, the reference value is updated once, i.e. the reference value is adjusted down once by the second correction value. The second correction value may be set according to actual needs.
For example, the reference value of the capacitive touch key is 150 units, the touch threshold value is 30 units, and the noise value is 5 units. In a series of measurements, the sample value is 130 units for 5 consecutive times, which results in touch_max (difference between the reference value and the sample value) of 20 units, which is greater than the noise value of 5 units but less than the Touch threshold value of 30 units. According to an aspect, the system will adjust the reference value down, for example to 148 units, to increase sensitivity to a slight touch.
In an exemplary embodiment, when the current reference value of the capacitive Touch key is greater than the current sampling value, and the difference between the current reference value and the current sampling value is greater than the Touch Threshold value and less than 2 times the Touch Threshold value, that is, 2×finger_threshold > touch_max [ ch ] > finger_threshold, the reference value of the capacitive Touch key is maintained as the current reference value.
It should be noted that, if the current reference value of the capacitive touch key (i.e. the capacitance value standard for determining that a touch occurs) is greater than the actually measured capacitance value (i.e. the sampling value), and the difference between the two values is within a certain range of the touch threshold value (greater than the touch threshold value but less than twice the touch threshold value), the system will keep the current reference value unchanged. This means that in this case, the difference indicates that the touch signal strength is moderate (neither too weak nor too strong), the system considers the existing reference value to be appropriate, no adjustment is required, erroneous judgment due to frequent adjustment of the reference value can be avoided, and it is ensured that the reference value is adjusted only when necessary.
For example, the reference value of the capacitive touch key is set to 200 units, and the touch threshold value is set to 50 units. In one measurement period, the sampled value is 130 units and the resulting difference is 70 units. This difference is greater than the touch threshold value by 50 units but less than 100 units (i.e., twice 50 units). According to the scheme, since the difference indicates that the touch signal strength is moderate, the system will keep the reference value 200 units unchanged.
In an exemplary embodiment, when the current reference value of the capacitive Touch key is greater than the current sampling value and the difference between the current reference value and the current sampling value is greater than the Touch Threshold value by 2 times, that is, touch_max [ ch ] > 2×finger_threshold, the reference value of the capacitive Touch key is adjusted to be the sum of the current sampling value and the Touch Threshold value by 2 times.
It should be noted that, the current sampling value reaches the condition of having fingers and is in a relatively sensitive environment, or the testing environment is different from the actual use environment, and an intelligent recognition technology is needed to be adopted to be compatible with the requirements of different occasions. When the reference value is greater than the sampling value and exceeds 2 times of the Touch Threshold value, the reference value is updated downwards to tk_base [ ch ] =tk_sample [ ch ] +2×finger_threshold, so that touch_max [ ch ] is limited within 2 times of finger_threshold. The update may be a successive approximation.
For example, the current reference value of the capacitive touch key is 300 units, the touch threshold value is 40 units, and the current sampling value is 100 units. The calculated difference is 200 units, which exceeds twice the touch threshold (40 x 2 = 80). According to the scheme, the system will adjust the reference value to the sum of the current sample value plus twice the touch threshold value, i.e. 100+80=180 units.
In an exemplary embodiment, the capacitance values of the plurality of capacitive touch keys may be sampled, and the difference between the reference value and the sampling value of each capacitive touch key is calculated to obtain a difference sequence formed by the difference between the reference value and the sampling value of each capacitive touch key; when the difference value between the maximum difference value and the next largest difference value in the difference value sequence is larger than the touch threshold value, marking a sampling value corresponding to the maximum difference value as a touch effective value; and when at least n-1 sampling values in the continuous n times of sampling of the same capacitive touch key are touch effective values, determining that the capacitive touch key is in a touch state.
It should be noted that, a plurality of capacitive touch keys may be sampled, and a sampling value of each key may be recorded. Then, the difference between the reference value and the sampling value of each capacitive touch key is calculated, and the maximum difference (representing the strongest touch signal) is found by comparing the difference between the reference value and the sampling value of each key. If the difference between the largest difference and the next largest difference exceeds a set touch threshold, then the sample value corresponding to the largest difference is considered a valid touch signal. If a key is detected as a valid touch signal in a plurality of consecutive samples, it can be determined that the key is in a touch state. The scheme can rapidly and accurately pre-judge finger touch, particularly in a multi-touch scene, can effectively distinguish the main touch point and the secondary touch point, can effectively process shake in the process of lowering the finger and shake in the process of leaving the finger, and improves the anti-interference fault tolerance.
For example, an 8-bit flag_tk [ ch ] register may be used to determine the touch state, with the initial state of 00000000 (no touch event).
The flag_TK [ ch ] register performs one-bit left shift processing once every sampling according to the touch effective value detection condition, and flag_TK [ ch ] < < = 1. For a touch key to first detect a valid touch (condition is met), the register is updated to 00000001. If a valid touch is continuously detected, the registers are updated to 00000011, 00000111, 00001111, 00011111, 00111111, 01111111 in sequence. When the register is updated to 01111111, it indicates that 7 valid touches are detected in the last 8 samples, and the capacitive touch key is determined to be in a touch state.
If the next touch is invalid, the register is shifted left and cleared at the least significant bit, e.g., to 11111110. If invalid touches occur consecutively, the registers may be updated sequentially to 11111100, 11111000, 11110000, 11100000, 11000000, 10000000, 00000000. When the number of "0" s reaches 7 or more, it is determined that the capacitive touch key is in a non-touch state.
In summary, according to the method for correcting the reference value of the capacitive touch key provided by the invention, the capacitance value is acquired through the preset frequency, a sampling value array formed by a plurality of sampling values is generated, the sampling values are subjected to filtering processing, the noise value is determined, and the reference value is corrected in real time based on the magnitude relation among the current reference value, the sampling values, the touch threshold value and the noise value, so that the system can respond to a real touch event more accurately, and the influence of environmental change is reduced.
Referring to fig. 2, based on the same inventive concept as the capacitive touch key reference value correction method, the present invention provides a capacitive touch key reference value correction device 200, which includes: an acquisition module 201, a filtering module 202 and a correction module 203.
The acquisition module 201 is configured to acquire a capacitance value of the capacitive touch key according to a preset frequency, and obtain a sampling value array composed of a plurality of sampling values. The filtering module 202 is configured to perform filtering processing on the sample value array, and determine a noise value of the sample value array based on the sample value array after the filtering processing, where the noise value is a difference value between a maximum sample value and a minimum sample value in the sample value array after the filtering processing. The correction module 203 is configured to correct the reference value of the capacitive touch key based on the magnitude relation of the current reference value, the current sampling value, the touch threshold value and the noise value of the capacitive touch key.
Referring to fig. 3, an embodiment of the present invention further provides an electronic device 300, where the electronic device 300 includes at least one processor 301, a memory 302 (e.g., a nonvolatile memory), a memory 303, and a communication interface 304, and the at least one processor 301, the memory 302, the memory 303, and the communication interface 304 are connected together via a bus 305. The at least one processor 301 is configured to invoke the at least one program instruction stored or encoded in the memory 302 to cause the at least one processor 301 to perform the various operations and functions of the capacitive touch key reference value correction method described in various embodiments of the present specification.
In embodiments of the present description, electronic device 300 may include, but is not limited to: personal computers, server computers, workstations, desktop computers, laptop computers, notebook computers, mobile electronic devices, smart phones, tablet computers, cellular phones, personal Digital Assistants (PDAs), handsets, messaging devices, wearable electronic devices, consumer electronic devices, and the like.
Embodiments of the present invention also provide a computer readable medium having computer-executable instructions carried thereon, which when executed by a processor, may be used to implement various operations and functions of the capacitive touch key reference value correction method described in the various embodiments of the present specification.
The computer readable medium in the present invention may be a computer readable signal medium or a computer readable storage medium or any combination of the two. The computer readable storage medium can be, for example, but not limited to, an electronic, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or a combination of any of the foregoing. More specific examples of the computer-readable storage medium may include, but are not limited to: an electrical connection having one or more wires, a portable computer diskette, a hard disk, a Random Access Memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disc read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the foregoing. In the context of this document, a computer readable storage medium may be any tangible medium that can contain, or store a program for use by or in connection with an instruction execution system, apparatus, or device.
In the present invention, however, the computer-readable signal medium may include a data signal propagated in baseband or as part of a carrier wave, with the computer-readable program code embodied therein. Such a propagated data signal may take any of a variety of forms, including, but not limited to, electro-magnetic, optical, or any suitable combination of the foregoing. A computer readable signal medium may also be any computer readable medium that is not a computer readable storage medium and that can communicate, propagate, or transport a program for use by or in connection with an instruction execution system, apparatus, or device. Program code embodied on a computer readable medium may be transmitted using any appropriate medium, including but not limited to: wireless, wire, fiber optic cable, RF, etc., or any suitable combination of the foregoing.
It will be appreciated by those skilled in the art that embodiments of the present invention may be provided as a method, system, or computer program product. Accordingly, the present invention may take the form of an entirely hardware embodiment, an entirely software embodiment or an embodiment combining software and hardware aspects. Furthermore, the present invention may take the form of a computer program product embodied on one or more computer-usable storage media (including, but not limited to, disk storage, CD-ROM, optical storage, and the like) having computer-usable program code embodied therein.
The present invention is described with reference to flowchart illustrations and/or block diagrams of methods, apparatus, systems, and computer program products according to embodiments of the invention. It will be understood that each flow and/or block of the flowchart illustrations and/or block diagrams, and combinations of flows and/or blocks in the flowchart illustrations and/or block diagrams, can be implemented by computer program instructions. These computer program instructions may be provided to a processor of a general purpose computer, special purpose computer, embedded processor, or other programmable data processing apparatus to produce a machine, such that the instructions, which execute via the processor of the computer or other programmable data processing apparatus, create means for implementing the functions specified in the flowchart flow or flows and/or block diagram block or blocks.
It will be evident to those skilled in the art that the invention is not limited to the details of the foregoing illustrative embodiments, and that the present invention may be embodied in other specific forms without departing from the spirit or essential characteristics thereof. The present embodiments are, therefore, to be considered in all respects as illustrative and not restrictive, the scope of the invention being indicated by the appended claims rather than by the foregoing description, and all changes which come within the meaning and range of equivalency of the claims are therefore intended to be embraced therein. Any reference sign in a claim should not be construed as limiting the claim concerned.
Furthermore, it should be understood that although the present disclosure describes embodiments, not every embodiment is provided with a separate embodiment, and that this description is provided for clarity only, and that the disclosure is not limited to the embodiments described in detail below, and that the embodiments described in the examples may be combined as appropriate to form other embodiments that will be apparent to those skilled in the art.

Claims (6)

1. A capacitive touch key reference value correction method, comprising:
Acquiring a capacitance value of a capacitive touch key according to a preset frequency to obtain a sampling value array consisting of a plurality of sampling values;
Filtering the sampling value array, and determining a noise value of the sampling value array based on the filtered sampling value array, wherein the noise value is a difference value between a maximum sampling value and a minimum sampling value in the filtered sampling value array;
correcting the reference value of the capacitive touch key based on the magnitude relation among the current reference value, the current sampling value, the touch threshold value and the noise value of the capacitive touch key;
Sampling the capacitance values of the capacitive touch keys, and calculating the difference between the reference value and the sampling value of each capacitive touch key to obtain a difference sequence formed by the difference between the reference value and the sampling value of each capacitive touch key; when the difference value between the maximum difference value and the next largest difference value in the difference value sequence is larger than the touch threshold value, marking a sampling value corresponding to the maximum difference value as a touch effective value; when at least n-1 sampling values are touch effective values in the continuous n times of sampling of the same capacitive touch key, determining that the capacitive touch key is in a touch state;
The correcting the reference value of the capacitive touch key based on the magnitude relation of the current reference value, the current sampling value and the noise value of the capacitive touch key specifically comprises the following steps:
When the current reference value of the capacitive touch key is smaller than the current sampling value and the difference value between the current sampling value and the current reference value is larger than the noise value, the current reference value of the capacitive touch key is up-regulated by a first correction value and then used as a new reference value;
When the current reference value of the capacitive touch key is larger than the current sampling value and the difference value between the current reference value and the current sampling value is continuously larger than the noise value and smaller than the touch threshold value for a plurality of times, the current reference value of the capacitive touch key is downwards regulated by a second correction value to be used as a new reference value;
And when the current standard value of the capacitive touch key is larger than the current sampling value and the difference value between the current standard value and the current sampling value is larger than the touch threshold value which is 2 times, adjusting the standard value of the capacitive touch key to be the sum of the current sampling value and the touch threshold value which is 2 times.
2. The method for correcting a reference value of a capacitive touch key according to claim 1, wherein correcting the reference value of the capacitive touch key based on the magnitude relation among the current reference value, the current sampling value, and the noise value of the capacitive touch key specifically includes:
when the current reference value of the capacitive touch key is larger than the current sampling value and the difference value between the current reference value and the current sampling value is smaller than the noise value, maintaining the reference value of the capacitive touch key as the current reference value; or (b)
When the current reference value of the capacitive touch key is smaller than the current sampling value and the difference value between the current sampling value and the current reference value is smaller than the noise value, the reference value of the capacitive touch key is maintained to be the current reference value.
3. The method for correcting a reference value of a capacitive touch key according to claim 1, wherein correcting the reference value of the capacitive touch key based on the magnitude relation among the current reference value, the current sampling value, and the noise value of the capacitive touch key specifically includes:
When the current reference value of the capacitive touch key is larger than the current sampling value, and the difference value between the current reference value and the current sampling value is larger than the touch threshold value and smaller than the touch threshold value by 2 times, the reference value of the capacitive touch key is maintained to be the current reference value.
4. A capacitive touch key reference value correction apparatus, comprising:
The acquisition module is used for acquiring the capacitance value of the capacitive touch key according to a preset frequency to obtain a sampling value array consisting of a plurality of sampling values; the method comprises the steps of obtaining a difference value sequence formed by difference values of a reference value and a sampling value of each capacitive touch key; when the difference value between the maximum difference value and the next largest difference value in the difference value sequence is larger than a touch threshold value, marking a sampling value corresponding to the maximum difference value as a touch effective value; when at least n-1 sampling values are touch effective values in the continuous n times of sampling of the same capacitive touch key, determining that the capacitive touch key is in a touch state;
The filtering module is used for carrying out filtering processing on the sampling value array, and determining a noise value of the sampling value array based on the filtering processed sampling value array, wherein the noise value is a difference value between a maximum sampling value and a minimum sampling value in the filtering processed sampling value array;
The correction module is used for correcting the reference value of the capacitive touch key based on the magnitude relation of the current reference value, the current sampling value, the touch threshold value and the noise value of the capacitive touch key;
The correcting the reference value of the capacitive touch key based on the magnitude relation of the current reference value, the current sampling value and the noise value of the capacitive touch key specifically comprises the following steps:
When the current reference value of the capacitive touch key is smaller than the current sampling value and the difference value between the current sampling value and the current reference value is larger than the noise value, the current reference value of the capacitive touch key is up-regulated by a first correction value and then used as a new reference value;
When the current reference value of the capacitive touch key is larger than the current sampling value and the difference value between the current reference value and the current sampling value is continuously larger than the noise value and smaller than the touch threshold value for a plurality of times, the current reference value of the capacitive touch key is downwards regulated by a second correction value to be used as a new reference value;
And when the current standard value of the capacitive touch key is larger than the current sampling value and the difference value between the current standard value and the current sampling value is larger than the touch threshold value which is 2 times, adjusting the standard value of the capacitive touch key to be the sum of the current sampling value and the touch threshold value which is 2 times.
5. An electronic device comprising a memory, a processor, and a computer program stored on the memory and executable on the processor, wherein the processor implements the capacitive touch key reference value correction method of any one of claims 1-3 when executing the program.
6. A computer readable medium, wherein computer executable instructions are carried in the computer readable medium, and the computer executable instructions are executed by a processor to implement the capacitive touch key reference value correction method according to any one of claims 1 to 3.
CN202410138098.0A 2024-02-01 2024-02-01 Capacitance touch key reference value correction method, device, equipment and readable medium Active CN117687535B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202410138098.0A CN117687535B (en) 2024-02-01 2024-02-01 Capacitance touch key reference value correction method, device, equipment and readable medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202410138098.0A CN117687535B (en) 2024-02-01 2024-02-01 Capacitance touch key reference value correction method, device, equipment and readable medium

Publications (2)

Publication Number Publication Date
CN117687535A CN117687535A (en) 2024-03-12
CN117687535B true CN117687535B (en) 2024-04-16

Family

ID=90132323

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202410138098.0A Active CN117687535B (en) 2024-02-01 2024-02-01 Capacitance touch key reference value correction method, device, equipment and readable medium

Country Status (1)

Country Link
CN (1) CN117687535B (en)

Citations (13)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN1979404A (en) * 2006-11-24 2007-06-13 启攀微电子(上海)有限公司 Self-adaptive judging method for capacitor type push-button
CN102722286A (en) * 2012-06-08 2012-10-10 深圳市汇顶科技有限公司 Reference updating method of touch detection terminal capable of removing large-scale interference and system
CN105119593A (en) * 2015-09-22 2015-12-02 惠州华阳通用电子有限公司 Capacitive button detection method and apparatus
CN105302383A (en) * 2014-06-23 2016-02-03 炬力集成电路设计有限公司 Anti-interference method and device for capacitive touch sensor
CN106656204A (en) * 2016-11-28 2017-05-10 杭州九阳小家电有限公司 Method and device for implementing interference resistance of touch key
CN109601015A (en) * 2017-07-31 2019-04-09 深圳市汇顶科技股份有限公司 Touch screen benchmark determines method, apparatus, touch screen and electric terminal
CN110995230A (en) * 2019-11-28 2020-04-10 九阳股份有限公司 Touch key processing method of food processor
CN111865289A (en) * 2020-06-18 2020-10-30 深圳市周立功单片机有限公司 Touch key detection device and method
CN113037268A (en) * 2021-03-22 2021-06-25 珠海格力电器股份有限公司 Method and device for adjusting key touch threshold
CN113126815A (en) * 2021-03-01 2021-07-16 卧安科技(深圳)有限公司 Key response control method and device, terminal equipment and storage medium
CN113659975A (en) * 2021-07-22 2021-11-16 无锡小净共享网络科技有限公司 Touch identification method, device, equipment and storage medium of touch key
CN114938224A (en) * 2022-05-17 2022-08-23 广东瑞德智能科技股份有限公司 Touch detection method of touch key, operation control device and storage medium
CN115562520A (en) * 2022-09-30 2023-01-03 王瑜亮 Method for identifying capacitive touch keys in humid environment

Patent Citations (13)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN1979404A (en) * 2006-11-24 2007-06-13 启攀微电子(上海)有限公司 Self-adaptive judging method for capacitor type push-button
CN102722286A (en) * 2012-06-08 2012-10-10 深圳市汇顶科技有限公司 Reference updating method of touch detection terminal capable of removing large-scale interference and system
CN105302383A (en) * 2014-06-23 2016-02-03 炬力集成电路设计有限公司 Anti-interference method and device for capacitive touch sensor
CN105119593A (en) * 2015-09-22 2015-12-02 惠州华阳通用电子有限公司 Capacitive button detection method and apparatus
CN106656204A (en) * 2016-11-28 2017-05-10 杭州九阳小家电有限公司 Method and device for implementing interference resistance of touch key
CN109601015A (en) * 2017-07-31 2019-04-09 深圳市汇顶科技股份有限公司 Touch screen benchmark determines method, apparatus, touch screen and electric terminal
CN110995230A (en) * 2019-11-28 2020-04-10 九阳股份有限公司 Touch key processing method of food processor
CN111865289A (en) * 2020-06-18 2020-10-30 深圳市周立功单片机有限公司 Touch key detection device and method
CN113126815A (en) * 2021-03-01 2021-07-16 卧安科技(深圳)有限公司 Key response control method and device, terminal equipment and storage medium
CN113037268A (en) * 2021-03-22 2021-06-25 珠海格力电器股份有限公司 Method and device for adjusting key touch threshold
CN113659975A (en) * 2021-07-22 2021-11-16 无锡小净共享网络科技有限公司 Touch identification method, device, equipment and storage medium of touch key
CN114938224A (en) * 2022-05-17 2022-08-23 广东瑞德智能科技股份有限公司 Touch detection method of touch key, operation control device and storage medium
CN115562520A (en) * 2022-09-30 2023-01-03 王瑜亮 Method for identifying capacitive touch keys in humid environment

Also Published As

Publication number Publication date
CN117687535A (en) 2024-03-12

Similar Documents

Publication Publication Date Title
US9377909B2 (en) Touchscreen data processing
EP3106970B1 (en) Signal adaptive filtering for touch detection
US8749507B2 (en) Systems and methods for adaptive interpretation of input from a touch-sensitive input device
CN103376937A (en) Method for controlling noise processing circuit of touch panel and signal processing device
CN113709623A (en) Earphone control method and device, earphone and storage medium
CN102156562A (en) Object sensing device, touch-control sensing system and touch-control sensing method
CN113126815B (en) Key response control method and device, terminal equipment and storage medium
CN117687535B (en) Capacitance touch key reference value correction method, device, equipment and readable medium
WO2014020380A1 (en) Method for performing touch detection and touch detection module therefor
CN113316759B (en) Capacitance detection circuit, touch chip and electronic equipment
CN107943536B (en) Method and device for adjusting threshold, storage medium and electronic equipment
CN113126814B (en) Key non-response correction method and device, terminal equipment and storage medium
CN113126813B (en) Correction method and device for key misjudgment, terminal equipment and storage medium
CN111459346A (en) Capacitive touch device and gesture recognition method, chip and storage medium thereof
CN113504840B (en) Touch data processing method and device and touch screen
CN112507994B (en) Method and device for determining pressure reference value, chip and electronic equipment
CN102122224B (en) Circuit module and method for touch detection
WO2022165733A1 (en) Method and apparatus for determining pressure reference value, and chip and electronic device
CN110633020B (en) Sensing method of touch control identification device and sensing module thereof
CN115016661A (en) Capacitive sensing touch device, control signal output method thereof and storage medium
CN113810038A (en) Updating method of environment threshold in touch induction, touch sensor and water outlet device
CN115877978A (en) Baseline tracking method and device of touch screen
CN115469769A (en) Touch detection method and device of capacitive screen
CN117691982A (en) Self-adaptive detection and identification method and device for key state of capacitive key
CN110580097A (en) Touch gesture recognition system and method

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
GR01 Patent grant