After the tutorial on how to use a Waveshare 5-inch TFT touch screen with a Raspberry Pi Model B, now we will repeat the test (more successfully, I hope) with a SainSmart 7-inch TFT touch screen. As the previous one, also this display - which I bought some time ago by Amazon - has a LCD resistive touch panel AT070TN92 with 800 x 480 px resolution and an HDMI interface. Regardless the size of the screen, the main difference is that in this module the power required is 12v DV instead of 5V DC and there isn't a GPIOs pin block for the connection with the RPI. On the other hand, it has a SVGA port and a 2AV input connector on the main boost driver board and a small adapter board that must be connected to the flat screen with a data cable and to the RPI with a 4-pin plug wire / USB cable (included in the package). There's also another small board with control buttons to power on/off, page down/up and select the video source by switching from HDMI to AV to VGA and back. These are its main features:
- Vendor: SainSmart
- Resolution:800 x 480 px
- Screen Type: 7 Inches Resistive AT070TN92 Screen
- Working Voltage/Current: DC 12V
- HDMI/VGA/2AV Interfaces with USB Controller Card and Cable
I have kept this piece of hardware in its box for quite some time and now it was time to try it! This is all you need:
- 1 x Raspberry Pi (any version) with Internet connection
- 1 x HDMI cable
- 1 x 8Gb SD card or microSD card with adapter (or more, don’t use the 4Gb or less)
- 1 x DC 12v power supply
- 1 x DC 5v 500mA power supply
Download, unzip and flash your SD card with a recent Raspbian image like 2015-02-16-wheezy-raspbian:
(you can do it with dd
command in Linux or Win32DiskImager in Windows).
Connect and power the RPI with the other board cards according to the instructions you will find on the SainSmart website
Plug an USB keyboard in your RPI and login into it with the username pi
. You can change the root password with the command
sudo passwd root
(enter twice the password you like).
Check your IP address with the command:
sudo ifconfig
in order to subsequently connect from a remote terminal through the pre-enabled ssh service (with PuTTY or WinSCP in Windows).
Update the packages with
sudo apt-get update
and then enlarge the SD card partition with
sudo raspi-config
and select the menu option 'Expand Filesystem'.
In the raspi-config
menu enter also 'Advanced Option' > 'SPI ENABLE/DISABLE AUTOMATIC LOADING' and 'Enable Boot to Desktop', so that after the reboot you can load the new kernel and see the graphical interface.
In the /boot/config.txt
file change the configuration to include the following lines:
framebuffer_width=800framebuffer_height=480
hdmi_force_hotplug=1
hdmi_cvt=800 480 60 6 0 0 0
hdmi_group=2
hdmi_mode=87
Reboot the RPI and make sure that the screen is in HDMI mode (with one of the controller board buttons)
After the reboot, run
sudo apt-get update && sudo apt-get upgrade
After the long upgrade, you can run
sudo rpi-update
to update the RPI's firmware and install the following packages:
sudo apt-get install libx11-dev libxext-dev libxi-dev x11proto-input-dev xinput evtest -y
You will also need to download and uncompress the xinput-calibrator
tarball (not included in the official repositories) from some source like this:
wget http://github.com/downloads/tias/xinput_calibrator/xinput_calibrator-0.7.5.tar.gz sudo tar xvf xinput_calibrator-0.7.5.tar.gz
cd xinput_calibrator-0.7.5/
sudo ./configure
sudo make
sudo make install
After the reboot, start xserver
and export the display with
su pi
FRAMEBUFFER=/dev/fb1 su -l pi -c startx &
export DISPLAY=:0.0 xinput_calibrator
If nothing happens, reboot the system again. Perhaps the touch function will work well but upside down, to fix this problem you just need to properly calibrate the monitor by running:
su pi
DISPLAY=:0.0 xinput_calibrator
Now you should be able to calibrate the monitor by pressing with a pen or a mouse in each of the 4 corners of the active area (as precisely as possible on the red crosses).
After that, the screen will say: " Copy the snippet below into /etc/X11/xorg.conf.d/99-calibration.conf
" (the calibration values may vary)
Section "InputClass" Identifier "calibration"
MatchProduct "eGalax Inc. USB TouchController"
Option "Calibration" "51 1941 1797 155"
EndSection
However, in order to make the calibration permanent you must copy the above content in another file that you will need to create
sudo nano /usr/share/X11/xorg.conf.d/01-input.conf
(Ctrl + O to save the data, Ctrl + X to exit)
Make sure that the same section is not present in other sub-directories of /usr/share/X11/xorg.conf.d/
and reboot the system.
After the restart the screen will have achieved the best calibration and solved its previous axis inversion problem.
Related links: