Touchscreen display on Raspberry Pi

Attach the display directly to the GPIO pins

So I just got a 5 inch 800×480 HDMI touchscreen display. It comes with a CD with the drivers, a small HDMI connector, a touch pen, and it has a nice back light control switch.

Here’s how it looks:

touchscreen-raspberry-pi

And this is how it looks from the back:

display-back

The neatest way to connect the display is to attach it on top of the GPIO pins, in such a way that the HDMI ports align nicely:

touchscreen-raspberry-pi-hdmi

And a look at the GPIO pins:

touchscreen-raspberry-pi-gpio

As far as I know this way of attaching the display works on the Raspberry Pi 2 and Raspberry Pi 3. If you have another development board, it might be that you can’t just fit the screen on top, due to a different layout of the GPIO pins and HDMI ports. However, don’t despair, you can still use the display, as I will show you how later on.

For the touch screen to work, install the following two C libraries: WiringPi and bcm2835 (they are on the CD that came with the display). Follow the instructions on the pages linked above if you have trouble installing the libraries. For the Raspberry Pi 2 you need to enable the device tree for the bcm2835 library to work. To do that run:

sudo raspi-config

Under Advanced Options you can find Device Tree, and after you enable it, you should reboot.

Next, copy the provided driver from the CD to the Rasberry Pi. The driver archive is in the “image” folder on the CD and it’s called “LCD-show-YYMMDD.tar.gz”. You can copy files to your home folder on the the Raspberry Pi with Filezilla, for example (for a tutorial on that please see here). After you copy the files run these commands:

tar xvf LCD-show.tar.gzcd LCD-show/sudo ./LCD5-show

After that, the system will restart automatically and you will be able to use the touchscreen functionality. Here is a picture of the Raspbian desktop on the touchscreen:

touchscreen-raspbian

Please note that when the touchscreen functionality is enabled, you can’t connect an external display in the HDMI port afterwards, unless you run this command:

sudo ./LCD-hdmi

Here is a video of the touchscreen working:

In case that after the driver installation, the booting sequence stops at something like this: “Kernel panic-not syncing: VFS: unable to mount root fs on unknown-block(179,2)”, like it did for me, don’t worry, there is a solution. Restart the Pi and press the Shift key. Edit the “cmdline.txt” configuration file and change “root=/dev/mmcblk0p2” to “root=/dev/mmcblk0p6“, the everything should work fine.

Connect the display through an HDMI cable

If the board that you own doesn’t have the same GPIO layout as the Raspberry Pi 2 or Raspberry Pi 3, or for some other reason you don’t want to use the touchscreen functionality, just the display, then the setup is much easier. You will need an HDMI cable to connect the two devices, and you will need a power cable for each device. Here is a picture of this setup, with a Raspberry Pi 2:

display-hdmi-raspberry-pi

Install MySQL on the Orange Pi
Web app with Flask & D3.js on Orange Pi

Leave a Reply

Your email address will not be published / Required fields are marked *