3.5inch RPi LCD (G)
| ||
Overview
Introduction
The 3.5inch RPi LCD (G) is equipped with a resistive touch screen with a resolution of 320 × 480, supporting two connection methods: Pigo pin communication and GH1.25 11PIN cable connection, and providing example materials for Raspberry Pi, ESP32, Pico, Arduino, etc.
Features
- 320×480 resolution, 262K RGB colors, clear and colorful displaying effect
- Embedded with ST7796S driver chip and XPT2046 resistive touch control chip, using SPI communication, minimizes required IO pins
- Supports two connection methods: Pigo pin communication and GH1.25 11PIN cable connection
- Adopts Immersion Gold process, nice looking, with better durability
- Provides complete demos and development materials for Raspberry Pi, Raspberry Pi Pico, ESP32 and Arduino platforms
Interfaces
Dimensions
Specifications
| Parameter Name | Parameter |
| Supply voltage | 5V |
| Logic voltage | 3.3V |
| LCD type | IPS |
| Communication interface | SPI |
| Controller chip | Display: ST7796S |
| Touch: XPT2046 | |
| Resolution | 320 (H) x 480 (V) |
| Display size | 49.56 × 74.04 (mm) |
| Touch panel Size | 54.86 × 83.79 (mm) |
Working with Raspberry Pi
Hardware Connection
This product supports two connection methods to Raspberry Pi
Method 1: Connect Raspberry Pi through Pigo Pin
Method 2: Connect Raspberry Pi through Cable
| Function pin | BCM encoding | Board physical pin number |
| TP_IRQ | 17 | 11 |
| TP_CS | 7 | 26 |
| LCD_BL | 18 | 12 |
| LCD_RST | 27 | 13 |
| LCD_DC | 22 | 15 |
| LCD_CS | 8 | 24 |
| SCLK | 11 | 23 |
| MOSI | 10 | 19 |
| MISO | 9 | 21 |
| GND | GND | 6 |
| VCC | 5V | 4 |
Enable SPI Interface
Enter the following command in the terminal:
sudo raspi-config nonint do_spi 0
Python Environment
- Install libraries
sudo apt-get update sudo apt-get install python3-pip sudo apt-get install python3-pil sudo apt-get install python3-numpy sudo apt-get install python3-spidev sudo apt install python3-smbus2
- Download and run the demo
wget https://files.waveshare.com/wiki/3.5inch_RPi_LCD_G/3inch5_RPI_LCD_G_RPI.zip unzip 3inch5_RPI_LCD_G_RPI.zip cd 3inch5_RPI_LCD_G_RPI sudo python ./main.py
Bookworm System Desktop Display
Method 1: Configure Device Tree Driver Screen (Recommended)
- Input in the terminal
wget https://files.waveshare.com/wiki/common/St7796s.zip unzip St7796s.zip sudo cp st7796s.bin /lib/firmware/
- Open config.txt file
sudo nano /boot/firmware/config.txt
Add the following statements at the end of [all]:
dtparam=spi=on dtoverlay=mipi-dbi-spi,speed=48000000 dtparam=compatible=st7796s\0panel-mipi-dbi-spi dtparam=width=320,height=480,width-mm=49,height-mm=79 dtparam=reset-gpio=27,dc-gpio=22,backlight-gpio=18 dtoverlay=ads7846,speed=2000000,penirq=17,xmin=300,ymin=300,xmax=3900,ymax=3800,pmin=0,pmax=65535,xohms=400 extra_transpose_buffer=2
- After reboot, the touch screen will light up normally
sudo reboot
Method 2: Install Kernel Module and DTBO Drive Screen
Install Driver Module
- Determine the current kernel version
uname -a
This command will output the complete kernel version information. For example, executing this command on Raspberry Pi 5 may produce the following output:
Linux raspberrypi 6.12.25+rpt-rpi-2712 #1 SMP PREEMPT Debian 1:6.12.25-1+rpt1 (2025-04-30) aarch64
This indicates that the kernel version number of this system is 6.12.25+rpt-rpi-2712, and it uses 64-bit ARM (AArch64) architecture.
- Download and install the ST7796 driver module
# Step 1: Download and enter the Waveshare-st7796s driver folder wget https://files.waveshare.com/wiki/3.5inch_RPi_LCD_F/Waveshare-st7796s.zip unzip Waveshare-st7796s.zip cd Waveshare-st7796s
# Step 2: cd to the directory of the corresponding kernel version number # Run the following command as in the example above cd 6.12.25/64/rpi-2712-RPi5
# Copy the corresponding version of st7796s.ko to the current system sudo cp st7796s.ko /lib/modules/$(uname -r)/kernel/drivers
# Make sure the module is loaded at boot time, add the module name to the /etc/modules file: sudo nano /etc/modules
# Add at the end st7796s

Enter the following statement in the terminal to handle kernel module dependencies:
sudo depmod -a
- Configure driver device tree
cd wget https://files.waveshare.com/wiki/common/Waveshare35g.dtbo sudo cp Waveshare35g.dtbo /boot/overlays/
For Rpi4 & Rpi5
- Configure the driver file
Refer to the steps here first #Install Driver Module
- Edit config.txt configuration file
sudo nano /boot/firmware/config.txt
Comment out the dual-screen configuration statements

Add the following statements at the end of [all]
dtparam=i2c_arm=on dtparam=i2c_arm_baudrate=50000 dtparam=spi=on dtoverlay=Waveshare35g,fps=60,speed=48000000,rotate=90,penirq=17 hdmi_force_hotplug=1 max_usb_current=1 hdmi_group=2 hdmi_mode=87 hdmi_cvt 480 320 60 6 0 0 0 hdmi_drive=2
- Create screen configuration file
Create 98-spi-screen.conf file
sudo nano /etc/X11/xorg.conf.d/98-spi-screen.conf
Add the following parameters to 98-spi-screen.conf file
Section "Device"
Identifier "SPI Screen"
Driver "fbdev"
Option "fbdev" "/dev/fb0"
EndSection
Note: After the entire process operation is completed, if they are not displayed, modify "/dev/fb0" to "/dev/fb1" and then restart it
- Switch to X11
sudo raspi-config nonint do_wayland W1
Restart to take effect
For All Raspberry Pi Versions
It must be operated based on the bookworm lite version, 64-bit lite or 32-bit lite
- Configure the driver file
Refer to the steps here first #Install Driver Module
- Edit config.txt configuration file
sudo nano /boot/firmware/config.txt
Comment out the KMS and dual-screen configuration statements

Add the following statements at the end of [all]
dtparam=i2c_arm=on dtparam=i2c_arm_baudrate=50000 dtparam=spi=on dtoverlay=Waveshare35g,fps=60,speed=48000000,rotate=90,ts_rotate_90 hdmi_force_hotplug=1 max_usb_current=1 hdmi_group=2 hdmi_mode=87 hdmi_cvt 480 320 60 6 0 0 0 hdmi_drive=2
- Download the necessary software
- Install the Xorg service
sudo apt-get install --no-install-recommends xserver-xorg -y sudo apt-get install --no-install-recommends xinit -y
- Install desktop manager
sudo apt install lightdm -y
- Install official Raspberry Pi GUI
sudo apt install raspberrypi-ui-mods -y
- Install git
sudo apt install git -y
- Install a browser (optional)
sudo apt install chromium-browser -y
- Install a music player (optional)
sudo apt install vlc -y
- Download and run the driver
Open the Raspberry Pi terminal and execute:
sudo apt install libraspberrypi-dev -y sudo apt-get install unzip -y sudo apt-get install cmake -y sudo wget https://files.waveshare.com/wiki/common/Rpi-fbcp.zip sudo unzip ./Rpi-fbcp.zip cd rpi-fbcp/ sudo rm -rf build sudo mkdir -m 777 ./build cd ./build sudo cmake .. sudo make -j4 sudo install fbcp /usr/local/bin/fbcp
- Set auto-start startx and fbcp
- Open the Bash shell file, or create one if it does not exist
sudo nano ~/.bashrc
Add the following code to the end of the file
if [ "$(cat /proc/device-tree/model | cut -d ' ' -f 3)" = "5" ]; then
# rpi 5B configuration
export FRAMEBUFFER=/dev/fb1
startx 2> /tmp/xorg_errors
else
# Non-pi5 configuration
export FRAMEBUFFER=/dev/fb0
startx 2> /tmp/xorg_errors
fi
- Create and edit a fbcp service file for autostart
sudo nano /etc/systemd/system/fbcp.service
Add service configuration in the file
[Unit] Description=Framebuffer Copy for Raspberry Pi After=network.target [Service] ExecStartPre=/bin/sleep 20 ExecStart=/usr/local/bin/fbcp Restart=always User=root Group=root [Install] WantedBy=multi-user.target
Reload the systemd configuration
sudo systemctl daemon-reload
The service enables auto-start at boot
sudo systemctl enable fbcp.service
Test the startup service
sudo systemctl start fbcp.service
- Set CLI automatic login
sudo raspi-config nonint do_boot_behaviour B2 sudo raspi-config nonint do_wayland W1 sudo reboot
Note1: Make sure that the username of the Raspberry Pi is pi, otherwise it will not be able to log in automatically
Note2: After setting all the configurations above, the system takes longer to restart each time, and SSH also requires a moment to enter
Rotate Screen
GUI interface rotation
- 1. Open the "Screen Configuration" application;
- 2. Check "Touchscreen"
- 3. Go to "Screen" -> "DSI-1" -> "Orientation", check the direction you need to rotate, and finally click "Apply" to complete the screen and touch synchronous rotation.

Command line control desktop rotation
- Install wlr-randr tool
sudo apt install wlr-randr
- View output name
wlr-randr
Here is the SPI-1 device as an example for output

- Execute the rotation command
wlr-randr --output SPI-1 --transform 90 #The rotation parameters can be changed to normal, 90, 180, 270
Adjust Backlight
PWM backlight adjustment
- Install WiringPi
cd ~ git clone https://github.com/WiringPi/WiringPi.git cd WiringPi ./build gpio -v
The successful installation will output the gpio version as follows:
- Manually adjust the screen PWM backlight
gpio -g mode 18 pwm #Configure the PIN as PWM mode gpio pwmc 100 #Set PWM clock divider gpio -g pwm 18 0 #Darkest gpio -g pwm 18 1023 #Brightest gpio -g mode 18 out #Clear the PIN to output mode
pinctrl backlight adjustment
- Set the screen on
sudo pinctrl set 18 op dh
- Set the screen off
sudo pinctrl set 18 op dl
Bullseye System Dektop Display
Install Driver Module
- Determine the current kernel version
uname -a
This command will output the complete kernel version information. For example, executing this command on Raspberry Pi 5 may produce the following output:
Linux raspberrypi 6.1.21-v8+ #1642 SMP PREEMPT Mon Apr 3 17:24:16 BST 2023 aarch64 GNU/Linux
This indicates that the kernel version number of this system is 6.1.21, and it uses 64-bit ARM (AArch64) architecture.
- Download and install the ST7796 driver module
# Step 1: Download and enter the Waveshare-st7796s driver folder wget https://files.waveshare.com/wiki/common/Waveshare-st7796s.zip unzip Waveshare-st7796s.zip cd Waveshare-st7796s
# Step 2: cd to the directory of the corresponding kernel version number # Run the following command as in the example above cd 6.1.21/64/
# Copy the corresponding version of st7796s.ko to the current system sudo cp st7796s.ko /lib/modules/$(uname -r)/kernel/drivers
# Make sure the module is loaded at boot time, add the module name to the /etc/modules file: sudo nano /etc/modules
# Add at the end st7796s

Enter the following statement in the terminal to handle kernel module dependencies:
sudo depmod -a
- Configure driver device tree
cd wget https://files.waveshare.com/wiki/common/Waveshare35g.dtbo sudo cp Waveshare35g.dtbo /boot/overlays/
Configure Driver File
Refer to the steps here first #Install Driver Module
- Edit config.txt configuration file
sudo nano /boot/config.txt
Comment out the KMS and dual-screen configuration statements

Add the following statements at the end of [all]
dtparam=i2c_arm=on dtparam=i2c_arm_baudrate=50000 dtparam=spi=on dtoverlay=Waveshare35g,fps=60,speed=48000000,rotate=90,penirq=17 hdmi_force_hotplug=1 max_usb_current=1 hdmi_group=2 hdmi_mode=87 hdmi_cvt 480 320 60 6 0 0 0 hdmi_drive=2
Download and Run Driver
Open the Raspberry Pi terminal and execute:
sudo apt install libraspberrypi-dev -y sudo apt-get install unzip -y sudo apt-get install cmake -y sudo wget https://files.waveshare.com/wiki/common/Rpi-fbcp.zip sudo unzip ./Rpi-fbcp.zip cd rpi-fbcp/ sudo rm -rf build sudo mkdir -m 777 ./build cd ./build sudo cmake .. sudo make -j4 sudo install fbcp /usr/local/bin/fbcp
Set Auto-start fbcp
- Open rc.local file
sudo nano /etc/rc.local
Before adding the following code to exit 0, be sure to add "&" to run in the background, otherwise the system may not start.
sleep 20 fbcp &
Calibrate Resistive Touch Screen
Run the following statements on the terminal:
sudo apt-get install xserver-xorg-input-evdev sudo cp -rf /usr/share/X11/xorg.conf.d/10-evdev.conf /usr/share/X11/xorg.conf.d/45-evdev.conf sudo apt-get install xinput-calibrator sudo nano /usr/share/X11/xorg.conf.d/99-calibration.conf
Add the following statements in the 99-calibration.conf file:
Section "InputClass"
Identifier "calibration"
MatchProduct "ADS7846 Touchscreen"
Option "Calibration" "3932 300 294 3801"
Option "SwapAxes" "1"
Option "EmulateThirdButton" "1"
Option "EmulateThirdButtonTimeout" "1000"
Option "EmulateThirdButtonMoveThreshold" "300"
EndSection
Restart to take effect
Working with ESP32S3
This chapter introduces how to set up the ESP32 environment, including the Arduino IDE, management of ESP32 boards, installation of related libraries, program compilation and downloading, as well as testing of demos. It aims to help users master the development board and facilitate secondary development.
Hardware Connection
- 11PIN cable connector
| LCD Pin | ESP32S3 |
| VCC | 3V3 |
| GND | GND |
| MISO | GP4 |
| MOSI | GP13 |
| SCLK | GP12 |
| LCD_CS | GP14 |
| LCD_DC | GP17 |
| LCD_RST | GP18 |
| LCD_BL | GP5 |
| TP_CS | GP2 |
| TP_IRQ | GP9 |
Arduino Environment Setup
Download and Install Arduino IDE
- Click to visit the Arduino official website, select the corresponding system and system bit to download The version of the Arduino IDE needs to be ≥ 1.8, and the path of installation must not be Chinese, otherwise there will be an error when compiling.

- Run the installer and install all by default
Install Arduino-ESP32
- Before using ESP32-related motherboards with the Arduino IDE, you must first install the software package for the esp32 by Espressif Systems development board
- According to board installation requirement, it is generally recommended to use Install Online. If online installation fails, use Install Offline.
- For the installation tutorial, please refer to Arduino board manager tutorial
| Board name | Board installation requirement | Version number requirement |
|---|---|---|
| esp32 by Espressif Systems | "Install Offline" / "Install Online" | 2.0.13 |
- The development board comes with an offline package. Click here to download: esp32_package_2.0.13_arduino offline package
Run the First Arduino Demo
New Project
void setup() {
// put your setup code here, to run once:
Serial.begin(115200);
}
void loop() {
// put your main code here, to run repeatedly:
Serial.println("Hello, World!");
delay(2000);
}
- Save the project and select
File->Save As.... In the pop-up menu, select the path to save the project, and enter a project name, such as Hello_World, clickSave
Compile and Flash Demos
- Select the corresponding development board, take the ESP32S3 motherboard as an example:
①. Click to select the dropdown menu option Select Other Board and Port;
②. Search for the required development board model esp32s3 dev module and select;
③. Select COM Port;
④. Save the selection.
- If the ESP32S3 mainboard only has a USB port, you need to enable USB CDC, as shown in the following diagram:
- Compile and upload the program:
①. Compile the program; ②. Compile and download the program; ③. Download successful.
- Open the Serial Monitor window, and the demo will print "Hello World!" every 2 seconds, and the operation is as follows:
Demo
- Download the Demo and unzip it
- Copy the libraries folder to the path of the Arduino library
C:\Users\{username}\Documents\Arduino
- Double click the demo main.ino in 3inch5_RPI_LCD_G_ESP32S3\examples\main path
- Select the appropriate configuration based on the resources of your ESP32S3
- Compile and flash the demo
![]()
After the flashing is completed, the screen will display touch normally
Resources
Schematic Diagram
Demos
Datasheets
Software
- Zimo221 Chinese character conversion software
- Image2Lcd image bitmap conversion software
- Image bitmap conversion tutorial
- Font library conversion tutorial
- Flash_download_tool
Diagrams
- 3.5inch RPi LCD (G) 3D Diagram-STP
- 3.5inch RPi LCD (G) 2D Diagram-DXF
- 3.5inch RPi LCD (G) 2D Diagram-PDF
Retropie System Usage Tutorial
FAQ
Support
Technical Support
If you need technical support or have any feedback/review, please click the Submit Now button to submit a ticket, Our support team will check and reply to you within 1 to 2 working days. Please be patient as we make every effort to help you to resolve the issue.
Working Time: 9 AM - 6 PM GMT+8 (Monday to Friday)











