You will need to connect it to the 5 Volt output to supply an of power for the screen also make sure you’re soldered joints are well attached so it doesn’t receive any interference which could also be an problem
Also manually initiate SPI
Adafruit_ST7789 tft = Adafruit_ST7789(TFT_CS, TFT_DC, TFT_MOSI, TFT_SCLK, TFT_RST);
//Replace that with this
Adafruit_ST7789 display = Adafruit_ST7789(&SPI, TFT_CS, TFT_DC, TFT_RST);
// put in setup
SPI.begin(TFT_SCLK, TFT_RST, TFT_MOSI, TFT_CS);
display.init(240, 280);
If you don’t have it already you will need to ive the SPIH file to the include part of your script this will allow the screen to run better and faster
See post #23, it looks like VCC would need to be 3.3V to interface with 3.3V I/O of XIAO.
Display will work on both I have evidence of it i’m running it now in fact it actually works better with more voltage so you don’t have any drops in voltage from the leds plus they are white leds and most white leds use a blue 5 volt connection for power Because all of white LED is is a blue led with Fluorescent phosphate on it
What display are you running? What wiring to which pins? What library worked? Sorry this has been doing my head absolutely in!
Please tell us the link to the display unit you are using and exactly how it is connected to XIAO.
The Xiao 3.3v is indeed measuring 3.3v when the display is not attached to that line.
Looking at the level shifter, I think VCC=3.3V to interface with XIAO.
However, I am not sure if the same display unit as in this schematic is used.
i posted already. and i have Unfortunately dismantled this project but let me see if I can find everything that I had on it
the links are Above in one of my other posts it won’t let me repost the links
BrentA,
Please tell us the link to the display unit you are using and exactly how it is connected to XIAO.
/**************************************************************************
XIAO ESP32S3 Connect display on
Connection:
Waveshare 240x280 (ST7789V) | XIAO ESP32S3
____________|
VCC | 3V3 or 5V
GND | GND
DIN | D10 GPIO9 (hardware SPI MOSI)
CLK | D8 GPIO7 (hardware SPI SCK)
CS | D1 GPIO2
DC | D3 GPIO4
RST | D0 GPIO1
BL | N.C.
**************************************************************************/
Here is the display: Waveshare 1.83inch-lcd-display-module-240280-resolution-spi-interface-ips-lcd-65k-colors-rounded-corners-micro-lcd-display
Here is my pin connections;
#define TFT_CS 2 // GPIO2 (D1)
#define TFT_RST 1 // GPIO1 (D0)
#define TFT_DC 4 // GPIO4 (D3)
#define TFT_MOSI 9 // GPIO9 (D10)
#define TFT_SCLK 6 // GPIO6 (D8)
You will probably need the hardware spi the pin out that I posted is the one I used To get everything working Although I think your display might be a little bit bigger than the one i have but should be the same
BrentA,
Using the names of the pins on the display unit and the names of the pins on the XIAO, please show us the connections, including even the power supply pins.
Literally everything is labeled as exactly on both read the schematic I posted it has everything GPIO labeling for code and the branded labeling on the board as well as the connections labeled from the display that I was using
And it worked?I think i have tried so many libraries. Do you have the code that made it work? You and I share the same pin connections. Gnd to Gnd and display + to 5v from the board.
The control chip seems to be NV3030B instead of ST7789, does Adafruit’s library support this chip?
Waveshare 1.83inch-lcd-display-module-240280-resolution-spi-interface-ips-lcd-65k-colors-rounded-corners-micro-lcd-display
I was able to get the display to work however I was unable to figure out how to convert the camera input into a 16 bit color for the screen to read from but I was able to get it to work and display individual colors
You can use this code as a base to start testing with it has everything for the camera and for the display you will probably need to remove whatever is in the loop though it kinda works but it just displays a blue image
And yes I have tried it with both the three Volt and the 5 Volt you get better results with the 5 Volt
/**************************************************************************
XIAO ESP32S3 Connect display on
Connection:
___________________________________________________________
Waveshare 240x280 (ST7789V) | XIAO ESP32S3
____________|
VCC | 3V3 (IMPORTANT not 5V)
GND | GND
DIN | D10 GPIO9 (hardware SPI MOSI)
CLK | D8 GPIO7 (hardware SPI SCK)
CS | D1 GPIO2
DC | D3 GPIO4
RST | D0 GPIO1
BL | N.C.
**************************************************************************/
#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"
#include <Adafruit_ImageReader.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
Adafruit_Image img;
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 = 20000000;
config.pixel_format = PIXFORMAT_JPEG;
config.frame_size = FRAMESIZE_240X240;
config.grab_mode = CAMERA_GRAB_WHEN_EMPTY;
config.fb_location = CAMERA_FB_IN_PSRAM;
config.jpeg_quality = 12;
config.fb_count = 1;
if (config.pixel_format == PIXFORMAT_JPEG) {
if (psramFound()) {
config.jpeg_quality = 10;
config.fb_count = 2;
config.grab_mode = CAMERA_GRAB_LATEST;
} else {
// Limit the frame size when PSRAM is not available
config.frame_size = FRAMESIZE_240X240;
config.fb_location = CAMERA_FB_IN_DRAM;
}
} else {
// Best option for face detection/recognition
config.frame_size = FRAMESIZE_240X240;
}
esp_err_t err = esp_camera_init(&config);
if (err != ESP_OK) {
tft.setTextSize(2);
drawinfo("Camera init failed with error 0x%x",err, ST77XX_WHITE, 20, 40);
Serial.printf("Camera init failed with error 0x%x", err);return;
}
delay(3000);
sensor_t *s = esp_camera_sensor_get();
// initial sensors are flipped vertically and colors are a bit saturated
if (s->id.PID == OV3660_PID) {
s->set_vflip(s, 1); // flip it back
s->set_brightness(s, 1); // up the brightness just a bit
s->set_saturation(s, -2); // lower the saturation
}
// drop down frame size for higher initial frame rate
if (config.pixel_format == PIXFORMAT_JPEG) {
s->set_framesize(s, FRAMESIZE_QVGA);
}
sensor_t* sensor = esp_camera_sensor_get();
ov5640.start(sensor);
delay(3000);
if (ov5640.focusInit() == 0) {
tft.fillScreen(ST77XX_BLACK);
tft.setTextSize(2);
drawtext("OV5640_Focus_Init Successful!", ST77XX_WHITE, 20, 20);
Serial.println("OV5640_Focus_Init Successful!");
}
delay(3000);
if (ov5640.autoFocusMode() == 0) {
tft.fillScreen(ST77XX_BLACK);
tft.setTextSize(2);
drawtext("OV5640_Auto_Focus Successful!", ST77XX_WHITE, 20, 20);
Serial.println("OV5640_Auto_Focus Successful!");
}
delay(3000);
}
void loop() {
uint8_t rc = ov5640.getFWStatus();
camera_fb_t* fb = esp_camera_fb_get();
if (!fb) {
Serial.println("Camera capture failed");
esp_camera_fb_return(fb);
return;
}
if (fb->format != PIXFORMAT_JPEG) {
Serial.println("Non-JPEG data not implemented");
esp_camera_fb_return(fb);
return;
}
esp_camera_fb_return(fb);
//camera_fb_t* fb = esp_camera_fb_get();
//tft.drawBitmap(10, 10,fb->buf , 240, 240,ST77XX_BLUE);
//img= fb;
img.draw(tft, tft.height(),tft.width());
}
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);
}
void drawinfo(char *text, uint8_t Info, uint16_t color, int16_t x, int16_t y) {
tft.setCursor(x, y);
tft.setTextColor(color);
tft.setTextWrap(true);
tft.printf(text,Info);
}
Switch these out in the code though for better results and manually start the SPI
Adafruit_ST7789 tft = Adafruit_ST7789(TFT_CS, TFT_DC, TFT_MOSI, TFT_SCLK, TFT_RST);
//Replace that with this
Adafruit_ST7789 tft = Adafruit_ST7789(&SPI, TFT_CS, TFT_DC, TFT_RST);
// put in setup
SPI.begin(TFT_SCLK, TFT_RST, TFT_MOSI, TFT_CS);
tft.init(240, 280);
And replace these so you get a better pin out connection and layout for the code If I remember correctly you will need all of the connections hooked up for it to work properly also the display I was using the backlight Was on when the pin was low so it did not need to be connected it may differ on yours
#define TFT_RST 1
#define TFT_DC 4
#define TFT_CS 2
// and replace that with this
#define TFT_RST 1
#define TFT_DC 4
#define TFT_CS 2
#define TFT_MOSI 9 // Data out
#define TFT_SCLK 7 // Clock out