3.5 inch Touch Screen Display for Raspberry Pi

We have an alternative solution for RPi compatible HDMI monitor; the 3.5 inch Resistive Touch Screen TFT LCD which uses the SPI (Serial Peripheral Interface) to communicate with the main processor. It can be mounted directly on the RPi GPIO pins and it doesn’t require any external power source. In this wiki section we have included detailed explanation on how to install LCD drivers in a custom Raspbian image. The standard version of Raspbian does not include drivers for LCD touch-screens, so will have to install, setup and configure them manually.

Components Used:

  1. Raspberry Pi 2
  2. 3.5 inch Touch Display
  3. Touch pen
  4. SD card (Min. 8 GB)

Steps For Touchscreen Configuration

  1. The touchscreen uses SPI (serial peripheral interface) to communicate to the main processor. By default, SPI communication is disabled in Raspberry Pi Boards.  To enable SPi, enter sudo raspi-config in command prompt; which will take us to the configuration menu. In the configuration menu move the selection to “Advanced Options” (see below):
  2. Enter the Advanced Options menu, and find the line that says “SPI    ENABLE/DISABLE AUTOMATIC LOADING“:
  3. Press the enter key and it will open up a decision window (see below).
  4. Would you like the SPI kernel module to be loaded by default? YESS! thats what we wanted. Once done, exit the configuration menu and type in terminal command ‘sudo reboot‘; for the changes to take effect. Note: This method is applicable, only with the Raspbian version released after 1-31-2015.
  5. Next step is to download the LCD driver, enter the following code in command prompt.

  6. Now we will have to configure the fbturbo video driver so as to change the video out from HDMI bus to SPI bus. For that, enter the following command in the terminal window:

    It will open up the configuration file, find the line, : Option “fbdev” “/dev/fb0″ and change the fb0 to fb1 (fb0 option will output to HDMI, fb1 option will output to SPI)

    Press Ctrl+X to exit and Y to save the file. Enter sudo reboot, for system reboot.

  7. After system reboot there wont be any output on the HDMI screen. So, to enter the further commands in the terminal we will have to use SSH method for remote connection to the Raspberry Pi board. Click here to see the steps on how to setup a remote connection.
  8. Once done with step 7, enter the following commands to test the driver:

  9. Next step is to configure the kernel modules for the LCD and the touchscreen for which we need to edit the /etc/modules file. Use the following command:

  10. Currently, the module for Raspberry Pi’s Broadcom processor snd-bcm2835 is set to load automatically. Add this code below the snd-bcm2835 line to support fbtft_device:

  11. Press Ctrl+X to exit then Y to save the changes.
  12. Now we need to edit the /boot/cmdline.txt file which contains boot-up settings of the system.

  13. At the end of the line in the cmdline.text, add the following code:

  14. Press Ctrl+X to exit then Y to save the changes.
  15. The next step is to activate the touch  screen, enter:

  16. For touch screen calibration enter,

     Add the code shown below in the configuration file.

  17. Enter sudo reboot. Check if the LCD’s display and touch functionality are working properly.
  18. Some people seems to have issues with the touch panel,  having the y-axis inverted in X11. If you experience this problem all you have to do is modify the configuration file usr/share/X11/xorg.conf.d/10-evdev.conf. For that enter

    You need to modify the Section “InputClass”  as shown below and it will work fine:

  19.  Thats it, enjoy your new I/O interface with all its pride. 🙂

Shop With US:

  • Click here to buy Raspberry Pi 2 from rhydoLABZ.
  • Click here to buy Raspberry Pi 2 Starter Kit from rhydoLABZ.
  • Click here to buy Raspberry Accessories from rhydoLABZ.
  • Click here to buy Raspberry Displays from rhydoLABZ.

Leave a Reply