Analog touch screen

Go To Last Post
5 posts / 0 new
Author
Message
#1
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Hello,
I am using an analog touchscreen on four ports of an AVR.
To get the coordinates I put a voltage on the TOP and BOTTOM pins of the touch screen and measure the voltage on one LEFT pin (and the other way round to get x and y).
It is working fine, as long as I actualy touch it. But when the touchscreen is not touched, it seems to float and I get a random values. That makes it impossible to use the coordinates, because I can not determin if it is a floating value or a touche value.
This must be a common issue. Is there any way to solve this?
Thanks!

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Perhaps a very high resistance voltage divider on the output pin, one resistor to ground and one to Vcc? Or just a very large resistor to Vcc so that you can tell when it is something other than Vcc and, thus, "touched"?

Jim

 

Until Black Lives Matter, we do not have "All Lives Matter"!

 

 

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

use the pullup on the AVR input port, set both outputs (top,bottom) to low.
Interrupt on pin change, switch top pin high, disable pullup and activate ADC.
Read input data.

Often, you don't even need to set the top pin to low, as the TS resistance is way less than the pullup, and you'll get a low level on any touch.

/Jesper
http://www.yampp.com
The quick black AVR jumped over the lazy PIC.
What boots up, must come down.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

There are 2 ways to solve this problem. First is to implement touch detection. This is done by enabling the internal pull-up on one of the pins, setting it's opposite to float, and then setting both pins of the other plane to GND. When a touch is detected, you then perform a conversion.

Touch Detection:
X+: Internal Pull-up
X-: HiZ [interrupt input]
y+: Gnd
Y-: Gnd

Another option is to kill the floating effect by performing a sample while the pin is held at VCC. This method requires twice as many samples, but should keep the reading at full scale (or darn close to it) when there is no touch present.

Conversion 1: Y-axis charge (dummy conversion)
X+: HiZ
X-: HiZ
Y+: ADC/VCC [or pulled up via internal R]
Y-: HiZ
Conversion 2: Y-axis measure
X+: Vcc
X-: Gnd
Y+: ADC/HiZ
Y-: HiZ
Conversion 3: X-axis charge (dummy conversion)
X+: ADC/Vcc [or pulled up via internal R]
X-: HiZ
Y+: HiZ
Y-: HiZ
Conversion 4: X-axis measure
X+: ADC/HiZ
X-: HiZ
Y+: Vcc
Y-: Gnd

Writing code is like having sex.... make one little mistake, and you're supporting it for life.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Thanks for the raplie.
It seems it was just a problem with the ADC. I started the conversion to soon after setting the MUX.

:oops: