3.5inch RPi LCD (F) 配备320 × 480分辨率的电容触摸屏,支持顶针通信和 GH1.25 13PIN 连接线两种连接方式,并提供树莓派、ESP32、Pico、Arduino等的示例资料。
参数名称 | 参数 |
供电电压 | 5V |
逻辑电压 | 3.3V |
屏幕类型 | IPS |
通信接口 | Display :SPI |
Touch :I2C | |
控制芯片 | Display :ST7796S |
Touch :GT911 | |
分辨率 | 320(H) x 480(V) |
显示尺寸 | 49.36 (H) x 73.84 (V) mm |
产品尺寸 | 61.00(H)x 92.44(V) mm |
这款产品支持两种连接方式连接到树莓派使用
功能引脚 | BCM编码 | Board物理引脚序号 |
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 |
在终端输入以下语句:
sudo raspi-config nonint do_spi 0 sudo raspi-config nonint do_i2c 0
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
wget https://www.waveshare.net/w/upload/d/d1/3inch5_RPI_LCD_F_RPI.zip unzip 3inch5_RPI_LCD_F_RPI.zip cd 3inch5_RPI_LCD_F_RPI sudo python ./main.py
wget https://www.waveshare.net/w/upload/d/da/St7796s.zip unzip St7796s.zip sudo cp st7796s.bin /lib/firmware/
sudo nano /boot/firmware/config.txt
在[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
sudo reboot
GUI 界面旋转
lite版本显示旋转
sudo apt install wlr-randr
wlr-randr
输出示例这里以SPI-1设备为例
wlr-randr --output SPI-1 --transform 90 #旋转参数可改为normal、90、180、270
PWM调光
cd ~ git clone https://github.com/WiringPi/WiringPi.git cd WiringPi ./build gpio -v
安装成功会输出gpio version版本,如下所示:
gpio -g mode 18 pwm #占用管脚为PWM管脚 gpio pwmc 100 #设置 PWM 时钟分频器 gpio -g pwm 18 0 #最暗 gpio -g pwm 18 1023 #最亮 gpio -g mode 18 out #释放为输出
pinctrl调光
sudo pinctrl set 18 op dh
sudo pinctrl set 18 op dl
uname -a
此命令将输出完整的内核版本信息。例如,在 Raspberry Pi 5 上执行该命令,可能会得到如下输出:
Linux raspberrypi 6.1.21-v8+ #1642 SMP PREEMPT Mon Apr 3 17:24:16 BST 2023 aarch64 GNU/Linux
这表明此系统的内核版本号是6.1.21,使用的是64位ARM(AArch64)架构。
# 第一步:下载并进入Waveshare-st7796s驱动文件夹 wget https://www.waveshare.net/w/upload/4/49/Waveshare-st7796s.zip unzip Waveshare-st7796s.zip cd Waveshare-st7796s
# 第二步:cd到对应内核版本号文件目录 # 如上面例子则运行下面指令 cd 6.1.21/64/
# 复制对应版本的st7796s.ko到当前系统 sudo cp st7796s.ko /lib/modules/$(uname -r)/kernel/drivers
# 确保模块在开机时被加载,将模块名添加到 /etc/modules 文件中: sudo nano /etc/modules
# 在末尾添加 st7796s
终端输入以下语句,处理内核模块依赖关系:
sudo depmod -a
cd wget https://www.waveshare.net/w/upload/2/29/Waveshare35f.dtbo sudo cp Waveshare35f.dtbo /boot/overlays/
需要先参考此处步骤#安装驱动模块
sudo nano /boot/config.txt
注释掉KMS和双屏配置语句
在[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
打开树莓派终端,执行:
sudo apt install libraspberrypi-dev -y sudo apt-get install unzip -y sudo apt-get install cmake -y sudo wget https://www.waveshare.net/w/upload/6/66/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
sudo nano /etc/rc.local
把以下代码加到exit 0前,注意一定要添加"&" 后台运行,否则可能会出现系统不能启动的情况。
sleep 20 fbcp &
重启后生效
本章介绍 ESP32 环境搭建,包括 Arduino IDE、ESP32板管理、相关库的安装,程序编译下载及示例程序测试,帮助用户掌握开发板,便于二次开发。
LCD引脚 | 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 |
板名称 | 板安装要求 | 版本号要求 |
---|---|---|
esp32 by Espressif Systems | “离线”安装/“在线”安装 | 2.0.13 |
File
-> New Sketch
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);
}
File
-> Save As...
;在弹出的菜单选择保存工程路径,并输入工程名,如 Hello_World,点击保存
①. 点击选择下拉框选项“Select Other Board and Port”;
②. 搜索需要的开发板型号“esp32s3 dev module”并选择;
③. 选择COM口;
④. 保存选择。
①. 编译程序;②. 编译并下载程序;③. 下载成功。
C:\Users\{用户名}\Documents\Arduino
等待烧录完成后,屏幕即可正常显示触摸。
周一-周五(9:30-6:30)周六(9:30-5:30)
手机:13434470212
邮箱:services04@spotpear.cn
QQ:202004841