Retropie with 5'' Touch Screen

Set up touch screen functionality for retro gaming

Written By: Cherie Tan

Dash icon
Difficulty
Easy
Steps icon
Steps
13
Retropie is a software library used to emulate retro video games and can be run on the Raspberry Pi. However, some of these games require the use of a touch screen. Our 5 inch LCD HDMI Display for Raspberry Pi 3 has touch-screen functionality.

In this guide, learn to set up the 5 inch LCD HDMI Display for Raspberry Pi 3 with Retropie.

Complete this guide to play retro games using touch functionality!

Step 1 Set Up Pre-requisites

This guide is to be used after you have completed the Retropie with Raspberry Pi guide where you would have set up gamepad controls, WiFi, keyboard layout, and the output audio device.
If you have a microSD card that has both Raspbian (with PIXEL desktop) and Retropie on it, you may want to follow our 5-Inch Touch Screen Display with Raspberry Pi guide where you will be able to manually calibrate the touch screen using a program called xinput_calibrator in Raspbian.
While touch functionality will not work in the Retropie main menu, it will work on some of its emulators such as DraStic (for NDS emulation).

Step 2 The 5 in Screen Kit

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

Step 3 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 4 Copy LCD driver 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 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
You should connect the LCD to the Raspberry Pi Model B or Raspberry Pi Zero with an HDMI cable rather than the HDMI connector
Turn on the 'backlight' switch on the back of the LCD

Step 6 Insert microSD card into Pi

Please insert the microSD card into the Raspberry Pi now.
Then connect the power supply to start up Retropie
Connect a keyboard as well as mouse to the Raspberry Pi and then power it on.

Step 7 Add these lines to config.txt

With the Raspberry Pi powered up with Retropie, press F4 to get to the terminal.

 First, we will edit the config.txt file to get rid of any black borders: sudo nano /boot/config.txt
For the screen to display in landscape mode, add the following lines to the end of the config.txt file:

max_usb_current=1

hdmi_group=2

hdmi_mode=87

hdmi_cvt 800 480 60 6 0 0 0

hdmi_drive=1

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 8 Install touch driver

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

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

cd LCD-show/

chmod +x LCD5-show

./LCD5-show

Step 9 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 
Navigate to the '/etc/X11' directory:

cd /etc/X11
Make a folder called 'xorg.conf.d'

sudo mkdir xorg.conf.d
Create a file '99-calibration.conf' :

sudo nano /etc/X11/xorg.conf.d/99-calibration.conf

Step 10 Touch screen calibration file

Section "InputClass"
        Identifier      "calibration"
        MatchProduct    "ADS7846 Touchscreen"
        Option  "Calibration"   "3910 222 3967 371"
EndSection
Add the following to the newly created 99-calibration.conf file.
   Then 'CTRL+X' to exit   Press 'Y' to save
Then press 'Enter' key
Note: If you have a microSD card that has both Raspbian and Retropie on it, you may manually calibrate the touch screen using a program called xinput_calibrator. Replace the values in Option "Calibration" "3910 222 3967 371"

Step 11 Install DraStic or other experimental emulators

Some experimental emulators such as DraStic will need to be installed.
On the main menu, select 'Retropie' to view the settings menu where you will see Audio, Bluetooth, Configuration Editor etc.
Select 'Retropie Setup'
Select 'Manage packages'
Select 'Manage experimental packages'
Select 'drastic'
Select  'Install from binary'
Let the installation run to completion, this may take a few minutes.

Step 12 Select NDS emulator

Once a ROM has been added, the emulator will show up on the main menu.
Select the Nintendo DS emulator
Select the ROM of your choice

Step 13 Configurations

Press 'M'  to bring up the menu as shown
Select 'Change Options' and set up any changes as you'd like
Select 'Configure Controls' to manually set up the controls for games running on DraStic
Use the stylus and start playing!