Summary:
This article focuses on how to use AT89S51, touch screen and touch screen controller ADS7846 to realize three-dimensional data collection and preprocessing of online dynamic signatures.
Due to the advantages of touch screen input, such as convenience, thinness and portability, more and more electronic products now use touch screens as input devices for human-machine interfaces. In dynamic signature authentication, the touch screen is also used as an input device to collect handwriting data.
The system is mainly composed of four-wire resistive touch screen, touch screen controller ADS7846, and single-chip microcomputer 89S51. The system block diagram is shown in Figure 1.
Four-wire resistive touch screen
The resistive touch screen uses resistive analog technology. It uses a layer of glass as the base layer, which is coated with a conductive layer of transparent oxide metal (ITO indium oxide), which is then covered with a layer of glass or a smooth plastic layer with a hardened outer surface. Its inner surface is also coated with a layer of ITO. There are many small transparent isolation points between the conductive layers to insulate the two conductive layers. Whenever a pen or finger is pressed, the two conductive layers contact each other, thus forming a circuit (Figure 2).
Both ends of the conductive layer are coated with a strip of silver glue, which is called a pair of electrodes on the working surface. One of the upper and lower conductive layers is in the horizontal direction and the other is in the vertical direction. They are used to measure the X and Y coordinate positions respectively. The electrodes on the horizontal plane are called X+ electrodes and X-electrodes, and the electrodes on the vertical plane are called Y+ electrodes and Y- electrodes. When working, the two electrodes provide a reference voltage according to the measurement needs or serve as measurement terminals to measure the position of the contact point. When measuring the X coordinate of the contact point, the X+ electrode and X- electrode on the conductive layer are connected to the reference voltage and If no voltage is applied to the ground and Y electrodes, a uniform voltage distribution will be formed between the The Y coordinate is similar. It only needs to be changed to apply voltage to the Y electrode and not apply voltage to the X electrode.
The principle of measuring touch pressure is related to the characteristics of the ITO (indium oxide) material. The conductivity formula of the ITO conductive film is r=r0(1+l0/d), where d is the thickness of the conductive film, so the conductivity of ITO It is inversely proportional to the thickness of the ITO conductive film, so when the touch pressure is greater, the ITO conductive film at the contact point is thinner, so the corresponding conductivity is greater and the resistance is smaller. Therefore, the measurement of touch pressure is essentially to measure the contact The resistance value of ITO conductive film.
Communication between ADS7846 and AT89S51
ADS7846 is a digital-to-analog conversion chip produced by BURN-BROWN specifically for four-wire resistive touch screens. There is a measurement circuit network composed of multi-channel analog switches and a 12-bit A/D converter inside. When working, 7846 opens the corresponding switch channel according to the different command words received by the data input port DIN, and accepts the returned analog voltage, obtains the corresponding digital quantity through A/D conversion, and then transmits it back to the microcontroller through DOUT.
AT89S51 is an upgraded product of ATMEL's newly launched 89C51.
The communication between AT89S51 and ADS7846 is mainly carried out through the I/O port of the microcontroller and the five pins of CLK, CS, DOUT, DIN and BUSY of the 7846. When the system is working, the microcontroller first selects the 7846 through the chip select signal, then sends the command control word data to the 7846 through DIN, and matches it with the corresponding timing pulse through the CLK pin. When the BUSY bit is set, it passes the DOUT data output port. Get the 12-bit conversion result.
Since the system is required to collect three-dimensional data including X coordinates, Y coordinates and pressure, first send the command word to open the measurement X channel, and the returned digital value is the X coordinate, and then send the command word to open the measurement Y channel. The resulting value is the Y coordinate. Then get the values of Z1 and Z2 in turn, and use the conversion formula
RTOUCH
RTOUCH can be calculated, which is the value of pressure Z (where RX-plant is the x-axis resistance value, which is related to the performance parameters of the touch screen, and X-Position is the X coordinate value obtained at the beginning).
It is worth mentioning here that Z1 and Z2 are still the digital values of the 12-bit A/D conversion after conversion, but the Z value obtained through the conversion formula is actually the resistance value of the two layers of ITO oxide film between the contact points. In this way, the three-dimensional information collection at a certain moment is completed. According to actual requirements, use a timer to set the sampling time to 10ms. The collected data is sent to the PC through the USB interface for storage for subsequent matching processing. At the same time, the collected data can be displayed on the LCD screen for observation while writing.
Figure 1 System circuit block diagram
Figure 2 Touch diagram of touch screen
Figure 3 Data waveform before processing
Figure 4 Processed data waveform
Initial calibration of touch screen
Since some edge parts of the touch screen are invalid touch areas, the actual converted X and Y coordinates are not from 0 to 4095. Therefore, initial calibration is required and the conversion formula is used to linearize it in the entire range from 0 to 4095. , the conversion formula of the X coordinate value is X=(X-Xmin)×4095/(Xmax-Xmin), where Xmax and In the same way, the conversion formula corresponding to the Y coordinate value is Y=(Y-Ymin)×4095/(Ymax-Ymin), where Ymax and Ymin are respectively the maximum and minimum values in the Y direction of the effective touch area of the touch screen. The pressure value represents the resistance value and cannot intuitively reflect the pressure. Therefore, according to actual needs, it is converted into a pressure value of 0 to 256 levels corresponding to the pressure. The conversion formula is Z=(Zmax-Z)×256/(Zmax-Zmin), where Zmax and Zmin are respectively the maximum resistance value and the minimum resistance value when the writing pen is in contact with the touch screen.
The experimental data shows that the characteristic parameters of the touch screen used are: Xmax and Xmin are 3860 and 180 respectively; Zmax and Zmin are 3690 and 440 respectively, and 540 and 350 respectively. Since the physical characteristics of each touch screen and writing pen are different, the system must be re-initialized and calibrated every time the touch screen or writing pen is replaced.
Data preprocessing
In the process of data collection, there are many factors that affect the accuracy of the data, so some corresponding preprocessing must be done on the data to ensure the accuracy of the collected data. There are mainly the following factors:
Missing dots caused by writing jitter
When collecting data, zero-value points will appear in the continuous data. There are two possibilities for the zero-value points: one is caused by changes in strokes during normal writing, and the other is due to the touch screen not being flat enough or being loose during writing. It is caused by the interruption of handwriting caused by jitter. The main way to distinguish it is to look at the interruption time, which is the number of consecutive zero values. Generally, the interruption time caused by jitter is less than the set sampling time of 10ms. Therefore, the zero value caused by jitter is between two Only one valid data can appear in the middle, which can be considered as an invalid zero value. The occurrence of more than two consecutive zero values can be considered as valid zero values generated by the change of strokes without processing. When a certain zero value is judged to be After the invalid zero value, linear interpolation is performed on it to make up for the loss of data, that is, an=(an+1+an-1)/2, where an is the invalid zero value point, an-1 and an+1 are an A valid value before and after. Figures 3 and 4 are the waveforms before and after processing respectively.
Removal of duplicate collection points
Due to the writer's pause when writing, multiple repeated collections at a certain point will obviously cause a large error with the sample data in subsequent matching. Therefore, it is necessary to delete duplicate data. Whenever the two points before and after are judged, When the X coordinate and Y coordinate are the same, it can be concluded that they are duplicate points, then the latter point will be deleted, and then subsequent points will be used to fill it in sequence. This ensures that the collected data can truly reflect handwriting information.
Calibration of writing position
The starting point of the writer's pen is not necessarily the same every time he writes. In this way, the result of each writing sampling will have a constant difference from the sampling value in the sample template. Therefore, it is necessary to calibrate the writing position. The processing method is to The X coordinate and Y coordinate of the first data collected are compared with the X coordinate and Y coordinate of the first data in the sample data. The formulas are DX=(X1-X’1), DY=(Y1-Y' 1), where X1 and Y1 are the X coordinate value and Y coordinate value of the first point in the sample data respectively, X'1 and Y'1 are the X coordinate value and Y coordinate value of the first point in the sample data , DX and DY are the offset values of the sampled data and the sample data in the X and Y directions. Therefore, the calibration formula is: Xn=Xn+DX, Yn=Yn+DY.
Previous article:51 microcontroller control statements
Next article:Real-time control design of embedded system with C51 microcontroller as the core
- Popular Resources
- Popular amplifiers
- Learn ARM development(16)
- Learn ARM development(17)
- Learn ARM development(18)
- Embedded system debugging simulation tool
- A small question that has been bothering me recently has finally been solved~~
- Learn ARM development (1)
- Learn ARM development (2)
- Learn ARM development (4)
- Learn ARM development (6)
Professor at Beihang University, dedicated to promoting microcontrollers and embedded systems for over 20 years.
- LED chemical incompatibility test to see which chemicals LEDs can be used with
- Application of ARM9 hardware coprocessor on WinCE embedded motherboard
- What are the key points for selecting rotor flowmeter?
- LM317 high power charger circuit
- A brief analysis of Embest's application and development of embedded medical devices
- Single-phase RC protection circuit
- stm32 PVD programmable voltage monitor
- Introduction and measurement of edge trigger and level trigger of 51 single chip microcomputer
- Improved design of Linux system software shell protection technology
- What to do if the ABB robot protection device stops
- Analysis of the application of several common contact parts in high-voltage connectors of new energy vehicles
- Wiring harness durability test and contact voltage drop test method
- From probes to power supplies, Tektronix is leading the way in comprehensive innovation in power electronics testing
- From probes to power supplies, Tektronix is leading the way in comprehensive innovation in power electronics testing
- Sn-doped CuO nanostructure-based ethanol gas sensor for real-time drunk driving detection in vehicles
- Design considerations for automotive battery wiring harness
- Do you know all the various motors commonly used in automotive electronics?
- What are the functions of the Internet of Vehicles? What are the uses and benefits of the Internet of Vehicles?
- Power Inverter - A critical safety system for electric vehicles
- Analysis of the information security mechanism of AUTOSAR, the automotive embedded software framework
- The stm32f103c8t6 core board is powered by two USB cables, and the program cannot start automatically
- [NUCLEO-F746ZG Learning] Construction Project-Based on RT-Thread
- I need help from a master who can use ADS software to make filters
- Beijing Excellence Communication is recruiting embedded developers with high salary!!!
- TMS570 Learning 3-Internal Flash Programming
- First post by a newbie
- What is 4G DTU and what are its specific functions?
- CadenceLIVE China 2022 China Online User Conference invites you to attend
- Super detailed summary of receiver sensitivity and equivalent noise bandwidth
- Difference between junction temperature and case top temperature of power device