RGB LCD Display for Raspberry Pi ST7735S 128×128 1.44inch

RGB LCD Display for Raspberry Pi ST7735S 128×128 1.44inch

Overview

This 1.44-inch TFT LCD display comes with an onboard joystick and six buttons, 128x 128 resolution, internal ST7735S controller. Based on Raspberry Pi 40pin GPIO header design, it can use SPI interface communication, providing Raspberry Pi C and python demo codes. It can realize points, lines, rectangles, circles painting, and display pictures.

Product Parameters

Resolution128 x 128
Control chipST7735S
Display Size25.5mm x 26.5mm
Screen TypeTFT
Operation temperature-20 ℃ to +70 ℃
Operating Voltage3.3V
Drive interface4-wire SPI
Dimensions65mm (L) x 30.2mm (W)

Usages

Since the bookworm system no longer supports the wiringpi library, the example program for this system uses the lgpio library, and for the bullseye system, the wiringpi library version of the example program can be used.

Hardware interface configuration description

Wiring Instructions for Raspberry Pi

The example program in the Raspberry Pi motherboard uses the wiringPi number pin definitions, and the bookworm system uses the pin definition of the BCM number. The definition of the connection with the Raspberry Pi motherboard is shown in the following table:

LCD InterfacePin FunctionBCM NumberWiringPi Number
VCC3.3V3.3V3.3V
GNDGNDGNDGND
SDAMOSI1012
SCKSCK1114
CSCE0810
D/CP6256
RESETP2272
BLP5245
K1P2170
K2P1181
K3P3223
K4P4234
RP282028
LP292129
LEFTP21521
DOWNP252625
DOWNP241924
CENTP22622
UPP231323

Resource Profile

Demo Codes Usage

Wiringpi Library Installation

sudo apt-get install wiringpi
wget https://project-downloads.drogon.net/wiringpi-latest.deb # Version 4B upgrade of Raspberry Pi
sudo dpkg -i wiringpi-latest.deb
gpio -v # If version 2.52 appears, the installation is successful

#For the Bullseye branch system, use the following command:

git clone https://github.com/WiringPi/WiringPi
cd WiringPi
./build
gpio -v

# Running gpio - v will result in version 2.70. If it does not appear, it indicates an installation error

If the error prompt "ImportError: No module named 'wiring pi'" appears when running the python version of the example program, run the following command:

# For Python 2. x version

pip install wiringpi

# For Python 3.x version

pip3 install wiringpi

Note: If the installation fails, you can try the following compilation and installation:

git clone --recursive https://github.com/WiringPi/WiringPi-Python.git

Note: --recursive option can automatically pull submodules, otherwise you need to download them manually.

Go to the WiringPi-Python folder you just downloaded and enter the following command to compile and install:

# For Python 2.x version

sudo python setup.py install

# For Python 3.x version

sudo python3 setup.py install

If the following error occurs:

1.44inch LCD Display (Raspberry Pi)

At this point, enter the command sudo apt install swig to install swig, and then perform sudo python3 setup.py install to compile and install it. If a message similar to the following appears, the installation is successful.

1.44inch LCD Display (Raspberry Pi)

lgpio library installation

For the bookworm system, the sample program uses the lgpio library. The following is the installation command for the library:

wget https://github.com/joan2937/lg/archive/master.zip
unzip master.zip
cd lg-master
make
sudo make install

Turn on the SPI Interface

sudo raspi-config

Enable the SPI interface:

Interfacing Options -> SPI -> Yes

To view the enabled SPI devices:

ls /dev/spi* # prints: "/dev/spidev0.0" and "/dev/spidev0.1"

Installation of Python Libraries

The demo codes uses the python environment, and to run the python example program, you need to install pil, numpy, spidev libraries, and enter the following commands in order to install:

sudo apt-get install python3-pil
sudo apt-get install python3-numpy
sudo apt-get install python3-pip
sudo pip3 install spidev

C Version Demo Codes

Note: For Raspberry Pi 4B and versions after raspbian_lite-2019-06-20, the following settings are required, otherwise the keys cannot be entered normally.

sudo nano /boot/config.txt

Add the following:

gpio=17,22,18,13,26,5,19,6,20,21,23=pu

Then save to exit.

Go to the 1.44inch_lcd/c directory

sudo make clean
sudo make
sudo ./main

Python Version Demo Codes

Go to the 1.44inch_lcd/python directory

python3 gui_demo.py

python3 key_demo.py

Demo Codes Description

C Language Version

The Demo Codes structure is divided into the bottom layer and the application layer, the underlying file is lcd_1.44inch.c and lcd_1.44inch.h, the underlying code implements the initialization of the Raspberry Pi motherboard control pin and LCD screen, and the application layer file lcd_gui.c and lcd_gui.h, mainly realizing the drawing of points, lines, rectangles, circles and the display function of English characters and pictures.

The files whose file names begin with "font" are related to the font. The ". c" suffix corresponds to the data source files of the font. The data structures of multiple font data source files are defined in the "fonts. h" file. The file with the suffix ". bmp" in the Raspberry Pi motherboard example program is the picture source file used for display. The number in the file name represents the pixel number of color (bpp, bit per pixel), for example, friits24.bmp represents the picture file in 24bpp true color format.

Python Language Version

The python language version of the example program is only provided for the Raspberry Pi platform. At the same time, because the python platform can reference the PIL image processing library, many application layer API functions can be directly provided by the library, which greatly reduces the amount of code in the example program. The python version of the demo code file has a gui_demo.py、key_demo.py、lcd_1inch44.py three files, gui_ Demo.py is mainly used to draw lines, rectangles and circles, and display English characters and pictures_ Demo.py is the function demonstration of on-board buttons, lcd_1inch44.py is the driver to realize the bottom layer of LCD, including SPI initialization, LCD screen reset, initialization, etc.

Resources

Schematic

Demo codes for bullseye system

Demo codes for bookworm system

Product

Data Sheet

ST7735S

Related Links

Python Image Library

If users need to implement more functions, they can learn from the official website https://pillow.readthedocs.io/en/latest/handbook/index.html

Technical Support

Technical Support and Product Notes