
The 1.3inch LCD Display Module is a compact and high-quality screen designed for versatile DIY projects. Featuring an 8-pin SPI interface and a 240 x 240 resolution, this display is powered by the ST7789 controller, ensuring smooth and efficient performance. Pre-soldered with nut copper pillars, it offers easy installation and stability.Provides demo code for platforms such as Raspberry Pi and Arduino. It can draw dots, lines, rectangles, and circles, as well as display images and text in both Chinese and English. Offers greater playability and DIY potential.
1.Product Features
- Built-in ST7789 controller
- 240 x 240 resolution
- Uses SPI interface, requiring fewer pins
- Ultra-compact size with pre-soldered nuts for easy installation
- Provides example programs for Raspberry Pi and Arduino development boards
2.Interface Definition
Specification | Details |
Model | 1.3INCH LCD HAT |
Chip | ST7789 |
Operating Voltage | 3.3V |
Color Display | RGB 65K colors |
Resolution | 240 x 240 |
Communication Interface | 4-wire SPI |
Mounting Holes | 2.5mm diameter |
LCD Display Area | 23.4mm (L) × 23.4mm (W) |
Dimensions | 29mm (L) × 26mm (W) |
3.Usage
Since the Bookworm system no longer supports the WiringPi library, the example programs for this system use the lgpio library instead. For the Bullseye system, the WiringPi version of the example programs can still be used.
3.1 Hardware Interface Configuration Instructions
3.1.1 Raspberry Pi Hardware Connection
The corresponding pin connections between the LCD and the Raspberry Pi are shown in the table below:

LCD interface | Pin function | BCM number | wiringPi number |
VCC | 3.3V | 3.3V | 3.3V |
GND | GND | GND | GND |
DIN | MOSI | 10 | 14 |
CLK | SCLK | 11 | 12 |
CS | CE0 | 8 | 10 |
RST | P2 | 27 | 2 |
DC | P6 | 25 | 6 |
BL | P5 | 24 | 5 |
The wiring diagram for the connection between the Raspberry Pi and the LCD display is shown below:

3.1.2 Arduino Hardware Connection
The corresponding pin connections between the LCD and the Arduino are shown in the table below:
LCD interface | Arduino UNO |
VCC | 5V |
GND | GND |
DIN | D11 |
SCK | D13 |
CS | D10 |
RST | D9 |
DC | D8 |
BL | D7 |
The wiring diagram for the connection between the Arduino and the LCD display is shown below;

3.2 Demonstration Code
3.2.1 Installing the WiringPi Library
Start by configuring the Raspberry Pi system:sudo raspi-config
Start configuring the Raspberry Pi system:
sudo raspi-config
sudo apt-get install wiringpi
Wget https://project-downloads.drogon.net/wiringpi-latest.deb
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
#When running gpio -v, it should display version 2.70. If not, it indicates that the installation was unsuccessful.
If an error message such as "ImportError: No module named 'wiringpi'" appears when running the Python version of the example program, please execute the following command:
#Applicable for Python 2.x versions
pip install wiringpi
#Applicable for Python 3.x versions
pip3 install wiringpi
Note: If the installation fails, you can try compiling and installing it manually as follows:
git clone --recursive http://github.com/WitingPi/WiringPi-Python.git
Note: The --recursive option will automatically fetch submodules; otherwise, you will need to download them manually.
Enter the WiringPi Python folder you just downloaded and run the following commands to compile and install:
#Applicable for Python 2.x versions
sudo python setup.py install
#Applicable for Python 3.x versions
sudo python3 setup.py install
If the following error occurs:

At this point, enter the command sudo apt install swig to install SWIG.
Then compile and install by running sudo python3 setup.py install.
If a message similar to the following appears, it means the installation was successful

3.2.2 Installing the LGPIO Library
For the Bookworm system, the example programs use the lgpio library.
The installation command for the library is as follows:
wget https://github.com/joan2937/lg/archive/master.zip
unzip master.zip
cd lg-master
make
sudo make install
3.2.3 Demonstration Program
Enable and use the SPI interface.sudo raspi-config
Select Interfacing Options → SPI → Yes in sequence.
Check the enabled SPI devices.
ls /dev/spi*
It should display: "/dev/spidev0.0" and "/dev/spidev0.1".
Installing Python Libraries
The demonstration code runs in a Python 3 environment.
To run the Python example code, you need to install the PIL, numpy, and spidev libraries.
Please run the following command to install them:
sudo apt-get install python3-pil
sudo apt-get install python3-numpy
sudo apt-get install python3-pip
sudo pip3 install spidev
C Example Program
The demonstration code is structured into two layers: the lower layer and the application layer.
The lower layer consists of the files lcd_1.3inch.c and lcd_1.3inch.h, which handle the initialization of the Raspberry Pi control pins and the LCD screen.
The application layer includes lcd_gui.c and lcd_gui.h, primarily responsible for drawing points, lines, rectangles, and circles, as well as displaying Chinese/English images and characters.
Files beginning with "font" are related to font libraries. Files with the ".c" suffix contain font data sources, and multiple font data structures are defined in fonts.h.
In the Raspberry Pi demo code, files with the ".bmp" suffix are image source files used for display.
In the Arduino UNO demo code, there are no ".bmp" files due to the UNO's limited available memory.
Instead, the image source data is stored as arrays within the image.cpp file.
To access the C demonstration code, navigate to the 1.3inch_lcd/c directory and execute the following command:
sudo make clean
sudo make
sudo ./main
Python Example Program
The Python example program is provided exclusively for the Raspberry Pi platform.
Since the Python environment can utilize the PIL (Python Imaging Library), many application layer API functions can be directly handled by the library, significantly reducing the amount of example code needed.
To access the Python demonstration code, navigate to the 1.3inch_lcd/python directory
python3 gui.py