📱 Elevate Your Projects with Touchscreen Brilliance!
The HiLetgoILI9341 2.8" SPI TFT LCD Display Touch Panel features a high-resolution 240x320 display with a robust PCB design, making it an ideal choice for developers looking to enhance their projects with vibrant visuals and intuitive touch capabilities.
K**K
Works with Teensy 3.2 or Arduino - here's how:
I love these displays and use them on all my projects. I've bought about 8 so far and can get them to work with either Teensy 3.2 or an Arduino Nano.For operation with a Teensy 3.21. use the <ILI9341_t3.h> from the PJRC--and this lib is very fast connect directly2. for touch use "UTouch.h"3. for SD I use <SdFat.h>4. no level shifters needed5. you may need to solder J1 (I do on all my displays)4. if you want to use SD, remove the resistors R1, R2, R3 and solder 0 ohm resistorsFor operation with Auduino Nano1. use the <Adafruit_ILI9341.h>2. for touch use "UTouch.h"3. for SD I have yet to get an SD to work with graphics due to not enough memory4. no level shifters needed5. you WILL need to solder J1 (I do on all my displays)EDIT as of 12/29/2019 Usage with Arduino connect as usual but power your Arduino with 3.3 volts (just connect 3.3 to the 5V pin on the arduino). Alternatively you can put a 1K series resistor on all pins to drop the voltage going to the unit (and power with 3v3). THESE UNITS WILL NOT WORK IF POWERED WITH 5 AND IF THE SIGNAL LINES ARE 5 VOLTS.update 2/2/2022 tips on usage to get everything working on a teensy 4.0 (or 3.2)/*This simple program will test1) the display, 2) the SD card, 3) the touch screen, 4) ability to readPixelThe readPixel is only supported by some display driverslike the ILI9341_t3 driver, there is a PrintScreen.h utility that will let yousave your screen to a BMP file and draw the fileif readPixel fails try to adjust speeds above. It's possible the display MISO is not tri stateand will basically own MISO where other devices can't use it. If so, you will need some external buffermagicIf using display with Teensy (3v3) solder J1, replace R1, R2, R3 with 0 ohmpin connectionsDisplay MCUVCC 3v3GND GNDCS 10RESET 3v3 If white screen 1) 8 or 2) use series 1K0 and 10uf to GND to slow chargeDC 9MOSI 11SCK 13LED 3v3 or connect to analog pin and use analogWrite(x) to fade brightnessMISO 12T_CLK 13T_CS 0T_DIN 11T_DO 12T_IRQ 1SD_SCK 13SD_MISO 12SD_MOSI 11SD_CS A3 (other digital pins may work, read data sheet for what pins support CS)*/#include "ILI9341_t3.h" // high speed display that ships with Teensy#include <XPT2046_Touchscreen.h> // touch driver for a TFT display#include <SdFat.h>#include <SPI.h>#define CS_PIN 10#define DC_PIN 9#define T_CS 0#define T_IRQ 1#define SD_CS A3int BtnX, BtnY;// you know the drillILI9341_t3 Display(CS_PIN, DC_PIN);XPT2046_Touchscreen Touch(T_CS, T_IRQ);TS_Point TouchPoint;SdFat sd;SdFile dataFile;void setup() {Serial.begin(9600);while (!Serial) {}Serial.println("Starting...");// start the dispalyDisplay.begin();Display.setRotation(1);// depending on your exact display getting touch + SD + display working// you may need to adjust the clock speed// default is 30 mhz but you may need to slow to 10000000 or set to as high as 100000000//Display.setClock(20000000);// start the touchTouch.begin();Touch.setRotation(1);// start the SD card// depending on your sd card and display, you may need to slow the sd card clock// I find 20 mhz to be pretty reliablebool SDStatus = sd.begin(SD_CS, SD_SCK_MHZ(20));//bool SDStatus = sd.begin(SD_CS);// test SD and write somethingif (SDStatus) {Serial.println("SD OK");dataFile.open("Test.txt", FILE_WRITE);dataFile.print("This is a test");dataFile.close();}else {Serial.println("SD failed");}// test displayDisplay.fillScreen(ILI9341_BLUE);Serial.print("Color of pixel (10,10): ");Serial.println(Display.readPixel(10, 10));delay(4000);Display.fillScreen(ILI9341_BLACK);}void loop() {if (Touch.touched()) {TouchPoint = Touch.getPoint();BtnX = TouchPoint.x;BtnY = TouchPoint.y;// consistency between displays is a mess...// this is some debug code to help show// where you pressed and the resulting map// x = map(x, real left, real right, 0, width);// y = map(y, real bottom, real top, 0, height);// tft with black headers, yellow headers will be differentBtnX = map(BtnX, 3700, 300, 0, 320);BtnY = map(BtnY, 3800, 280, 0, 240);// Serial.print(", Mapped: ");// Serial.print(BtnX);// Serial.print(",");// Serial.println(BtnY);Display.fillCircle(BtnX, BtnY, 3, ILI9341_RED);// delay(5);}}
C**R
Works fine once you get past a few gotchas
Let me state, it works, it works as expected and I like the display.Let me get you over a couple of gotchas. First off, no joke on the 3.3V logic. You can't use an UNO for testing, it just doesn't work. I can think of a chipset I haven't been able to cheat it but 5V = doesn't function (worked fine after I switched processors, I didn't cook mine).I got mine working on an Arduino MKR. I tied reset to the MKRs VCC, I plugged the display VCC into the 5V pin. I used the Adafruit ILI9341 library and the display test ran after I look the "LED" pin and tied it to pin 6 and did the told digitalWrite(6, HIGH); on the top line of setup();.I then tested the touch screen with the XPT2046 library, there is only one out there from memory. One note... the MISO/MOSI lines are NOT connected as some online walkthroughs state... so you'll need to switch wires over for bench testing. I used the example with IRQ and put my CS on pin 5 and IRQ on pin 4. The sensitivity of the display matched my expectations for a resistive touch screen (vs capacitive).For the hassle I prefer the Adafruit version but with a little extra effort it's worth the lower cost.
E**R
Cheap but good
This is fully functional. Works exactly how it was intended to. For the price, I will probably buy more of these. Super easy to set up. Pins are clearly labeled. Definitely a great value. It is however slower than other higher end expensive units but you get what you pay for.
P**K
Guide and helpful steps for other first-timers!
After spending way too much time trying to figure out the touchscreen, I wanted to share what finally worked for me! First, I'll share the pinout. Next, I'll share the steps that worked with the eSPI library. Lastly, I'll show you the steps using an alternative library - the XPT2046_Touchscreen library.Let me just say it was initially confusing to me because the ILI9341 is the display, but the touchscreen is actually controlled by an XPT2046. And I struggled with connecting everything properly to an ESP-WROOM-32 ESP32 ESP-32S dev board.First, this is the pinout I used. I use the same pinout for both libraries.ILI9341 -> ESP32-WROOM 32sT_IRQ -> GPIO27 (TOUCH7)T_DO -> GPIO19 (VSPIMISO)T_DIN -> GPIO23 (VPSIMOSI)T_CS -> GPIO21T_CLK -> GPIO18 (VSPI SCK)SDO(MISO) -> Not connectedLED -> GPIO32SCK -> GPIO18SDI(MOSI) -> GPIO23 (VPSIMOSI)DC/RS -> GPIO2RESET -> GPIO4CS -> GPIO15GND -> GNDVCC -> 3.3VI'll assume you know how to select the correct Board within the Arduino IDE. For me, it was "Node32s" ESP32 board.Steps to use eSPI Library:1. Take a deep breath2. Open the Arduino IDE3. Install the "TFT_eSPI" Library by Bodmer (I tested with version 2.3.70)4. Close the Arduino IDE5. Open the eSPI "User_Setup.h" file. This file contains the TFT_eSPI configuration. By default, I think the Arduino IDE would have installed this file (step 3 above) in this location: C:\Users\<username>\Documents\Arduino\libraries\TFT_eSPI\User_Setup.h6. Within my User_Setup.h file, I have only these 19 lines uncommented:#define ILI9341_DRIVER // Generic driver for common displays#define TFT_MISO 19#define TFT_MOSI 23#define TFT_SCLK 18#define TFT_CS 15#define TFT_DC 2#define TFT_RST 4#define TOUCH_CS 21#define LOAD_GLCD#define LOAD_FONT2#define LOAD_FONT4#define LOAD_FONT6#define LOAD_FONT7#define LOAD_FONT8#define LOAD_GFXFF#define SMOOTH_FONT#define SPI_FREQUENCY 27000000#define SPI_READ_FREQUENCY 20000000#define SPI_TOUCH_FREQUENCY 25000007. Open the Arduino IDE8. Go to File > Examples > TFT_eSPI > Generic > Touch_calibrate. (It will be at the bottom of the example list...just keep scrolling down.)9. Compile and upload the sketch. Given that we configured the pinout in step 6 above, there should be no need to make any changes to the code in the Touch_calibrate example.10. Open the serial monitor (note the default serial baud rate in the Touch_calibrate code)11. On the ILI9341 screen, you should be prompted to touch each of the 4 corners of the screen to calibrate it. I recommend using the stylus since the calibration requires precise taps.12. After calibrating the 4 corners of the screen, the screen will say "Calibration complete!" at which point you can use the stylus to draw on the screen. At this moment, the calibration data will have been sent through to the serial port, too.13. Success!14. You'll be happy to hear that the other TFT_eSPI examples should work right out with this same pinout. One of my favorites is TFT_Starfield. Just make sure to select an example that's 320x240 to match the ILI9341 resolution.Steps to use XPT2046_Touchscreen library (an alternative to TFT_eSPI):1. Take a deep breath2. Open the Arduino IDE3. Install the "XPT2046_Touchscreen" Library by Paul Stoffregen (I tested with version 1.4.0)4. Close the Arduino IDE and reopen the Arduino IDE.5. Go to File > Examples > XPT2046_Touchscreen > TouchTest. (It will be at the bottom of the example list...just keep scrolling down.)6. Make the following changes prior to the setup() definition:#define CS_PIN 21#define TIRQ_PIN 27XPT2046_Touchscreen ts(CS_PIN, TIRQ_PIN);7. Compile and upload the sketch.8. The ILI9341 screen will be completely white, but don't panic. The screen is supposed to be blank white because this example tests only the touch aspect of the ILI9341, not the display aspect.9. Open the serial monitor (note the default serial baud rate in the code)10. Use the stylus to press on different points of the screen. After each press, you should see a readout over the serial port of the pressure, x coordinate, and y coordinate of the pressed area.11. Success!
Trustpilot
3 days ago
1 month ago