touch screens

Thread Starter

rougie

Joined Dec 11, 2006
410
Hello,
I am a newbie when it comes to touch screens. I have a small 4 wire resistive touch screen approx. 2" diaogonal. It believe that the outer edge two wires of the FPC cable are "+". Where as the two other wires are the return signals each in respect with their "+" wire. I am applying 3.0VDC at the "+" wires and trying to read the output voltage on the return wires as I move an object pressing on the touch screen.

The problem is, I am reading a steady 3.0VDC on the return wires no matter where I touch on the touch screen.

Has anyone done this before? If anyone can help, it would be very appreciated.
Thanks

Ross
 

Attachments

colinb

Joined Jun 15, 2011
351
Good point chrisw, if he just wants to use the screen (as opposed to learning how it works and doing it himself for educational value) then a dedicated touch screen interface IC would be a great idea. Most that I have seen are I²C but as chrisw points out there are SPI ones as well. They are really simple to use and might save power in the end.
 

Thread Starter

rougie

Joined Dec 11, 2006
410
hello colinb,

Yes that's the exact document I read late last night. I tried it and it worked. I tried the "x" axis reading it via the "Y+" output. So I have made a schamatic. On how I got it to work, please view attachment "Touch Screen Bias".

Also, the "Y-" can't always just stay open. It also has to be tied to ground when we want to measure the y axis via the "X+" output. So I would need the PIC to control the "Y-" to be at "Open" state at one instance and "grounded" state in another instance. I am Planning to do the circuit outlined in attachement called "touch screen transistor". I have not tried this though... I am not that good at electronics. I was wondering if you can take a look as to weather or not I should proceed this way. I was planning to use a 2n2222 with a 1K ohm resistor!

Your help would be very appreciated. Thanks.

PS. The "touch screen transistor" schematic is just for the X measurement, I would obvioulsy do the same transistor layout for
"X-" !

r
 

Attachments

Last edited:

colinb

Joined Jun 15, 2011
351
rougie;412417 Also said:
I am not a PIC guy, but you should be able to switch the Y- pin between high-impedance (“tri-state” input mode) and ground (output mode, logic LOW) dynamically from the code. You should not need the transistor+resistor.
 

Thread Starter

rougie

Joined Dec 11, 2006
410
>I am not a PIC guy, but you should be able to switch the Y- pin between high->impedance (“tri-state” input mode) and ground (output mode, logic LOW) dynamically >from the code. You should not need the transistor+resistor.

Yes that is true... But I have never done this, I would have to look into it.

Thanks for your help.
r
 

ErnieM

Joined Apr 24, 2011
8,377
You may or may not need some driver circuitry here, not because the outputs can't drive the lines as need be (they can), but because most earlier PICs do not allow arbitrary A2D inputs to be chosen. This means for a zero circuitry driver you need to be able to change the lines driving X+ and Y+ from digital to analog A2D inputs, leaving one as digital as the other goes analog.

If your PIC can't do that then you need a driver circuit. That's 4 transistors and some resistors.

Mikroelectronia does it using 5 transistors. It works.
 

THE_RB

Joined Feb 11, 2008
5,438
You may or may not need some driver circuitry here, not because the outputs can't drive the lines as need be (they can), but because most earlier PICs do not allow arbitrary A2D inputs to be chosen.
...
Please explain?

It can be done on any PIC (even early ones) provided the PIC can change its pins from outputs to inputs, and 2 of the 4 PIC pins need to be ADC capable.

A resistive touchpanel can be controlled from 4 PIC pins and needs only 2 high value resistors, as pulldown resistors, to give a stable state for a not-pressed condition.
 

ErnieM

Joined Apr 24, 2011
8,377
Please explain?

It can be done on any PIC (even early ones) provided the PIC can change its pins from outputs to inputs, and 2 of the 4 PIC pins need to be ADC capable.
Once again, certain older devices such as the popular PIC18F4550 only devote 4 bits to picking 12 analog channels, thus they cannot arbitrarirly reassign them individually between analog and digital functions. So you get stuck using 2 lines just to real the voltages. If you dislike external circuitry you could use 4 digital lines to drive +X -X +Y -Y, so you get stuck using 6 lines to read the touchscreen.

If you can arbitrarily assign between analog and digital function you can just use 4 lines directly. If you're clever about how you read a press state you don't need any pull down resistors (hint: you need read each side twice with different drives).
 

chrisw1990

Joined Oct 22, 2011
551
Good point chrisw, if he just wants to use the screen (as opposed to learning how it works and doing it himself for educational value) then a dedicated touch screen interface IC would be a great idea. Most that I have seen are I²C but as chrisw points out there are SPI ones as well. They are really simple to use and might save power in the end.
alright alright.. if you wanna do it that way i get it, just most of my projects are done with a tight time scale so knowing something works 100% is much better =P i think anyway;)
 

THE_RB

Joined Feb 11, 2008
5,438
Once again, certain older devices such as the popular PIC18F4550 only devote 4 bits to picking 12 analog channels, thus they cannot arbitrarirly reassign them individually between analog and digital functions. So you get stuck using 2 lines just to real the voltages. If you dislike external circuitry you could use 4 digital lines to drive +X -X +Y -Y, so you get stuck using 6 lines to read the touchscreen.
...
Once again, no, that would only be correct if setting the 2 ADC pins disabled the output drivers.

You can set 2 pins as digital outputs, then the other 2 pins as ADC inputs. Then as needed use TRIS to turn one of the ADC inputs into a digital output.

Once again, only 4 PIC pins needed.
 
Last edited:
Top