4 or 5 wire Touch Screen driver using a propeller instead of a specialised IC
Cluso99
Posts: 18,069
I have been looking at the specifications of the TSC2003 & TSC2007.
It seems to me that the prop should be capable of doing this quite easily. The only dificult part is the ADC.
Has anyone done this??
Postedit: I bought a Nintendo replacement 4-wire touch screen replacement (touch section, not LCD) for <$3 shipped on eBay. These units, and others for different phones, seem readily available.
These should make great and easy to use specialised keypads with a printed decal underneath!
It seems to me that the prop should be capable of doing this quite easily. The only dificult part is the ADC.
Has anyone done this??
Postedit: I bought a Nintendo replacement 4-wire touch screen replacement (touch section, not LCD) for <$3 shipped on eBay. These units, and others for different phones, seem readily available.
These should make great and easy to use specialised keypads with a printed decal underneath!
Comments
Beauty of the TSC2003 is that it requires 0 additional pins...
Guess my enthusiasm for helping got the best of me.
It shouldn't be too hard for a Propeller to mimic what the 2003 does. I wonder if it can be kept to 4 Propeller pins with the counters and sigma-delta method though. Using 4 pins with simple RC circuits would be easy but probably not as precise over temperature with reasonable capacitors.
* a 9x9 touch keypad using 4 pins taking advantage of an offset threshold about 1.4 volts (Apply 3v3:0v to top:bottom, then swap and apply 0v:3v. Repeat for other direction)
* a 4x3 telephone keypad using 5 pins (using one perturb resistor)
* a 4x4 touch keypad using 6 pins (using two perturb resistors)
Here is how it may work using the 2 extra perturb pins to 'perturb' the threshold
* Apply 3v3 to the electrode at the top of the screen (Y+), and 0v to the bottom (Y-). Sense using one of the X lines at the threshold voltage of the prop (1.4~1.65v). Leave the 'X perturb floating' for now to determine which half of Y (top or bottom) is being pressed
* Now pull the X sensing line HIGH via a resistor. This moves the position at which the threshold will trigger. The right value of resistor should be able to shift the threshold point to 25% of the screen Y direction.
* Now pull the X sensing line LOW via the same resistor. Should shift the threshold point to 75% of the screen Y direction.
* Repeat the above to determine the X position using a Y perturb resistor.
The other thing to try is to try and take advantage of any noise to resolve a gradient of position. Use 2 counters in "bucket mode" to count the number of positive and negative samples in a given interval, say 100msec.
When exactly on the threshold, the ratio of these should be 50:50%. As the finger is dragged one way or the other this will change...75:25...90:10... until it hits 100%. The operating size will depend on the noise present, but this might give a useful central "directional touch pad"
Simple theory of 4 wire touch panel...
The X plane (left to right) has a resistance across the panel. The Y plane (top to bottom) has a resistance across the panel in the top/bottom plane. When a point is pressed the resistances of both the X plane and the Y plane form resistive dividers.
By placing a Gnd at one end of one of the planes, and a pullup resistor at one end of the opposite plane, it is possible to detect when the touch screen is pressed.
By placing a voltage across the X plane, it is possible to measure that resultant voltage on the Y axis. By doing the same with the Y plane by applying a voltage, it is possible to measure the resultant voltage on the X axis.
So, if I place 3V3 at XL (X left) and GND at XR, I should be able to measure the voltage at Y bottom. The I place 3V3 at YT (Y top) and GND at YB. I should be able to measure the voltage at X right.
Then of course there is some complex mathematics to be done.
First problem is to read the voltage at Y bottom with the prop while outputting a high to XL and a low to XR.
We are only going to be able to measure this with a prop if the resultant Y voltage is > 1/2 Vdd (> 3.3/2V = 1.75V) so we will have to check both ends of the Y axis. I think it may be better to use a higher voltage applied in the first place, something in the order of 2*3.3V=6.6V. Using the sigma-delta method, we can determine the voltage on one other end of the Y axis.
Any ideas from the analog specialists?
http://forums.parallax.com/showthread.php?108069
It also has a nice Prop-style circuit diagram in the driver file.
Look a few posts down for the one from Ken Peterson with the zip file attachment.
I use the AR1010 to provide a single pin streaming input...
It seems that both 1mm pitch and 0.5mm pitch are used, so it depends on the touch sensor used. Also top or bottom fingers are used.
The Nintendo DS replacement I have seems to be 0.5mm pitch and top entry when folded back (it is not 1mm, but at present I have no means to definitively measure this)
This is a 0.5mm pitch smt part with both top and bottom entry from DigiKey WM1386CT-ND
This is a 1mm pitch smt part from DigiKey 455-1919-1-ND
I do not want to use a part (TSC2003 or TSC2007) that costs almost half the price of a prop when I am sure the prop can do it.
Thanks for the links. Here is the circuit extracted from Ken Peterson's published code. Note that it is (c) and does not contain the MIT license. However, it seems to use the basic sigma-delta method, so I am sure there is usable code available for this. Perhaps I should PM Ken to ask if he would post to the obex, or add the mit license.
If the pins are not available, then a cheap I2C would be preferable. I see the AR1020 is much cheaper that the TSC2003 or TSC2007.
In fact, an AVR could do the job cheaply too.
By using the second AN008 demo code, auto-calibration can be achieved.
adc_002 - Archive [Date 2011.06.13 Time 17.58].zip
BTW: I did not have correct value parts available, so I used 100K instead of 150K and 10nF instead of 1nF. The scaling is incorrect, but it works which is what I wanted to prove. I had not used the ADC on the prop before. Certainly, the moment you do not have pins available, the AR1020 seems to be the cheapest. I did look at the ATtiny, but of course you then have to program it.
Sparkfun sell a small breakout which has the 4 pin connector already mounted and broken out to 0.1" spacing. Its a good place to start.
As far as just the connector part, there are several manufacturers. Omron, Hirose, etc. You just have to be careful which side of the FPC the connector is designed to mate with (some are upper, some lower, some both I believe)
Now to make a tiny cheap pcb for it I will probably put an optional ATTiny44A/84 on it too. That way, the same pcb can be used with 5 (7 with calibration) prop pins direct to the prop or 1 or 2 via I2C or serial.
I want to use it as an input device to the prop. Because it is a clear screen, I could print a colored (paper) decal and mount it underneath to mark the keys I want.
will monitor four system voltage levels including the battery. Its little brother the TSC2004 is less money but does not
monitor the voltages.
In our design the Prop chip is way to overloaded to compute finger position. When the Prop 2 chip comes out we are going
to start using the new SX8677 chip that will sense multiple fingers so we can do gestering.