SainSmart 3.5" TFT LCD Module 320*240 Touch Screen Display For Raspberry Pi2/3

From SainSmart Wiki
Jump to: navigation, search
3.5inch RPi TFT LCD


  • SainSmart 3.5 inch TFT LCD module is a special design for Raspberry Pi for portable application. It features a 3.5 "display with 320x480 16bit color pixels and resistive touch screen. The LCD is well mated with Pi board and interface with Pi via the high speed SPI port, and support console, X windows, displaying images or video etc. It therefore Provides 4 press buttons for user defined functions.
  • Sale page

Programming the image file

RPi LCD needs to use a SPI interface, but in the original image file of Raspberry Pi, the displayer is driven via a HDMI port. So the original image is not applicable for RPi LCD, and you should install the LCD driver to your Pi or use the Ready-to-use image file provided by Sainsmart,click here.

Apply the RPi LCD in a custom Raspbian system mirror image

In some cases, you may be inconvenient to use the image supplied by us, then you can install the LCD driver on an original system.

Download the LCD driver and extract it to your Raspbian OS (e.g. copy the driver to your Pi by sftpor using U disk). Then run the following command via putty:

tar xvf LCD-show.tar.gz
cd LCD-show/
  • For 3.2inch RPi LCD, run the command:
sudo ./LCD32-show
  • For 3.5inch RPi LCD, run the command:
sudo ./LCD35-show
  • For 4inch RPi LCD, run the command:
sudo ./LCD4-show
  • For 5inch RPi LCD, run the command:
sudo ./LCD5-show

Wait a few minutes, the system automatically restart, you can use normal Raspberry Pi LCD.

Touch screen calibration

This LCD can be calibrated using a program called xinput_calibrator which is pre-installed on the offer image. However, it was not pre-installed on original Raspbian OS. So in this case, you should get and install the program manually with

sudo apt-get install -y xinput-calibrator

Enter the following commands for touch screen calibration:

sudo DISPLAY=:0.0 xinput_calibrator

After running these commands, there will be a prompt for four-point calibration shown in the LCD screen. Click the points one by one to finish the touch calibration. Then, the new calibration data will be displayed in the terminal, as shows below. Please get these data for future use.

Doing dynamic recalibration:
Setting new calibration data: 3950, 202, 298, 3863

Enter the following command to edit 99-calibration.conf:

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

Then, the old calibration data will be displayed in the terminal:

Section "InputClass"
Identifier	"calibration"
MatchProduct	"ADS7846 Touchscreen"
Option	"Calibration"	"3932 300 294 3801"
Option	"SwapAxes"	"1"

Modify the calibration data to the new calibration data displayed in the step 2):

Section "InputClass"
Identifier	"calibration"
MatchProduct	"ADS7846 Touchscreen"
Option	"Calibration"	"3950 202 298 3863"
Option	"SwapAxes"	"1"

Press the keys Ctrl+X, and select the option Y to save the modification.

The modification will be valid after rebooting the system. Enter the following command for system rebooting:

sudo reboot

Notices: In case of inaccurate touch, please perform screen calibration again and reboot the system.