Forum Rule: Always post complete source code & details to reproduce any issue!
Page 2 of 7 FirstFirst 1 2 3 4 ... LastLast
Results 26 to 50 of 169

Thread: 2.8 ILI9341 restive touch miso not connected ?

  1. #26
    Senior Member+ defragster's Avatar
    Join Date
    Feb 2015
    Posts
    10,567
    P#22 displays 'Pressure' - is that a 3D pressure on the display value you can easily reference? If you see a high pressure value do you see less noise in the reported readings?

    When I did a BING - everything with correlation quickly devolved to statistical analysis - i.e. lots of samples and math.

    Are samples polled or interrupt supplied? How much response time is lost with a 2 or 4 oversample that you could sum, then shift away? That would minimize but not ignore errant readings, but also make dragging lag.

  2. #27
    Senior Member PaulStoffregen's Avatar
    Join Date
    Nov 2012
    Posts
    21,286
    I've added 3X oversampling, where the best 2 of 3 are averaged.

    Not sure if it really makes much of a difference. Curious to hear feedback from anyone who uses it with real displays.

  3. #28
    Senior Member+ defragster's Avatar
    Join Date
    Feb 2015
    Posts
    10,567
    Is this a suitable variant of the board?
    New 240x320 2.8" SPI TFT LCD Touch Panel Serial Port Module +PCB ILI9341 5V/3.3V
    $8.90 each shipped

    Quote Originally Posted by Wozzy View Post
    I never finish any project because fun stuff like this always sidetracks me! :-)
    Indeed - after a few months of being sidetracked here - that is the current norm . . .

  4. #29
    Senior Member Wozzy's Avatar
    Join Date
    Jan 2013
    Location
    Philadelphia, Pennsylvania USA
    Posts
    354
    A qualitative look at the serial output stream of x&y position shows that the 3x oversampling works.

    For these plots I'm trying to hold my finger as steady as I can.
    Click image for larger version. 

Name:	Capture125.JPG 
Views:	141 
Size:	52.8 KB 
ID:	5264
    This is X and Y coordinates plotted vs time.
    Yellow is X and Blue is Y
    Each horizontal grid line is about 190 counts out of 3800 (Maximum)

    Edit: The plot is created by a nice little Windows program I recently found called Serial Chart by Starlino.com
    It plots a realtime strip chart from comma separated variable data read directly from the COM port.

    Edit 2: Pressure Value displayed is spewed directly from the library as the Z value.
    I didn't notice any correlation between X-Y noise and changing Z pressure.
    I have a capacitive touch stylus around here somewhere... I will try that next.
    Last edited by Wozzy; 10-12-2015 at 03:24 AM.

  5. #30
    Senior Member PaulStoffregen's Avatar
    Join Date
    Nov 2012
    Posts
    21,286
    The new display is available on the website.

    http://www.pjrc.com/store/display_ili9341_touch.html

  6. #31
    Senior Member
    Join Date
    Oct 2012
    Location
    Portland OR
    Posts
    678
    Wow! That was quick. I'm still amazed these things can be so inexpensive. Just out of curiosity, how much current does this display need? I assume there is a built-in backlight, which probably draws most of the power, but if you turn off the backlight the display is probably unreadable?

    PS. @Wozzy: I like the KST Plot program which can do live-update plots from .csv file as it is being written. Windows/Mac/Linux versions available. I think KST can do more complex plots, but it looks like SerialChart is easier to use.
    Last edited by JBeale; 10-12-2015 at 04:43 PM.

  7. #32
    Senior Member PaulStoffregen's Avatar
    Join Date
    Nov 2012
    Posts
    21,286
    Good question. I haven't measured precisely, but a Teensy 3.2 (running at 96 MHz) and the display are together drawing approx 72 mA from my power supply.

  8. #33
    Senior Member+ defragster's Avatar
    Join Date
    Feb 2015
    Posts
    10,567
    Quote Originally Posted by PaulStoffregen View Post
    The new display is available on the website.

    http://www.pjrc.com/store/display_ili9341_touch.html
    Found and ordered! :-) Priority shipping (to allow protective packaging) from Oregon will be must faster than Hong Kong- now I can have a distraction with nearly instant gratification!

  9. #34
    Senior Member+ Frank B's Avatar
    Join Date
    Apr 2014
    Location
    Germany NRW
    Posts
    6,158
    Quote Originally Posted by defragster View Post
    Found and ordered! :-) Priority shipping (to allow protective packaging) from Oregon will be must faster than Hong Kong- now I can have a distraction with nearly instant gratification!
    Hehe, my recent distraction resulted in my first teensy 3.1 murdered.
    It lives its second life as a keychain as a constant reminder to be more careful.

  10. #35
    Senior Member+ defragster's Avatar
    Join Date
    Feb 2015
    Posts
    10,567
    I'm about to update my GOOD efforts with your that distraction - if only you hadn't distracted yourself during that distraction that Teensy would be alive and well.

    Now I MUST order from OSH ASAP to get the PJRC Carrier board - if only PJRC stocked them to drop one in my package :-)

  11. #36
    Senior Member+ Frank B's Avatar
    Join Date
    Apr 2014
    Location
    Germany NRW
    Posts
    6,158
    Quote Originally Posted by PaulStoffregen View Post
    I've added 3X oversampling, where the best 2 of 3 are averaged.

    Not sure if it really makes much of a difference. Curious to hear feedback from anyone who uses it with real displays.
    Works good. Dividing by ten ( tft.print(p.x / 10); ) gives very good results.

  12. #37
    Senior Member+ Frank B's Avatar
    Join Date
    Apr 2014
    Location
    Germany NRW
    Posts
    6,158
    Hm, i ran the Touchpaint example , x & y coordinates are swapped !

  13. #38
    Senior Member+ defragster's Avatar
    Join Date
    Feb 2015
    Posts
    10,567
    If samples come that fast then doing 8 and a bit shift divide would be trivial. Doing logic to exclude one could throw out the right one and take more cycles. Making that oversample user adjustable [2,4,8] might allow fine tuning on 'noise versus speed' critical systems.

  14. #39
    Senior Member+ Frank B's Avatar
    Join Date
    Apr 2014
    Location
    Germany NRW
    Posts
    6,158
    yup, something like that. Or
    x &= ~0x7;

    Then, increasing the Z_THRESHOLD gives better results (at least for my display).


    @paul:
    The touchpaint example is ok with these lines changed in XPT2046_Touchscreen.cpp
    Code:
        if (z >= Z_THRESHOLD) {
            xraw = 4096-y;
            yraw = x;
        }
    That's not the "correct" solution, but gives a hint what to change.

    Edit:
    The edited "Touchpaint" (if someone wants to try it):
    Code:
    /***************************************************
      This is our touchscreen painting example for the Adafruit ILI9341 Shield
      ----> http://www.adafruit.com/products/1651
    
      Check out the links above for our tutorials and wiring diagrams
      These displays use SPI to communicate, 4 or 5 pins are required to
      interface (RST is optional)
      Adafruit invests time and resources providing this open source code,
      please support Adafruit and open-source hardware by purchasing
      products from Adafruit!
    
      Written by Limor Fried/Ladyada for Adafruit Industries.
      MIT license, all text above must be included in any redistribution
     ****************************************************/
    
    
    #include <SPI.h>
    #include <Wire.h>      // this is needed even tho we aren't using it
    #include <ILI9341_t3.h>
    #include <XPT2046_Touchscreen.h>
    
    
    // This is calibration data for the raw touch data to the screen coordinates
    #define TS_MINX 150
    #define TS_MINY 130
    #define TS_MAXX 3800
    #define TS_MAXY 4000
    
    // The XPT2046 uses hardware SPI on the shield, and #8
    #define CS_PIN  8
    XPT2046_Touchscreen ts(CS_PIN);
    // The display also uses hardware SPI, plus #9 & #10
    #define TFT_CS 10
    #define TFT_DC  9
    ILI9341_t3 tft = ILI9341_t3(TFT_CS, TFT_DC);
    
    
    // Size of the color selection boxes and the paintbrush size
    #define BOXSIZE 40
    #define PENRADIUS 3
    int oldcolor, currentcolor;
    
    void setup(void) {
     // while (!Serial);     // used for leonardo debugging
     
      Serial.begin(9600);
      Serial.println(F("Touch Paint!"));
      
      tft.begin();
        ts.begin();
      tft.fillScreen(ILI9341_BLACK);
      
      // make the color selection boxes
      tft.fillRect(0, 0, BOXSIZE, BOXSIZE, ILI9341_RED);
      tft.fillRect(BOXSIZE, 0, BOXSIZE, BOXSIZE, ILI9341_YELLOW);
      tft.fillRect(BOXSIZE*2, 0, BOXSIZE, BOXSIZE, ILI9341_GREEN);
      tft.fillRect(BOXSIZE*3, 0, BOXSIZE, BOXSIZE, ILI9341_CYAN);
      tft.fillRect(BOXSIZE*4, 0, BOXSIZE, BOXSIZE, ILI9341_BLUE);
      tft.fillRect(BOXSIZE*5, 0, BOXSIZE, BOXSIZE, ILI9341_MAGENTA);
     
      // select the current color 'red'
      tft.drawRect(0, 0, BOXSIZE, BOXSIZE, ILI9341_WHITE);
      currentcolor = ILI9341_RED;
    }
    
    
    void loop()
    {
      // See if there's any  touch data for us
      if (ts.bufferEmpty()) {
        return;
      }
      /*
      // You can also wait for a touch
      if (! ts.touched()) {
        return;
      }
      */
    
      // Retrieve a point  
      TS_Point p = ts.getPoint();
      
     /*
      Serial.print("X = "); Serial.print(p.x);
      Serial.print("\tY = "); Serial.print(p.y);
      Serial.print("\tPressure = "); Serial.println(p.z);  
     */
     
      // Scale from ~0->4000 to tft.width using the calibration #'s
      p.x = map(p.x, TS_MINX, TS_MAXX, 0, tft.width());
      p.y = map(p.y, TS_MINY, TS_MAXY, 0, tft.height());
    
      /*
      Serial.print("("); Serial.print(p.x);
      Serial.print(", "); Serial.print(p.y);
      Serial.println(")");
      */
    
      if (p.y < BOXSIZE) {
         oldcolor = currentcolor;
    
         if (p.x < BOXSIZE) { 
           currentcolor = ILI9341_RED; 
           tft.drawRect(0, 0, BOXSIZE, BOXSIZE, ILI9341_WHITE);
         } else if (p.x < BOXSIZE*2) {
           currentcolor = ILI9341_YELLOW;
           tft.drawRect(BOXSIZE, 0, BOXSIZE, BOXSIZE, ILI9341_WHITE);
         } else if (p.x < BOXSIZE*3) {
           currentcolor = ILI9341_GREEN;
           tft.drawRect(BOXSIZE*2, 0, BOXSIZE, BOXSIZE, ILI9341_WHITE);
         } else if (p.x < BOXSIZE*4) {
           currentcolor = ILI9341_CYAN;
           tft.drawRect(BOXSIZE*3, 0, BOXSIZE, BOXSIZE, ILI9341_WHITE);
         } else if (p.x < BOXSIZE*5) {
           currentcolor = ILI9341_BLUE;
           tft.drawRect(BOXSIZE*4, 0, BOXSIZE, BOXSIZE, ILI9341_WHITE);
         } else if (p.x < BOXSIZE*6) {
           currentcolor = ILI9341_MAGENTA;
           tft.drawRect(BOXSIZE*5, 0, BOXSIZE, BOXSIZE, ILI9341_WHITE);
         }
    
         if (oldcolor != currentcolor) {
            if (oldcolor == ILI9341_RED) 
              tft.fillRect(0, 0, BOXSIZE, BOXSIZE, ILI9341_RED);
            if (oldcolor == ILI9341_YELLOW) 
              tft.fillRect(BOXSIZE, 0, BOXSIZE, BOXSIZE, ILI9341_YELLOW);
            if (oldcolor == ILI9341_GREEN) 
              tft.fillRect(BOXSIZE*2, 0, BOXSIZE, BOXSIZE, ILI9341_GREEN);
            if (oldcolor == ILI9341_CYAN) 
              tft.fillRect(BOXSIZE*3, 0, BOXSIZE, BOXSIZE, ILI9341_CYAN);
            if (oldcolor == ILI9341_BLUE) 
              tft.fillRect(BOXSIZE*4, 0, BOXSIZE, BOXSIZE, ILI9341_BLUE);
            if (oldcolor == ILI9341_MAGENTA) 
              tft.fillRect(BOXSIZE*5, 0, BOXSIZE, BOXSIZE, ILI9341_MAGENTA);
         }
      }
      if (((p.y-PENRADIUS) > BOXSIZE) && ((p.y+PENRADIUS) < tft.height())) {
        tft.fillCircle(p.x, p.y, PENRADIUS, currentcolor);
      }
    }
    Obviously, the comments (first lines) are wrong :-)
    Last edited by Frank B; 10-12-2015 at 10:09 PM.

  15. #40
    Senior Member+ Frank B's Avatar
    Join Date
    Apr 2014
    Location
    Germany NRW
    Posts
    6,158
    I just found this algorithm ( but did'nt read the whole article) https://en.wikipedia.org/wiki/RANSAC
    German: https://de.wikipedia.org/wiki/RANSAC-Algorithmus

    ...just another distraction.
    Last edited by Frank B; 10-12-2015 at 09:41 PM.

  16. #41
    Senior Member PaulStoffregen's Avatar
    Join Date
    Nov 2012
    Posts
    21,286
    Quote Originally Posted by defragster View Post
    If samples come that fast then doing 8 and a bit shift divide would be trivial.
    Within the library, each measurement on each axis takes approx 8 us. Version 1.1 does 3 measurements on each axis, plus the 2 needed to determine the touch pressure. With some overheard, the whole process is probably between 70 to 75 us to read the touch sensor.

    Doing logic to exclude one could throw out the right one and take more cycles.
    In an attempt to throw out the worst sample, the code currently computes the distance between each pair. The pair with the least distance apart is kept and averaged. That seems to be pretty effective. But of course more work could be done on better ways.....

    [/QUOTE]
    Making that oversample user adjustable [2,4,8] might allow fine tuning on 'noise versus speed' critical systems.[/QUOTE]

    Please feel free to dig into the library source!

    At this moment I'm pretty happy with the performance of version 1.1, so I'm not personally planning to spend much more time on this. But if you or anyone else comes up with a much better way, I'd be happy to merge a good pull request.

  17. #42
    Senior Member PaulStoffregen's Avatar
    Join Date
    Nov 2012
    Posts
    21,286
    Quote Originally Posted by Frank B View Post
    I just found this algorithm ( but did'nt read the whole article) https://en.wikipedia.org/wiki/RANSAC
    Oh, that does look pretty awesome. Maybe I will end up getting "distracted" again....

  18. #43
    Senior Member
    Join Date
    Jan 2014
    Posts
    157
    I am excited about this. I am confused though regarding choosing a ili9341 with xpt2046 touchscreen that is compatible with the OSH board pointed to by Paul.
    Seems like the board has one row of connectors but many of the displays I see have two rows.

    Can someone point me to an actual display (preferably 3.2") that is compatible with the OSH board and Touchscreen library?

    thanks,

    Richard

  19. #44
    Senior Member+ defragster's Avatar
    Join Date
    Feb 2015
    Posts
    10,567
    Post #30 above has this link to a 'one' row supported unit in the PJRC Store. It is a 2.8" board though.

    I ordered a couple yesterday and I'll have them by Friday according to the tracking number I got today. I could have ordered them from Hong Kong and saved a couple bucks - per Paul these are tested to work so I won't get any lemons and they will be the model supported by the PJRC library - and I won't forget I ordered them before they get here.

    I placed my first OSH board order today too - they are scheduled on panels to be made 10/15 so I suppose I'll see them by the end of next week.
    Last edited by defragster; 10-14-2015 at 06:12 AM.

  20. #45
    Senior Member PaulStoffregen's Avatar
    Join Date
    Nov 2012
    Posts
    21,286
    Quote Originally Posted by RichardFerraro View Post
    Seems like the board has one row of connectors but many of the displays I see have two rows.
    You need the type with 1 row of 14 pins.

    The 2 row types usually have 40 pins (20 per row). Those are meant for parallel connection. They can be used with the UTFT library. The parallel interface is very fast, but it requires a lot of wires that use up nearly all the pins on Teensy.

    We should have more in stock in about 1 week. If you buy from PJRC, you'll get a display we actually tested.

    But you'll probably do fine to get one from China. Just make sure it has 1 row of 14 pins. Take a moment to count the number of pins in the photos. If there's a photo of the back side where signal names are printed, compare the names to the "ILI9341 Pin" column in the connections table. There's always some small risk when you build stuff directly from Chinese merchants, but if the photo has 14 pins and you can see the same signal names in the same order, odds are very good it'll work.

    If ordering from China, I highly recommend buying a spare.

  21. #46
    Member
    Join Date
    Feb 2014
    Location
    Southern Oregon
    Posts
    79
    Quote Originally Posted by PaulStoffregen View Post
    ...The added components are two 10K resistors, as pullups on the two CS signals....
    And it looks like you switched from surface mount to a through hole capacitor on the ground leg of the fuse. Thank you.

    Ordered some screens and the boards from OSH Park, now just rounding out my Digi-Key order...

    Digi-Key has a 14 position 0.100" housing for the connector - Digikey 609-2329-ND (to make a pig-tail for enclosure mounting)

    And I found what looks to be an equivalent DC power jack to the one you use - Digikey CP-002A-ND (a few cents more, but I seem order more from Digi-Key than Mouser these days)

    Thanks for adding these screens and the work on the library too!

    --Jon

  22. #47
    Senior Member+ defragster's Avatar
    Join Date
    Feb 2015
    Posts
    10,567
    Jon - thanks for the digikey jack part# - with my display and OSH order I'll need to finish Digikey too for some of the 6 OSH boards. What part # did you use for the 1uF capacitor? So many parts - so many distractions.

  23. #48
    Member
    Join Date
    Feb 2014
    Location
    Southern Oregon
    Posts
    79
    Tim — On the older OSH test boards for the smaller non-touchscreen Paul used a surface mount 1uF 0805 capacitor - Digikey 1276-1066-1-ND.

    But it looks like Paul switched to through holes (for now?) on the test board that's out on OSH Park. I have drawers full of through hole caps, so didn't order any of those.

    He said he'd update with a parts list, etc. once he tested it a bit. If you're not in a hurry...

    --Jon

  24. #49
    Senior Member+ defragster's Avatar
    Join Date
    Feb 2015
    Posts
    10,567
    Quote Originally Posted by epicycloid View Post
    Tim — On the older OSH test boards for the smaller non-touchscreen Paul used a surface mount 1uF 0805 capacitor - Digikey 1276-1066-1-ND.
    Thanks, I saw the update to the board as you noted so knew the SMD was out of date. Being new to this - my desk doesn't have those kind of drawers. I may have picked up a suitable cap assortment. Searching on Digikey is daunting knowing a few functional words can take you to the wrong list - or even the right one with a few thousand parts on many pages to differentiate - and caps having so many material types . . . and then when you find a suitable through hole - there is the the leg distance. It looks like the OSH turn around is longer than I thought so I have time it seems for Paul to update. Though looking now at the OSH images it seems the cap legs are .10"

  25. #50
    Member
    Join Date
    Feb 2014
    Location
    Southern Oregon
    Posts
    79
    Not to hijack the original thread, but when re-starting in electronics a few years ago, I found it easy to buy some of the assortments from Jameco...

    This catalog page has their most popular assortments, and I'd get the ceramic capacitors, radial electrolytics and tantalum's. Just the "refill" part numbers, unless you want to buy in to their whole drawer organization system (which I didn't).

    They also have various E12 and other combinations of resistors on a separate catalog page.

    I got a couple sets of Akro-Mils 44 drawer sets and hung them on the wall. But talking about component organization here, is probably like discussing religion, so just take this as one person's opinion.

    Digi-Key and Mouser probably have similar assortments, if you know how to search for them, like E12 or E24 1/4 watt resistor assortments.

    HTH,

    --Jon

Posting Permissions

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