Hardware:
ESP: ESP-32-S3-WROOM-1
Camera: OV5640 (18 pins)
Screen: ST7789V (2inch, 240x320) (8 pins)
Dev setup:
OS: Linux Mint 23
IDE: VS Code
ESP-IDF: v6.0.1
Problem:
I'm trying to get the screen to show the camera, but it's all messed up.
I'm trying (Claude is trying) to modify a dvp_spi_lcd example with no real luck...
I'm attaching the dvp_spi_lcd_main.c, some logs and a photo of the screen.
Current physical pins to GPIO:
Screen:
VCC > 3.3v
GND > GND
DIN > GPIO 11
CLK > GPIO 12
CS > GPIO 21
DC > GPIO 47
RST > 3.3v
BL > GPIO 18
Camera:
3.3v > 3.3v
GND > GND
SIOC > GPIO 4
SIOD > GPIO 5
VSYNC > GPIO 14
HREF > GPIO 16
PCLK > GPIO 13
XCLK > GPIO 10
D9 > GPIO 40
D8 > GPIO 48
D7 > GPIO 45
D6 > GPIO 9
D5 > GPIO 8
D4 > GPIO 17
D3 > GPIO 7
D2 > GPIO 6
RST > not connected
PWDN > GND
Main/CMakeLists.txt (I guess the attachment limit is 3 files...):
idf_component_register(SRCS "dvp_spi_lcd_main.c"
INCLUDE_DIRS "."
REQUIRES esp_lcd driver esp_driver_ledc esp_camera)
Note:
If you'll suggest changing the GPIO pins, keep in mind that I need pins for buttons that'll be under a Resistor Ladder, and some sort of a battery % monitor...
Thanks for the help.
Need help with camera and screen project
-
TheRealThreeeye
- Posts: 4
- Joined: Thu Jul 16, 2026 12:29 pm
Need help with camera and screen project
- Attachments
-
- 20260718_113447.JPG (2.29 MiB) Viewed 95 times
-
- Logs.txt
- (5.75 KiB) Downloaded 1 time
-
- dvp_spi_lcd_main.c
- (10.14 KiB) Downloaded 3 times
-
nopnop2002
- Posts: 359
- Joined: Thu Oct 03, 2019 10:52 pm
- Contact:
Re: Need help with camera and screen project
Code: Select all
.pixel_format = PIXFORMAT_RGB565,
You can use JPEG as the camera's capture format.
Here is an example of displaying JPEGs on the ST7789.
https://github.com/nopnop2002/esp-idf-st7789
-
TheRealThreeeye
- Posts: 4
- Joined: Thu Jul 16, 2026 12:29 pm
Re: Need help with camera and screen project
Thanks for the replay.
But I'm stuck on displaying the camera feed...
I might have forgot to mention that the screen is showing what is "supposed" to be me waving my hand in front of the camera.
The colors are all wrong, and it's very grainy.
Thanks
But I'm stuck on displaying the camera feed...
I might have forgot to mention that the screen is showing what is "supposed" to be me waving my hand in front of the camera.
The colors are all wrong, and it's very grainy.
Thanks
-
nopnop2002
- Posts: 359
- Joined: Thu Oct 03, 2019 10:52 pm
- Contact:
Re: Need help with camera and screen project
Is there a possibility that R and B are swapped?
Code: Select all
uint32_t r = ((p0 >> 11) & 0x1F) + ((p1 >> 11) & 0x1F)
+ ((p2 >> 11) & 0x1F) + ((p3 >> 11) & 0x1F);
uint32_t g = ((p0 >> 5) & 0x3F) + ((p1 >> 5) & 0x3F)
+ ((p2 >> 5) & 0x3F) + ((p3 >> 5) & 0x3F);
uint32_t bl = (p0 & 0x1F) + (p1 & 0x1F)
+ (p2 & 0x1F) + (p3 & 0x1F);
-
TheRealThreeeye
- Posts: 4
- Joined: Thu Jul 16, 2026 12:29 pm
Re: Need help with camera and screen project
It is a possibility, but I don't know the right values (and apparently neither does Claude, because it's telling me that it's swapped, and trying to fix it with no luck).
Do you have a suggestion of how the R and B are supposed to be?
Do you have a suggestion of how the R and B are supposed to be?
-
nopnop2002
- Posts: 359
- Joined: Thu Oct 03, 2019 10:52 pm
- Contact:
Re: Need help with camera and screen project
To begin with, why not try stopping the downscaling from 320x240 to 240x180?
I haven't used `esp_lcd_panel_draw_bitmap` myself, but I believe the following code will correctly display a specific part of the camera image.
I haven't used `esp_lcd_panel_draw_bitmap` myself, but I believe the following code will correctly display a specific part of the camera image.
Code: Select all
while (1) {
camera_fb_t *fb = esp_camera_fb_get();
if (!fb) { vTaskDelay(pdMS_TO_TICKS(5)); continue; }
if (fb->len < (size_t)(SRC_W * SRC_H * 2)) {
esp_camera_fb_return(fb);
continue;
}
esp_lcd_panel_draw_bitmap(s_panel, 0, 0, LCD_W, LCD_H, fb->buf);
esp_camera_fb_return(fb);
frames++;
if (frames % 30 == 0) ESP_LOGI(TAG, "Frames: %lu", frames);
}
-
TheRealThreeeye
- Posts: 4
- Joined: Thu Jul 16, 2026 12:29 pm
Re: Need help with camera and screen project
I don't know if it was the AI, or the Firmware, but I created a new project using PlatformIO instead of ESP-IDF, it's working flawlessly right from the start...
Thanks everyone for your suggestions, I'll mark this thread as resolved.
Thanks everyone for your suggestions, I'll mark this thread as resolved.
Who is online
Users browsing this forum: Amazon [Bot], PetalBot and 2 guests