Raspberry Pi and Adafruit 5" 800x480 Touchscreen display

A place where updates of QLC+ activities and technical articles are posted as if it was a blog
Post Reply
User avatar
mcallegari
Posts: 1602
Joined: Sun Apr 12, 2015 9:09 am
Location: Italy
Real Name: Massimo Callegari
Contact:

Raspberry Pi and Adafruit 5" 800x480 Touchscreen display

Post by mcallegari » Sun Aug 16, 2015 1:02 pm

Today I needed to unplug my brain from the QLC+ 5 developments (which are proceeding pretty well btw !), so I decided to play with a device I purchased recently and write an article about it.
Despite a user recently told me that I am a crook (yes, this is what I get back for spending my personal time on this project), here's an example of how I invest the money I receive from donations.

This article basically continues the exploration of possible touchscreen solutions, started here

This time I wanted to go a little bit further, with pros and cons.
Before you go on reading, this article is not here to teach you how to use Linux (Google is your friend for that).
It's nerdy stuff for nerd people :)

The system is composed by 3 devices:
- A Raspberry Pi 2 (surprise !)
- Adafruit DPI TFT Kippah with touchscreen driver
- 5" TFT 800x480 Display with touchscreen

A couple of words on the driver and the display.
It's a SPI display, and as far as I can tell it uses also some i2c signals (probably for the backlight)
The refresh rate is quite good, but it's not an IPS display. If you look at it beyond a let's say 30 degrees angle, it will start to look dark. Basically you need to be in front of it.
The touchscreen is resistive, but from what I saw it's accurate enough.
The backlight is very good. The picture is clear and bright.

This is how the devices look, semi-assembled
IMG_0887-small.jpg
Note the orientation of the FFC cable between the Kippah and the display. An upside down connection won't fry the boards, but won't work either...

The 40-pin connector of the Kippah is not suitable for the first generation RPi. You need at least a RPi1 B+ or a RPi2.

Assemblying is very easy. Just firmly plug the kippah to the Pi IO strip and add an extra USB->microUSB cable between the RPi and the Kippah.
This is needed for the touchscreen. Without the cable, the TS won't work.
As for the power supply, I used a 5V 2A. The current absorption depends on how many USB device you plug.

This is how the resulting sandwhich looks like.
IMG_0888-small.jpg
IMG_0889-small.jpg
This is a kind of con of this solution. The display is clearly much bigger than the RPi, and there are chips along the FFC that prevent to decrease the height of the whole thing.
Here it's up to your DIY skills to create a proper case for it. The total height is around 5-6cm.

Before powering up, there are a couple of things you need to tweak on the SD card boot partition.

The Adafruit instructions are here: https://learn.adafruit.com/adafruit-dpi ... t/overview

but in this article I provide also the missing information and the specific changes for QLC+.

Enable the display

Download the dt-blob.bin file from here: http://adafruit-download.s3.amazonaws.com/dt-blob.bin
and simply copy it in the boot partition of your SD card (mounted on /boot if you do it via SSH)

Edit /boot/config.txt and replace the line

Code: Select all

dtparam=i2c0,i2c1,spi
with

Code: Select all

overscan_left=-32
overscan_right=-32
overscan_top=-32
overscan_bottom=-32
  
# Disable spi and i2c, we need these pins.
dtparam=spi=off
dtparam=i2c_arm=off
 
# enable the DPI display
enable_dpi_lcd=1
display_default_lcd=1
# set up the hsync/vsync/clock polarity and format
dpi_output_format=454661
# set up the size to 800x480
dpi_group=2
dpi_mode=87
hdmi_cvt=800 480 60 6
Boot the RPi and the display will show everything, including the very initial boot splash gradient, the kernel messages and of course QLC+

QLC+ parameters

Connect via SSH shutdown QLC+ (service qlcplus stop) and edit the file: /etc/init.d/qlcplus
Find the line starting with QLCPLUS_OPTS, remove "--overscan" and add "-plugin evdevmouse:abs" at the beginning of the options between quotes

Add the following lines after the QLCPLUS_OPTS line:

Code: Select all

export QT_QPA_EGLFS_HIDECURSOR=1
export QT_QPA_EGLFS_DISABLE_INPUT=1
It took me a whole morning to find out these simple 3 options. This is what I call "a shortcut" ! ;)
For the super nerds: the Kippah USB cable is needed to expose the touchscreen as a HID device to Linux, mapped on /dev/input/event.
Thing is that they used a mouse profile, instead of a touchscreen profile.
So Qt gets confused and need to be instructed to treat the TS values as absolute mouse coordinates.
The DISABLE_INPUT flag is tricky and it's necessary to tell Qt to get data only from the mouse plugin, otherwise it tries to mix also the data coming from udev+libinput.

Touchscreen calibration

First, make sure the USB cable from your RPi to the Kippah is plugged in !
Give the following commands (via SSH is OK):

Code: Select all

apt-get update
apt-get install python-pip python-pygame
pip install pyusb==1.0.0b1
wget http://adafru.it/ar1100py
mv ar1100py ar1100.py
chmod +x ar1100.py
wget http://adafruit-download.s3.amazonaws.com/gradient800x480.jpg
Note that this will eat 135MB of your SD card !! So maybe you might want to run a raspi-config and expand your filesystem first.

Now plug a keyboard to the RPi, login and type the following:

Code: Select all

python ar1100.py
If you get the message "Couldn't fin generic either" just give the command above once again.
If you keep on getting the message, then the USB cable is not connected !

If successful, you will see a rainbow picture on the screen. Hit the ESC key to exit.
Basically this operation writes the EEPROM of the Kippah driver with some permanent calibration values.

Now you can reboot the RPi and enjoy the results !
IMG_0891-small.jpg
IMG_0894-small.jpg
Conclusions
In the end I've been able to make this solution to work on the QLC+ RPi image, with not much effort.
You don't need to compile anything, and that's good.

So, here's the pros and cons.

Pros:
- the 5" display and its 800x480 resolution is quite good for a standalone QLC+ solution
- the display refresh rate and backlight are good
- the touchscreen is quite responsive and accurate

Cons:
- it's a quite *expensive solution. Driver + Display + UPS + Custom taxes goes above 100€ :(
- it requires an extra USB cable and a specific case to be portable
- the display is not IPS, and it has a narrow view angle

I would suggest this solution only if you have a few bucks to spend and only if you intend to build a case for it.
I imagine it would be very nice to control the lights of a bar/pub. A proper Virtual Console with a multi-page frame can give you all the controls you need for a basic-medium ligthing situation

* in theory, it would be possible to connect any 40-pin compatible display. So probably there are cheap chinese displays working with the Kippah. However, if the PINs are not correct, you will fry the display and probably the Kippah too. I personally wouldn't risk my money on that.

User avatar
alegrechi
Posts: 6
Joined: Sun Apr 12, 2015 5:08 pm
Location: Florence - Italy
Real Name: Alessandro Grechi
Contact:

Re: Raspberry Pi and Adafruit 5" 800x480 Touchscreen display

Post by alegrechi » Mon Aug 17, 2015 2:02 pm

Nice tutorial ! :)

felixfx
Posts: 3
Joined: Mon Jul 20, 2015 2:17 am
Real Name:

Re: Raspberry Pi and Adafruit 5" 800x480 Touchscreen display

Post by felixfx » Sun Aug 30, 2015 1:56 am

After searching a while I bought the "Eleduino 2015 - 7 Inch 800x480 Pixel"-Touchscreen-LCD for about 80€ on amazon. I also bought the raspberry pi2-case at the back site of the display for 10€. Touchscreen needs to be connected to HDMI and a USB-Port. It was easy to install, works good and costs less than 100€. :)

Image
Image

User avatar
pengumaniac
Posts: 75
Joined: Wed Jul 08, 2015 8:59 am
Location: FRH, Germany
Real Name: Manfred Flintstone

Re: Raspberry Pi and Adafruit 5" 800x480 Touchscreen display

Post by pengumaniac » Sun Aug 30, 2015 9:44 pm

hi felixfx
looks nice & clean - did you have a look too with the official raspbian & LXDE?
Gentoo | profile=desktop | LXDE | QLC+ qt4-build / openSUSE 13.2-x86_64 | KDE | QLC+ qt5-rpmbuild
The best way to predict the future is to invent it. (Alan Curtis Kay) - I'd like to emerge -avuND world, but there are no news in sync for stable updates

Callietechno010
Posts: 1
Joined: Mon Jun 13, 2016 11:46 am
Real Name:
Contact:

Re: Raspberry Pi and Adafruit 5" 800x480 Touchscreen display

Post by Callietechno010 » Mon Jun 13, 2016 11:48 am

Thanks for sharing a great information with us. I also purchased touch screen for raspberry pi some days ago. And its working good.

Image

Post Reply