+ Reply to Thread
Page 1 of 3 123 LastLast
Results 1 to 20 of 43

Thread: Capacitive Multi-Touch example code

  1. #1

    Default Capacitive Multi-Touch example code

    Here's an example of how to interface to the Newhaven 5" capacitive touch touchscreen.
    I'm using our DVI Graphics shield along with the touchscreen plugin.
    But, this can also work with our NH4 adapter, Newhaven's adapter or your own adapter.
    Should work with the 4.3" capacitive screens too with required changes to the display portion of the demo.

    The interface is I2C, so it's was really easy to write the driver.
    It tracks up to 5 fingertips, so it's kinda cool.

    Also, it can detect the zoom in and out gestures all by itself.

    5p0_CapTouchTest1 - Archive [Date 2012.07.15 Time 15.36].zip

    Update: Now have it working with the low cost NH4 adapter and have a $3 breakout for the capacitive touch connector:
    Click image for larger version

Name:	NH4_CapTouch_4p3.jpg
Views:	103
Size:	119.8 KB
ID:	95017
    You just have to run 4 jumper wires as shown in the photo above...

    Update2: Now demonstrated to work with Newhaven 5" LCDs...
    Last edited by Rayman; 08-20-2012 at 12:40 AM.

  2. #2

    Default Re: Capacitive Multi-Touch example code

    Here's a photo of how I've wired it up. There wasn't room for the 6-pin connector on this board, when I learned about these multi-touch screens, but I did fit in a 4-pin header to connect to the external 6-pin adapter. You only need 4 wires (vdd, gnd, SCL, SDA) to make it work.
    Click image for larger version

Name:	CT_Wiring.jpg
Views:	163
Size:	99.4 KB
ID:	94219

    Just be careful because pins 3&4 are reversed between board and 6-pin connector...

  3. #3

    Default Re: Capacitive Multi-Touch example code

    Nice work again Rayman

    Do you by chance offer a standing subscription service where we can just sign up, and you send us these goodies + bill as you get each device/chip up and running?

  4. #4

    Default Re: Capacitive Multi-Touch example code

    Sounds like a great idea
    The 5" multi-touch screens are little pricey, but I now see that multi-touch is really nice and probably worth the extra expense.
    You also don't have to calculate and judge Z (how hard you're pressing), the chip does all this for you...

  5. #5

    Default Re: Capacitive Multi-Touch example code

    Rayman

    I unzipped the parts and put them into my prop folder. I get two errors that state:

    PSB2_i2cdriver relocation pointer error 0228
    PSB2_i2cdriver fatal unable to locate object to fix up 40

    This is on 2 different computers, the object is in the folder as I can load it. I was trying to test on the 4.3. Any thoughts?

    Ok that was BST, Proptool loads.
    Last edited by T Chap; 08-16-2012 at 10:03 PM.

  6. #6

    Default Re: Capacitive Multi-Touch example code

    I've never seen that error before... Is this with the Parallax Prop Tool?
    You may have different versions of PSB2_i2cdriver now... Maybe try renaming this new one to something else...

  7. #7

    Default Re: Capacitive Multi-Touch example code

    Well it loads with proptool but I do not have an sd card on my test rig so it is a blank screen. I will try to figure out how to adapt the 4.3 resistive demo graphics to the new capacitive demo. BTW if anyone is available to help program a demo for me please get in touch via PM. I have a newhaven 4.3 capacitive and need to get this up and running asap and have no experience with graphics or touch.

  8. #8

    Default Re: Capacitive Multi-Touch example code

    T Chap, I think you have the NH4 Paint Demo.
    What you might try is replace the PSB2_i2cdriver in that one with this new one.
    Then, copy the touchscreen example code from here into the paint program.
    Next, you could either have the code set pixels in the graphics area or draw text on the text area...


    BTW: How are you connecting to the I2C touchscreen 6-pin tail connector?

  9. #9

    Default Re: Capacitive Multi-Touch example code

    I am doing just as the ribbon wire calls out the order. 1 = 3v3 2 gnd 3 scl 4 sda nc 5/6

    I will try that idea in a few minutes, thanks.
    Last edited by T Chap; 08-17-2012 at 12:18 AM.

  10. #10

    Default Re: Capacitive Multi-Touch example code

    Ok, I've adapted the paint example for the Newhaven 4.3" capacitive touch touchscreen...
    Been putting it off for a long time, so thanks for asking for it...

    Let me know if this doesn't work for you:
    NH4_Paint3_CT - Archive [Date 2012.08.16 Time 20.26].zip

    It actually works better than I expected...

  11. #11

    Default Re: Capacitive Multi-Touch example code

    I must not have the small ribbon connected correctly, no response on touch but the screen looks good. I can recheck the connections at the shop tomorrow and let you know.

  12. #12

    Default Re: Capacitive Multi-Touch example code

    Make sure you don't have SCL and SDA reversed... Also, if you're not using a regular Prop board on P28 and P29, you'll need a 10k pullup resistor on SDA... Also, make sure you don't have the ribbon connector in upside down...

  13. #13

    Default Re: Capacitive Multi-Touch example code

    Ok good call, I am using a Prop stick which I believe has pullups to the on board eeprom. The ribbon was reversed, still no luck. I will have to retrace the connections tomorrow. Thanks

  14. #14

    Default Re: Capacitive Multi-Touch example code

    I had a few things wrong, but that demo works great! Much better than the resistive. It looks like you don't have it checking for a range like the resistive, so I without having looked at it much I assume that it is either being touched or not to the code. But, it does respond to the lightest touch so that is the goal for my project anyway. Thanks for putting all this stuff together.

  15. #15

    Default Re: Capacitive Multi-Touch example code

    This is my first steps with graphics and LCDs, and I want to learn how to create some bitmaps for elements on the screen like buttons, logos, other graphics. I notice in the paint demo there are some externally loaded dat files that appear to hold the button image info. Can someone tell me how to go about creating elements like that? I also will be using the LCD in vertical modes on occasion, and would like to flip the graphics over. Is that something that must happen in the original bitmap or can the bitmaps be flipped during or after loading?

  16. #16

    Default Re: Capacitive Multi-Touch example code

    T Chap, glad you got capacitive touch working with the NH4! It really does work better than I expected with the paint program. I didn't think it would do smooth curves, but it does very well. It's also nice how you don't really need to push on it at all.

    The driver works just like the VGA driver. You can find apps to make 1 and 2-bit bitmaps on my website. There is also a very long thread around about the Samsung version of this driver... (actually the drivers are almost identical, it's mostly just the backlight circuit that is different).

  17. #17

    Default Re: Capacitive Multi-Touch example code

    Rayman. I used the Prop Interleaved Generator to make a little symbol. I want the display to be background black for default for now, and the letters and other icons to be white. I loaded the bmp of 'logo' into the 1bitmap program you made, exported the .dat. For some reason the LCD shows the logo plus some chopped off part of one of the buttons you made. If i delete the other parts of the code that load the buttons, the screen stays blue and never shows anything. Is it possible to just show this one symbol, then create more symbols like and stick them together to create words? Secondly, the char gen only allows for vertical oriented chars, but I may have versions of the LCD flipped vertical, in which case is it doable in SPIN to flip the data by 90 degrees or does the bit map have to be flipped for example in any image editor(photoshop, preview etc), then resaved?

    The goal is to create some white icons, logos, text, arrows, etc, then position on the screen in a horizontal or vertical manner.

    Thanks for all the hard work putting those apps together.
    Attached Images Attached Images
    Attached Files Attached Files

  18. #18

    Default Re: Capacitive Multi-Touch example code

    T Chap, there's one unfortunate "trick" to making this work... We have to align all the graphics to a 16-long boundary before using them...
    This is done at the beginning of the code...
    But, in some earlier versions of code, you need to manually specify how many tiles worth of graphics need to be moved. I think it was usually called "nuchars".
    If you have the wrong number there, bad things will happen.

    In newer codes, I have it automatically do this...

  19. #19

    Default Re: Capacitive Multi-Touch example code

    Since what I want is static and small parts to display, maybe I need just a simple method of turning on pixels on the screen from SPIN versus loading bit maps?

  20. #20

    Default Re: Capacitive Multi-Touch example code

    Well, another option is to use one or more "Graphics" areas and use "Graphics.spin" to control them.
    This uses up a lot of memory, but you can save room by making it single buffered instead of double buffered...

    You can start from the NH4 Paint example to do it this way...

+ Reply to Thread

Similar Threads

  1. Capacitive touch better on 4.3" touchscreen?
    By Rayman in forum Propeller 1 Multicore Microcontroller
    Replies: 15
    Last Post: 05-11-2012, 08:16 PM
  2. Touchscreen code examples
    By Don M in forum Propeller 1 Multicore Microcontroller
    Replies: 2
    Last Post: 09-03-2011, 09:02 PM
  3. Touchscreen menu system code help needed
    By RinksCustoms in forum BASIC Stamp
    Replies: 0
    Last Post: 07-12-2006, 12:30 AM
  4. capacitive level
    By hutdon in forum BASIC Stamp
    Replies: 4
    Last Post: 08-18-2004, 08:21 PM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts