2.8inch RPi LCD (A)
说明
|
| ||||||||||||||||||||||||||||
| ||||||||||||||||||||||||||||
视频
产品特点
- 硬件分辨率为320×240
- 电阻式触摸控制
- 兼容并可直接插入任何版本的树莓派
- 提供驱动(支持Raspberry Pi OS\Ubuntu\Kali和Retropie系统)
- 支持FBCP软件驱动,可设置软件分辨率和双屏显示
- 和你的树莓派一样大
- 沉金工艺,精雕细琢
版本说明
- 由于原来2.8inch RPi LCD (A)使用的IC已缺货,我们更换了一款显示效果可替代的驱动方案。
- 外观设计上,LCD尺寸无差别,但软件需要更新,Rev2.1版本增加背光PWM控制功能。(需要使用最新版本的驱动)
- 用户可以通过模块背面的丝印判断新老版本。如果背面丝印带有Rev2.1的,则为新版本。
硬件连接
连接GPIO接口,Raspberry Pi引出了40个GPIO管脚,而屏幕引出了26个管脚,连接时注意对应屏幕管脚和树莓派管脚。
接口定义
以下标识为“NC”的引脚表示LCD没有占用该引脚,用户可用于其它应用。
| 引脚号 | 标识 | 描述 |
|---|---|---|
| 1 | 3.3V | 电源正(3.3V电源输入) |
| 2 | 5V | 电源正(5V电源输入) |
| 3 | NC | NC |
| 4 | 5V | 电源正(5V电源输入) |
| 5 | NC | NC |
| 6 | GND | 电源地 |
| 7 | KEY1 | 按键1 |
| 8 | NC | NC |
| 9 | GND | 电源地 |
| 10 | NC | NC |
| 11 | TP_IRQ | 触摸面板中断,检测到触摸面板有按下则为低电平 |
| 12 | PWM | 背光控制 |
| 13 | RST | 复位 |
| 14 | GND | 电源地 |
| 15 | LCD_RS | LCD指令控制,指令/数据寄存器选择 |
| 16 | KEY2 | 按键2 |
| 17 | 3.3V | 电源正(3.3V电源输入) |
| 18 | KEY3 | 按键3 |
| 19 | LCD_SI / TP_SI | LCD显示 / 触摸面板的SPI数据输入 |
| 20 | GND | 电源地 |
| 21 | TP_SO | 触摸面板的SPI数据输出 |
| 22 | KEY4 | 按键4 |
| 23 | LCD_SCK / TP_SCK | LCD显示 / 触摸面板的SPI时钟信号 |
| 24 | LCD_CS | LCD片选信号,低电平选择LCD |
| 25 | GND | 电源地 |
| 26 | TP_CS | 触摸面板片选信号,低电平选择触摸面板 |
软件设置
在Trixie和Bookworm系统上使用
适用于Raspberry pi4 & pi5
1、配置驱动
打开树莓派终端,执行:
sudo apt-get install unzip -y sudo apt-get install cmake -y sudo wget https://www.waveshare.net/w/upload/3/3f/Waveshare28a-v2.zip sudo unzip ./Waveshare28a-v2.zip sudo cp waveshare28a-v2.dtbo /boot/overlays/
编辑config.txt文件
sudo nano /boot/firmware/config.txt
dtparam=spi=on dtoverlay=waveshare28a-v2 dtoverlay=ads7846,cs=1,penirq=17,penirq_pull=2,speed=50000,keep_vref_on=1,pmax=255,xohms=60 hdmi_force_hotplug=1 max_usb_current=1 hdmi_group=2 hdmi_mode=1 hdmi_mode=87 hdmi_cvt 480 320 60 6 0 0 0 hdmi_drive=2 display_rotate=0
2、设置开机自启动
- 打开.bash_profile文件,如果没有.bash_profile文件则自己创建一个
sudo nano ~/.bash_profile
把以下代码加到.bash_profile文件最下面
export FRAMEBUFFER=/dev/fb1 startx 2> /tmp/xorg_errors
- 打开99-fbturbo.~文件,若已经存在此文件需要确认fb为fb0
sudo nano /usr/share/X11/xorg.conf.d/99-fbturbo.~
把以下内容加到99-fbturbo.~配置文件中
Section "Device"
Identifier "Allwinner A10/A13 FBDEV"
Driver "fbturbo"
Option "fbdev" "/dev/fb0"
Option "SwapbuffersWait" "true"
EndSection
3、设置CLI自动登录
sudo raspi-config nonint do_boot_behaviour B2 sudo raspi-config nonint do_wayland W1 sudo reboot
Note1:确保树莓派的用户名为pi否则无法正常自动登录
Note2:设置上述所有配置后,系统每次重启期间都会变久一点,SSH也需要等待一会儿才能进入;
4、配置触摸
- 安装calibrator软件
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
- 编辑99-calibration.conf配置文件
sudo nano /usr/share/X11/xorg.conf.d/99-calibration.conf
把以下内容加到99-calibration.conf配置文件中
Section "InputClass"
Identifier "calibration"
MatchProduct "ADS7846 Touchscreen"
Option "Calibration" "198 3679 292 3800"
Option "SwapAxes" "1"
Option "EmulateThirdButton" "1"
Option "EmulateThirdButtonTimeout" "1000"
Option "EmulateThirdButtonMoveThreshold" "300"
EndSection
重启后生效
sudo reboot
5、配置摄像头
- 编辑config.txt文件
sudo nano /boot/firmware/config.txt
在config.txt最后加入以下代码
dtoverlay=vc4-kms-v3d max_framebuffers=2
- 编辑98-spi-screen.conf配置文件
sudo nano /etc/X11/xorg.conf.d/98-spi-screen.conf
把以下内容加到98-spi-screen.conf配置文件中 并添加:
Section "Device" Identifier "SPI Screen" Driver "fbdev" Option "fbdev" "/dev/fb0" EndSection
重启后生效
sudo reboot
打开摄像头:
libcamera-hello --qt-preview
适用于所有树莓派版本
可使用任意下列 Lite 系统镜像(根据需要选择 64 位或 32 位):
1、下载必要的软件
- 更新系统
sudo apt update && sudo apt upgrade && sudo apt full-upgrade -y
- 安装xorg服务
sudo apt-get install --no-install-recommends xserver-xorg -y sudo apt-get install --no-install-recommends xinit -y
- 安装桌面管理器
sudo apt install lightdm -y
- 安装树莓派官方GUI
sudo apt install raspberrypi-ui-mods -y
- 安装浏览器(可选)
sudo apt install chromium-browser -y
2、配置驱动
打开树莓派终端,执行:
sudo apt-get install unzip -y sudo apt-get install cmake -y sudo wget https://www.waveshare.net/w/upload/3/3f/Waveshare28a-v2.zip sudo unzip ./Waveshare28a-v2.zip sudo cp waveshare28a-v2.dtbo /boot/overlays/
编辑config.txt文件
sudo nano /boot/firmware/config.txt
dtparam=spi=on dtoverlay=waveshare28a-v2 dtoverlay=ads7846,cs=1,penirq=17,penirq_pull=2,speed=50000,keep_vref_on=1,pmax=255,xohms=60 hdmi_force_hotplug=1 max_usb_current=1 hdmi_group=2 hdmi_mode=87 hdmi_cvt 640 480 60 6 0 0 0 hdmi_drive=2 display_rotate=0
3、设置自启动startx
- 打开.bash_profile文件,如果没有.bash_profile文件则自己创建一个
sudo nano ~/.bash_profile
把以下代码加到.bash_profile文件最下面
export FRAMEBUFFER=/dev/fb1 startx 2> /tmp/xorg_errors
- 打开99-fbturbo.~文件,若已经存在此文件需要确认fb为fb0
sudo nano /usr/share/X11/xorg.conf.d/99-fbturbo.~
把以下代码加到99-fbturbo.~文件里面
Section "Device"
Identifier "Allwinner A10/A13 FBDEV"
Driver "fbturbo"
Option "fbdev" "/dev/fb0"
Option "SwapbuffersWait" "true"
EndSection
4、设置CLI自动登录
sudo raspi-config nonint do_boot_behaviour B2 sudo raspi-config nonint do_wayland W1 sudo reboot
Note1:确保树莓派的用户名为pi否则无法正常自动登录
Note2:设置上述所有配置后,系统每次重启期间都会变久一点,SSH也需要等待一会儿才能进入;
5、配置触摸
- 安装calibrator软件
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
- 编辑99-calibration.conf配置文件
sudo nano /usr/share/X11/xorg.conf.d/99-calibration.conf
把以下内容加到99-calibration.conf配置文件中
Section "InputClass"
Identifier "calibration"
MatchProduct "ADS7846 Touchscreen"
Option "Calibration" "198 3679 292 3800"
Option "SwapAxes" "1"
Option "EmulateThirdButton" "1"
Option "EmulateThirdButtonTimeout" "1000"
Option "EmulateThirdButtonMoveThreshold" "300"
EndSection
重启后生效
sudo reboot
在Bullseye 64位系统上使用
请在树莓派官网下载bullseye版本的镜像64bit。
1、配置驱动
打开boot目录下的config.txt文件,注释掉dtoverlay=vc4-kms-v3d,并在[all]末尾添加
dtparam=spi=on dtoverlay=waveshare28a-v2 dtoverlay=ads7846,cs=1,penirq=17,penirq_pull=2,speed=50000,keep_vref_on=1,pmax=255,xohms=60 hdmi_force_hotplug=1 max_usb_current=1 hdmi_group=2 hdmi_mode=1 hdmi_mode=87 hdmi_cvt 480 320 60 6 0 0 0 hdmi_drive=2 display_rotate=0
2、配置触摸
在终端运行以下语句:
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
在99-calibration.conf文件中增加以下语句:
Section "InputClass"
Identifier "calibration"
MatchProduct "ADS7846 Touchscreen"
Option "Calibration" "198 3679 292 3800"
Option "SwapAxes" "1"
Option "EmulateThirdButton" "1"
Option "EmulateThirdButtonTimeout" "1000"
Option "EmulateThirdButtonMoveThreshold" "300"
EndSection
3、运行FBCP移植
此过程需要联网
sudo apt-get install cmake wget https://www.waveshare.net/w/upload/6/66/Rpi-fbcp.zip unzip Rpi-fbcp.zip cd rpi-fbcp/ mkdir build cd build/ cmake .. make sudo install fbcp /usr/local/bin/fbcp
4、设置开机自启动
sudo nano /etc/rc.local
在末尾exit 0前添加以下语句:
sleep 7 fbcp &
重启后屏幕即可正常显示
sudo reboot
在Bullseye 32位系统和Buster系统上使用
方法一,安装驱动
请在树莓派官网下载最新版本的镜像(Raspbian/Ubuntu Mate/Kali或Retropie)。为了方便使用,这里提供Raspbian镜像
- 2019-07-10-raspbian-buster-full-------------提取码:s5x9
1) 将镜像文件下载到电脑上,并解压得到.img文件。
2) 将TF卡连接到电脑,打开Win32DiskImager.exe软件,选择第1步准备的.img文件,点击write烧写镜像。烧写完成后,安全弹出TF卡。
3) 将TF卡接入到树莓派上,启动树莓派,登录树莓派的终端(可以将树莓派接到HDMI显示器或用ssh远程登录)。
4) 先通过网络下载相关驱动代码,在执行相应的安装命令,在整个过程中确保可以正常联网。
git clone https://github.com/waveshare/LCD-show.git cd LCD-show/ 如果为老版本,则执行以下代码: sudo ./LCD28-show 如果为新版本,则执行以下代码: sudo ./LCD28-show-V2
重启后即可使用(为了方便使用,可以调整屏幕显示方向,参见#设置显示方向)。
注意1:执行apt-get upgrade会导致LCD无法正常工作。此时需要编辑SD卡中的 config.txt 文件,并删除这一句:dtoverlay=ads7846。
注意2:在Raspbian-lite下,需要执行sudo ./LCD28-show lite或sudo ./LCD28-show-V2 lite命令,以安装驱动。
方法二,使用预装驱动的镜像
这里提供预装驱动的镜像,解压并把镜像写入到TF卡中(打开Win32DiskImager.exe软件,选择.img文件,点击「write」烧写镜像)。然后把卡插入树莓派就可以使用了。 如果为老版本,则烧写以下镜像:
- 2.8inch RPi LCD (A)启动镜像-基于2020-08-20-raspios-buster-armhf-full-------------提取码:wxdz
如果为新版本,则烧写以下镜像:
- 2.8inch RPi LCD (A)-V2启动镜像-基于2021-05-07-raspios-buster-armhf-full-------------提取码:wxdz
设置显示方向
安装完触摸驱动后,可以通过运行以下命令修改屏幕旋转方向。
cd LCD-show/ #X可选0、90、180和270。分别表示LCD旋转0度、90度、180度和270度。 #如果为老版本,则执行以下代码: sudo ./LCD28-show X #如果为新版本,则执行以下代码: sudo ./LCD28-show-V2 X
在Raspbian-lite下的旋转命令如下:
cd LCD-show/ #X可选0、90、180和270。分别表示LCD旋转0度、90度、180度和270度。 #如果为老版本,则执行以下代码: sudo ./LCD28-show lite X #如果为新版本,则执行以下代码: sudo ./LCD28-show-V2 lite X
安装校准软件进行校准
- 本LCD可以通过xinput-calibrator程序进行校准。
- 运行以下命令,进行安装:
sudo apt-get install xinput-calibrator
- 点击任务栏的Menu键,选择Preferences -> Calibrate Touchscreen。
- 按显示提示进行触摸校准。
- 如果要保存这些触摸值,需要在以下路径新建一个99-calibration.conf文件(如果已存在则不需要新建)
/etc/X11/xorg.conf.d/99-calibration.conf
- 将触摸参数(不同LCD,下图数据可能不同)保存至99-calibration.conf,即可
安装虚拟键盘
1. 执行以下命令安装相应软件
sudo apt-get update sudo apt-get install matchbox-keyboard sudo nano /usr/bin/toggle-matchbox-keyboard.sh
2. 复制以下内容到toggle-matchbox-keyboard.sh,保存退出
#!/bin/bash #This script toggle the virtual keyboard PID=`pidof matchbox-keyboard` if [ ! -e $PID ]; then killall matchbox-keyboard else matchbox-keyboard & fi
3. 执行以下命令
sudo chmod +x /usr/bin/toggle-matchbox-keyboard.sh sudo mkdir /usr/local/share/applications sudo nano /usr/local/share/applications/toggle-matchbox-keyboard.desktop
4. 复制以下内容到toggle-matchbox-keyboard.desktop,保存退出
[Desktop Entry] Name=Toggle Matchbox Keyboard Comment=Toggle Matchbox Keyboard` Exec=toggle-matchbox-keyboard.sh Type=Application Icon=matchbox-keyboard.png Categories=Panel;Utility;MB X-MB-INPUT-MECHANSIM=True
5. 执行以下命令,注意该步骤必须使用"pi"用户权限,如果使用管理员权限,将找不到该文件
sudo nano /etc/xdg/lxpanel/LXDE-pi/panels/panel
6. 找到类似以下命令(不同版本的图标可能有一定差异)
Plugin {
type = launchbar
Config {
Button {
id=lxde-screenlock.desktop
}
Button {
id=lxde-logout.desktop
}
}
7. 加入以下代码以新增一个Button项,如下图
Button {
id=/usr/local/share/applications/toggle-matchbox-keyboard.desktop
}
8. 执行以下命令重启系统,正常可以看到左上角多了一个虚拟键盘的图标
sudo reboot
PWM背光调节功能
对于Pi4,需要先更新wiringPi版本,操作方法如下(对于3B+及更早的版本,则无需更新):
wget https://project-downloads.drogon.net/wiringpi-latest.deb sudo dpkg -i wiringpi-latest.deb gpio -v # 运行gpio -v会出现2.52版本,如果没有出现说明安装出错
更新wiringPi成功后,可通过以下命令控制背光亮度。
gpio -g mode 18 pwm #占用管脚为PWM管脚 gpio pwmc 100 gpio -g pwm 18 0 #最暗 gpio -g pwm 18 1023 #最亮 gpio -g mode 18 out #释放为输出
资料
开发资料
树莓派镜像
如果为老版本,则烧写以下镜像:
- 2.8inch RPi LCD (A)启动镜像-基于2020-08-20-raspios-buster-armhf-full-------------提取码:wxdz
如果为新版本,则烧写以下镜像:
- 2.8inch RPi LCD (A)-V2启动镜像-基于2021-05-07-raspios-buster-armhf-full-------------提取码:wxdz
- 2.8inch RPi LCD (A)启动镜像桌面版本64位适用于所有版本树莓派-基于2024-07-04-raspios-bookworm-arm64-lite.img-------------提取码:wxdz
软件
树莓派相关教程
LCD显示区域
FAQ
- 该LCD必须安装驱动才能正常使用。具体请查看用户手册相关介绍。
- 由于树莓派镜像和版本经常更新,如遇到无法正常使用LCD的情况,请下载我们提供的最新版本镜像或到树莓派官网下载最新的镜像并安装我们提供的最新驱动进行使用。
- 确定硬件连接无误且接触良好。
- 确定TF卡烧写正常。
树莓派正常启动时PWR灯常亮,ACT灯闪烁。如果发现两灯都常亮则可能是TF卡烧写镜像不成功或TF卡与树莓派接触不良。
推荐使用5V 2.5A电源适配器对树莓派进行供电。 如使用PC机的USB接口对树莓派供电,可能由于供电不足导致树莓派无法正常启动。
商业级(0~70摄氏度)。



