The system mainly consists of a four-wire resistive touch screen, a touch screen controller ADS7846, a single-chip microcomputer 89S51, and corresponding software programs. The system block diagram is shown in Figure 1.
1 Four-wire resistive touch screen
The resistive touch screen uses resistive analog technology. It is a layer of glass as the base layer, coated with a transparent metal oxide (ITO indium oxide) conductive layer, and then covered with a layer of glass or a smooth plastic layer with hardened outer surface; the inner surface is also coated with an ITO conductive layer. There are many tiny transparent isolation points between them to separate and insulate the two conductive layers. Whenever a pen or finger is pressed, the two conductive layers come into contact with each other. And form a circuit, as shown in Figure 2.
Both ends of the conductive layer are coated with a silver glue, which is called a pair of electrodes on the working surface. The upper and lower conductive layers are horizontal and vertical, respectively, and are used to measure the X and Y coordinate positions. The electrodes on the horizontal plane are called X+ electrode and X- electrode, and the electrodes on the vertical plane are called Y+ electrode and Y- electrode, as shown in Figure 3. When working, the two electrodes provide reference voltage according to measurement needs or serve as measuring ends 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 respectively connected to the reference voltage and ground; if no voltage is applied to the Y electrode, a uniform voltage distribution will be formed between the X electrodes. The Y+ electrode is used as the measurement point, and the voltage value obtained is converted through A/D conversion, and the X coordinate of the contact point can be correspondingly determined. The Y coordinate is similar, just change it to apply voltage to the Y electrode and not to the X electrode.
The calculation formula for the X coordinate and the Y coordinate is
VREF is the reference voltage added to the A/D converter inside ADS7846, and can be connected to VCC as the reference voltage.
The principle of measuring touch pressure is related to the inherent characteristics of ITO (indium oxide) material. The conductivity formula of ITO conductive film is ρ=ρ0 (1+3λ0/d) (d is the thickness of the conductive film), that is, the conductivity of ITO is inversely proportional to the thickness of ITO conductive film. The greater the touch pressure, the thinner the ITO conductive film at the contact point, and the corresponding conductivity is greater and the resistance is smaller. Therefore, the measurement of touch pressure is essentially to measure the resistance value of the contact ITO conductive film.
2 Touch screen control chip ADS7846
ADS7846 is a digital-to-analog conversion chip produced by Burn-Brown Company specifically for four-wire resistive touch screens. It has a measurement circuit network composed of a multi-channel analog switch and a 12-bit A/D converter. When working, ADS7846 opens the corresponding switch channel according to different command words received from 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. [page]
S is the start flag bit. Only when the S bit is high, ADS7846 starts to receive command words. A0, A1, and A2 are channel selections, which change according to the measurement needs. MODE selects whether it is 8-bit or 12-bit A/D conversion. According to actual requirements, 12-bit A/D conversion is selected here. SER/DFR is the working mode selection bit. ADS7846 has two working modes: one is single-ended input and the other is differential input. When pressure measurement is required, the differential input working mode must be used. PD1 and PD0 are used to control the internal reference voltage and the switch of the analog-to-digital converter.
3 Data communication between the single-chip microcomputer AT89S51 and ADS7846
(1) AT89S51
AT89S51 is an upgraded product of the 89C51 newly launched by Atmel, and is fully compatible with 89C51. Compared with 89C51, the following main functions have been added:
① Online programming and downloading can be carried out through the data download line, making program writing more convenient and simple;
② The working crystal oscillator can reach 33MHz, which improves the operating speed;
③ A watchdog circuit has been added to improve the anti-interference ability of the circuit.
(2) Communication between AT89S51 and ADS7846
The communication between AT89S51 and ADS7846 is mainly carried out through the I/O port of the single-chip microcomputer and the five pins of CLK, CS, DOUT, DIN, and BUSY of ADS7846. CLK is the working pulse of ADS7846, CS is the chip select signal of ADS7846, DOUT is the data output, DIN is the data input, and BUSY is the conversion judgment bit. When the system is working, the microcontroller first selects ADS7846 through the chip select signal, then sends the command control word data to ADS7846 through DIN, and matches it with the corresponding timing pulse through the CLK pin. After the BUSY bit is set, the 12-bit conversion result is obtained through the DOUT data output port.
Since the system is required to collect three-dimensional data including X coordinates, Y coordinates and pressure, the command word to open the measurement X channel is first sent, and the digital value returned is the X coordinate, and then the command word to open the measurement Y channel is sent, and the value obtained is the Y coordinate. Then the values of Z1 and Z2 are obtained in turn, and RTOUCH, that is, the value of pressure Z, can be calculated through the conversion formula. Among them, Rx is the value of the X-axis resistance, which is related to the performance parameters of the touch screen; is the X coordinate value obtained at the beginning.
The program flow is shown in Figure 4.
It is worth mentioning that Z1 and Z2 are still the digital values of the 12-bit A/D conversion after conversion, but the Z value obtained by 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, the sampling time is set to 10ms using the timer, that is, 100 points are sampled in 1s. The collected data is sent to the PC through the USB interface for subsequent matching processing. At the same time, the collected data can be displayed on the LCD screen for observation while writing.
4 Initialization calibration of touch screen
Since some edge parts of the touch screen are invalid touch areas, the actual converted X coordinates and Y coordinates are not from 0 to 4095, so initialization calibration is required to linearize them in the entire range of 0 to 4095 through the conversion formula. The conversion formula of the X coordinate value is X=(X-Xmin)4096/(Xmax-Xmin), where Xmax and Xmin are the maximum and minimum values of the effective touch area of the touch screen in the X direction. Similarly, the conversion formula corresponding to the X coordinate value is Y=(Y-Ymin) 4096/(Ymax-Ymin), where Ymax and Ymin are the maximum and minimum values of the effective touch area of the touch screen in the Y direction. The pressure value represents the resistance value and cannot directly reflect the pressure. Therefore, according to actual needs, it is converted into a 0 to 256 level pressure value corresponding to the pressure. The conversion formula is Z=(Zmax-Z) 256/(Zmax-Zmin), where Zmax and Zmin are the maximum and minimum resistance values when the writing pen contacts the touch screen.
The experimental data show that the characteristic parameters of the touch screen used are Xmax and Xmin are 3860 and 180, Ymax and Ymin are 3690 and 440, and Zmax and Zmin are 540 and 350. Since the physical characteristics of each touch screen and writing pen are different, the system must be re-initialized every time the touch screen or writing pen is replaced.
5 Data preprocessing
During the data collection process, 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.
(1) Missing points caused by writing jitter
When collecting data, zero value points will appear in the continuous data. There are two possibilities for the appearance of zero value points: one is caused by the change of normal writing strokes, and the other is caused by the interruption of handwriting due to the unevenness of the touch screen or the jitter during writing. The method of distinguishing is mainly to look at the interruption time, that 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 generated by jitter can only appear once between two valid data, which can be considered as an invalid zero value; and the appearance of more than two consecutive zero values can be considered as a valid zero value generated by the change of strokes and no processing is performed. When a zero value is judged to be an invalid zero value, linear interpolation is performed to compensate for the data loss, that is, an=(an+1+an-1)/2. Among them, an is an invalid zero value point, an-1 and an+1 are a valid value before and after an respectively. Figure 5 and Figure 6 are waveforms before and after processing, respectively. [page]
(2) Removal of repeated acquisition points
Due to the pauses of the writer when writing, multiple acquisitions are made at a certain point. Obviously, there will be a large error with the sample data in the subsequent matching, so it is necessary to delete the repeated data. Whenever the X-coordinates and Y-coordinates of the two points before and after are determined to be the same, they can be determined to be repeated points, and the latter point is deleted, and then the subsequent points are used to fill in the gaps. This ensures that the collected data can truly reflect the handwriting information.
(3) Calibration of writing position
The starting point of the writer's writing may not be the same each time. Therefore, the result of each writing sampling has a constant difference from the sampling value in the sample template, so it is necessary to calibrate the writing position. The processing method is to compare the X coordinate and Y coordinate of the first data collected with the X coordinate and Y coordinate of the first data in the proofreading data. The formulas are ΔX=(X1-X1), ΔY=(Y1-Y1). Among them, X1 and Y1 are the X coordinate value and Y coordinate value of the first point of the sampled data, X*1 and Y*1 are the X coordinate value and Y coordinate value of the first point in the sampled data, and ΔX and ΔY are the offset values of the sampled data and the sample data in the X direction and Y direction. Therefore, the calibration formula is
Xn=Xn+ΔX, Yn=Yn+ΔY.
The above are several methods for preprocessing data. Preprocessing can provide more accurate data for subsequent handwriting matching and reduce the amount of matching calculations. Therefore, preprocessing is an important step before handwriting matching authentication, and its quality will directly affect the accuracy of authentication.
Previous article:Research on Dual-CPU Servo Controller Based on AT89C51+DSP
Next article:Design of wireless temperature measurement system based on C8051 and Atmega16
- 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
- CGD and Qorvo to jointly revolutionize motor control solutions
- CGD and Qorvo to jointly revolutionize motor control solutions
- Keysight Technologies FieldFox handheld analyzer with VDI spread spectrum module to achieve millimeter wave analysis function
- Infineon's PASCO2V15 XENSIV PAS CO2 5V Sensor Now Available at Mouser for Accurate CO2 Level Measurement
- Advanced gameplay, Harting takes your PCB board connection to a new level!
- Advanced gameplay, Harting takes your PCB board connection to a new level!
- A new chapter in Great Wall Motors R&D: solid-state battery technology leads the future
- Naxin Micro provides full-scenario GaN driver IC solutions
- Interpreting Huawei’s new solid-state battery patent, will it challenge CATL in 2030?
- Are pure electric/plug-in hybrid vehicles going crazy? A Chinese company has launched the world's first -40℃ dischargeable hybrid battery that is not afraid of cold
- General method of displaying pictures and texts on TFT color screen
- Ultra-low standby power consumption DC-DC controller chip
- I need a simulation diagram of a car reversing radar system (paid)
- SVPWM Program
- TI C2000 interrupt service function
- Rumor has it that DJI is laying off 14,000 employees? PR Director: 14,000 in total
- About GDDFU Mode Application
- Summarize the commonly used communication interfaces of microcontrollers
- Considerations for using PMOS tube as power switch
- "Circuit Garden" by artist Kelly Heaton