Touch key detection method and detection circuit, microcontroller and touch detection system

By using an ADC module in a microcontroller for DFT transformation and phase comparison, the problem of false triggering of touch buttons in humid environments is solved, achieving higher detection accuracy and cost-effectiveness.

CN115617199BActive Publication Date: 2026-02-03NANJING QINHENG MICROELECTRONICS CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202211263482.0
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Priority Date
2022-09-14
Filing Date
2022-10-14
Publication Date
2026-02-03
Estimated Expiration
2042-10-14

AI Technical Summary

Technical Problem

Existing touch button detection methods are prone to false triggering in humid or wet environments, increasing the possibility of misjudgment.

Method used

A sinusoidal signal detection method is adopted. The DFT transformation is performed by the ADC module in the microcontroller to calculate the signal phase change. Combined with the reference phase comparison, the touch operation is judged. The characteristic of capacitor current phase lead is utilized to reduce false judgment.

Benefits of technology

It reduces false triggering in humid and wet environments, improves the accuracy of touch button detection, reduces the impact of external interference, and saves costs by eliminating the need for an additional independent module.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN115617199B_ABST
    Figure CN115617199B_ABST
Patent Text Reader

Abstract

The application discloses a touch key detection method and detection circuit, a microcontroller and a touch detection system. The method comprises the following steps: inputting a sinusoidal signal to a touch key sensor; sampling an output signal of the touch key sensor by an ADC module; performing DFT transformation on a sampling result of the ADC module by the microcontroller to obtain a frequency point energy; calculating a phase according to the frequency point energy; comparing the phase with a preset reference phase; and determining that a touch operation is performed when the phase is smaller than the reference phase. The sampling method of the ADC module comprises the following steps: setting a sampling synchronization phase and a sampling point number N; starting sampling by the ADC module when the sinusoidal signal is located at the sampling synchronization phase; and taking N sampling points which are collected at equal intervals continuously as the sampling result of the ADC module. The application can reduce touch misjudgment and improve waterproof effect.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of touch button technology, and in particular to touch button detection methods and detection circuits, microcontrollers and touch detection systems. Background Technology

[0002] Compared to traditional mechanical buttons, capacitive touch buttons offer significant advantages such as longer lifespan, durability, stylish design, and lower cost. Therefore, an increasing number of microcontrollers are integrating touch button functionality on-chip. Touch buttons typically employ detection methods based on relaxation oscillation, current sources, and charge migration. Each of these methods requires a dedicated touch button module, consuming wafer space and increasing the manufacturing cost of the microcontroller.

[0003] The circuit principles of the three commonly used touch button detection methods mentioned above are as follows: Figure 1 The figures shown all represent the parasitic capacitance to ground on the touch button sensor. When no button is pressed, the capacitance detected by the touch button module is the parasitic capacitance C of the touch sensor. x If a button is pressed, the detected capacitance is the parasitic capacitance C of the touch sensor. x and human touch capacitance C T This allows the system to determine whether a button has been pressed based on the change in capacitance.

[0004] While the three commonly used touch button detection methods mentioned above can meet the needs of regular touch button applications, they also have the problem of being easily triggered in humid or wet environments. Summary of the Invention

[0005] Purpose of the invention: In order to solve the problem that touch button detection in the prior art is prone to false triggering in humid and wet environments, the present invention provides a touch button detection method, detection circuit, microcontroller and touch detection system.

[0006] Firstly, to achieve the above objectives, the technical solution adopted by the present invention is: a touch button detection method, comprising the following steps:

[0007] Input a sine wave signal to the touch button sensor;

[0008] The ADC module samples the output signal of the touch button sensor. The microcontroller performs DFT transformation on the sampling result of the ADC module to obtain the frequency point energy. The phase is calculated based on the frequency point energy. The phase is compared with a preset reference phase. When the phase is less than the reference phase, it is determined to be a touch operation.

[0009] The sampling method of the ADC module includes: setting the sampling synchronization phase and the number of sampling points N; when the sine signal is at the sampling synchronization phase, the ADC module starts sampling, and the N sampling points collected at equal intervals are taken as the sampling result of the ADC module.

[0010] Furthermore, let the frequency of the sinusoidal signal be fo, and the sampling frequency of the ADC module be fs, satisfying fs = M * fo, where M is a positive integer.

[0011] Furthermore, the method for calculating the phase based on the sampling results of the ADC module is as follows:

[0012] The DFT transformation formula is as follows:

[0013]

[0014] Where x[n] is the sampled value of the ADC module, X[k] is the frequency point energy, k is the harmonic order, and N is the number of sampling points;

[0015] Assuming the real and imaginary parts of X[k] are R and I respectively, calculate the phase based on R and I:

[0016]

[0017] Furthermore, the method for calculating the reference phase includes: under the condition that there is no touch and no droplet interference on the touch button sensor, a sine signal is input to the touch button sensor, the ADC module samples the output signal of the touch button sensor, the sampling result is subjected to DFT transformation to obtain the frequency point energy, and the phase of the frequency point energy is calculated as the reference phase.

[0018] Furthermore, the ADC module samples the output signal of the touch button sensor multiple times, calculates the phase corresponding to each sampling result, and takes the average of all phases as the reference phase.

[0019] Furthermore, the method for generating the sinusoidal signal includes:

[0020] Quantize the sinusoidal signal to be output into a sinusoidal function table;

[0021] Every fixed time interval T1, a value is taken from the sine function table and sent to the DAC module, and a sine signal is generated through the output register of the DAC module.

[0022] A microcontroller includes a sine wave signal generation module, an ADC module, a memory, and a processor. The memory stores a software program, and when the processor executes the software program, it implements the aforementioned touch button detection method.

[0023] A touch detection system includes the microcontroller described above and at least one touch button sensor, wherein the touch button sensor is connected to the microcontroller.

[0024] A touch button detection circuit includes a processor, a touch button sensor, a sine wave signal generation module, and an ADC module. The input terminal of the touch button sensor is connected to the output terminal of the sine wave signal generation module, the output terminal of the touch button sensor is connected to the input terminal of a current-to-voltage conversion amplifier circuit, the output terminal of the current-to-voltage conversion amplifier circuit is connected to the input terminal of an anti-aliasing filter, and the output terminal of the anti-aliasing filter is connected to the input terminal of the ADC module.

[0025] The processor is used to control the sine wave signal generation module to output a sine wave signal. When the output sine wave signal is at the sampling synchronization phase, the processor controls the ADC module to sample the output signal of the touch button sensor. The processor calculates the phase based on the sampling result of the ADC module and determines the touch operation based on the phase change.

[0026] Furthermore, the touch button sensor includes a transmitting electrode and a receiving electrode, with the transmitting electrode forming a semi-enclosed structure around the receiving electrode, and the receiving electrode extending out from the opening of the semi-enclosed structure.

[0027] Beneficial effects: Compared with existing technologies:

[0028] 1. This invention detects the phase change of the signal flowing through the touch button sensor. Based on the characteristic that the current phase of a capacitor leads, the capacitance change of the touch button sensor is obtained. When a person's hand approaches the touch button sensor, part of the electric field will couple from the human body to the ground, causing the measured capacitance to decrease, thus indicating that a touch has occurred. If water stains or oil stains adhere to the touch button sensor, the coupling between the transmitting and receiving electrodes of the touch button sensor is enhanced, and the measured capacitance increases, which is the opposite of the phenomenon caused by human touch. This reduces touch misjudgment and achieves a waterproof effect.

[0029] 2. The basic capacitance of the touch button sensor of the present invention is affected by the distance and parallel length between the transmitting and receiving electrodes, so the basic capacitance is controllable; and the receiving electrode is contained inside the transmitting electrode, which is not easily affected by nearby devices, traces, and ground, thus increasing the anti-interference capability.

[0030] 3. This invention uses the built-in ADC module of a general-purpose microcontroller for touch button detection, eliminating the need for an additional independent touch button module, resulting in small size and low cost. Attached Figure Description

[0031] Figure 1 This is a schematic diagram of a traditional touch button detection circuit.

[0032] Figure 2This is a schematic diagram of the touch button detection method of the present invention;

[0033] Figure 3 This is a schematic diagram of the electric field of the human body proximity touch button sensor of the present invention;

[0034] Figure 4 This is a schematic diagram of the equivalent capacitance of the touch button sensor of the present invention after a water droplet is attached to it;

[0035] Figure 5 This is a schematic diagram of the touch button detection circuit in Embodiment 1;

[0036] Figure 6 This is a schematic diagram of the touch button sensor structure in Embodiment 1;

[0037] Figure 7 This is a schematic diagram of another type of touch button sensor structure. Detailed Implementation

[0038] The technical solutions of the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of the present invention, and not all embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of the present invention.

[0039] like Figure 2 As shown, this invention proposes a touch button detection method, comprising the following steps:

[0040] The sine wave signal generation module outputs a sine wave signal to the touch button sensor 1. The method for outputting the sine wave signal includes: quantizing the sine wave signal to be output into a sine function table; taking values ​​from the sine function table at fixed time intervals T1 and sending them to the DAC module; and generating a sine wave signal through the output register of the DAC module. In this embodiment, a DAC module is used to generate the sine wave signal, which is suitable for scenarios where the microcontroller itself contains a DAC module, allowing direct reuse of its own DAC. However, the method for generating the sine wave signal is not limited to this one; for example, SPWM can be used for lookup table filtering to output a sine wave, or a sine wave oscillation circuit can be used. The ADC module samples the output signal of the touch button sensor 1. The microcontroller performs a DFT transformation on the sampling results of the ADC module to obtain the frequency point energy, calculates the phase based on the frequency point energy, and compares the phase with a preset reference phase. When the phase is less than the reference phase, a touch operation is determined. Touch detection utilizes the characteristic of capacitor current phase lead; a larger phase leads to a larger capacitance, and vice versa. The capacitance of the touch button sensor 1 changes differently in different scenarios, such as... Figure 3As shown, the touch button sensor 1 generally does not directly contact the finger, otherwise a short circuit will occur. Therefore, it is usually used under a covering (such as an acrylic sheet). When a person's hand approaches the touch button sensor 1, part of the electric field will couple from the human body to ground, causing the capacitance to decrease. At this time, the phase calculated by the ADC module also decreases, thus allowing the detection of a touch. Figure 4 As shown, when water stains or oil stains adhere to the touch button sensor 1, the equivalent capacitance of the touch button sensor 1 is C. X and C water Therefore, the capacitance increases, which is the opposite of the phenomenon produced by human touch. So, the method of using phase to determine whether the touch button sensor 1 is being operated can have the effect of waterproofing and preventing interference.

[0041] The reference phase is used to compare whether the phase of the acquired signal has changed. The calculation method of the reference phase includes: under the condition of no touch and no droplet interference, the sine wave signal generation module inputs a sine wave signal to the touch button sensor 1, the ADC module samples the output signal of the touch button sensor 1, the sampling result is subjected to DFT transformation to obtain the frequency point energy, and the phase is calculated based on the frequency point energy as the reference phase. Under the condition of no touch and no droplet interference, the capacitance of the touch button sensor 1 will not change, so the phase will not change either. The phase calculated under this condition can be used as the reference phase. In order to ensure the accuracy of the reference phase, the ADC module can also sample the output signal of the touch button sensor 1 multiple times to calculate multiple phase values. The reference phase is obtained by averaging the multiple phase values. The averaging method can reduce the generation of errors.

[0042] The sampling method of the ADC module includes: setting a sampling synchronization phase and the number of sampling points N. When the sinusoidal signal is at the sampling synchronization phase, the ADC module starts continuous, equally spaced sampling, and uses the N consecutively equally spaced sampling points as the sampling result of the ADC module. The sampling synchronization phase is to ensure that the position of the input sinusoidal signal is the same as the starting position of the ADC module sampling. In a microcontroller, the microcontroller can receive feedback information from the DAC module for each signal it sends. This facilitates the control of the ADC module to perform synchronous sampling. The phase of the sampled signal after synchronization can be calculated and compared with a reference phase. The ADC module samples N sampling points each time, and the DFT transform and phase calculation can be performed using the N sampling points. The DFT transform formula is as follows:

[0043]

[0044] Where x[n] is the sampled value of the ADC module, X[k] is the frequency point energy, k is the harmonic order, and N is the number of sampling points. The frequency of the sinusoidal signal is set to fo, and the sampling frequency of the ADC module is fs, satisfying fs = M * fo. For ease of calculation, let N = M, so that when the ADC module samples N points, it can sample a complete cycle of the sinusoidal signal. Assuming the sinusoidal signal frequency is set to 1kHz, the sampling frequency is configured to 512kHz, and N is 512, then analyzing the frequency response at 1kHz, with k taking a value of 1, the calculated frequency point energy is the fundamental energy. After obtaining the frequency point energy, the phase is calculated: Assuming the real and imaginary parts of X[k] are R and I respectively, the phase is calculated based on R and I:

[0045]

[0046] This invention proposes a microcontroller, including a sine wave signal generation module, an ADC module, a memory, and a processor. The memory stores a software program, which enables the processor to implement the touch button detection method described above when executing the software program. This invention also proposes a touch detection system, including the microcontroller described above and at least one touch button sensor 1, with the touch button sensor 1 connected to the microcontroller.

[0047] like Figure 5 As shown, a touch button detection circuit includes a processor, a touch button sensor 1, a sine wave signal generation module, and an ADC module. In this embodiment, the sine wave signal is generated by the DAC module, which is built into the microcontroller itself. Alternatively, other circuits capable of generating sine waves, such as an SPWM generation module or a sine wave oscillation circuit, can also be used. The input terminal of the touch button sensor 1 is connected to the output terminal of the DAC module. The output terminal of the touch button sensor 1 is connected to the input terminal of a current-to-voltage conversion amplifier circuit. The output terminal of the current-to-voltage conversion amplifier circuit is connected to the input terminal of an anti-aliasing filter. The output terminal of the anti-aliasing filter is connected to the input terminal of the ADC module. The current-to-voltage conversion amplifier circuit also includes a feedback resistor R. f By adjusting the feedback resistor R f The magnitude of the voltage level ensures that the amplified output signal is within the sampling range of the ADC module. The output of the DAC module is connected to the input of the touch button sensor 1 via a voltage follower, which enhances the output driving capability. The processor controls the DAC module to output a sinusoidal signal. When the output sinusoidal signal is at the sampling synchronization phase, it controls the ADC module to sample the output signal of the touch button sensor 1. The processor performs a DFT transform based on the ADC module's sampling results to obtain the frequency point energy, calculates the phase based on the frequency point energy, and compares the phase with a preset reference phase. When the phase is less than the reference phase, it is determined to be a touch operation.

[0048] To further prevent external interference from affecting the use of the touch button sensor 1, the structure of the touch button sensor 1 can be as follows: Figure 6 As shown, the touch button sensor 1 includes a transmitting electrode 11 and a receiving electrode 12. The transmitting electrode 11 forms a semi-enclosed structure around the receiving electrode 12, and the receiving electrode 12 extends from the opening of the semi-enclosed structure. The receiving electrode 12 is contained inside the transmitting electrode 11, making it less susceptible to external interference. Different structures of touch button sensors 1 will result in different capacitance changes due to variations in human hand contact. The structure of the touch button sensor 1 can also be as follows... Figure 7 As shown, both the receiving electrode 12 and the transmitting electrode 11 are conductive sheets. A closed region is formed inside the transmitting electrode 11, and the receiving electrode 12 is disposed inside the transmitting electrode 11 and does not contact the transmitting electrode 11.

Claims

1. A method for detecting touch buttons, characterized in that, Includes the following steps: Input a sine wave signal to the touch button sensor; The ADC module samples the output signal of the touch button sensor. The microcontroller performs DFT transformation on the sampling result of the ADC module to obtain the frequency point energy. The phase is calculated based on the frequency point energy. The phase is compared with a preset reference phase. When the phase is less than the reference phase, it is determined to be a touch operation. The sampling method of the ADC module includes: setting the sampling synchronization phase and the number of sampling points N; when the sinusoidal signal is at the sampling synchronization phase, the ADC module starts sampling and takes the N sampling points collected at equal intervals as the sampling result of the ADC module; let the frequency of the sinusoidal signal be fo, and the sampling frequency of the ADC module be fs, satisfying fs=M*fo, where M is a positive integer; The method for calculating the reference phase includes: under the condition that there is no touch and no droplet interference on the touch button sensor, a sine signal is input to the touch button sensor, the ADC module samples the output signal of the touch button sensor, the sampling result is subjected to DFT transformation to obtain the frequency point energy, and the phase of the frequency point energy is calculated as the reference phase.

2. The touch button detection method according to claim 1, characterized in that, The method for calculating the phase based on the sampling results of the ADC module is as follows: The DFT transformation formula is as follows: , in These are the sampled values ​​from the ADC module. It represents the energy at a frequency point, k is the harmonic order, and N is the number of sampling points; Assumption The real and imaginary parts are R and I, respectively. Calculate the phase based on R and I: 。 3. The touch button detection method according to claim 1 or 2, characterized in that, The ADC module samples the output signal of the touch button sensor multiple times, calculates the phase corresponding to each sampling result, and takes the average of all phases as the reference phase.

4. The touch button detection method according to claim 1 or 2, characterized in that, The method for generating the sinusoidal signal includes: Quantize the sinusoidal signal to be output into a sinusoidal function table; Every fixed time interval T1, a value is taken from the sine function table and sent to the DAC module, and a sine signal is generated through the output register of the DAC module.

5. A microcontroller, characterized in that, It includes a sine wave signal generation module, an ADC module, a memory, and a processor. The memory stores a software program, and when the processor executes the software program, it implements the touch button detection method as described in any one of claims 1-4.

6. A touch detection system, characterized in that, It includes a microcontroller as described in claim 5 and at least one touch button sensor, wherein the touch button sensor is connected to the microcontroller.

7. A touch button detection circuit, characterized in that, The system includes a processor, a touch button sensor, a sine wave signal generation module, and an ADC module. The input terminal of the touch button sensor is connected to the output terminal of the sine wave signal generation module. The output terminal of the touch button sensor is connected to the input terminal of a current-to-voltage conversion amplifier circuit. The output terminal of the current-to-voltage conversion amplifier circuit is connected to the input terminal of an anti-aliasing filter. The output terminal of the anti-aliasing filter is connected to the input terminal of the ADC module. The processor controls the sinusoidal signal generation module to output a sinusoidal signal. When the output sinusoidal signal is at the sampling synchronization phase, it controls the ADC module to start sampling the output signal of the touch button sensor and takes the N sampling points collected at equal intervals as the sampling result of the ADC module. Let the frequency of the sinusoidal signal be fo, and the sampling frequency of the ADC module be fs, satisfying fs=M*fo, where M is a positive integer. The processor calculates the phase based on the sampling results of the ADC module, performs DFT transformation on the sampling results of the ADC module to obtain frequency point energy, calculates the phase based on the frequency point energy, determines touch operation based on phase change, compares the phase with a preset reference phase, and determines touch operation when the phase is less than the reference phase. The method for calculating the reference phase includes: under the condition that there is no touch and no droplet interference on the touch button sensor, a sine signal is input to the touch button sensor, the ADC module samples the output signal of the touch button sensor, the sampling result is subjected to DFT transformation to obtain the frequency point energy, and the phase of the frequency point energy is calculated as the reference phase.

8. The touch button detection circuit according to claim 7, characterized in that, The touch button sensor includes a transmitting electrode and a receiving electrode. The transmitting electrode surrounds the receiving electrode in a semi-enclosed structure, and the receiving electrode extends out from the opening of the semi-enclosed structure.

Citation Information

Patent Citations

  • Impedance characteristic testing device

    CN111983317A

  • Touch display

    US20110216039A1