A complete ready-to-use starter project for the ESP32-S3 4.0" 480×480 RGB LCD development board (ESP32-4848S040). Built with ESP-IDF framework for maximum performance and flexibility. Includes properly configured display driver, touch support, and LVGL 9 demo UI.
- ESP-IDF — Native framework without Arduino abstraction for optimal performance
- ST7701S RGB Display — 480×480 16-bit color, 60Hz refresh
- GT911 Capacitive Touch — Touch I2C controller
- LVGL 9 — Modern embedded GUI library
- PWM Backlight Control — Smooth brightness adjustment via slider
- Runtime Timing Adjustment — UART console for display tuning without recompilation
- Persistent Settings — NVS storage for timing parameters
- Clean Architecture — Modular source files, easy to extend
| Component | Specification |
|---|---|
| MCU | ESP32-S3-WROOM-1U-N16R8 |
| Flash | 16MB QIO @ 80MHz |
| PSRAM | 8MB Octal @ 80MHz |
| Display | 4.0" IPS LCD, 480×480, RGB565 |
| Display Driver | ST7701S (3-wire SPI init + RGB interface) |
| Touch Controller | GT911 (I2C @ 400kHz) |
| Backlight | PWM controlled (GPIO38) |
Click to expand pinout
RGB Data Bus:
| Signal | GPIO |
|---|---|
| R0-R4 | 11, 12, 13, 14, 0 |
| G0-G5 | 8, 20, 3, 46, 9, 10 |
| B0-B4 | 4, 5, 6, 7, 15 |
Control Signals:
| Signal | GPIO |
|---|---|
| DE | 18 |
| VSYNC | 17 |
| HSYNC | 16 |
| PCLK | 21 |
3-Wire SPI (ST7701S Init):
| Signal | GPIO |
|---|---|
| CS | 39 |
| SCK | 48 |
| SDA | 47 |
Touch (I2C):
| Signal | GPIO |
|---|---|
| SDA | 19 |
| SCL | 45 |
Backlight:
| Signal | GPIO |
|---|---|
| PWM | 38 |
# Clone the repository
git clone https://github.com/abcbbck-png/ESP32-4848S040-First-Start.git
cd ESP32-4848S040-First-Start
# Build the project
pio run
# Upload to device
pio run -t upload
# Monitor serial output
pio device monitorOr use the PlatformIO sidebar in VS Code: Build → Upload → Monitor
├── src/
│ ├── main.c # Application entry, LVGL task
│ ├── display.c/h # ST7701S RGB panel driver
│ ├── touch.c/h # GT911 touch driver
│ ├── backlight.c/h # PWM backlight control
│ ├── ui.c/h # LVGL demo interface
│ ├── timing_config.c/h # NVS-backed timing parameters
│ ├── uart_console.c/h # Runtime timing adjustment
│ └── board_config.h # Hardware pin definitions
├── managed_components/ # ESP Component Registry deps
│ ├── espressif__esp_lcd_st7701/
│ ├── espressif__esp_lcd_touch_gt911/
│ └── lvgl__lvgl/
├── platformio.ini # Build configuration
├── sdkconfig.defaults # ESP-IDF defaults
├── partitions.csv # Flash partition table
└── lv_conf.h # LVGL configuration
Connect at 115200 baud to adjust display timing on-the-fly:
| Command | Description |
|---|---|
help |
Show available commands |
timing |
Display current timing values |
hbp <value> |
Set HSYNC back porch (shift LEFT +) → save & reboot |
hfp <value> |
Set HSYNC front porch → save & reboot |
hpw <value> |
Set HSYNC pulse width → save & reboot |
vbp <value> |
Set VSYNC back porch (shift UP +) → save & reboot |
vfp <value> |
Set VSYNC front porch → save & reboot |
vpw <value> |
Set VSYNC pulse width → save & reboot |
reset |
Reset to defaults & reboot |
Tip: If you see horizontal shifting or tearing, try adjusting porch values. The default configuration (all zeros) works for most panels.
Edit board_config.h for compile-time defaults:
#define LCD_HSYNC_BACK_PORCH 0
#define LCD_HSYNC_FRONT_PORCH 0
#define LCD_VSYNC_BACK_PORCH 0
#define LCD_VSYNC_FRONT_PORCH 0Key settings in lv_conf.h:
#define LV_COLOR_DEPTH 16
#define LV_USE_DRAW_SW 1
#define LV_DRAW_BUF_STRIDE_ALIGN 4Adjust in platformio.ini:
board_build.f_cpu = 240000000L
board_upload.flash_size = 16MB
board_build.flash_mode = qioRecommended workflow for building your own application:
- Replace the UI — Modify
src/ui.cwith your own screens and logic - Add custom modules — Create new
.c/.hfiles insrc/and register them insrc/CMakeLists.txt - Add ESP-IDF components — Declare new dependencies in
src/idf_component.yml - SDK-level settings — Configure only via
sdkconfig.defaults(avoid editingsdkconfigdirectly)
The project structure is intentionally modular — display, touch, and backlight drivers are decoupled from application logic.
This project is licensed under the MIT License — see the LICENSE file for details.
Made with ❤️ for the ESP32 community

