Maker Pro
Raspberry Pi

How to Add an LCD Touchscreen to Your Raspberry Pi

March 23, 2018 by Arvind Sanjeev
Share
banner

Interface an LCD screen with your Raspberry Pi for project portability and ease of use.

An LCD touchscreen for Raspberry Pi

Touchscreen displays are one of the coolest things you can add to a Raspberry Pi. Having a nice display always boosts the overall portability of your project. You can build on a prolific number of applications using portable TFT LCD displays. You could even make your own customized smartphone! However, most displays are not used because they are expensive and complicated to interface with the Raspberry Pi. In this Raspberry Pi touchscreen LCD tutorial, I will show you how to interface an extremely simple and cheap 3.2-inch LCD display. This TFT LCD display also has a resistive touchscreen and a stylus.

The screen I chose was the Waveshare SpotPear 3.2-inch LCD display with resistive touchscreen. As far as I could tell after research, it is the cheapest and the simplest LCD with a touch interface that can be added to Raspberry Pi projects. You can do a lot of things with these displays. You can build head-mounted displays (like the SmartCap), a portable kiosk, or just add it to any of your existing projects where you need an LCD display with a touch interface. 

If you're not familiar with using the Raspberry Pi terminal, check out this tutorial on basic Linux commands.

How Does Adding the LCD Touchscreen Work? 

Interfacing the LCD display with your Raspberry Pi is simple. The LCD module comes with Raspberry Pi's GPIO pin-compatible female headers. This means that you just have to plug in your display module to your Raspberry Pi's GPIO pins. No other connections or connectors are necessary! This touchscreen's TFT LCD display will provide you with 320x240 resolution. Here are more details on the Waveshare 3.2-inch LCD display.

Raspberry Pi touchscreen LCD tutorial 

Here, we use an LCD display with resistive touchscreen. Normally, when you try to interface such displays with a Raspberry Pi, you have to install various drivers. But here, I provide an image file for the Raspbian OS. This means that you just have to install the OS I provide to your SD card and your Raspberry Pi will start working with the LCD display and touch interface.

This Raspberry Pi touchscreen LCD uses the SPI communication protocol. The GPIO pins on the Raspberry Pi are directly plugged in to the female header of the 3.2-inch LCD touchscreen display, so you don't have to worry about the connections.

Connecting the 3.2-inch Raspberry Pi Touchscreen LCD Display

Plugging the Raspberry Pi touchscreen LCD

This will have to be the easiest step since you just need to take the LCD module and plug it in to your Raspberry Pi's GPIO pins as shown in the picture above.

In case you need to utilize other pins on your Raspberry Pi for the project, you can then use the Raspberry Pi's GPIO-to-breadboard connectors (male-to-female) like these.

Or you can just check out the connections for the pins of the Raspberry Pi touchscreen LCD display module as shown below.

PIN NO. | SYMBOL | DESCRIPTION
1, 17 | 3.3V | Power positive (3.3V power input)
2, 4 | 5V | Power positive (5V power input)
3, 5, 7, 8, 10, 22 | NC | NC
6, 9, 14, 20, 25 | GND | Ground
11 | TP_IRQ | Touch panel interrupt, low level while the Touch panel detects touching
12 | KEY1 | Key
13 | RST | Reset
15 | LCD_RS | LCD instruction control, Instruction/Data Register selection
16 | KEY2 | Key
18 | KEY3 | Key
19 | LCD_SI / TP_SI | SPI data input of LCD/Touch Panel
21 | TP_SO | SPI data output of Touch Panel
23 | LCD_SCK / TP_SCK | SPI clock of LCD/Touch Panel
24 | LCD_CS | LCD chip selection, low active
26 | TP_CS | Touch Panel chip selection, low active


Installing the Raspbian OS Image for the 3.2-inch Raspberry Pi Touchscreen LCD Display 

Normally, when trying to interface a touchscreen LCD display with the Raspberry Pi, you need to install various drivers, make changes in the kernel, etc. With this project, you can forget about all that. Just install the .img file for Raspbian onto to your SD card. You can find the file and the datasheet for the display here. The image file can be found inside the folder "IMAGE".

The Raspberry Pi touchscreen 

Next, you have to install this image file to your Raspberry Pi. Take an empty SD card and an SD card reader. For Windows users, check out these steps as detailed by the Raspberry Pi foundation.

Insert the SD card into your SD card reader and check which drive letter was assigned. You can easily see the drive letter (for example G:) by looking in the left column of Windows Explorer. You can use the SD card slot (if you have one) or a cheap SD adapter in a USB port.

  • Download the Win32DiskImager utility from the Sourceforge Project page (it is also a zip file); you can run this from a USB drive.
  • Extract the executable from the zip file and run the Win32DiskImager utility; you may need to run the utility as an administrator. Right-click on the file, and select Run as administrator.
  • Select the image file you extracted above.
  • Select the drive letter of the SD card in the device box. Be careful to select the correct drive; if you get the wrong one you can destroy your data on the computer's hard disk! If you are using an SD card slot in your computer and can't see the drive in the Win32DiskImager window, try using a cheap SD adapter in a USB port.
  • Click Write and wait for the write to complete.
  • Exit the imager and eject the SD card.

Now, insert this SD card into your Raspberry Pi and power it up. You should see the display come alive in a few seconds.

For Linux users:

Check Step 2 of our How to Back Up Your Raspberry Pi Project Files tutorial.

After that, test your SD card by inserting it into the Raspberry Pi and powering it up. You should see the Raspberry Pi touchscreen LCD display booting up.

Raspberry Pi touchscreen LCD display and stylus 

You have successfully interfaced a touchscreen LCD display with a Raspberry Pi! You can now add this cool display to any of your projects and have a sleek touch interface to enter the inputs. Check out the demo video of the Raspberry Pi touchscreen LCD display in action below.

Author

Avatar
Arvind Sanjeev

An interaction designer and engineer. Yahoo-Accenture had also awarded him as the "Most Promising Innovator".

Related Content

Comments


You May Also Like