3.5inch DPI LCD
| ||
Overview
Features
- 3.5inch IPS capacitive touch screen, 640 x 480 hardware resolution.
- Based on the 40pin GPIO interface of Raspberry Pi.
- Uses the DPI666 interface of Raspberry Pi to drive LCD, refresh rate up to 60Hz.
- Drives capacitive touch through the I2C interface of Raspberry Pi, 5-point touch, toughened glass panel, hardness up to 6H.
- Supports Raspberry Pi OS/Ubuntu/Kali systems.
Working with Raspberry Pi
Hardware Connection
Please install the display screen carefully onto the Raspberry Pi's 40PIN GPIO interface as shown in the figure.
Software Settings
For Raspberry Pi OS Bookworm
Download the latest version of the image from the Raspberry Pi official website.
- 1. Download the compressed file to the PC, and extract it as img file.
- 2. Connect the TF card to the PC, format the TF card with SDFormatter software.
- 3. Open the Win32DiskImager software, select the system image prepared in step 1, and click Write to burn the system image.
- 4. After the image burning is completed, open the config.txt file in the root directory of the TF card, add the following code at the end of the config.txt and save:
dtoverlay=vc4-kms-v3d dtoverlay=waveshare-35dpi dtoverlay=waveshare-touch-35dpi
- 5. Download the 3.5inch DPI LCD DTBO file and extract, then copy to the overlays directory (/boot/overlays/).
- 6. Save and safely eject the TF card, then insert the TF card into the Raspberry Pi.
- 7. Power on the Raspberry Pi, and wait for about 30 seconds and it will be displayed normally.
For Raspberry Pi OS Bullseye
Download the latest version of the image from the Raspberry Pi official website.
- 1. Download the compressed file to the PC, and extract it as img file.
- 2. Connect the TF card to the PC, format the TF card with SDFormatter software.
- 3. Open the Win32DiskImager software, select the system image prepared in step 1, and click Write to burn the system image.
- 4. After the image burning is completed, open the config.txt file in the root directory of the TF card, add the following code at the end of the config.txt and save:
dtoverlay=vc4-kms-v3d dtoverlay=vc4-kms-DPI-35inch dtoverlay=waveshare-35dpi-3b-4b dtoverlay=waveshare-35dpi-3b dtoverlay=waveshare-35dpi-4b
- 5. Download the 3.5inch DPI LCD DTBO file and extract, then copy to the overlays directory (/boot/overlays/).
- 6. Save and safely eject the TF card, then insert the TF card into the Raspberry Pi.
- 7. Power on the Raspberry Pi, and wait for about 30 seconds and it will be displayed normally.
For Raspberry Pi OS Buster and Ubuntu systems
- 1. Open the config.txt file in the root directory of the TF card, add the following code at the end of the config.txt, save and safely eject the TF card.
gpio=0-9=a2 gpio=12-17=a2 gpio=20-25=a2 dtoverlay=dpi18 enable_dpi_lcd=1 display_default_lcd=1 extra_transpose_buffer=2 dpi_group=2 dpi_mode=87 dpi_output_format=0x6f006 hdmi_timings=640 0 20 10 10 480 0 10 5 5 0 0 0 60 0 60000000 1 dtoverlay=waveshare-35dpi-3b-4b dtoverlay=waveshare-35dpi-3b dtoverlay=waveshare-35dpi-4b
Note: If it is Raspberry Pi 4, you also need to comment out dtoverlay=vc4-fkms-V3D.
- 2. Download the 3.5inch DPI LCD DTBO file and extract, then copy to the overlays directory (/boot/overlays/).
- 3. Save and safely eject the TF card, then insert the TF card into the Raspberry Pi.
- 4. Insert the 3.5inch DPI LCD into the 40PIN GPIO interface of the Raspberry Pi, power on the Raspberry Pi, and wait for about ten seconds and it will be displayed normally.
Display Rotation (Raspberry Pi OS and Kali)
First, check whether the KMS or FKMS driver is loaded on the system you are using.
Check method: In /boot/config.txt, check whether dtoverlay=vc4-kms-v3d or dtoverlay=vc4-fkms-v3d is is enabled on the corresponding motherboard.
With KMS or FKMS driver loaded
Use the following command for display rotation:
sudo nano /etc/xdg/lxsession/LXDE-pi/autostart #Enter the command corresponding to the display rotation angle at the end of the autostart file, and it will take effect after rebooting the system #0: #0: rotate 0 degrees; 1: rotate 270 degrees; 2: rotate 180 degrees; 3: rotate 90 degrees xrandr -o 1
No KMS or FKMS driver loaded
Use the following command for display rotation:
sudo nano /boot/config.txt #Enter the command corresponding to the display rotation angle at the end of the config.txt file, and it will take effect after rebooting the system #0: #0: rotate 0 degrees; 1: rotate 90 degrees; 2: rotate 180 degrees; 3: rotate 270 degrees display_rotate=3
Touch rotation
After the display is rotated, the position of the touch is incorrect because the touch doesn't change with the display angle. So the touch also needs to be modified.
1. Install libinput.
sudo apt-get install xserver-xorg-input-libinput
- If the system you installed is Ubuntu. The installation code is:
sudo apt install xserver-xorg-input-synaptics
2. Create the xorg.conf.d directory under /etc/X11 (if the directory already exists, proceed directly to step 3).
sudo mkdir /etc/X11/xorg.conf.d
3. Copy the 40-libinput-conf file to the directory you created just now.
sudo cp /usr/share/X11/xorg.conf.d/40-libinput.conf /etc/X11/xorg.conf.d/
4. Edit this file.
sudo nano /etc/X11/xorg.conf.d/40-libinput.conf
Find the touchscreen section, add the following statement inside, and then save the file.
Option "CalibrationMatrix" "0 1 0 -1 0 1 0 0 1"
Similar to the picture below:
5. Reboot Raspberry Pi
sudo reboot
After completing these steps, you can perform a 90-degree rotation.
Note:
90 degree rotation: Option "CalibrationMatrix" "0 1 0 -1 0 1 0 0 1"
180 degree rotation: Option "CalibrationMatrix" "-1 0 1 0 -1 1 0 0 1"
270 degree rotation: Option "CalibrationMatrix" "0 -1 1 1 0 0 0 0 1"
Other Operations
Disable power saving
If you want to keep the display turning on all the time, you can disable the power-saving function. You can disable the function by setting it up as follows.
Open lightdm.conf
sudo nano /etc/lightdm/lightdm.conf
Modify lightdm.conf. Find the [SeatDefaults] option and uncomment the line "xserver-command", modify it as below:
#xserver-command=X
Modify it into:
xserver-command=X -s 0 -dpms
- -s # –Disable the screen protection.
- -dpms -Disable power saving.
Reboot.
sudo reboot
Control brightness by PWM
If you use Pi4, you need to update wiringPi version first. The operation method is as follows (for 3B+ and earlier versions, there is no need to update):
wget https://project-downloads.drogon.net/wiringpi-latest.deb sudo dpkg -i wiringpi-latest.deb gpio -v # Run gpio -v and version 2.52 will appear. If it does not appear, there is an installation error
After the wiringPi is successfully updated, you can control the backlight brightness by the following commands.
gpio -g mode 18 PWM #Configure the PIN as PWM mode gpio pwmc 100 gpio -g pwm 18 X #Brightest gpio -g pwm 18 1023 #Dimmest gpio -g mode 18 out #Clear the PIN to output mode
Turn on/off HDMI output
You can use the following commands to turn the screen off and on.
vcgencmd display_power 0 vcgencmd display_power 1
Pinout Definition
The pins labeled "NC" below mean that the touch screen is not using these pins, and the user can use them for other applications.
PIN NO. | SYMBOL | DESCRIPTION |
---|---|---|
1 | NC | Not Connected |
2 | 5V | Power positive (5V power supply) |
3 | VSYNC | Vertical sync |
4 | 5V | Power positive (5V power supply) |
5 | HSYNC | Horizontal sync |
6 | GND | Ground |
7 | B2 | RGB signal cable |
8 | G4 | RGB signal cable |
9 | GND | Ground |
10 | G5 | RGB signal cable |
11 | G7 | RGB signal cable |
12 | PWM | Backlight control |
13 | TP_INT | Touch Panel interrupt |
14 | GND | Ground |
15 | R4 | RGB signal cable |
16 | R5 | RGB signal cable |
17 | NC | Not Connected |
18 | R6 | RGB signal cable |
19 | TP_SDA | I2C SDA for touch panel |
20 | GND | Ground |
21 | B7 | RGB signal cable |
22 | R7 | RGB signal cable |
23 | TP_SCL | I2C SCL for touch panel |
24 | B6 | RGB signal cable |
25 | GND | Ground |
26 | B5 | RGB signal cable |
27 | LCD_CLK | LCD clock |
28 | DE | LCD data enable |
29 | B3 | RGB signal cable |
30 | GND | Ground |
31 | B4 | RGB signal cable |
32 | G2 | RGB signal cable |
33 | G3 | RGB signal cable |
34 | GND | Ground |
35 | NC | Not Connected |
36 | G6 | RGB signal cable |
37 | NC | Not Connected |
38 | R2 | RGB signal cable |
39 | GND | Ground |
40 | R3 | RGB signal cable |
Raspberry Pi Long-press Right-click Setting
Raspberry Pi Long-press Right-click Software Installation
Test environment: 2022-04-04-raspios-bullseye-armhf 32-bit system.
Models supported: Supports Waveshare DSI LCD, DPI LCD, and HDMI LCD capacitive touch screen series 32-bit systems, while 64-bit systems are not supported by default
wget https://files.waveshare.com/upload/1/18/Evdev-right-click-emulation.zip unzip Evdev-right-click-emulation.zip cd evdev-right-click-emulation sudo apt install build-essential libevdev2 libevdev-dev -y sudo cp 'out/evdev-rce' '/usr/local/bin/' sudo chmod +x '/usr/local/bin/evdev-rce'
Enter the command:
sudo evdev-rce
After running, you can touch and long press to realize the right-click function.
Set pi user can perform
sudo usermod -G 'input' -a pi echo 'uinput' | sudo tee -a /etc/modules sudo nano /etc/udev/rules.d/99-uinput.rules
Add following in 99-uinput.rules file.
KERNEL=="uinput", MODE="0660", GROUP="input"
Save it and run it in the terminal.
sudo udevadm control --reload-rules sudo udevadm trigger
Then reboot:
sudo reboot
Run after reboot (no sudo needed at this point).
evdev-rce
After running, you can touch and long press to realize the right-click function.
Set Startup
Enter in the terminal.
sudo mkdir ~/.config/autostart sudo nano ~/.config/autostart/right_click.desktop
Add the following in right_click.desktop.
[Desktop Entry] Version=1.0 Type=Application Name=evdev-rce GenericName=Enable long-press-to-right-click gesture Exec=env LONG_CLICK_INTERVAL=1000 LONG_CLICK_FUZZ=200 /usr/local/bin/evdev-rce Terminal=true StartupNotify=false
If you want to modify the sensitivity, you can modify the size of the two parameters: LONG_CLICK_INTERVAL=1000, LONG_CLICK_FUZZ=200.
Resources
Related resources
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)