Raspberry Pi Touchscreen Setup Tutorial

Raspberry Pi Touchscreen Setup Tutorial

This article will show you how to connect and configure a touch screen to work with Raspberry Pi. For example, we will use a five-inch HDMI screen RPA05010R with 800×480 pixels resolution.

Touchscreen RPA05010R for Raspberry Pi

This screen can be connected to any computer and used as a small external monitor, but if you connect it to Raspberry Pi and set it up correctly, it will have the touchscreen function available.


Let’s look at the main elements on the back of the display:

Raspberry Pi touchscreen schema

  1. MicroUSB connector for power connection, the screen needs 5V. You can also connect the power through the connector 4, detailed description of the connector pins is given in the table below.
  2. HDMI connector for connection of non-standard devices.
  3. The switch “Backlight Power” allows you to turn on and off the screen’s backlighting in cases when you need to save battery power.
  4. Connector 13*2 Pin: Allows you to connect power from Raspberry Pi, as well as send Touchscreen signals from the display back to the microcomputer.
  5. Additional interface for connecting to the display contacts.

Raspberry Pi touchscreen pins


The display can be connected in two main ways. You can simply connect an HDMI cable and power to it. In this case, the display will work as a normal monitor.

Or you can connect it to the Raspberry Pi socket as an expansion board. In this case, the display will be powered by the microcomputer, and it will also have the Touchscreen function. This connection option will be perfect for Raspberry Pi 3B/2B/B+ models.

Connect the display to the microcomputer socket, as shown in the picture below. The edge pins of the Raspberry Pi should match.

Connectiing touchscreen to Raspberry Pi

Also, connect the display to Raspberry Pi using the HDMI adapter that is included. If you connected the pins correctly in the first step, the HDMI connectors of the display and the microcomputer should be exactly opposite each other.

Connectiing touchscreen to Raspberry Pi HDMI

Driver Installation

1. The very first thing we need to do to configure is to change the config.txt file in the root directory of the system. For this purpose, you can remove the SD card from Raspberry Pi, insert it into your main computer, make changes in the text editor, and save. Either do it through the command line without turning off your microcomputer, if you can connect to it over SSH or if you have an external monitor connected.

You need to add the following lines to the config.txt file:

# --- added by elecrow-pitft-setup ---
hdmi_cvt 800 480 60 6 0 0 0 0
# --- end elecrow-pitft-setup ---

Save, close the file, insert the memory card back into Raspberry Pi, connect the display and power. The system starts to load.

2. After the system boots up, you will see your desktop, but the image will only take up a part of the screen. For the screen to work properly, you need to install the driver at the command line. To do this, start the terminal by clicking the icon in the top menu, or connect to Raspberry Pi via SSH.

No matter how you got to the microcomputer’s command line, the command to download the driver will be the same. Type the following command and press Enter:

git clone https://github.com/Elecrow-keen/Elecrow-LCD5.git

After you finish downloading the driver, you need to install it – enter the following commands one by one and press Enter after each:

cd Elecrow-LCD5
sudo ./Elecrow-LCD5

After rebooting, the image will be full screen as in the photo:

Fullscreen touchscreen Raspberry Pi

Touch Screen Calibration

For the touch screen functions to work, you need to install the driver. To do this, enter the following command in the terminal:

sudo apt-get install -y xinput-calibrator

After installing the driver, you should calibrate the screen. To do this, open the main menu and go to “Preferences -> Calibrate Touchscreen”:

Preferences - Calibrate Touchscreen on Raspberry Pi

The screen calibration program will start. You should follow the instructions and press the stylus several times on the screen in the desired places:

Calibration of touchscreen Raspberry Pi

Now check how well the touchscreen works. If the keystrokes are not accurate, then please restart the system and recalibrate the screen.

Setting the Resolution

You have installed the necessary drivers and made the image work full screen and touchscreen, but most likely, the system still uses the old screen resolution. To change it, open the main settings in the main menu:

Main settings in the main menu Raspbian

In the window that appears, click the “Set Resolution” button:

Option Set Resolution on Raspberry Pi

In the drop-down menu, select 800×480 resolution and click OK! Now your touch screen is fully ready to work. You can go on to create your projects!