ESP3-C3 Super Mini wiring to ST7789

Slonni
Posts: 5
Joined: Sat Dec 30, 2023 10:13 pm

ESP3-C3 Super Mini wiring to ST7789

Postby Slonni » Thu Jan 04, 2024 11:05 pm

I want to connect a ESP32-C3 Super Mini with display 240*240 ST7789 (with SPI) using Library TFT_eSPI
(The same display connected to ESP32 D1 Mini is running as expected)
Here is a picture and pinout of the ESP-C3 Super Mini
Pinout ESP32-C3 Super Mini.png
Pinout ESP32-C3 Super Mini.png (289.15 KiB) Viewed 14519 times
The display has the following SPI Pins:
BLK = Backlight
DC = Data/Command
RES = Reset
SDA = Serial Data or SPI MOSI
SCL = Serial Clock or SPI SCK
VCC = VCC (3.3 Volt)
GND = Ground

I am connecting the ESP32-C3 Super Mini with the display using the following pins (as configured in the TFT_eSPI for ESP32-C3_ILI9341.h) generic default in Setup70c_ESP32_C3_IL
BLK --> not connected
DC --> Pin 8
RES --> Pin 10
SDA --> Pin 6
SCL --> Pin 4
VCC --> 3V3
GND --> GND

The SW I am using is functioning on ESP32 D1 Mini with display connected - not with the ESP32-C3 wired as described.
Anyone any idea what I am doing wrong? Any support to get it running is highly appreciated.
Thanks much.

beegeebee
Posts: 8
Joined: Sun Jan 07, 2024 5:28 pm

Re: ESP3-C3 Super Mini wiring to ST7789

Postby beegeebee » Sun Jan 07, 2024 6:28 pm

Hi,

I got my first ESP32-C3 supermini a couple of days ago and have been running through various tests when I came across your problem. ST7789 test was my next one and I also use TFT_eSPI. I haven't had any problems and it is working OK with a 320x240 ST7789 TFT.

When setting up your code for TFT_eSPI I assume you are creating a custom copy of User_Setup.h in the TFT_eSPI install folder. For the ESP32-C3 Supermini I have the following User_Setup.h :

#define USER_SETUP_INFO "User_Setup"
#define ST7789_DRIVER
#define TFT_RGB_ORDER TFT_BGR
#define TFT_WIDTH 240
#define TFT_HEIGHT 320
#define TFT_MISO 5
#define TFT_MOSI 6
#define TFT_SCLK 4
#define TFT_CS 7 // Chip select control pin
#define TFT_DC 8 // Data Command control pin
#define TFT_RST 9 // Reset pin (could connect to RST pin)
#define TOUCH_CS -1 // Chip select pin (T_CS) of touch screen
#define LOAD_GLCD // Font 1. Original Adafruit 8 pixel font needs ~1820 bytes in FLASH
#define LOAD_FONT2 // Font 2. Small 16 pixel high font, needs ~3534 bytes in FLASH, 96 characters
#define LOAD_FONT4 // Font 4. Medium 26 pixel high font, needs ~5848 bytes in FLASH, 96 characters
#define LOAD_FONT6 // Font 6. Large 48 pixel font, needs ~2666 bytes in FLASH, only characters 1234567890:-.apm
#define LOAD_FONT7 // Font 7. 7 segment 48 pixel font, needs ~2438 bytes in FLASH, only characters 1234567890:-.
#define LOAD_FONT8 // Font 8. Large 75 pixel font needs ~3256 bytes in FLASH, only characters 1234567890:-.
#define LOAD_GFXFF // FreeFonts. Include access to the 48 Adafruit_GFX free fonts FF1 to FF48 and custom fonts
#define SPI_FREQUENCY 27000000

My TFT is 320x240 so you will need to adjust the TFT_HEIGHT setting. As you only have an SDA pin this should be wired to GPIO06. GPIO05 does not need connecting to anything as you do not need MISO. You also have no CS (Chip select pin on the TFT). This means you can only have one device on the SPI bus if the TFT is attached.

I see your TFT has a backlight pin. This should normally be held high or driven by a pin on the ESP32. If you want to drive it from the ESP32 add the following lines to your User_Setup.h

#define TFT_BL 10 // LED back-light control pin
#define TFT_BACKLIGHT_ON HIGH // Level to turn ON back-light (HIGH or LOW)

and wire pin GPIO10 to the backlight pin on the TFT.

Your wiring should be

ESP32 ST7789
GPIO06 -> SDA
GPIO04 -> SCL
GPIO08 -> DC
GPIO09 -> RST
GPIO10 -> BLK
3V3 -> VCC
GND -> GND

Give it a try.

michielbruijn
Posts: 2
Joined: Wed Jan 17, 2024 10:55 pm

Re: ESP3-C3 Super Mini wiring to ST7789

Postby michielbruijn » Wed Jan 17, 2024 11:24 pm

Hello,

I stumbeled upon the same problem while experimenting.
I got a ESP32 38-pin where I got this st7889 display working.

Now I want to have it working on the ESP32C3 as well.
I tried your suggestions but I can't get it to work (yet).
Nothing happens when I wire the board like you suggested

edit:
Although I was able to check each pin for high an low with a multimeter, I couldn't get a simple serial output to work on this device.
I did however manage to do this on the other esp32 board. So no faulty cable or something...

edit2: Serial wasn't working because I had to set USB CDC on boot enabled in the Arduino IDE
Last edited by michielbruijn on Fri Jan 19, 2024 8:04 am, edited 1 time in total.

beegeebee
Posts: 8
Joined: Sun Jan 07, 2024 5:28 pm

Re: ESP3-C3 Super Mini wiring to ST7789

Postby beegeebee » Thu Jan 18, 2024 3:35 pm

Hi michielbruijn,
Have you got a photo of what you have wired up?

You are using tft_espi I hope.

beegeebee
Posts: 8
Joined: Sun Jan 07, 2024 5:28 pm

Re: ESP3-C3 Super Mini wiring to ST7789

Postby beegeebee » Thu Jan 18, 2024 7:32 pm

Attached are photos showing the two types of tft (same resolution but different sizes). One has CS pin connected to GPIO07 on the ESP32C3 Super Mini. The other shows a smaller (cheaper) tft with no CS pin. On this one the BLK pin is in the same place as the CS pin on the larger tft (top pin in the photo with a black lead). The black lead connects the BLK pin to 3.3V.

michielbruijn
Posts: 2
Joined: Wed Jan 17, 2024 10:55 pm

Re: ESP3-C3 Super Mini wiring to ST7789

Postby michielbruijn » Thu Jan 18, 2024 8:19 pm

It's working. I reviewed the files and I forgot to uncomment
//#define TFT_CS -1 // Not connected
Because I thought it wasn't important.
Thanks!
Attachments
20240118_212237.jpg
20240118_212237.jpg (3.67 MiB) Viewed 13266 times

Jarizapo
Posts: 4
Joined: Thu Feb 08, 2024 4:04 pm

Re: ESP3-C3 Super Mini wiring to ST7789

Postby Jarizapo » Thu Feb 08, 2024 4:18 pm

Hello!

I've been trying to get my ESP32 C3 Super mini to work with my TFT Display and I have gotten nothing.

I tried everything that has already been talked in this thread and I even found a video on YouTube from michielbruijn where he changes the ports and has a example code.

I can only get to turn the display's backlight on but that's it.

I don't know if my User_Setup.h may have a problem or the esp32/display.

I also want to point out that my display is a little bit different. Instead of SKL it shows SCK and at the bottom it says "GMT130-V1.0 IPS 240*240" instead of just "IPS 240X240"

In my User_Setup.h I only have uncommented these lines:

Code: Select all

#define USER_SETUP_INFO "User_Setup"
#define ST7789_DRIVER
#define TFT_RGB_ORDER TFT_BGR
#define TFT_WIDTH  240 // ST7789 240 x 240 and 240 x 320
#define TFT_HEIGHT 240 // ST7789 240 x 240
#define LOAD_GLCD   // Font 1. Original Adafruit 8 pixel font needs ~1820 bytes in FLASH
#define LOAD_FONT2  // Font 2. Small 16 pixel high font, needs ~3534 bytes in FLASH, 96 characters
#define LOAD_FONT4  // Font 4. Medium 26 pixel high font, needs ~5848 bytes in FLASH, 96 characters
#define LOAD_FONT6  // Font 6. Large 48 pixel font, needs ~2666 bytes in FLASH, only characters 1234567890:-.apm
#define LOAD_FONT7  // Font 7. 7 segment 48 pixel font, needs ~2438 bytes in FLASH, only characters 1234567890:-.
#define LOAD_FONT8  // Font 8. Large 75 pixel font needs ~3256 bytes in FLASH, only characters 1234567890:-.
#define LOAD_GFXFF  // FreeFonts. Include access to the 48 Adafruit_GFX free fonts FF1 to FF48 and custom fonts
#define SPI_FREQUENCY  27000000
The example code is:

Code: Select all

#include <TFT_eSPI.h>
#include <WiFi.h>

// ESP32C3 super mini setup
#define TFT_MISO 5
#define TFT_MOSI 8
#define TFT_SCLK 9
#define TFT_CS    -1 // Not connected
#define TFT_DC    2
#define TFT_RST   4  // Connect reset to ensure display initialises
#define TFT_BL   10            // LED back-light control pi
#define TFT_BACKLIGHT_ON HIGH  // Level to turn ON back-light (HIGH or LOW)

TFT_eSPI tft = TFT_eSPI();

void toggleBacklight() {
  digitalWrite(TFT_BL, !digitalRead(TFT_BL));
}

void setup(void) {
  pinMode(TFT_BL, OUTPUT);
  Serial.begin(9600);
  Serial.println("ST7789 TFT WiFi Scan Test");

  tft.begin();                                 // initialize a ST7789 chip
  tft.setSwapBytes(true);                      // swap the byte order for pushImage() - corrects endianness
  tft.setRotation(3);
  tft.fillScreen(TFT_BLACK);

  toggleBacklight();  // Schakel backlight in
}

void displayWiFiScanResults() {
  int n = WiFi.scanNetworks();

  tft.fillScreen(TFT_BLACK);
  tft.setTextSize(1);
  tft.setTextColor(TFT_WHITE);
  
  if (n == 0) {
    tft.setCursor(10, 10);
    tft.println("No networks found");
  } else {
    tft.setCursor(10, 10);
    tft.print(n);
    tft.println(" networks found");

    for (int i = 0; i < n; ++i) {
      tft.print(i + 1);
      tft.print(": ");
      tft.print(WiFi.SSID(i));
      tft.print(" (");
      tft.print(WiFi.RSSI(i));
      tft.print(")");
      tft.println((WiFi.encryptionType(i) == WIFI_AUTH_OPEN) ? " " : "*");
    }
  }
}

void loop() {
//  delay(1000);
//  toggleBacklight();  // Schakel backlight in
//  delay(1000);
//  toggleBacklight();  // Schakel backlight uit

  displayWiFiScanResults();  // Toon WiFi-scanresultaten op het LCD-scherm

  // Wacht een tijdje voordat je opnieuw scant
  delay(5000);
}
(I have the same cables and pins conected like in the video https://www.youtube.com/watch?v=TCHKwlc4Oj0 )

I also have my board configured to be an "ESP32C3 Dev Module" with the esp32 downloaded from the Board Manager and the TFT_eSPI library downloaded (and this on the additional boards manager URLs: https://raw.githubusercontent.com/espre ... index.json ).

I'm pretty new at this type of projects and I'm very lost right now so sorry in advance if the text is too much but I figured that the more information the easier to fix what's happening.

beegeebee
Posts: 8
Joined: Sun Jan 07, 2024 5:28 pm

Re: ESP3-C3 Super Mini wiring to ST7789

Postby beegeebee » Thu Feb 08, 2024 8:02 pm

Jarizapo: double check your wiring and ensure the mosi pin goes to SDA on the tft. If you can post a photo of the wired up board and tft then that will help.

Jarizapo
Posts: 4
Joined: Thu Feb 08, 2024 4:04 pm

Re: ESP3-C3 Super Mini wiring to ST7789

Postby Jarizapo » Fri Feb 09, 2024 4:40 pm

Hi!

Sorry for taking so long to reply back.

Here's a picture of the setup.

I still haven't figured it out. My friend told me that I didn't need to solder the pins to the ESP32 if I had it like that but I don't know if not soldering is causing the problem, since the backlight works and some small programs from Arduino IDE like "File > Examples > 01.Basics > Blink" work fine.
WhatsApp Image 2024-02-09 at 17.28.37.jpeg
WhatsApp Image 2024-02-09 at 17.28.37.jpeg (86.12 KiB) Viewed 12040 times

beegeebee
Posts: 8
Joined: Sun Jan 07, 2024 5:28 pm

Re: ESP3-C3 Super Mini wiring to ST7789

Postby beegeebee » Sat Feb 10, 2024 8:16 pm

Comparing your photo to the pin allocations in your code you have declared
#define TFT_DC 2
but the yellow wire to DC on the TFT is connected to GPIO3 and not GPIO2.

Who is online

Users browsing this forum: No registered users and 132 guests