This project allows video streaming from a PC to an ST7789 screen using an ESP32 via UART.
Click aquí para ver el archivo léame en español
- ✅ Real-time video streaming from a PC to the ESP32.
- ✅ Frame conversion and compression to JPEG to optimize transmission.
- ✅ Decoding on the ESP32 and display on the ST7789 screen.
- ✅ Automatic color adjustment and image rotation in Python.
- ✅ FPS optimization (~10-15 FPS with stable UART at 921600 baud).
- 📟 ST7789 screen (135x240 pixels, SPI)
- 🎛️ ESP32 (preferably with PSRAM for better performance)
- 🖥️ PC with Linux or Windows (to send video)
- 🔌 USB cable for programming and communication with the ESP32
Make sure to install the following libraries in Arduino IDE, If you can't find them in the Arduino library, you can copy them directly to your computer from the arduino/libraries directory of this project, copy and paste them into the libraries folder that the Arduino software creates on your PC:
TFT_eSPI
→ To manage the ST7789 screenJPEGDecoder
→ To decode JPEG images
📌 Required configurations in TFT_eSPI
:
- Edit
User_Setup.h
and ensure the following settings:#define ST7789_DRIVER #define TFT_WIDTH 135 #define TFT_HEIGHT 240 #define TFT_MISO -1 // Not use for ST7789 #define TFT_MOSI 23 // GPIO 23 #define TFT_SCLK 18 // GPIO 18 #define TFT_CS 5 // GPIO 5 #define TFT_DC 2 // GPIO 2 #define TFT_RST 4 // GPIO 4 #define TFT_BL 32 // If the display need a enable signal, use 3.3V EN pin or a GPIO #define SPI_FREQUENCY 40000000 // Optionally, 80 MHz if supported by the screen #define USE_DMA // For better performance
Install dependencies using:
pip install -r requirements.txt
📌 Contents of requirements.txt
:
opencv-python
pyserial
numpy
-
Open Arduino IDE and upload the
display.ino
code. -
Close the Serial Monitor in Arduino before running the Python script.
-
Connect the ST7789 screen to the ESP32 using SPI:
ESP32 ST7789 3.3V VCC GND GND 18 SCK 19 MOSI 5 DC 23 CS 4 RST
- Open the terminal and execute:
python3 send.py
- The video will start streaming to the ST7789 screen via ESP32.
✔️ Solution: Ensure that tft.setSwapBytes(true);
is enabled on the ESP32.
✔️ Solution: Modify in Python:
frame = cv2.rotate(frame, cv2.ROTATE_90_CLOCKWISE)
✔️ Solution: Ensure that the frame size in Python is 135x240
:
frame = cv2.resize(frame, (135, 240))
This project is licensed under MIT, allowing free use and modifications.