Raspberry pi touchscreen LCD: The Best LCD Tutorial
Touchscreen displays are always one of the coolest things that you can add to a Raspberry Pi. Having a neat display always boosts the overall portability of your project. You can build upon 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 are really complicated to interface with the Raspberry Pi. However, in this Raspberry Pi touchscreen LCD tutorial, I will show you 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 Wave Share SpotPear 3.2” LCD display with resistive touchscreen. As far as I could tell after research, it is the cheapest and the simplest LCD with 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 touch interface. So, just follow this simple tutorial to learn to work with a Raspberry Pi touchscreen LCD.
- Raspberry pi B/B+ or Raspberry Pi 3
- Wave share SpotPear 3.2” LCD display with touchscreen.
- SD card to hold the raspbian OS (8 GB)
Raspbian image for Wave share SpotPear 3.2” LCD display
How does it 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 320*240 resolution. Here are more details on the Wave share 3.2” LCD display.
Here, we use an LCD display with resistive touchscreen. Normally, when youtry to interface such displays with a Raspberry Pi, you have to install various drivers, etc. But here, I will be providing 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 on to the female header of the 3.2 inch LCD touchscreen display, so don’t have to worry about the connections.
Step 1: Connect your 3.2” raspberry pi touchscreen LCD display
This will have to be the easiest step, since you just need to take the LCD module and plug it into 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 this: GPIO connectors.
Or you can just check out the connections for the pins of the Raspberry Pi touchscreen LCD display module as shown below:
|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|
|15||LCD_RS||LCD instruction control, Instruction/Data Register selection|
|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|
Step 2: Install the raspbian OS image for the 3.2” 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 doing 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: image file. The image file can be found inside the folder “IMAGE”.
Next, you have to install this image file to your Raspberry Pi. So, take an empty SD card and an SD card reader. For Windows users, check out the 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 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 this tutorial: http://diyhacking.com/backup-and-restore-raspberry-pi/
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.
Now, 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.