Hi,
I purchased this item through Pi Hut and am having issues with the touchscreen working. I am working with a Teensy 3.6. The screen works and will load the examples through the Arduino application. The touchscreen is unresponsive when I load the touchscreen examples. The wires are soldered on the Teensy: Y- 21, X+ 22, Y+ 31, X- 32. Any help is appreciated.
Touchscreen Issues with 3.2" TFT LCD with Touchscreen Breakout Board w/MicroSD Socket - ILI9341 Product ID: 1743
Moderators: adafruit_support_bill, adafruit
Please be positive and constructive with your questions and comments.
- Kuffcakes
- Posts: 49
- Joined: Sun Oct 08, 2017 12:23 am
- mikeysklar
- Posts: 14194
- Joined: Mon Aug 01, 2016 8:10 pm
Re: Touchscreen Issues with 3.2" TFT LCD with Touchscreen Breakout Board w/MicroSD Socket - ILI9341 Product ID: 1743
Are you using the Adafruit_Touchscreen library?
https://github.com/adafruit/Adafruit_TouchScreen
Can you paste in the code you have been running in CODE brackets?
https://github.com/adafruit/Adafruit_TouchScreen
Can you paste in the code you have been running in CODE brackets?
- Kuffcakes
- Posts: 49
- Joined: Sun Oct 08, 2017 12:23 am
Re: Touchscreen Issues with 3.2" TFT LCD with Touchscreen Breakout Board w/MicroSD Socket - ILI9341 Product ID: 1743
Hi,
Yes, I pulled the library from Arduino following the steps on this site:
https://learn.adafruit.com/adafruit-2-8 ... ouchscreen
I loaded the breakoutTouchPaint example from the Adafruit_ILI9341 library and the screen is unresponsive when trying to select colors or draw.
Yes, I pulled the library from Arduino following the steps on this site:
https://learn.adafruit.com/adafruit-2-8 ... ouchscreen
I loaded the breakoutTouchPaint example from the Adafruit_ILI9341 library and the screen is unresponsive when trying to select colors or draw.
Code: Select all
/***************************************************
This is our touchscreen painting example for the Adafruit ILI9341 Breakout
----> http://www.adafruit.com/products/1770
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
****************************************************/
/** NOT FOR USE WITH THE TOUCH SHIELD, ONLY FOR THE BREAKOUT! **/
#include <Adafruit_GFX.h> // Core graphics library
#include <SPI.h>
#include <Adafruit_ILI9341.h>
#include "TouchScreen.h"
// These are the four touchscreen analog pins
#define YP A2 // must be an analog pin, use "An" notation!
#define XM A3 // must be an analog pin, use "An" notation!
#define YM 9 // can be any digital pin
#define XP 8 // can be any digital pin
// This is calibration data for the raw touch data to the screen coordinates
#define TS_MINX 150
#define TS_MINY 120
#define TS_MAXX 920
#define TS_MAXY 940
#define MINPRESSURE 10
#define MAXPRESSURE 1000
// The display uses hardware SPI, plus #9 & #10
#define TFT_CS 10
#define TFT_DC 9
Adafruit_ILI9341 tft = Adafruit_ILI9341(TFT_CS, TFT_DC);
// For better pressure precision, we need to know the resistance
// between X+ and X- Use any multimeter to read it
// For the one we're using, its 300 ohms across the X plate
TouchScreen ts = TouchScreen(XP, YP, XM, YM, 300);
// Size of the color selection boxes and the paintbrush size
#define BOXSIZE 40
#define BANNED 3
int oldcolor, currentcolor;
void setup(void) {
// while (!Serial); // used for leonardo debugging
Serial.begin(9600);
Serial.println(F("Touch Paint!"));
tft.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()
{
// Retrieve a point
TSPoint p = ts.getPoint();
/*
Serial.print("X = "); Serial.print(p.x);
Serial.print("\tY = "); Serial.print(p.y);
Serial.print("\tPressure = "); Serial.println(p.z);
*/
// we have some minimum pressure we consider 'valid'
// pressure of 0 means no pressing!
if (p.z < MINPRESSURE || p.z > MAXPRESSURE) {
return;
}
// Scale from ~0->1000 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-BANNED) > BOXSIZE) && ((p.y+BANNED) < tft.height())) {
tft.fillCircle(p.x, p.y, BANNED, currentcolor);
}
}
- Kuffcakes
- Posts: 49
- Joined: Sun Oct 08, 2017 12:23 am
Re: Touchscreen Issues with 3.2" TFT LCD with Touchscreen Breakout Board w/MicroSD Socket - ILI9341 Product ID: 1743
I tested this code on an arduino Leonardo to see if there is an issue with the Teensy and the touchscreen portion did not work.
- mikeysklar
- Posts: 14194
- Joined: Mon Aug 01, 2016 8:10 pm
Re: Touchscreen Issues with 3.2" TFT LCD with Touchscreen Breakout Board w/MicroSD Socket - ILI9341 Product ID: 1743
Let's start with the basic touchscreendemo.ino
https://github.com/adafruit/Adafruit_To ... screendemo
Code: Select all
// Touch screen library with X Y and Z (pressure) readings as well
// as oversampling to avoid 'bouncing'
// This demo code returns raw readings, public domain
#include <stdint.h>
#include "TouchScreen.h"
#define YP A2 // must be an analog pin, use "An" notation!
#define XM A3 // must be an analog pin, use "An" notation!
#define YM 8 // can be a digital pin
#define XP 9 // can be a digital pin
// For better pressure precision, we need to know the resistance
// between X+ and X- Use any multimeter to read it
// For the one we're using, its 300 ohms across the X plate
TouchScreen ts = TouchScreen(XP, YP, XM, YM, 300);
void setup(void) {
Serial.begin(9600);
}
void loop(void) {
// a point object holds x y and z coordinates
TSPoint p = ts.getPoint();
// we have some minimum pressure we consider 'valid'
// pressure of 0 means no pressing!
if (p.z > ts.pressureThreshhold) {
Serial.print("X = "); Serial.print(p.x);
Serial.print("\tY = "); Serial.print(p.y);
Serial.print("\tPressure = "); Serial.println(p.z);
}
delay(100);
}
- Kuffcakes
- Posts: 49
- Joined: Sun Oct 08, 2017 12:23 am
Re: Touchscreen Issues with 3.2" TFT LCD with Touchscreen Breakout Board w/MicroSD Socket - ILI9341 Product ID: 1743
Thank you for working with me (just realized I posted in the wrong forum). I uploaded touchscreendemo.ino to my Leonardo and the 3.2" screen goes white. The graphics demo will load when uploaded to the Leonardo.
I purchased the 2.8" version of this screen as well from Adafruit and it will only show a white screen. I can switch the jumpers back to the 3.2" screen and the graphics demo will start up when powered on. I checked the tabs on the ribbon cable and they are secure. IM1, IM2, and IM3 are all soldered for SPI.
I purchased the 2.8" version of this screen as well from Adafruit and it will only show a white screen. I can switch the jumpers back to the 3.2" screen and the graphics demo will start up when powered on. I checked the tabs on the ribbon cable and they are secure. IM1, IM2, and IM3 are all soldered for SPI.
- Kuffcakes
- Posts: 49
- Joined: Sun Oct 08, 2017 12:23 am
Re: Touchscreen Issues with 3.2" TFT LCD with Touchscreen Breakout Board w/MicroSD Socket - ILI9341 Product ID: 1743
There are phantom touches on the 3.2" screen when I use breakoutTouchpaint.ino.
- mikeysklar
- Posts: 14194
- Joined: Mon Aug 01, 2016 8:10 pm
Re: Touchscreen Issues with 3.2" TFT LCD with Touchscreen Breakout Board w/MicroSD Socket - ILI9341 Product ID: 1743
What do you see on the serial console when running the touchdemo.ino code on the Leonardo?
You can use customize the pressure by taking a resistance reading between the X+ and X- pins. The example below is for 300 ohms.
You can use customize the pressure by taking a resistance reading between the X+ and X- pins. The example below is for 300 ohms.
Code: Select all
// For better pressure precision, we need to know the resistance
// between X+ and X- Use any multimeter to read it
// For the one we're using, its 300 ohms across the X plate
TouchScreen ts = TouchScreen(XP, YP, XM, YM, 300);
- Kuffcakes
- Posts: 49
- Joined: Sun Oct 08, 2017 12:23 am
Re: Touchscreen Issues with 3.2" TFT LCD with Touchscreen Breakout Board w/MicroSD Socket - ILI9341 Product ID: 1743
Here is what I am seeing using the serial console (monitor?) on the 3.2" screen. the 2.8" screen will register touches as well but is still a white screen when the graphicstest.ino is loaded.
Code: Select all
X = 628 Y = 326 Pressure = 453
X = 336 Y = 807 Pressure = 433
X = 664 Y = 766 Pressure = 413
X = 670 Y = 774 Pressure = 256
X = 664 Y = 772 Pressure = 193
X = 670 Y = 766 Pressure = 165
X = 735 Y = 287 Pressure = 240
X = 738 Y = 287 Pressure = 194
X = 355 Y = 431 Pressure = 651
X = 357 Y = 433 Pressure = 820
X = 348 Y = 453 Pressure = 576
X = 344 Y = 452 Pressure = 514
X = 346 Y = 452 Pressure = 475
X = 350 Y = 452 Pressure = 439
X = 351 Y = 453 Pressure = 428
X = 348 Y = 452 Pressure = 477
X = 426 Y = 464 Pressure = 660
X = 429 Y = 466 Pressure = 506
X = 429 Y = 465 Pressure = 504
X = 428 Y = 466 Pressure = 511
Last edited by Kuffcakes on Sun Dec 04, 2022 11:46 pm, edited 2 times in total.
- Kuffcakes
- Posts: 49
- Joined: Sun Oct 08, 2017 12:23 am
Re: Touchscreen Issues with 3.2" TFT LCD with Touchscreen Breakout Board w/MicroSD Socket - ILI9341 Product ID: 1743
I found the issue with the 3.2" screen. The pin assignments in the code are incorrect for YM and XP for breakouttouchpaint.ino. I was changing the digital pin to not piggy back off of D/C.
The 2.8" screen is still a white when breakkouttouchpaint.ino and graphicstest.ino are loaded onto it.
touchscreendemo.ino
breakouttouchpaint.ino
The 2.8" screen is still a white when breakkouttouchpaint.ino and graphicstest.ino are loaded onto it.
touchscreendemo.ino
Code: Select all
#define YP A2 // must be an analog pin, use "An" notation!
#define XM A3 // must be an analog pin, use "An" notation!
#define YM 8 // can be a digital pin
#define XP 11 // can be a digital pin
Code: Select all
// These are the four touchscreen analog pins
#define YP A2 // must be an analog pin, use "An" notation!
#define XM A3 // must be an analog pin, use "An" notation!
#define YM 9 // can be any digital pin
#define XP 8 // can be any digital pin
- Kuffcakes
- Posts: 49
- Joined: Sun Oct 08, 2017 12:23 am
Re: Touchscreen Issues with 3.2" TFT LCD with Touchscreen Breakout Board w/MicroSD Socket - ILI9341 Product ID: 1743
Here are two pictures of the 2.8" screen that is only showing a white screen.
- mikeysklar
- Posts: 14194
- Joined: Mon Aug 01, 2016 8:10 pm
Re: Touchscreen Issues with 3.2" TFT LCD with Touchscreen Breakout Board w/MicroSD Socket - ILI9341 Product ID: 1743
Congrats on figuring out the pinouts to use the 3.2" with your Teensy.
Please start another thread for the Teensy 3.6 + 2.8" TFT white screen.
Please start another thread for the Teensy 3.6 + 2.8" TFT white screen.
- Kuffcakes
- Posts: 49
- Joined: Sun Oct 08, 2017 12:23 am
Re: Touchscreen Issues with 3.2" TFT LCD with Touchscreen Breakout Board w/MicroSD Socket - ILI9341 Product ID: 1743
I only wish I had noticed that sooner.
My next issue is getting the screen to work on its intended project. I figured out how to build a synth looper that was posted on YouTube. I am replacing the DS touchscreen and mini screen with the 3.2" screen. The screen acts as a beat repeater and bit crusher.
The 3.2" screen will only work if I hold down on it and then move my finger around for the effects. I need to figure out how to just make it work.
My next issue is getting the screen to work on its intended project. I figured out how to build a synth looper that was posted on YouTube. I am replacing the DS touchscreen and mini screen with the 3.2" screen. The screen acts as a beat repeater and bit crusher.
The 3.2" screen will only work if I hold down on it and then move my finger around for the effects. I need to figure out how to just make it work.
Please be positive and constructive with your questions and comments.