The induction key based on ATmega48 is very simple in hardware design. Each key only needs one resistor and one capacitor to realize it. Usually, the induction electrode is distributed on the printed circuit board in the form of copper foil. The induction electrode can be designed into different sizes and shapes according to specific application needs. At the same time, the use of conductive media such as metal springs or conductive sponges can extend the key to a suitable length or height, as shown in Figure 2.
Figure 2 Sensing electrode extended by metal spring
Figure 3 Hardware schematic diagram
In typical applications, the sampling capacitor C1 or C2 uses 22 nF, and the current limiting resistor R1 or R2 uses 1 kΩ. However, in actual application systems, the capacitance of the sampling capacitor and the resistance of the current limiting resistor need to be adjusted according to the sensitivity of the sensing button to achieve the best effect. The hardware schematic is shown in Figure 3.
4 Library installation and software configuration
To use the I/O port of the ATmega48 microcontroller as a sensor key input port, you first need to install the QTouch library Atmel_QTouch_Libraries. The latest version of the library is 4.3. After installation, you need to load the library file corresponding to the microcontroller into the project. Atmel's integrated development environment AVR Studio provides convenient settings. After creating a new project, you can add the library link file in the Project→Configuration Options→Libraries interface.
Secondly, you need to configure the I/O port. Set the corresponding macro definition parameters in the project configuration (Project→Configuration Options→Custom Options) interface, as shown in Figure 4.
Figure 4 AVR Studio project configuration interface
D_QTOUCH_: Requires the use of the QTouch function library.
DSNSK=C and DSNS=C: means setting the ATmega48 PC port as the sensor key port.
DQT_NUM_CHANNELS=4: indicates the maximum number of available channels.
DQT_DELAY_CYCLES=1: indicates the charging and discharging cycle time of the sampling capacitor.
In addition, the header file of the library function needs to be added to the application system source program. The code is as follows:
#include "touch_api.h"
5 System Application
The application process is shown in Figure 5. After the system is initialized, the config_sensors() function is first called to configure the required I/O port as the sampling port of the sensing button, and the various states of each sensing button are initialized. Then the sensing parameters are set, including the button calibration threshold, positive drift value, negative drift value, maximum continuous sensing time, etc. Finally, in the main program of the application system, the library function qt_measuer_channels() needs to be called periodically to measure the sensing signal and detect the state of the button.
Figure 5 QTouch application process
It should be noted that the sensing key acquisition uses a timer interrupt of the system, so the interrupt program in the application system will have a certain impact on it. This requires that during the key sensing process, the processing time of the interrupt service program of the application system should be as short as possible. When the capacitive sensing is working, the interrupt service program processing time should not exceed 1 ms, otherwise it will seriously affect the sensitivity of the sensing key and even cause the sensing key to malfunction.
The application system procedures are as follows:
int main( void ){
init_system();/*System initialization*/
config_sensors();/*Configure the I/O port as a sensor button*/
qt_init_sensing();/*Initialize the sensing sensor*/
qt_set_parameters();/*Sensing parameter settings*/
init_timer_isr();/*Timer setting for sensing buttons*/
qt_filter_callback = 0;/*Filter parameter selection*/
__enable_interrupt();/*Enable timer interrupt*//*Application main loop*/
while (1) {
if( time_to_measure_touch ) {
time_to_measure_touch = 0u; /*Continue to the next acquisition cycle*/
qt_measure_sensors( current_time_ms_touch );/*Sensor detection*/
}
KeyBuff = (qt_measure_data.qt_touch_status.sensor_states[0]);/*Get the sensor key status*/
.../*System applications*/
}
}
6 Conclusion
The embedded inductive button design based on Atmel QTouch technology simplifies the design difficulty, reduces the application cost of the system, saves the size and space of the printed circuit board, and the system application is stable and can be flexibly applied to various electronic products.
Previous article:Design of induction button based on embedded technology1
Next article:Introduction to the working principles of various types of touch screens
- Popular Resources
- Popular amplifiers
- Semantic Segmentation for Autonomous Driving: Model Evaluation, Dataset Generation, Viewpoint Comparison, and Real-time Performance
- Machine Learning and Embedded Computing in Advanced Driver Assistance Systems (ADAS)
- Intelligent program synthesis framework and key scientific problems for embedded software
- arm_embedded_machine_learning_design_dummies_guide
- High signal-to-noise ratio MEMS microphone drives artificial intelligence interaction
- Advantages of using a differential-to-single-ended RF amplifier in a transmit signal chain design
- ON Semiconductor CEO Appears at Munich Electronica Show and Launches Treo Platform
- ON Semiconductor Launches Industry-Leading Analog and Mixed-Signal Platform
- Analog Devices ADAQ7767-1 μModule DAQ Solution for Rapid Development of Precision Data Acquisition Systems Now Available at Mouser
- Domestic high-precision, high-speed ADC chips are on the rise
- Microcontrollers that combine Hi-Fi, intelligence and USB multi-channel features – ushering in a new era of digital audio
- Using capacitive PGA, Naxin Micro launches high-precision multi-channel 24/16-bit Δ-Σ ADC
- Fully Differential Amplifier Provides High Voltage, Low Noise Signals for Precision Data Acquisition Signal Chain
- 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
- Questions about generating light painting with allegro16.6
- NUCLEO-G431RB Review -> OPAMP
- CCS8.0
- [GD32L233C-START Review] - 8. Driving a 1.5-inch OLED screen using ordinary GPIO
- High-speed acquisition module
- What does USB_OTG_FS and USB_OTG_HS mean?
- I2C Master Mode for TI BLE CC2541
- Where can I find the PHI EVM Controller information for the TI ADC acquisition board?
- Loto Practical Tips (8) Application of Loto Oscilloscope in Repairing LED Desk Lamp Dimming Problems
- [NXP Rapid IoT Review] W2-Sensor Data Collection Test