0
votes

I would like to connect my ESP32 (Lolin32 Lite Dev Board) to a "1.3 inch 7PIN SPI HD Full Color IPS TFT Display Screen ST7789 Drive IC 240*240". I am using the Arduino IDE.

I have not managed to find a ST7789 library for the ESP32. I have tried to port the Arduino_ST7789 library to the ESP32 to no avail (I am relatively new at embedded programming). I am currently writing my own library from scratch, but effort.

What code/libraries would I need to get started with the display?

My hardware connections are as follows

ESP32 -> Display

Pin GND -> GND

Pin 3.3V -> VCC

Pin 18 -> SCL

Pin 23 -> SDA

Pin 15 -> RES

Pin 13 -> DC

Pin 2 -> BLK

2
The [TFT_eSPI library])github.com/Bodmer/TFT_eSPI) should support the ST7789 display on the ESP32. Alternatively, describe the exact problem you have with the Adafruit library.Codo

2 Answers

0
votes

I figured out the solution, I wasn't able to use the Arduino_ST7789 library because i did not have the correct boards manager.

To get the correct manager go File->Preferences then scroll down to "Additional Boards Manager URLs" and add the following URL. https://dl.espressif.com/dl/package_esp32_index.json Note: If you have existing URLs don't delete them otherwise you will lose access. Add the board to your sketch by going Tools->Board->LoLin D32

Get the relevant libraries by downloading this https://github.com/adafruit/Adafruit-ST7735-Library as a .zip

Next add the library by going Sketch->Include Library->Add .ZIP Library...

Then go to File->Examples->Adafruit ST7785 ST7789 Library->Graphicstest

Use the following code above the setup function

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

#define TFT_CS          5
#define TFT_RST         15 // Or set to -1 and connect to Arduino RESET pin
#define TFT_DC          13
#define TFT_MOSI        23  // Data out
#define TFT_SCLK        18  // Clock out

Adafruit_ST7789 tft = Adafruit_ST7789(TFT_CS, TFT_DC, TFT_MOSI, TFT_SCLK, TFT_RST);

float p = 3.1415926;

Sit back and enjoy some crazy displays

0
votes

You can use the Hardware supported SPI as well. Initialize the display library like:

Adafruit_ST7789 tft = Adafruit_ST7789(TFT_CS, TFT_DC, TFT_RST);

and adjust the SPI to your specific IO lines at startup (in setup()):#

  SPI.begin(TFT_SCLK, TFT_MISO, TFT_MOSI);
  tft.init(240, 320); // Init ST7789 320x240