OSOYOO 3.5 Inch SPI
Touch Display for RPi

Online tutorial: https://osoyoo.com/?p=50824
1 / 23ContentCaution ............................................................................................................................ 3Overview ......................................................................................................................... 3
INTRODUCTION ......................................................................................................... 3
FEATURES .................................................................................................................. 4
KEY PARAMETERS .................................................................................................... 4
INTERFACE DEFINITION ........................................................................................... 5
Getting Started ................................................................................................................ 7
READY-TO-USE IMAGE INSTALLATION GUIDE FOR RASPBERRY PI OS............. 7
TOUCH DRIVER INSTALLATION GUIDE FOR RASPBERRY PI OS ....................... 11
Advanced course .......................................................................................................... 14
USE SSH TOOL TO CONTROL RASPBERRY PI REMOTELY ................................ 14
ROTATE THE DISPLAY DIRECTION ....................................................................... 19
INSTALL VIRTUAL KEYBOARD ............................................................................... 19

2 / 23

Caution•

If you don’t install the touch driver and use 3.5″ SPI screen, this screen will show
white screen. Please don’t worry and follow our guide to make it work.

•Please confirm that your SD card have enough space for touch driver•In this guide, we introduce two way to install the touch driver for this screen:
ready-to-use image and touch driver installation.

•This screen is just compatible with Raspberry Pi OS. All guide in this user
manual are tested with Raspberry Pi OS from official website.

Overview
INTRODUCTION
3.5 inch SPI Touch Display is designed for Raspberry Pi.

3 / 23

FEATURES•

320 x 480 hardware resolution•

Resistive touch control•

Compatible and supported by any version of Raspberry Pi board.(Directlypluggable)•Drivers provided (works with your own Raspbian)•Supports FBCP software driver as well, allows to config software resolution andset up dual-display•Size perfectly fits the Pi (Raspberry Pi B+/2B/3B/3B+/4/Zero/Zero W)•Use software keyboard (system interaction without keyboard/mouse)•Reversible screen display orientation•PWM backlight brightness controllable•

High-quality PCBs and components.

KEY PARAMETERS

4 / 23SKU

O

LCD Type

TFT

LCD Interface

SPI(Fmax:24MHz)

Touch Screen Type

ResistiveTouch Screen Controller XPT2046
Colors262K

Driver IC

ILI9488

Backlight

LED

Resolution

320RGB(H)×480(V) (Pixel)

Backlight Current

120maPower Dissipation

0.13A*5V

Operating Temp. (℃)-20~60

Active Area

49×73.4(mm)Product Size85.5*55(mm)Package Size

135*95*45 (mm)

Net Weight55 (g)INTERFACE DEFINITION

The pins marked as “NC” below indicate that the pins are not occupied by the LCD andcan be used by the user for other applications.
5 / 23

Pin No.

Identification

Description

1

3.3V

Power (3.3V input)

2

5V

Power (5V input)

3NC

NC

45V

Power (5V input)

5NC

NC

6

GND

Ground

7NC

NC

8NC

NC

9

GND

Ground

10NC

NC

11

TP_IRQ

12NC

NC

13NC

NC

14

GND

Ground

15NC

NC

16NC

NC

173.3VPower (3.3V input)

18

LCD_RS

Command/Data Register Select

19

LCD_SI / TP_SI

LCD display / SPI data input of touch panel

20

GND

Ground21

TP_SO

SPI data output of touch panel

22

RSTReset

23

LCD_SCK /TP_SCK

The touch panel is interrupted, and it is low when it isdetected that the touch panel is pressed

SPI clock signal for LCD display / touch panel

24

LCD_CS

LCD chip select signal, low level selects LCD

25

GND

Ground26

TP_CS

Touch panel chip select signal, low level selects touchpanel
6 / 23

Getting Started
READY-TO-USE IMAGE INSTALLATION GUIDE FOR RASPBERRY PI OSStep 1: Download Ready-to-use Image of Raspberry Pi OS
from: https://osoyoo.com/driver/pi/raspberrypi.img
Step 2: Prepare a newly MicroSD memory card (TF card) with USB microSD card
reader, recommend sizes are 8G, 16G, and 32G. Insert Micro SD card in USB micro SDcard reader, and connect USB micro SD card reader with your PC.

If you need to format MicroSD card, please download SDFormatter
from: https://www.sdcard.org/downloads/formatter_4/.

7 / 23

Step 3: Download the Win32DiskImager utility from
Sourceforge: https://sourceforge.net/projects/win32diskimager/

Step 4: Run the Win32DiskImager utility. You may need to run the utility asadministrator. Right-click on the file, and select Run as administrator.
Step 5: Browse driver image file from Step 1:8 / 23

Step 6: Select correct device you prepared and click “write” to burn the driver image file(from Step 1) into MicroSD card. (Note: Please confirm you choose the correct SD card,or you’ll damage the files in your device)

9 / 23

Step 7: Connecting touch screen LCD display to your Raspberry Pi (Note: There are 40
pins on Raspberry Pi, but there are 26 pins on the LCD, so you should pay attention toconnecting the pins to your Pi accordingly.)

Step 8: Insert MicroSD card from step 8 into your raspberry pi and power it up.

10 / 23

TOUCH DRIVER INSTALLATION GUIDE FOR RASPBERRY PI OS
Caution:
1. If you don’t install the touch driver and use 3.5″ SPI screen, this screen will show
white screen. Please don’t worry and follow the following guide to make it work.
2. You can install the touch driver on the existing Raspberry Pi OS.
3. Please confirm that your SD card have enough space for touch driver
Step 1. Burn Raspberry Pi OS (please download OS from Raspberry Pi official website)
in a TF card/micro SD card, and insert this card in your raspberry Pi. (please confirm
that the SD card have enough space for touch driver)
Step 2. Connect Raspberry Pi to your HDMI monitor or TV. Put a keyboard and mouseinto Raspberry Pi USB ports, as following. (please don’t install 3.5″ SPI screen now, as
it will show white screen)

Step 3. Getting the Raspberry Pi connected to the Internet (If you want to learn how toget the Raspberry Pi connected to the Internet, please visit
https://osoyoo.com/2017/06/20/raspberry-pi-3-basic-tutorial/ )Step 4. Open terminal, and enter the following command to get the Raspberry Pi’s IPaddress

11 / 23

hostname -I

Step 6. Enter the following command in the terminal of Raspberry Pi to install the touchdriver.
git clone https://github.com/osoyoo/LCD-show.git
cd LCD-show/

Step 7. Enter the following command in the terminal of Raspberry Pi to run touch driverchmod +x lcd35b-show./lcd35b-show
The touch function will restart automatically.

12 / 23

Step 8. Shut down and remove the HDMI/TV monitor. keyboard and mouse, then installthe 3.5″ SPI screen with the Raspberry Pi which has install touch driver. (There are 40
pins on Raspberry Pi, but there are 26 pins on the LCD, so you should pay attention toconnecting the pins to your Pi accordingly)

Step 9. Power on this Raspberry Pi screen.

13 / 23

Advanced course
USE SSH TOOL TO CONTROL RASPBERRY PI REMOTELY
Step 1. After installing the touch driver, put a keyboard and mouse into Raspberry Pi
USB ports, and open terminal, and enter the following command to get the Raspberry
Pi’s IP address
hostname -I
Step2. Enter the following command to enable SSH.
sudo raspi-config

14 / 23

Step 3. You will go to configuration menu, selectInterface Options ->SSH -> Yes ->OK ->Finish

15 / 23

16 / 23

Step 4. Install ssh tool in your computer (If you want to learn how to Use ssh tool tocontrol Raspberry Pi’s remotely, please visit https://osoyoo.com/2017/06/20/raspberrypi-3-basic-tutorial/)
Here we take PuTTY for windows users as example. Please download PuTTY
from: https://www.chiark.greenend.org.uk/~sgtatham/putty/ and install this exe. in yourWindows PC

Step 5. Open PuTTY and click Session on the left tree-alike structure (generally it’scollapsed upon PuTTY startup):

Step 6. Enter the IP address you got from step1 under Host Name (or IP address) and
22 under Port (by default it is 22), then click open.

17 / 23

Step 7. Note that when you first log in to the Raspberry Pi with the IP address, you’ll beprompted with a security reminder. Just click Yes. When the PuTTY window prompts
login as: type in the user name: pi, and password: raspberry (the default one, if you
haven’t changed it).
Note: when you’re typing the password in, the window shows nothing just null, but
you’re in fact is typing things in. So just focus on typing it right and press Enter. Afteryou log in the RPi successfully, the window will display as follows:

18 / 23

ROTATE THE DISPLAY DIRECTION
Step1. Enter ssh tool to control Raspberry Pi remotely
Step2. After installing the touch driver, you can rotate display 90 degrees clockwise
direction by running the following commands (Note: #90 can be 0, 90, 180 and 270.
Indicates that the display rotates 0 degrees, 90 degrees, 180 degrees and 270 degrees
clockwise direction, respectively.)
cd LCD-show/
sudo ./lcd35b-show 90

INSTALL VIRTUAL KEYBOARD
Step 1. Enter ssh tool to control Raspberry Pi remotely
Step 2. Update matchbox-keyboard
sudo apt-get install update
sudo apt-get install matchbox-keyboard

19 / 23

Step 3. Run the following command to create file toggle-matchbox-keyboard.sh under/usr/bin
sudo nano /usr/bin/toggle-matchbox-keyboard.sh

Step 4. Copy the statements below to toggle-matchbox-keyboard.sh and press ctrl + X
then Y to save this file, then click “enter” to exit nano editor(Note: press right key ofkeyboard to paste statements in Putty terminal).
#!/bin/bash#This script toggle the virtual keyboard
PID=`pidof matchbox-keyboard`if [ ! -e $PID ]; thenkillall matchbox-keyboard
elsematchbox-keyboard -s 50 extended&fi20 / 23Step 5. Execute the commands:sudo chmod +x /usr/bin/toggle-matchbox-keyboard.shsudo mkdir /usr/local/share/applications

Step 6. Run the following command to create file applications/toggle-matchboxkeyboard.desktop under /usr/local/share/applications/sudo nano /usr/local/share/applications/toggle-matchbox-keyboard.desktop

Step 7. Copy the statements to toggle-matchbox-keyboard.desktop and and press ctrl +X then Y to save this file, then click “enter” to exit nano editor.(Note: press right key ofkeyboard to paste statements in Putty terminal)[Desktop Entry]
Name=Toggle Matchbox Keyboard
Comment=Toggle Matchbox Keyboard`
Exec=toggle-matchbox-keyboard.sh
Type=Application
Icon=matchbox-keyboard.png
Categories=Panel;Utility;MB
X-MB-INPUT-MECHANSIM=True

21 / 23

Step 8. Execute commands as below. Note that you need to use “Pi ” user permission
instead of root to execute this command.
sudo nano /etc/xdg/lxpanel/LXDE-pi/panels/panel

6. Find the statement which is similar to below: (It maybe different in different version.
You can use ctrl + W to search button to find this part)
Plugin {type = launchbar
Config {Button {id=lxde-screenlock.desktop}
Button {id=lxde-logout.desktop}}

22 / 23

7. Append these statements to add an button option, and press ctrl + X then Y to savethis file, then click “enter” to exit nano editor.(Note: press right key of keyboard to paste
statements in Putty terminal)
Button {id=/usr/local/share/applications/toggle-matchbox-keyboard.desktop}

8. Run the following command to reboot your Raspberry Pi. If the virtual keyboard isinstalled correctly, you can find that there is a keyboard icon on the left of the bar
sudo reboot

23 / 23