ST7789 240X280 Display on esp32s3 not working

The output of the S3 port is 3.3 V, so the VCC pin of the display must be connected to the 3V3 pin of the XIAO.

send a picture of your wireing setup

Here is a schematic I found on the Waveshare website.

This display module can run at either 3.5V or 5V, but the interface voltage must be the same as the VCC pin voltage.
In other words, to run XIAO with a port voltage of 3.3V, the VCC pin must be connected to 3.3V.

I have been working on an image receiver for the XIAO ESP32S3 Sense board that can send the images via LoRa.

The XIAO as a tracker and image transmitter does work but the receiver needed to be a bigger board and have an TFT display to show the images. Using one of the low cost ESP32S3 Development boards that comes with both a camera connector and an SD card holder, there is just enough spare pins to drive an ST7789 display. I have tried the 280x240 display and the 320x240 display, both are displaying sent images just fine.

I am using the TFT_eSPI TFT library as that can use the TFT_eFEX extension to write a JPG image in a PSRAM buffer onto the display.

1 Like

upload://zAJSTggmNDbu0qs2tOuhrNq25tQ.jpeg

Scl and Sda are not connection options for the display that I’m using as far as which pin the power for the display is connected as long as it’s connected to the same power supply it doesn’t matter and as long as the grounds are tied together however it is possible that the wiring isn’t entirely accurate but I’m using the gpio pinout and what is hopefully an accurate pinout image if someone could provide me with an accurate GPO pinout image that would be helpful

And for some reason every time I try to attach an image it just says embedded attachments aren’t allowed for some reason

Xiao has two output power pins the first one closest to the USB port is a 5 volts which is labeled VUSB that is the one that my screen is connected to the other one is the 3.3 V pin I have also used that one it doesn’t work on either one

Hi there,
FYI,

  • 5V - This is 5v out from the USB port. You can also use this as a voltage input but you must have some sort of diode (schottky, signal, power) between your external power source and this pin with anode to battery, cathode to 5V pin.
  • 3V3 - This is the regulated output from the onboard regulator. You can draw 700mA
  • GND - Power/data/signal ground

HTH
GL :slight_smile: PJ :v:

When you use battery power, there will be no voltage on the 5V pin.

I am aware of that I’m not entirely a noob currently the only im trying to do is get it to function correctly which is currently not everything is wired and connected as explained in the first comment of this topic I am using a single power source both of which the board and the screen are connected to as said previously my code apparently works not that I would be able to tell myself I don’t have anything else to test with other than the one that I currently have that I can’t get to work but in all honesty I got frustrated with it and haven’t touched it in a couple of days so everything is as it was in this topic unfortunately

Here is an example of the connection.
Please try to connect and move it correctly.

Waveshare 240x280   XIAO ESP32S3
         VCC             3V3 (IMPORTANT not 5V)
         GND             GND
         DIN             D10
         CLK             D8
         CS              D1
         DC              D3
         RST             D0
         BL              N.C.
#define TFT_CS        D1  // CS
#define TFT_RST       D0  // RST
#define TFT_DC        D3  // DC
#define TFT_MOSI      D10 // DIN
#define TFT_SCLK      D8  // CLK

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

Awesome thank you that actually helped it works now but now I’m having an issue with it not seeing the camera

#define PWDN_GPIO_NUM  -1
#define RESET_GPIO_NUM -1
#define XCLK_GPIO_NUM  10
#define SIOD_GPIO_NUM  40
#define SIOC_GPIO_NUM  39

#define Y9_GPIO_NUM    48
#define Y8_GPIO_NUM    11
#define Y7_GPIO_NUM    12
#define Y6_GPIO_NUM    14
#define Y5_GPIO_NUM    16
#define Y4_GPIO_NUM    18
#define Y3_GPIO_NUM    17
#define Y2_GPIO_NUM    15
#define VSYNC_GPIO_NUM 38
#define HREF_GPIO_NUM  47
#define PCLK_GPIO_NUM  13

OV5640 ov5640 = OV5640();

This Is the gpio pin numbering i think it is right, but not sure. i’m using ov5640 Camera.

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

#define TFT_RST       1
#define TFT_DC        4
#define TFT_CS        2

// For ST7789, using hardware SPI (SCK=GPIO7, MOSI=GPIO9): 
Adafruit_ST7789 tft = Adafruit_ST7789(TFT_CS, TFT_DC, TFT_RST);

#define PWDN_GPIO_NUM  -1
#define RESET_GPIO_NUM -1
#define XCLK_GPIO_NUM  10
#define SIOD_GPIO_NUM  40
#define SIOC_GPIO_NUM  39

#define Y9_GPIO_NUM    48
#define Y8_GPIO_NUM    11
#define Y7_GPIO_NUM    12
#define Y6_GPIO_NUM    14
#define Y5_GPIO_NUM    16
#define Y4_GPIO_NUM    18
#define Y3_GPIO_NUM    17
#define Y2_GPIO_NUM    15
#define VSYNC_GPIO_NUM 38
#define HREF_GPIO_NUM  47
#define PCLK_GPIO_NUM  13

OV5640 ov5640 = OV5640();

void setup(void) {
  delay(500);
  Serial.begin(115200);
  delay(500);
  Serial.print(F("240x280 IPS ST7789V SPI"));
  Serial.println();
  Serial.print("MOSI: ");
  Serial.println(MOSI);
  Serial.print("SCK:  ");
  Serial.println(SCK);

  // using a 2.4" IPS 240x320 SPI (ST7789V):
  tft.init(240, 280);           // Init ST7789 240x320
  tft.setRotation(1);
  tft.fillScreen(ST77XX_BLACK);
  
  Serial.println(F("Initialized"));
  Serial.println(tft.width());
  Serial.println(tft.height());

  delay(1000);

  //Serial.begin(115200);

  camera_config_t config;
  config.ledc_channel = LEDC_CHANNEL_0;
  config.ledc_timer = LEDC_TIMER_0;
  config.pin_d0 = Y2_GPIO_NUM;
  config.pin_d1 = Y3_GPIO_NUM;
  config.pin_d2 = Y4_GPIO_NUM;
  config.pin_d3 = Y5_GPIO_NUM;
  config.pin_d4 = Y6_GPIO_NUM;
  config.pin_d5 = Y7_GPIO_NUM;
  config.pin_d6 = Y8_GPIO_NUM;
  config.pin_d7 = Y9_GPIO_NUM;
  config.pin_xclk = XCLK_GPIO_NUM;
  config.pin_pclk = PCLK_GPIO_NUM;
  config.pin_vsync = VSYNC_GPIO_NUM;
  config.pin_href = HREF_GPIO_NUM;
  config.pin_sscb_sda = SIOD_GPIO_NUM;
  config.pin_sscb_scl = SIOC_GPIO_NUM;
  config.pin_pwdn = PWDN_GPIO_NUM;
  config.pin_reset = RESET_GPIO_NUM;
  config.xclk_freq_hz = 24000000;
  config.pixel_format = PIXFORMAT_JPEG;
  config.frame_size = FRAMESIZE_VGA;
  config.jpeg_quality = 10;
  config.fb_count = 2;

  esp_err_t err = esp_camera_init(&config);
  if (err != ESP_OK) {
    tft.setTextSize(2);
    drawtext("Camera init failed with error 0x%x", ST77XX_WHITE, 20, 40);
    Serial.printf("Camera init failed with error 0x%x", err);
  }
  delay(3000);
  sensor_t* sensor = esp_camera_sensor_get();
  ov5640.start(sensor);
 delay(3000);  
 if (ov5640.focusInit() == 0) {
    drawtext("OV5640_Focus_Init Successful!", ST77XX_WHITE, 20, 20);
    Serial.println("OV5640_Focus_Init Successful!");
  }
 delay(3000);  
 if (ov5640.autoFocusMode() == 0) {
    drawtext("OV5640_Auto_Focus Successful!", ST77XX_WHITE, 20, 20);
    Serial.println("OV5640_Auto_Focus Successful!");
  }
  delay(3000);
}


void loop() {
  tft.fillScreen(ST77XX_BLACK);
  tft.setTextSize(3);
  drawtext("BLACK", ST77XX_WHITE, 20, 20);
  tft.drawRoundRect(1, 1, tft.width()-2, tft.height()-2, 25, ST77XX_WHITE);
  delay(3000);

  tft.fillScreen(ST77XX_WHITE);
  tft.setTextSize(3);
  drawtext("WHITE", ST77XX_BLACK, 20, 20);
  tft.drawRoundRect(1, 1, tft.width()-2, tft.height()-2, 25, ST77XX_BLACK);
  //tft.drawRect(1, 1, tft.width()-2, tft.height()-2, ST77XX_BLACK);
  delay(3000);

  tft.fillScreen(ST77XX_RED);
  tft.setTextSize(3);
  drawtext("RED", ST77XX_CYAN, 20, 20);
  delay(3000);

  tft.fillScreen(ST77XX_GREEN);
  tft.setTextSize(3);
  drawtext("GREEN", ST77XX_MAGENTA, 20, 20);
  delay(3000);

  tft.fillScreen(ST77XX_BLUE);
  tft.setTextSize(3);
  drawtext("BLUE", ST77XX_YELLOW, 20, 20);
  delay(3000);
  
  tft.fillScreen(ST77XX_CYAN);
  tft.setTextSize(3);
  drawtext("CYAN", ST77XX_RED, 20, 20);
  delay(3000);

  tft.fillScreen(ST77XX_MAGENTA);
  tft.setTextSize(3);
  drawtext("MAGENTA", ST77XX_GREEN, 20, 20);
  delay(3000);

  tft.fillScreen(ST77XX_YELLOW);
  tft.setTextSize(3);
  drawtext("YELLOW", ST77XX_BLUE, 20, 20);
  delay(3000);

}

void drawtext(char *text, uint16_t color, int16_t x, int16_t y) {
  tft.setCursor(x, y);
  tft.setTextColor(color);
  tft.setTextWrap(true);
  tft.print(text);

}

This is the Code i’m testing with.

Hi there,
Can you add a line to show the SS and CS pins?
HTH
GL :slight_smile: PJ :v:

Unfortunately I have merged some code together here. I have the code from the screen that I put in here and then, I have those PIN numbers I have gotten from the pinout section of the webcam server for the xiao. so it should be correct but it’s not working.