Resistive touch screen displays are composed of multiple layers that are separated by thin spaces. Pressure applied to the surface of the display by a finger or stylus causes the layers to touch, which completes electrical circuits and tells the device where the user is touching.
In this chapter we are focusing only on 4-wire resistive touch screen interfacing.
Step 1: Components Required
- Arduino Board
- Touch Screen
- Connecting Wires

Step 2: Connections to Arduino
- Connect X1 of touch screen to A0 of arduino
- Connect X2 to A1 of arduino
- Connect Y1 to A2 of arduino
- Connect Y2 to A3 of arduino


Step 3: Programming the arduino
How it works?
Measure X axis Voltage

To measure X axis voltage
1.We are going to measure voltage on Y1
pinMode(Y1,INPUT);
2. Make Y2 Tristate
pinMode(Y2,INPUT);
digitalWrite(Y2,LOW);
3. Form a voltage divider in X1(+5V) and X2(GND)
pinMode(X1,OUTPUT);
digitalWrite(X1,HIGH);
pinMode(X2,OUTPUT);
digitalWrite(X2,LOW);
4. Read the ADC from Y1 pin
X = (analogRead(Y1))/(1024/XYresolution);
Measure Y axis Voltage

To measure Y axis voltage
1.We are going to measure voltage on X1
pinMode(X1,INPUT);
2. Make X2 Tristate
pinMode(X2,INPUT);
digitalWrite(X2,LOW);
3. Form a voltage divider in Y1(+5V) and Y2(GND)
pinMode(Y1,OUTPUT);
digitalWrite(Y1,HIGH);
pinMode(Y2,OUTPUT);
digitalWrite(Y2,LOW);
4. Read the ADC from X1 pin
Y = (analogRead(X1))/(1024/Yresolution);
Arduino Code for Touch Screen Interface
/*=================================
This code demostrates 4-Wire Touch screen
interfacing with Arduino
www.circuits4you.com
4- Wire Touchscreen Connections
A0=====X+
A1=====X-
A2=====Y+
A3=====Y-
=================================*/
//Define your Touch screen connections
#define A0 X1
#define A1 X2
#define A2 Y1
#define A3 Y2
//Define your screen resolution as per your Touch screen (Max: 1024)
#define Xresolution 320 //128
#define Yresolution 240 //64
void setup()
{
Serial.begin(9600);
}
void loop()
{
int X,Y; //Touch Coordinates are stored in X,Y variable
pinMode(Y1,INPUT);
pinMode(Y2,INPUT);
digitalWrite(Y2,LOW);
pinMode(X1,OUTPUT);
digitalWrite(X1,HIGH);
pinMode(X2,OUTPUT);
digitalWrite(X2,LOW);
X = (analogRead(Y1))/(1024/Xresolution); //Reads X axis touch position
pinMode(X1,INPUT);
pinMode(X2,INPUT);
digitalWrite(X2,LOW);
pinMode(Y1,OUTPUT);
digitalWrite(Y1,HIGH);
pinMode(Y2,OUTPUT);
digitalWrite(Y2,LOW);
Y = (analogRead(X1))/(1024/Yresolution); //Reads Y axis touch position
//Display X and Y on Serial Monitor
Serial.print("X = ");
Serial.print(X);
Serial.print(" Y = ");
Serial.println(Y);
delay(100);
}
Result
Observe the result on serial monitor. It displays where you have touched on the screen.
