Here is a nice little screen sold by Sainsmart, not only compatible with Raspberry-like boards, but with every HDMI-enabled device.
It could be powered via a 5v mini-USB cable and doesn’t need an external power supply so it is really autonomous.
It also features a SPI touch panel.
Unfortunately, the Sainsmart’s description is partly wrong, and they don’t give much details about installation / use. Lukily, I have sorted everything for you.
Note : this installation guide probably works also for the 7″ inch version !
1- Specifications
LCD Panel | HannStar HSD050IDW1 |
LCD Type | TFT Transmissive Normal White super wide viewing angle |
LCD Size | 5″ inches (display area : 108mm x 65mm) |
LCD Resolution | 800 x 480 RGB |
Pixel pitch | 0.135mm x 0.135mm |
Video output | HDMI |
Video controller | Texas Instruments TFP401 |
Touch panel type | Resistive |
Touch panel output | SPI + 1 interrupt on 7x 2.54mm pin header |
Touch controller | Texas Instruments TSC2046 |
Powering | 5V via Mini-USB |
Size | 143mm x 85mm x 75mm (including pin header extrusion) |
Price / Availability | $49.99 at Sainsmart |
This display is very easy to use : just plug it to any HDMI port and to a 5V mini-USB and it will work.
The touchpanel needs a little more work, though.
2- Pictures
3- Touchpanel wiring
Touchpanel uses one SPI channel, one additionnal pin for interrupt and one pin for ground.
So, it means touchpanel will only work with a SPI enabled board : Raspberry Pi, Banana Pi, Beaglebone, etc… It won’t work with a regular PC.
This guide is aimed to Raspberry Pi, but it may be adapted for other boards easily.
Display pin | Raspberry Pi pin |
GND | GND |
T_IRQ | GPIO 25 (pin 22) – Change to another pin if you wish |
T_MISO | SPI_MISO (pin 21) |
T_MOSI | SPI_MOSI (pin 19) |
T_CS | SPI_CE0 (pin 24) – Change to SPI_CE1 (pin 26) if you want to use the second SPI cable select. |
T_CLK | SPI_SCLK (pin 23) |
T_BUSY | Not connected |
4- Touchpanel installation
TSC2046 controller is ADS7846 compatible, and last versions of Raspbian has an overlay ready to use.
Edit /boot/config.txt, enable spi and activate ADS7846 overlay.
sudo nano /boot/config.txt
Add these lines to the end of the file :
dtparam=spi=on
dtoverlay=ads7846-overlay,penirq=25,cs=0
Change cs=0 to cs=1 if you want to use the second SPI cable select.
Change penirq if you wired T_IRQ on another pin
5- Console touch calibration
Input devices get a device name which depends on the order of detection (/dev/input/eventX).
These udev rules will create a symlink /dev/input/touchscreen
pointing to the touch controller device. Reloading the driver or rebooting is necessary for the change to take effect.
/etc/udev/rules.d/95-ads7846.rules
SUBSYSTEM=="input", KERNEL=="event[0-9]*", ATTRS{name}=="ADS7846*", SYMLINK+="input/touchscreen"
/etc/udev/rules.d/95-stmpe.rules
SUBSYSTEM=="input", ATTRS{name}=="stmpe-ts", ENV{DEVNAME}=="*event*", SYMLINK+="input/touchscreen"
Now, reboot.
In order to use the touch panel with python, X, and to calibrate it, a few packages need loading :
sudo apt-get install -y libts-bin evtest xinput python-dev python-pip
sudo pip install evdev
# install ts_test with Quit button
sudo wget -O /usr/bin/ts_test http://tronnes.org/downloads/ts_test
sudo chmod +x /usr/bin/ts_test
To calibrate the touchscreen :
sudo TSLIB_FBDEVICE=/dev/fb0 TSLIB_TSDEVICE=/dev/input/touchscreen ts_calibrate
6- X windows touch calibration
xinput-calibrator provides a way to calibrate the touchpanel for X windows use. Install
cd /tmp
wget http://tronnes.org/downloads/xinput-calibrator_0.7.5-1_armhf.deb
sudo dpkg -i -B xinput-calibrator_0.7.5-1_armhf.deb
rm xinput-calibrator_0.7.5-1_armhf.deb
Configure xinput-calibrator to autostart with X windows.
sudo wget -O /etc/X11/Xsession.d/xinput_calibrator_pointercal https://raw.github.com/tias/xinput_calibrator/master/scripts/xinput_calibrator_pointercal.sh
echo "sudo /bin/sh /etc/X11/Xsession.d/xinput_calibrator_pointercal" | sudo tee -a /etc/xdg/lxsession/LXDE-pi/autostart
On first start of X windows a calibration window will be displayed.
startx
Delete /etc/pointercal.xinput
and restart X to recalibrate.
Touch panel rotation
xinput-calibrator doesn’t handle touchpanels with X/Y swapped.
If your calibration results in swapped axis, add these config files.
/usr/share/X11/xorg.conf.d/99-ads7846-cal.conf
Section "InputClass"
Identifier "calibration"
MatchProduct "ADS7846 Touchscreen"
Option "SwapAxes" "1"
EndSection
/usr/share/X11/xorg.conf.d/99-stmpe-cal.conf
Section "InputClass"
Identifier "calibration"
MatchProduct "stmpe-ts"
Option "SwapAxes" "1"
EndSection
7- Disable screen blanking
Edit /boot/cmdline.txt and add consoleblank parameter
sudo nano /boot/cmdline.txt
add this to the end of the line :
consoleblank=0
Edit /etc/kbd/config and edit display blanking parameters
sudo nano /etc/kbd/config
Find these lines and replace the values with 0 (zero) :
BLANK_TIME=0
POWERDOWN_TIME=0
8- Conclusion
This is a very cool display. It works out of the box (minus the touchpanel), is totally autonomous and the quality is great.
I only hope Sainsmart will upgrade it to 5″ inches 1080p panel, as the LCD controller chip seems to support it…
Sources :
https://www.raspberrypi.org/forums/viewtopic.php?t=64993&f=45
https://github.com/notro/fbtft/wiki/FBTFT-on-Raspian
https://github.com/raspberrypi/linux/blob/rpi-4.0.y/arch/arm/boot/dts/overlays/ads7846-overlay.dts
3 réflexions au sujet de « [Review / Guide] Sainsmart 5″ inch HDMI touch display »