Touch Panel

Hi to all, I wrote a simple tutorial (in Italian, but sources in english) to read the touch position from a resistive touchpad with Arduino. Here you can find the video A second video shows the touch panel over a led matrix where each led can be switched on touching on it ( Sources available to my site: Arduino rocks !

Thanks for posting that. It's the best explained source code i have seen for reading a 4 wire resistive touch pad. Very usefull.

Thanks again to Marco for posting this code. I had a few problems compiling on 0015 so I tidied up the code a little and re-worded the comments.

/* TOUCH.PDE - Arduino sketch * TOUCH.PDE - Arduino sketch

  • Read from a touch panel the touch position
  • return it on serial port
  • Hardware used:
  • Resistive touch panel, 4 wire
  • Arduino Diecimila
  • April, 5th 2009 * April, 5th 2009
  • by Marco Nicolato
  • edited by Pauric O’Callaghan

// Touch panel output wiring. These define the pins
// used to apply voltages across the touch screen
#define leftOutput 2 // LEFT to digital output 2
#define bottomOutput 3 // BOTTOM to digital output 3
#define rightOutput 4 // RIGHT to digital output 4
#define topOutput 5 // TOP to Digital output 5

// Touch panel input wiring. These define the analog
// input pins used to read the voltage from the screen
#define topInput 3 // TOP also to analog input 3
#define rightInput 4 // RIGHT also to analog input 4
#define LED 13 // LED flashes on touch event

// Values of where the screen was touched 0-1000
int touchX = 0;
int touchY = 0;

void setup()
pinMode(LED, OUTPUT);

void loop()
if (touched())
Serial.print(touchX); //prints X to the serial
Serial.print(" Y=");
Serial.println(touchY); //prints Y to the serial

digitalWrite(LED, HIGH); // Flashes LED for each touch read
delay(50); // for 50 ms
digitalWrite(LED, LOW);


// return TRUE if touched, and coords in touchX and touchY
boolean touched()
boolean touch = false;

// Horizontal routine
// 1: apply voltages to left & right
// 2: turn top & bottom digital outputs off
// 3: read top via analog inputs
pinMode(leftOutput, OUTPUT);
digitalWrite(leftOutput, LOW); // set Left = ground
pinMode(rightOutput, OUTPUT);
digitalWrite(rightOutput, HIGH); // set Right = Vcc

pinMode(topOutput, INPUT); // Sets Top and Bottom to inputs
pinMode(bottomOutput, INPUT); // to give them high impedence

touchX = analogRead(topInput); // wait a bit, then read from Top

// Vertical routine
// 1: apply voltages to top & bottom
// 2: turn left & right digital outputs off
// 3: read right via analog inputs
pinMode(bottomOutput, OUTPUT);
digitalWrite(bottomOutput, LOW); // Set Bottom to 0v
pinMode(topOutput, OUTPUT);
digitalWrite(topOutput, HIGH); // set Top to +Vcc

pinMode(rightOutput, INPUT);
pinMode(leftOutput, INPUT);

touchY = analogRead(rightInput); // wait a bit, then read from Right

// Only if coords are below 1000
if(touchX < 1000 and touchY < 1000)
touch = true;

return touch;

Where did you purchase the 4 wire touch pad from?

Hi Darudude I bought that touchpanel at a local electronic shop in Italy, near my city. It was part of a surplus offer (displays, cpu, TOUCH PANELS, etc), one year ago. (now all was gone) I suggest to check in internet, I've found here: a little touchpanel, but I think you can find other sites where buy it (I hope ;) ). Bye Marco Nicolato

Hi Radiorental Tankyou for your work on IDE 0015 (I work on IDE 0010), I'll include it in my site. Bye Marco Nicolato

they have many others for different cellphones and other gadgets.

Cheap and free shipping.

I am sure you will find something that sutes you at:

Question is how to connect the touch panel, how do you define the pins on panels?

MikMo, you are reading my mind…

Hi Hulk

To define wires, usually i look through the panel to see the plates (top, bottom, left and right) and estimate the track to each output pin. If they are not visible, you can try to measure the resistence between each couple of pin.

Bye Marco Nicolato

I got my 7" touchpanel on fleebay. Search for eepc touch panel. $40 Sparkfun have a small (nintendo DS sized) panel for $10