0 Introduction
MCU (Micro Controller Unit) is the Chinese name for multi-point control unit, also known as single chip microcomputer. It refers to the integration of computer CPU, RAM, ROM, timer and multiple I/O interfaces on a single chip with the emergence and development of large-scale integrated circuits to form a chip-level computer, which can perform different combination controls for different application scenarios.
In applications that require a user interface, traditional electromechanical switches are being replaced by capacitive touch sensing controls. The touch sensing software can detect the touch of a human hand by controlling the RC charge and discharge time consisting of a resistor and the touch electrode capacitance. The change in RC charge and discharge time due to the change in electrode capacitance can be detected, then filtered, and finally sent to the host system through a dedicated I/O port or I2C/SPI interface. The components BOM required by the software library is low cost because only two resistors are needed per channel to realize the touch detection function.
1 RC induction principle
The RC sampling principle is to sense the human body's touch on the capacitive touch sensor (button, roller or slider) by measuring the tiny changes in the capacitance of the touch electrode.
The electrode capacitance (C) is periodically charged and discharged through a fixed resistor (R). The capacitance value depends on several parameters: electrode area (A), relative dielectric constant of the insulator ( ), relative humidity of the air ( ), and the distance between the two electrodes (d). The capacitance value can be obtained by the following formula
Figure 1 RC voltage detection
When a fixed voltage is applied, the voltage at increases or decreases accordingly as the capacitance value changes, as shown in Figure 2.
Figure 2 Measuring charging time
The capacitance value (C) is obtained by calculating the charging time ( ) required for the voltage to reach the threshold. In touch sensing applications, the capacitance value (C) consists of two parts: fixed capacitance (electrode capacitance, ) and capacitance (sensing capacitance, ) caused by the human hand when the hand touches or approaches the electrode. Using this principle, it is possible to detect whether the finger touches the electrode.
Figure 3 Touch Sensing
This is the basic principle used by the sensing layer in touch sensing software to detect human touch.
2 Hardware Implementation
Figure 4 shows an implementation example. An RC network is formed by R1, R2 and the capacitor (about 5pF) in parallel with the capacitor electrode ( ) and the finger capacitor ( ). By measuring the charge and discharge time of this RC network, the touch of the human hand can be detected. All electrodes share a "load I/O" pin. Capacitor R2 (10K?) is optional and is used to reduce the impact of noise.
Figure 4 Capacitive touch sensing implementation example
3 Software Implementation
This chapter describes the implementation of the touch sensing RC principle.
3.1 Charging time measurement principle
To ensure robust capacitive touch sensing applications, the charge time measurement needs to be sufficiently accurate.
A simple timer (no IC function required) and a series of simple software operations are used to periodically check whether the voltage on the sensing I/O port reaches the threshold.
3.2 Basic Measurements
Use a normal timer to measure the charging time. Before charging the capacitor, the timer counter value is recorded. When the voltage on the sampled I/O port reaches a certain threshold ( ), the timer counter value is recorded again. The difference between the two is the charging or discharging time.
Figure 5 Timer counter value
3.3 Oversampling
The purpose of oversampling is to measure the time it takes for the input voltage to reach high and low levels ( and ) with the accuracy of the CPU clock. In order to cover all value ranges, each measurement is delayed by one CPU clock cycle compared to the previous measurement. [page]
Figure 6 Input voltage measurement
3.4 Principle of input voltage measurement
To improve stability under voltage and temperature variations, the electrode is measured twice in succession: the first measurement is the charging time of the capacitor until the input voltage rises to . The second measurement is the discharge time of the capacitor until the input voltage drops to . The following figure and the table below detail the operation flow on the sensing electrode (sense I/O) and the load I/O pin.
Table 2 Capacitor charge and discharge measurement steps
3.5 Effects of Touch
The capacitance value of the electrode ( ) depends on several main factors: the shape and size of the electrode, the wiring between the touch sensing controller and the electrode (especially the ground coupling), and the material and thickness of the dielectric panel. Figure 8 illustrates this "touch effect". The time (i.e. the moment when the level is reached) is longer than that; similarly, the time to drop to the level is also longer than that.
Figure 8 Touch effect example
3.6 Multiple measurements and removal of high-frequency noise
In order to improve the measurement accuracy and remove high-frequency noise, it is necessary to measure and multiple times before deciding whether any key is effectively "touched".
Figure 9 Types of measurements
Note: The figure below illustrates an example of noise removal. If the number of measurements (N) is set to 4, then a complete measurement of one electrode will consist of 4 correct "Batch Group Measurements" (BGs).
Figure 10 shows the situation where all measurements are valid without the influence of noise. In this example, each measurement in the continuous group of measurements is valid, allowing a complete measurement to be completed very quickly.
Figure 10 Example 1
Figure 11 shows a situation where there is some noise that makes some measurements invalid (i.e., r1 and r2). In this example, the continuous group measurement BG3 is repeated several times until all the measurements in it are valid and the group measurement passes.
Figure 11 Example 2
Figure 12 shows that there is a lot of noise, which makes the number of invalid group measurements reach the maximum limit (for example, 20). In this case, the entire electrode measurement is invalid.
Figure 12 Example 3
Previous article:Design of Carbon Monoxide Monitoring Alarm Based on ADuC834
Next article:PIC16F84A single chip microcomputer LED light circuit and source program
Recommended ReadingLatest update time:2024-11-16 20:37
- Popular Resources
- Popular amplifiers
- Wireless Sensor Network Technology and Applications (Edited by Mou Si, Yin Hong, and Su Xing)
- Modern Electronic Technology Training Course (Edited by Yao Youfeng)
- Modern arc welding power supply and its control
- Small AC Servo Motor Control Circuit Design (by Masaru Ishijima; translated by Xue Liang and Zhu Jianjun, by Masaru Ishijima, Xue Liang, and Zhu Jianjun)
Professor at Beihang University, dedicated to promoting microcontrollers and embedded systems for over 20 years.
- Innolux's intelligent steer-by-wire solution makes cars smarter and safer
- 8051 MCU - Parity Check
- How to efficiently balance the sensitivity of tactile sensing interfaces
- What should I do if the servo motor shakes? What causes the servo motor to shake quickly?
- 【Brushless Motor】Analysis of three-phase BLDC motor and sharing of two popular development boards
- Midea Industrial Technology's subsidiaries Clou Electronics and Hekang New Energy jointly appeared at the Munich Battery Energy Storage Exhibition and Solar Energy Exhibition
- Guoxin Sichen | Application of ferroelectric memory PB85RS2MC in power battery management, with a capacity of 2M
- Analysis of common faults of frequency converter
- In a head-on competition with Qualcomm, what kind of cockpit products has Intel come up with?
- Dalian Rongke's all-vanadium liquid flow battery energy storage equipment industrialization project has entered the sprint stage before production
- Allegro MicroSystems Introduces Advanced Magnetic and Inductive Position Sensing Solutions at Electronica 2024
- Car key in the left hand, liveness detection radar in the right hand, UWB is imperative for cars!
- After a decade of rapid development, domestic CIS has entered the market
- Aegis Dagger Battery + Thor EM-i Super Hybrid, Geely New Energy has thrown out two "king bombs"
- A brief discussion on functional safety - fault, error, and failure
- In the smart car 2.0 cycle, these core industry chains are facing major opportunities!
- The United States and Japan are developing new batteries. CATL faces challenges? How should China's new energy battery industry respond?
- Murata launches high-precision 6-axis inertial sensor for automobiles
- Ford patents pre-charge alarm to help save costs and respond to emergencies
- New real-time microcontroller system from Texas Instruments enables smarter processing in automotive and industrial applications
- [TI recommended course] #Switch-mode power converter compensation is simple and easy#
- [Silicon Labs BG22-EK4108A Bluetooth Development Review] 5. Automatically Create a Serial Printing Project
- [RVB2601 Creative Application Development] + Unboxing and Trial
- Causes and solutions for DSP chip cold soldering
- Do I have the right to share the software manual of eLinx2.1.1, the FPGA tool of Yihaiwei?
- [Allwinner heterogeneous multi-core AI intelligent vision V853 development board evaluation] nfs configuration
- Two-Phase Interleaved LLC Resonant Converter Reference Design Using C2000 MCU
- TI CC3200 WIFI Training Development Kit (OURS-SDK-WFB) IAR for ARM7.8 Debugging 1————Data Preparation
- Jiang Shangyi returns, Liang Mengsong resigns! SMIC responds
- SparkRoad FPGA development board drives LVDS display