3.2 inch Touch Screen Display for Raspberry Pi

We have an alternative solution for Raspberry Pi compatible HDMI display; the 3.2 inch Resistive TFT Touch Screen Display, which uses SPI Protocol (serial peripheral interface) to communicate with the main processor. It can be mounted directly to the GPIO pins and it doesn’t require any external power source. In here we have detailed explanation on how to install LCD drivers in a custom Raspbian image. The standard version of Raspbian does not include drivers for LCD touchscreens, so we will have to install and configure them manually. 

Components Used:

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

Steps For Touchscreen Configuration

  1. The 3.2″ touchscreen uses SPI (serial peripheral interface) to communicate with the main processor. In an RPi board SPI communication is disabled by default.  To enable it enter sudo raspi-config in the command prompt. The command will open up configuration menu, inside the configuration menu select  “Advanced Options” (see below):
  2. Inside ‘Advanced Options‘, find the line that says “SPI    ENABLE/DISABLE AUTOMATIC LOADING“. Select it and that will open up a confirmation box:
  3. Select Yes and press the enter key. Exit the configuration menu and type in sudo reboot ,for the changes to take effect :Note: This will work only on those Raspbian versions released after 1-31-2015.
  4. Now we will have to download the LCD driver, for which enter the following code in command prompt.

  5. After that, configure the fbturbo video driverto divert the RPi display out from HDMI bus to the SPI bus. Enter the below given code in command prompt,

    It will open up a configuration file, find the line, : Option “fbdev” “/dev/fb0″ and change the fb0 to fb1. The fb0 option will output to HDMI bus, and the fb1 option will output to the SPI bus.Press Ctrl+X to exit and Y to save the file. Enter sudo reboot.
  6. After a reboot there wont be any output on HDMI screen. To input further commands in terminal window we will have to use the SSH method for remote connection with the Raspberry Pi board. Click here for details on how to setup the remote connection.
  7. Next step is to configure the kernel modules for display and touch functionality. To configure these kernel modules, we need to edit the /etc/modules file. In the command prompt, enter:
  8. Currently, the kernel 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 and ads7846_device modules:

    Note:  Starting from fb_ili9340 to the end of the line, ‘-3′, should be entered ALL IN ONE LINE !!!” fbtft_device denotes the kernel module of LCD and ads7846_device denotes the kernel module of touchscreen. ads7846 is the touchscreen controller chip used in the Waveshare 3.2″ LCD and many other touchscreen displays.

  9. Press Ctrl+X to exit and Y to save the changes.
  10. Now we need to edit the /boot/cmdline.txt file, which is the RPi’s boot-up configuration file. Use the following code in command prompt to open the file.
     

    Replace it with all the below code in one line:
  11. Press Ctrl+X to exit and Y to save the changes. Now enter sudo reboot.
  12. Now we will have to activate the touch screen, use the following code:
  13. Insert the below line at the end of config.txt,
  14. For touch screen calibration, enter:

     Add the code shown below in the configuration file.
  15. Enter sudo reboot. Check whether the LCD and the touch screen are working properly.
  16. Some people have seems to have issues with touch panel, having x-axis inverted in X11. If you see this problem you’ll have to modify usr/share/X11/xorg.conf.d/10-evdev.conf. For that enter

    You need to modify the Section “InputClass” as shown below;

     
  17. Thats it! You are all set with your new I/O interface

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 3.2 inch Resistive Touch Screen TFT LCD for Raspberry Pi

FAQ:

Q: Will this LCD module support Rsapberry Pi versions B and B+?
Ans:
Yes it will support the B and B+ versions with latest NOOBS image. The installation procedures are the same for these versions.

 

Leave a Reply

Your email address will not be published. Required fields are marked *

*

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code class="" title="" data-url=""> <del datetime=""> <em> <i> <q cite=""> <strike> <strong> <pre class="" title="" data-url=""> <span class="" title="" data-url="">