
Click the blue text above to follow us
1. Required Hardware


2. Test Code
spi=SPI(1,baudrate=30000000, sck=Pin(21), mosi=Pin(47))# Use hardware SPI, speed cannot be too high, too high will cause CPU to restart, actual measurement above 30000000 will restart
tft=st7789.ST7789(spi, 320, 240, dc=Pin(43, Pin.OUT), cs=Pin(44, Pin.OUT),inversion=True)
tft.init()
tft.rotation(0)
tft.fill(0)
camera.deinit()
try: camera.init(0, d0=11, d1=9, d2=8, d3=10, d4=12, d5=18, d6=17, d7=16,
format=camera.JPEG, framesize=camera.FRAME_HQVGA, fb_location=camera.PSRAM,
xclk_freq=camera.XCLK_10MHz,
href=7, vsync=6, reset=-1, pwdn=-1,
sioc=5, siod=4, xclk=15, pclk=13)
except Exception as e: camera.deinit()
camera.init(0, d0=11, d1=9, d2=8, d3=10, d4=12, d5=18, d6=17, d7=16,
format=camera.JPEG, framesize=camera.FRAME_HQVGA, fb_location=camera.PSRAM,
xclk_freq=camera.XCLK_10MHz,
href=7, vsync=6, reset=-1, pwdn=-1,
sioc=5, siod=4, xclk=15, pclk=13)
Finally, through the while True loop, the images captured by the camera are displayed in real-time on the LCD screen. The complete code is as follows:
from machine import SPI,Pin,PWM,SoftSPI
import time,camera,st7789
spi=SPI(1,baudrate=30000000, sck=Pin(21), mosi=Pin(47))# Use hardware SPI, speed cannot be too high, too high will cause CPU to restart, actual measurement above 30000000 will restart
tft=st7789.ST7789(spi, 320, 240, dc=Pin(43, Pin.OUT), cs=Pin(44, Pin.OUT),inversion=True)
tft.init()
tft.rotation(0)
tft.fill(0)
camera.deinit()
try: camera.init(0, d0=11, d1=9, d2=8, d3=10, d4=12, d5=18, d6=17, d7=16,
format=camera.JPEG, framesize=camera.FRAME_HQVGA, fb_location=camera.PSRAM,
xclk_freq=camera.XCLK_10MHz,
href=7, vsync=6, reset=-1, pwdn=-1,
sioc=5, siod=4, xclk=15, pclk=13)
except Exception as e: camera.deinit()
camera.init(0, d0=11, d1=9, d2=8, d3=10, d4=12, d5=18, d6=17, d7=16,
format=camera.JPEG, framesize=camera.FRAME_HQVGA, fb_location=camera.PSRAM,
xclk_freq=camera.XCLK_10MHz,
href=7, vsync=6, reset=-1, pwdn=-1,
sioc=5, siod=4, xclk=15, pclk=13)
while True: buf=camera.capture()
with open('/1.jpg','wb') as f: f.write(buf)
tft.jpg('/1.jpg', 0, 0)
3. Test Results

01
ESP32-S3 displays JPG and PNG images on LCD (based on MicroPython)
02
ESP32-S3 captures photos with a resolution of 1600X1200
03
ESP32-S3 implements web image transmission (based on MicroPython)