Shop OBEX P1 Docs P2 Docs Learn Events
4 or 5 wire Touch Screen driver using a propeller instead of a specialised IC — Parallax Forums

4 or 5 wire Touch Screen driver using a propeller instead of a specialised IC

Cluso99Cluso99 Posts: 18,069
edited 2011-09-02 14:05 in Propeller 1
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!

Comments

  • jazzedjazzed Posts: 11,803
    edited 2011-06-07 19:06
    Try this. I've used it successfully with a 2003 ... haven't tested with a 2007 yet.
  • RaymanRayman Posts: 14,807
    edited 2011-06-07 19:19
    I can't think of the name at the moment, but somebody did do a 4-wire touchscreen interface. I think it required 4 Prop pins.

    Beauty of the TSC2003 is that it requires 0 additional pins...
  • jazzedjazzed Posts: 11,803
    edited 2011-06-07 20:10
    Cluso99 wrote: »
    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??

    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.
  • TubularTubular Posts: 4,706
    edited 2011-06-07 23:06
    I think the prop should be able to do
    * 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"
  • Cluso99Cluso99 Posts: 18,069
    edited 2011-06-10 00:24
    I updated the first post with info of cheap touch panels from eBay <$3 shipped. They are 4 wire so now to get the prop to run with them...

    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.
    TouchScreen.JPG

    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?
    399 x 400 - 13K
  • RaymanRayman Posts: 14,807
    edited 2011-06-10 07:14
    Took me a few minutes, but I found the old thread with code for directly reading a touchscreen with the Prop:

    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.
  • Jim FouchJim Fouch Posts: 395
    edited 2011-06-10 08:16
    Anyone know the surface mount part that fits most of the touch screens out there?
  • RaymanRayman Posts: 14,807
    edited 2011-06-10 08:19
    I use the TSC2003 for the touchscreens and boards I sell. It's I2C, has internal temperature, and also has battery voltage inputs...
  • TubularTubular Posts: 4,706
    edited 2011-06-10 14:02
    Jim, are you referring to the 4 wire 0.5mm FPC connector, or the IC?

    I use the AR1010 to provide a single pin streaming input...
  • Cluso99Cluso99 Posts: 18,069
    edited 2011-06-10 18:45
    Connector...
    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.

  • Cluso99Cluso99 Posts: 18,069
    edited 2011-06-10 19:02
    Touch Screen for the prop.JPG


    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.
    1011 x 499 - 73K
  • RaymanRayman Posts: 14,807
    edited 2011-06-11 05:46
    If cost is your main concern, there are cheaper SPI touchscreen chips out there.
  • Jim FouchJim Fouch Posts: 395
    edited 2011-06-11 07:42
    Tubular: I was inquiring about the connector.
  • Cluso99Cluso99 Posts: 18,069
    edited 2011-06-11 18:13
    Rayman: The prop should be able to do this with minimal parts and no more than 8 pins (maybe less) for a 4wire display.
    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.
  • Cluso99Cluso99 Posts: 18,069
    edited 2011-06-13 01:07
    Here is working code using a 4 wire touch panel and 7 prop pins. The circuit is contained within the source code. The Parallax Sigma-Delta Appnote AN008 and code was used as the basis for this.

    By using the second AN008 demo code, auto-calibration can be achieved.

    TouchPanelCircuit.JPG

    adc_002 - Archive [Date 2011.06.13 Time 17.58].zip
  • jazzedjazzed Posts: 11,803
    edited 2011-06-13 09:14
    Cluso99 wrote: »
    Here is working code using a 4 wire touch panel and 7 prop pins.
    That's great when you have 7 pins to spare. Why do people keep putting non bus things on P0..7 ?
  • RaymanRayman Posts: 14,807
    edited 2011-06-13 09:39
    I'm definitely planning on direct touchscreen drive with Prop 2. With plenty of pins and built-in ADC on each pin, it will be a lot easier...
  • Cluso99Cluso99 Posts: 18,069
    edited 2011-06-13 18:39
    jazzed: Because these were the pins available on my protoboard :) Any pins will work although the 3 ADC pins need to be adjacent.

    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.
  • TubularTubular Posts: 4,706
    edited 2011-06-13 18:51
    Jim Fouch wrote: »
    Tubular: I was inquiring about the connector.

    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)
  • Cluso99Cluso99 Posts: 18,069
    edited 2011-09-02 13:43
    An update. The connector OR746CT-ND from DigiKey ~$0.90 works.

    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.
  • BigFootBigFoot Posts: 259
    edited 2011-09-02 14:05
    sx8677_8.pdfWe have hundreds of TSC2003 chips in the field and they work very well, they also have two temperature sensors and
    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.
Sign In or Register to comment.