Raspberry Pi 5-inch Display Tutorial
Product Features
- Hardware resolution of 800 x 480
- Capacitive touch control
- Compatible and can be directly plugged into any version of Raspberry Pi (Raspberry Pi Generation 1B and Raspberry Pi Zero require a separate HDMI cable)
- Driver provided (supports Raspbian\Ubuntu\Kali and Retropie systems)
- When used for display only, it does not take up any I/O resources (when using touch function, it takes up I/O)
- Supports backlight control, more power saving
- Sunken gold craftsmanship, fine craftsmanship
New features of the latest version V2:
- Improved backlight driver program, lower power consumption (V1 version power consumption is on the high side)
- Improve the screw locking method, more scientific and reliable (V1 version of the screws installed between the sandwich, fall off and re-installation, a lot of work)
- Improve PCB silkscreen, labeling LCD occupied pins (V1 version is not intuitive enough)
- CE, ROHS certification (V1 version no CE, ROHS certification)
Note: Many cottage manufacturers copy the old V1 version.
Quick Start
Hardware Connections
1.Connecting the GPIO Interface- Raspberry Pi pins out 40 GPIO pins, while the screen pins out 26 pins, when connecting, pay attention to the corresponding screen pins and Raspberry Pi pins.
- Raspberry Pi Model B and Raspberry Pi Zero need a separate HDMI cable for connection.
3.Turn the Backlight on the back of the LCD to ON.
You can enable the touch function in two ways: Method 1, install the driver for Raspbian/Ubuntu Mate/Kali or Retropie system. Method two, use the image with pre-installed driver.
Note: This product can only be used for Raspberry Pi, not for PC. For example, if you connect the LCD to a computer via HDMI cable, then the LCD will not display anything.
Method 1, Install the driver
Please download the latest version of the image from RockBee official website (https://rockbee.cc/pages/raspberry-pi-os).
1) Download the image file to your computer and unzip it to get the .img file.
2) Connect the TF card to your computer, open Win32DiskImager.exe software, select the .img file prepared in step 1, and click write to burn the image.
3) After the burning is completed, use the writing pad to open the config.txt file in the root directory of the TF card, add the following code at the end of config.txt to save and safely eject the TF card.
max_usb_current=1
hdmi_group=2
hdmi_mode=87
hdmi_cvt 800 480 60 6 0 0 0
hdmi_drive=1
Note: For Raspberry Pi 4, you also need to comment out dtoverlay=vc4-fkms-V3D.
(4) Connect the TF card to the Raspberry Pi and start the Raspberry Pi, log into the Raspberry Pi's terminal (you can connect the Raspberry Pi to an HDMI monitor or log in remotely with ssh).
(5)Download the relevant driver code through the network, and then execute the corresponding installation commands, and make sure that you can connect to the Internet normally during the whole process.
- git clone https://github.com/waveshare/LCD-show.git
- cd LCD-show/
- sudo ./LCD5-show
Reboot and touch can be used (in order to facilitate the use of the screen can be adjusted to display the direction, see # set the display direction).
Method 2, use the pre-installed driver image
Here we provide a pre-installed driver image, unzip it and write the image to the TF card (open Win32DiskImager.exe software, select the .img file, click “write” to burn the image). Then insert the card into the Raspberry Pi and it's ready to use.
Setting Display Orientation
After installing the touch driver, you can modify the screen rotation direction by running the following command.
- cd LCD-show/
- #X can be 0, 90, 180 and 270, which means the LCD rotates 0 degree, 90 degree, 180 degree and 270 degree respectively.
- sudo . /LCD5-show X
cd LCD-show/
#X can be 0, 90, 180, and 270 degrees, which means the LCD is rotated by 0, 90, 180, and 270 degrees, respectively.
sudo . /LCD5-show lite X
Installation of calibration software for calibration
- This LCD can be calibrated using the xinput-calibrator program.
- Run the following command to install it:
- sudo apt-get install xinput-calibrator
- Click the Menu key on the taskbar and select Preferences -> Calibrate Touchscreen.
- Follow the display prompts to perform touch calibration.
- To save these touch values, you need to create a new 99-calibration.conf file in the following path (no need to create a new one if it already exists)
- /etc/X11/xorg.conf.d/99-calibration.conf
- Save the touch parameters (the data below may be different for different LCDs) to 99-calibration.conf, and you're done!
Installing the Virtual Keyboard
1. Execute the following commands to install the appropriate software
- sudo apt-get update
- sudo apt-get install matchbox-keyboard
- sudo nano /usr/bin/toggle-matchbox-keyboard.sh
2. Copy the following to toggle-matchbox-keyboard.sh, save and exit
- #!/bin/bash
- #This script toggle the virtual keyboard
- PID=`pidof matchbox-keyboard`
- if [ ! -e $PID ]; then
- killall matchbox-keyboard
- else
- matchbox-keyboard &
- fi
3. Execute the following command
- 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. Copy the following to toggle-matchbox-keyboard.desktop, save and exit
- [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. Execute the following command, note that this step must be done with “pi” user privileges, if you use administrator privileges, the file will not be found
sudo nano /etc/xdg/lxpanel/LXDE-pi/panels/panel
6. Find a command similar to the following (icons may vary somewhat between versions)
- Plugin {
- type = launchbar
- Config {
- Button {
- id=lxde-screenlock.desktop
- }
- Button {
- id=lxde-logout.desktop
- }
- }
7. Add the following code to add a new Button item as follows
- Button {
- id=/usr/local/share/applications/toggle-matchbox-keyboard.desktop
- }
8. Reboot the system with the following command, and you will see an additional virtual keyboard icon in the upper left corner
- sudo reboot
Interface Definitions
The following pins labeled “NC” indicate that the LCD does not occupy the pin and can be used by the user for other applications.
Pin No | Identification | Description |
---|---|---|
1 | 3.3V | power positive (3.3V power input) |
2 | 5V | power positive (5V power input) |
3 | NC | NC |
4 | 5V | power positive (5V power input) |
5 | NC | NC |
6 | GND | Power supply ground |
7 | NC | NC |
8 | NC | NC |
9 | GND | Power supply ground |
10 | NC | NC |
11 | NC | NC |
12 | NC | NC |
13 | NC | NC |
14 | GND | Power supply ground |
15 | NC | NC |
16 | NC | NC |
17 | 3.3V | power positive (3.3V power input) |
18 | NC | NC |
19 | TP_SI | SPI data input for LCD display/touch panel |
20 | GND | Power supply ground |
21 | TP_SO | SPI data output of touch panel |
22 | TP_IRQ | Touch panel interrupt, detect the touch panel is pressed then low level |
23 | TP_SCK | SPI clock signal of touch panel |
24 | NC | NC |
25 | GND | Power supply ground |
26 | TP_CS | Touch panel chip select signal, low level to select the touch panel |