# Interface with touch screen using arduino

Basically I am trying to stimulate a touch screen with an arduino board. I know this has been asked several times and Ive spent a long time looking at solutions, namely some kind of foil stuck to a touch screen being pulled to phones ground, or USB shield, or arduino earth, or a fruit or your body etc. I have tried all of this and more, using a transistor, MOSFET, optocoupler, and even a relay. All while holding the phone, or on the table or on top of a foil sheet or a grounded foil sheet etc... I have had varying success with all of them but nothing reliable and repeatable long term.

The relay has been the most successful, connecting foil via the armeture switch to the phones ground. If I set the arduino to pulse the relay closed for 100ms every 2000ms in this case, Interestingly I find a consistent result: when I place the foil a touch occurs and isn't released, the foil and wire are enough to do it. After between 30 seconds to a minute, the touch is released and touch events start pulsing with the arduinos input via the relay, and after 30 seconds to a minute or so longer, the screen stops responding all together, even to finger touches on the back of the foil - where this produced a touch event beforehand.

So I figure the screen is adapting to the environment. Just as it would need to if you were using your phone standing on a flag pole vs leaning against the steel wall of a truck. For some reason it decides the foil is environmental noise and 'numbs' that area of the screen to it.

So my question is, is there a way to reset the capacitive field image between each touch, or is there a different method to achieve touch events using the arduino?

EDIT Attached is a basic schematic of the circuit. Pin 2 is switching from LOW to HIGH for 100ms, then to LOW, for 2 seconds, and the relay clicks closed accordingly. The wire labeled 'Wire A' has been tried a variety of ways. To iPhone Gnd like it is, to Arduino Gnd, to my fingers, to a piece of foil laid under the iPhone. Additionally I have tried all these combinations with a 1000k resistor in series, and capacitors varying from 100pf to 100nf, separately and together with the resistor.

The underlying problem is the piece of foil stuck to the screen. The iPhone sensor seems to be able to determine its proximity is not changing, even if its electrical characteristics are.

• Can you put up some pictures and a schematic? Apr 4, 2015 at 22:24
• Sure I will be home in a few hours and will draw something up Apr 5, 2015 at 15:46

I've actually made some progress with this method I have found the problem to be the parasitic, or static capacitance of whatever I stick to the screen. It is enough to bring the base level reference at that sensor up too high to consider anything else a touch.

If I stick the foil with a 5 inch strand of hair-width wire, and pinch the end of the wire, it will work for about 30 seconds then stop working. If I leave it for 10 minutes it still won't work, nor will touching the foil itself. If I clip the strand of wire to maybe 3 inches, and pinch the end, it will start working after 30 seconds. Leaving it again for 10 minutes, it still works.

So really the question is, if I have a piece of foil on the screen with a 2 inch strand of wire, how do I electrically connect something to that for a moment, without adding any parasitic capacitance to it in the mean time. A transistor by itself was ok, pinching the wire would still get a touch but as soon as I solder something to the emitter of the transistor the foil would stop working after 30 seconds. A relay also has too much metal inside the terminal, causing the same problem after 30 seconds. I am pretty sure I have the problem pinned down, as with both of these situations, if I clip what I have soldered off, after 30 seconds or so the foil begins working again if I pinch the little strand.

EDIT So the problem was a thick tempered glass screen protector I had on the phone. I removed that and the amount of material able to be connected to the foil increased substantially. It works perfectly with a relay for hours. I tried with a transistor it works for a while but eventually becomes 'numb' to it so I guess the minuscule current across the 'off' transistor is enough to cause the foils capacitance to increase.

Perhaps older phones measured pixel-to-ground capacitance, but I'd be surprised if new ones still do. It is just so much more sensitive to interference. Also, sensing mutual capacitance permits a row-column scanning sensor approach, where one conductive layer is divided into rows and another layer into columns, and the mutual capacitance of all $N$ columns is measured while stepping through rows $1...M$. In this way, it makes populating a $M\times N$ mutual capacitance array $\mathbf{C_M}$ quite easy.
In case you're wondering how this could be done, consider having all $M$ rows and $N$ columns discharged to $0\rm{V}$. Take row $i$ and charge it from $0\rm{V}$ to $5\rm{V}$. All $N$ columns will see an increase in voltage due to whatever small capacitance couples them to row $i$. Some columns, however, will see a greater voltage than others, because they have greater mutual capacitance to row $i$ due to a nearby finger. This process is repeated for all $M$ rows to populate $\mathbf{C_M}$, thus resolving the finger's position in two dimensions. I've glossed over some details, but that's the basic gist.