3.5inch RPi LCD (F)

From Waveshare Wiki
Jump to: navigation, search
3.5inch RPi LCD (F)
3.5inch RPi LCD (F)

320×480, I2C / SPI
{{{name2}}}

{{{name3}}}

{{{name4}}}

{{{name5}}}

{{{name6}}}

Overview

Introduction

The 3.5inch RPi LCD (F) is equipped with a capacitive touch screen with a resolution of 320 × 480, supporting two connection methods: Pigo pin communication and GH1.25 13PIN 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
  • High touch screen transmittance, fast response and long lifetime
  • Embedded with ST7796S driver chip and GT911 capacitive touch control chip, using SPI and I2C communication respectively, minimizes required IO pins
  • Supports two connection methods: Pigo pin communication and GH1.25 13PIN 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

3.5inch-RPi-LCD-F-details-11.jpg

Dimensions

3.5inch-RPi-LCD-F-details-size.jpg

Specifications

Parameter Name Parameter
Supply voltage 5V
Logic voltage 3.3V
LCD type IPS
Communication interface Display: SPI
Touch: I2C
Controller chip Display: ST7796S
Touch: GT911
Resolution 320 (H) x 480 (V)
Display size 49.36 (H) x 73.84 (V) (mm)
Dimensions 61.00 (H) x 92.44 (V) (mm)

Raspberry Pi Tutorial

Hardware Connection

This product supports two connection methods to Raspberry Pi

Method 1: Connect the Raspberry Pi through Pigo Pin

750px-3.5inch-RPi-LCD-F-details-13.jpg

Method 2: Connect the Raspberry Pi through GH1.25 13PIN Cable

Function pin BCM encoding Board physical pin number
TP_RST 17 11
TP_INT 4 7
TP_SCL 3 5
TP_SDA 2 3
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 and I2C Interfaces

Enter the following command in the terminal:

sudo raspi-config nonint do_spi 0
sudo raspi-config nonint do_i2c 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%20RPi%20LCD%20(F)/3inch5_RPI_LCD_F_RPI.zip
unzip 3inch5_RPI_LCD_F_RPI.zip
cd 3inch5_RPI_LCD_F_RPI
sudo python ./main.py

Bookworm System Desktop Display

Drive Screen

  • 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=goodix,addr=0x5d
  • After reboot, the touch screen will light up normally
sudo reboot

Rotate Screen

GUI interface rotation

  • 1. Open the "Screen Configuration" application;

3.5F rotate 1.png

  • 2. Check "Touchscreen"

3.5F rotate 2.png 3.5F rotate 3.png

  • 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.

3.5F rotate 4.png
lite version display 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
3.5F rotate 5.png

  • 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 dimming

  • 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:
3.5F pwm1.png

  • 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 dimming

  • 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

Note: Bullseye requires the official version 6.1.21 kernel version or higher.
  • 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

3.5F st7796.png
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/Waveshare35f.dtbo
sudo cp Waveshare35f.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
FBCP CLOSE.jpg
Add the following statements at the end of [all]

dtparam=i2c_arm=on
dtparam=i2c_arm_baudrate=50000
dtparam=spi=on
dtoverlay=Waveshare35f,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 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 &

3.5F rocal.png
Restart to take effect

ESP32S3 Tutorial

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

  • 13PIN cable connector
LCD Pin ESP32S3
VCC 3V3
GND GND
MISO GP42
MOSI GP2
SCLK GP1
LCD_CS GP39
LCD_DC GP41
LCD_RST GP40
LCD_BL GP5
TP_SDA GP15
TP_SCL GP7
TP_INT GP17
TP_RST GP16

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.
    ESP32-S3-AMOLED-1.91-Ar-software-01.png
  • Run the installer and install all by default
The environment setup is carried out on the Windows 10 system, Linux and Mac users can access Arduino-esp32 environment setup for reference

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
  • 3.5inch RPi LCD (F) required development board installation description
Board name Board installation requirement Version number requirement
esp32 by Espressif Systems "Install Offline" / "Install Online" 2.0.13

Run the First Arduino Demo

If you are just getting started with ESP32 and Arduino, and you don't know how to create, compile, flash, and run Arduino ESP32 programs, then please expand and take a look. Hope it can help you!

New Project

  • Run the Arduino IDE and select File -> New Sketch
    ESP32-S3-AMOLED-1.91-Ar-study-01.png
  • Enter the code:
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, click Save

ESP32-S3-AMOLED-1.91-Ar-study-02.png

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.
ESP32-S3-AMOLED-1.91-Ar-study-03.png

  • Some development boards with specified version numbers support direct model selection, for example, "Waveshare ESP32-S3-LCD-1.69":

ESP32-S3-AMOLED-1.91-Ar-study-07.png

  • If the ESP32S3 mainboard only has a USB port, you need to enable USB CDC, as shown in the following diagram:

ESP32-S3-AMOLED-1.91-Ar-study-04.png

  • Compile and upload the program:

①. Compile the program; ②. Compile and download the program; ③. Download successful.
ESP32-S3-AMOLED-1.91-Ar-study-05.png

  • Open the Serial Monitor window, and the demo will print "Hello World!" every 2 seconds, and the operation is as follows:

ESP32-S3-AMOLED-1.91-Ar-study-06.png

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_F_ESP32S3\examples\main path

3.5F esp32 1.png

  • Select the appropriate configuration based on the resources of your ESP32S3

3.5F esp32 2.png

  • Compile and flash the demo

3.5F esp32 3.png
After the flashing is completed, the screen will display touch normally

Resources

Schematic Diagram

Demo

Datasheets

Softwares

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)