5-Inch Touch Screen Display with Raspberry Pi

How to set up the 5-inch touch screen with the Raspberry Pi

Written By: Cherie Tan

Dash icon
Steps icon
The 5 inch LCD HDMI Display for Raspberry Pi 3  supports 800x480 resolution and has touch screen control capabilities. But it requires a few modifications before it can be used. 

In this guide, we will show you how to attach it to the Pi, then get it up and running quickly!

Some examples of what you could build with it includes a Raspberry Pi tablet, handheld game console or a digital photo frame.

Step 1 The Kit

There are four parts to the kit, including the 5-inch LCD touch screen.
A HDMI connector
Stylus pen
Screws and stand-offs

Step 2 Turn on the 'backlight' switch

We will turn the backlight on by flicking the switch. 
This is located on the back side of the LCD screen.

Step 3 Attach LCD to Raspberry Pi

Plug the LCD into the Raspberry Pi
Connect the HDMI connector to the HDMI interface on the LCD and the Pi.
  • Note: You should connect the LCD to the Raspberry Pi Model B or Raspberry Pi Zero with an HDMI cable rather than the HDMI connector.

Step 4 Copy LCD driver and xinput calibrator to Pi

This driver is for Raspbian after 180303 version. 

The second thing you will need later is the xinput calibrator: Xinput-calibrator_0.7.5-1_armhf.zip
  • Open up the .zip folder. The file you will need to copy over is: xinput-calibrator_0.7.5-1_armhf.deb
Copy both of them into the microSD card's "boot" folder. You can do so using a microSD card reader connected to your computer.

Step 5 Insert microSD card into Pi

If you have a NOOBS microSD card with Raspbian, please insert it into the Raspberry Pi now.
Then connect the power supply to start up Raspbian.
Don't have a NOOBS microSD card? Not to worry, please follow our guide on how to create a NOOBS MicroSD card.
Connect a keyboard as well as mouse to the Raspberry Pi and then power it on.
If you have previously configured the Raspberry Pi with a different display i.e. our 7-inch display, please start with a fresh copy of Raspbian, or else the calibration will be off. 

Step 6 Connect to a network

To download the driver for the touch driver, you will need a network connection.
So connect to your network by first clicking on the WIFI icon on the top right-hand corner of the desktop.
Click on 'Turn On Wi-Fi'
Then choose your network connection.
Enter credentials and save.

Step 7 Open terminal window

Right now, you might notice some black borders. We will change some settings so that the screen will be fully used. Click on the terminal window icon on the top left hand corner of the desktop.
With a terminal window open, run the following command: sudo nano /boot/config.txt

Step 8 Add these lines to config.txt

For the screen to display in landscape mode, add the following lines to the end of the config.txt file:




hdmi_cvt 800 480 60 6 0 0 0


Press CTRL+X , then press 'Y' and finally hit the 'Enter' key to save. 

Type sudo reboot in the terminal to restart the Pi. Once booted up again, you will notice that the black borders are now gone!

Step 9 Install touch driver

Enter the following commands in a terminal window to install the touch driver:

tar xzvf /boot/LCD-show-*.tar.gz 

cd LCD-show/

chmod +x LCD5-show


Step 10 Rotate the screen

The screen orientation can be set using these commands:

0 degree rotation:

cd LCD-show/

./LCD5-show 0

90 degree rotation:

cd LCD-show/

./LCD5-show 90

180 degree rotation:

cd LCD-show/

./LCD5-show 180

270 degree rotation:

cd LCD-show/

./LCD5-show 270

For this guide, we will rotate it 90 degrees so that it can be viewed in a portrait orientation.

Step 11 Touch screen calibration

Finally, we will calibrate the touch screen. Enter the following command to install xserver-xorg-input-evdev:
sudo apt-get install xserver-xorg-input-evdev
Make sure that evdev.conf has a higher number than 40-libinput.conf. To do so, rename it with the following command:
sudo cp -rf /usr/share/X11/xorg.conf.d/10-evdev.conf /usr/share/X11/xorg.conf.d/45-evdev.conf 
Now we will download a program called xinput_calibrator, the software you had added to your Pi in Step 4. So open up the boot folder and double-click on the file, 'xinput-calibrator_0.7.5-1_armhf.deb'
To calibrate the touchscreen, click on Menu > Preference > Calibrate Touchscreen. Follow the prompts.

Step 12 Create a 99-calibration.conf

Section "InputClass"
        Identifier      "calibration"
        MatchProduct    "ADS7846 Touchscreen"
        Option  "Calibration"   "270 3992 3899 144"
Navigate to the '/etc/X11' directory: cd /etc/X11
Make a folder called 'xorg.conf.d' with the command: sudo mkdir xorg.conf.d
Create a file '99.calibration.conf' using the command: sudo nano /etc/X11/xorg.conf.d/99-calibration.conf
Enter the touch parameters you obtained in the previous step. 
Save file with CTRL+O 
Reboot the Pi with: sudo reboot

Step 13 Turn on the 'backlight' switch

We will turn the backlight on by flicking the switch. 
This is located on the back side of the LCD screen.