D1 Mini to 2.4 SPI TFT

Hi real novice looking for help.

The tft is a cheap Chinese one with IC:ST7789V SPI on the box. Using a AZDelivery 4mb D1 Mini V3.
I have watched several videos and have been trying to get my screen to just run the graphics tests (tried the esp8266 with ST7789.h one and the ILI9341.h) both codes upload ok but I just get a white screen.

mosi 7
miso 6
clk 5

top of code ILI9341

#include "SPI.h"
#include "Adafruit_GFX.h"
#include "Adafruit_ILI9341.h"

// For the Adafruit shield, these are the default.
#define TFT_DC  1
#define TFT_CS  8
#define TFT_RST 2

// Use hardware SPI (on Uno, #13, #12, #11) and the above for CS/DC
Adafruit_ILI9341 tft = Adafruit_ILI9341(TFT_CS, TFT_DC, TFT_RST);
// If using the breakout, change pins as desired
//Adafruit_ILI9341 tft = Adafruit_ILI9341(TFT_CS, TFT_DC, TFT_MOSI, TFT_CLK, TFT_RST, TFT_MISO);

void setup() {
  Serial.begin(9600);
  Serial.println("ILI9341 Test!");

top of code esp8266 test

#include <Adafruit_GFX.h>    // Core graphics library
#include <Adafruit_ST7789.h> // Hardware-specific library for ST7789
#include <SPI.h>

#if defined(ARDUINO_FEATHER_ESP32) // Feather Huzzah32
  #define TFT_CS         14
  #define TFT_RST        15
  #define TFT_DC         32

#elif defined(ESP8266)
#define TFT_CS         8
#define TFT_RST        2
#define TFT_DC         1

#else
// For the breakout board, you can use any 2 or 3 pins.
// These pins will also work for the 1.8" TFT shield.
#define TFT_CS        10
#define TFT_RST        9 // Or set to -1 and connect to Arduino RESET pin
#define TFT_DC         8
#endif

// OPTION 1 (recommended) is to use the HARDWARE SPI pins, which are unique
// to each board and not reassignable. For Arduino Uno: MOSI = pin 11 and
// SCLK = pin 13. This is the fastest mode of operation and is required if
// using the breakout board's microSD card.



// For 1.14", 1.3", 1.54", 1.69", and 2.0" TFT with ST7789:
Adafruit_ST7789 tft = Adafruit_ST7789(TFT_CS, TFT_DC, TFT_RST);


// OPTION 2 lets you interface the display using ANY TWO or THREE PINS,
// tradeoff being that performance is not as fast as hardware SPI above.
//#define TFT_MOSI 11  // Data out
//#define TFT_SCLK 13  // Clock out


// OR for the ST7789-based displays, we will use this call
// Adafruit_ST7789 tft = Adafruit_ST7789(TFT_CS, TFT_DC, TFT_MOSI, TFT_SCLK, TFT_RST);


float p = 3.1415926;

void setup(void) {
  Serial.begin(9600);
  Serial.print(F("Hello! ST77xx TFT Test"));

  // OR use this initializer (uncomment) if using a 2.0" 320x240 TFT:
  tft.init(240, 320);           // Init ST7789 320x240

  // SPI speed defaults to SPI_DEFAULT_FREQ defined in the library, you can override it here
  // Note that speed allowable depends on chip and quality of wiring, if you go too fast, you
  // may end up with a black screen some times, or all the time.
  //tft.setSPISpeed(40000000);

  Serial.println(F("Initialized"));

__

Apologies in advance if I have done something stupid, I've been trying to get it to work on my own for over 10 hrs.
Thanks

Please post a link to the actual display that you have bought. e.g. Ebay sale page.

Your photo looks like an ILI9341 display.

I strongly advise writing all the #defines with the name, pin number and wire colour.

Then using the software SPI constructor first.
When this is working, try the hardware SPI constructor.

If you have a problem, post a photo that clearly shows each wire colour and each end. Then readers can compare the photo with your #defines.

Adafruit_ILI9341 should be fine. But life is much easier with Bodmer's TFT_eSPI.h library. Use the appropriate "Setup.h" file and follow his exact wiring.

David.

p.s. if the sealed anti-static bag says ST7789 it almost certainly is ST7789. i.e. use Adafruit_ST7789.h (or the Setup...ST7789.h for TFT_eSPI)

David.

Hi David, thanks for the quick reply
this is the link to the screen (sticker on box said 2.4" TFT 14P IC:ST7789V SPI 240(RGB) X 320 10922)

I'll work through your other comments

Thanks for pointing me in the right direction, I finally got it to output the graphics test using Bodmers eSPI and the ST7789 driver.
I'm not sure I fully understand how I got there but will re read through again when my head hurts less.
Many thanks for your help

I am intrigued. I have never seen a Red 2.4 inch ST7789 SPI display.

Did you use Setup18_ST7789.h with TFT_eSPI ?
Or did you write a custom User_Setup.h file ?

Please can you try Setup18_ST7789.h and report back.
Do all the examples work ? i.e. colours, directions, ...

Or did you use Setup1_ILI9341.h but with

#define ST7789_DRIVER   //instead of ILI9341_DRIVER

If you make a report, please quote the "Setup.h" file by name.
Copy-paste any "edits"

David.

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.