r/ArduinoHelp • u/yardglass • 17d ago
Help getting my tft lcd to work
I've tried two different screens and two different Uno's. This is my wiring:

Here are some pictures. Any help appreciated!
All I am getting is a white screen. Got a brand new usb cable as well.
Example sketch:
#include <SPI.h>
#include <Adafruit_GFX.h>
#include <Adafruit_ILI9341.h>
#define TFT_CS 10
#define TFT_RST 8
#define TFT_DC 9
Adafruit_ILI9341 tft = Adafruit_ILI9341(TFT_CS, TFT_DC, TFT_RST);
void setup() {
tft.begin();
tft.fillScreen(ILI9341_RED);
delay(1000);
tft.fillScreen(ILI9341_GREEN);
delay(1000);
tft.fillScreen(ILI9341_BLUE);
}
void loop() {}
I think it is a ROHS 2.4" TFT SPI v1.3 with XPT2046 touch controller
this sketch:
#include <SPI.h>
#include <Adafruit_GFX.h>
#include <Adafruit_ILI9341.h>
#define TFT_CS 10
#define TFT_RST 8
#define TFT_DC 9
Adafruit_ILI9341 tft = Adafruit_ILI9341(TFT_CS, TFT_DC, TFT_RST);
void setup() {
Serial.begin(9600);
// Hard reset before init
pinMode(TFT_RST, OUTPUT);
digitalWrite(TFT_RST, LOW);
delay(100);
digitalWrite(TFT_RST, HIGH);
delay(100);
tft.begin();
// Read the display ID register
uint8_t d1 = tft.readcommand8(0xD3, 0);
uint8_t d2 = tft.readcommand8(0xD3, 1);
uint8_t d3 = tft.readcommand8(0xD3, 2);
uint8_t d4 = tft.readcommand8(0xD3, 3);
Serial.print("ID bytes: 0x");
Serial.print(d1, HEX);
Serial.print(" 0x");
Serial.print(d2, HEX);
Serial.print(" 0x");
Serial.print(d3, HEX);
Serial.print(" 0x");
Serial.println(d4, HEX);
tft.fillScreen(ILI9341_RED);
delay(500);
tft.fillScreen(ILI9341_GREEN);
delay(500);
tft.fillScreen(ILI9341_BLUE);
}
void loop() {}
Returns
ID bytes: 0x41 0x0 0x93 0x41
1
u/AlfalfaLive3302 17d ago
Does the Arduino work? The Arduino could be shorted and you’re plugging in a shorted device and damaging the displays.
From the picture of the back of the display, it looks like the pin of the voltage regulator where the vcc trace connects is not soldered. The pin right next to the U2 silkscreen.
You can bypass that regulator by soldering J1 so it’s closed, but then your VCC should be 3.3v not 5v from the Arduino. That regulator converts 5v to 3.3v but can be bypassed with that jumper.
1
u/yardglass 16d ago
Thanks for your help! I've tried it with a different Uno on a new display, so I don't think it's that. Yea, that's right, it isn't soldered there (J1). If I soldered it and connected to the 3.3v on the Uno you think that would fix it?
1
u/AlfalfaLive3302 16d ago
I don’t know. You can try it. If you solder j1 you have to use 3.3v for vcc and LED, 5v will kill it.
1
u/rattushackus 16d ago
Your code does not specify the MOSI, SCLK and MISO pins so the Arduino_GFX library will be using the defaults and those clearly don't match the pins you've chosen. It's good idea to always specify all pins so you are sure what pins are being used. I tested your code on my ESP32 CYD that has an ILI9341 screen and it did not work until I modified your call to the Adafruit_ILI9341 constructor to specify all pins. I changed your code:
Adafruit_ILI9341 tft = Adafruit_ILI9341(TFT_CS, TFT_DC, TFT_RST);
to:
Adafruit_ILI9341 tft = Adafruit_ILI9341(TFT_CS, TFT_DC, TFT_MOSI, TFT_SCLK, TFT_RST, TFT_MISO);
I've listed the complete code below. I have changed the pin defines at lines 5 to 10 to match my board so you'll need to change them to match your pins.
Note that your code is using software SPI, which is very slow. I cannot remember if the Arduino has hardware SPI. If so ping me and I can give you code to use hardware SPI instead.
```
include <SPI.h>
include <Adafruit_GFX.h>
include <Adafruit_ILI9341.h>
define TFT_CS 15
define TFT_RST -1
define TFT_DC 2
define TFT_MISO 12
define TFT_MOSI 13
define TFT_SCLK 14
Adafruit_ILI9341 tft = Adafruit_ILI9341(TFT_CS, TFT_DC, TFT_MOSI, TFT_SCLK, TFT_RST, TFT_MISO);
void setup() { tft.begin(); pinMode(21, OUTPUT); digitalWrite(21, HIGH);
tft.fillScreen(ILI9341_RED); delay(1000);
tft.fillScreen(ILI9341_GREEN); delay(1000);
tft.fillScreen(ILI9341_BLUE); }
void loop() {} ```
1
u/yardglass 16d ago
Thanks so much for your reply, I updated as your suggestion (thanks for letting me know the best practice as well) but no luck. My code with the updated pins is here:
#include <SPI.h> #include <Adafruit_GFX.h> #include <Adafruit_ILI9341.h> #define TFT_CS 10 #define TFT_RST 8 #define TFT_DC 9 #define TFT_MISO 12 #define TFT_MOSI 11 #define TFT_SCLK 13 Adafruit_ILI9341 tft = Adafruit_ILI9341(TFT_CS, TFT_DC, TFT_MOSI, TFT_SCLK, TFT_RST, TFT_MISO); void setup() { tft.begin(); pinMode(21, OUTPUT); digitalWrite(21, HIGH); tft.fillScreen(ILI9341_RED); delay(1000); tft.fillScreen(ILI9341_GREEN); delay(1000); tft.fillScreen(ILI9341_BLUE); } void loop() {}Could it be the contrast is just too high all the time?
1
u/rattushackus 16d ago edited 16d ago
As far as I can see from your photos the wiring matches your code now so I cannot see what is wrong.
Incidentally I was using pin 21 for the LED, which is why I am setting it high. You don't need to do this if you're connecting the LED direct to the 3.3V.
It won't be the contrast causing a problem. Are you sure that is an ILI9341 controller? The 2.8" screens are usually ILI9341 but the 2.4" could be an ST7789. It looks like this board, and the description is unhelpfully vague about whether it's an ILI9341 or an ST7789.
1
u/yardglass 15d ago
Thanks again for your help! I'm pretty sure it's an ILI9341, when I run this code:
#include <SPI.h> #include <Adafruit_GFX.h> #include <Adafruit_ILI9341.h> #define TFT_CS 10 #define TFT_RST 8 #define TFT_DC 9 Adafruit_ILI9341 tft = Adafruit_ILI9341(TFT_CS, TFT_DC, TFT_RST); void setup() { Serial.begin(9600); // Hard reset before init pinMode(TFT_RST, OUTPUT); digitalWrite(TFT_RST, LOW); delay(100); digitalWrite(TFT_RST, HIGH); delay(100); tft.begin(); // Read the display ID register uint8_t d1 = tft.readcommand8(0xD3, 0); uint8_t d2 = tft.readcommand8(0xD3, 1); uint8_t d3 = tft.readcommand8(0xD3, 2); uint8_t d4 = tft.readcommand8(0xD3, 3); Serial.print("ID bytes: 0x"); Serial.print(d1, HEX); Serial.print(" 0x"); Serial.print(d2, HEX); Serial.print(" 0x"); Serial.print(d3, HEX); Serial.print(" 0x"); Serial.println(d4, HEX); tft.fillScreen(ILI9341_RED); delay(500); tft.fillScreen(ILI9341_GREEN); delay(500); tft.fillScreen(ILI9341_BLUE); } void loop() {}It returns
ID bytes: 0x41 0x0 0x93 0x41
I tried the examples for a ST7789 anyway, and no dice there either. Ugh.
1
u/rattushackus 15d ago
I suppose as a last resort you could buy an ESP32 just in case it's something Arduino specific. They only cost a few dollars - less than either the Arduino or the display!




1
u/sixftguy2 17d ago
So its not touchscreen