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
Resolution | 128 x 128 |
Control chip | ST7735S |
Display Size | 25.5mm x 26.5mm |
Screen Type | TFT |
Operation temperature | -20 ℃ to +70 ℃ |
Operating Voltage | 3.3V |
Drive interface | 4-wire SPI |
Dimensions | 65mm (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 Interface | Pin Function | BCM Number | WiringPi Number |
---|---|---|---|
VCC | 3.3V | 3.3V | 3.3V |
GND | GND | GND | GND |
SDA | MOSI | 10 | 12 |
SCK | SCK | 11 | 14 |
CS | CE0 | 8 | 10 |
D/C | P6 | 25 | 6 |
RESET | P2 | 27 | 2 |
BL | P5 | 24 | 5 |
K1 | P2 | 17 | 0 |
K2 | P1 | 18 | 1 |
K3 | P3 | 22 | 3 |
K4 | P4 | 23 | 4 |
R | P28 | 20 | 28 |
L | P29 | 21 | 29 |
LEFT | P21 | 5 | 21 |
DOWN | P25 | 26 | 25 |
DOWN | P24 | 19 | 24 |
CENT | P22 | 6 | 22 |
UP | P23 | 13 | 23 |
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:
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.
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
Demo codes for bullseye system
Demo codes for bookworm system
Data Sheet
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