2.4inch LCD Display

I.Description

1.1. Product Introduction

2.4-inch Display, ILI9341 Driver, 320×240 Resolution

This 2.4-inch LCD display features a resolution of 320×240, delivering clear and stable image quality suitable for various small-size display interface applications. The product utilizes the ILI9431 display driver IC, facilitating system development and rapid integration to meet the application requirements of embedded devices for display modules. The overall board dimensions align with the screen size, offering a compact structure that optimizes internal space within the final product, making it particularly suitable for designs with strict volume and mounting layout requirements. The interface uses an 8-pin connector with a 1.25mm pitch, providing a simple, reliable, and convenient connection.

1.2. Product Features

  • 2.4-inch LCD display, 320×240 resolution
  • Control connection via 8-pin connector with 1.25mm pitch
  • SPI communication interface
  • Built-in ILI9341 controller

1.3. Product Specifications

Dimensions63mm (Length) × 44mm (Width)
Resolution320 × 240
Communication InterfaceSPI
Active Area (Viewing Area)48.96mm × 36.72mm
Display ColorsRGB 262K
Driver ICILI9341
Supply Voltage3.3V / 5V

1.4.Module Resources

①LCD screen connector

②Control interface: 8-pin, 1.25mm pitch connector

③M2.5 SMT brass standoff

II. Usage

2.1 Hardware Description

2.1.1 Interface Definition

Pin Name

Description

VCC

Power Positive

GND

Power Ground

DIN

SPI Data Input

SCK

SPI Clock Signal

CS

LCD Chip Select

DC

LCD Data/Command Select

RST

LCD Reset Signal

BL

LCD Backlight Control

2.2 Raspberry Pi Demo Code

2.2.1 Raspberry Pi Hardware Connection

The demo code for the Raspberry Pi motherboard uses the wiringPi pin numbering. For the Bookworm system, BCM pin numbering is used. Connections to the Raspberry Pi are defined in the table below:

LCD Interface

BCM

wiringPi

VCC

3.3V

3.3V

GND

GND

GND

DIN

MOSI

12

SCK

SCLK

14

CS

CE0

10

RST

22

3

DC

25

6

BL

24

5

2.2.2 Installing Wiringpi Library

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 commands:

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

Running gpio -v will show version 2.70. If it does not appear, the installation failed.

If you encounter the error "ImportError: No module named 'wiringpi'" when running Python examples, run the following commands:

For Python 2.x

pip install wiringpi

For Python 3.x

pip3 install wiringpi
Note: If installation fails, try compiling and installing as follows:
git clone --recursive http://github.com/WitingPi/WiringPi-Python.git

Note: The --recursive option automatically pulls submodules; otherwise, you need to download them manually. Enter the downloaded WiringPi-Python folder and run the following commands to compile and install:

For Python 2.x

sudo python setup.py install

For Python 3.x

sudo python3 setup.py install
If the following error appears:

Run the command sudo apt install swig to install swig, then compile and install using sudo python3 setup.py install. If you see information similar to the following, the installation was successful.

2.2.3 Installing LGPIO Library

For the Bookworm system, the demo code uses the lgpio library. The installation commands are as follows:

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

2.2.4 Enabling SPI Interface

sudo raspi-config
Enable the SPI interface:
Interfacing Options->SPI->Yes

Check enabled SPI devices:

ls /dev/spi*
This will print: "/dev/spidev0.0" and "/dev/spidev0.1"

2.2.5 Installing Python Libraries

The demo code uses the Python 3 environment. To run the Python demo, you need to install the PIL, numpy, and spidev libraries. Enter the following commands to install:

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

2.2.6 Running Python Demo

Navigate to the Python demo directory:

cd /home/pi/2.4inch LCD Display/lgpio/python
Execute:
sudo python3 main.py

2.2.7 Running C Demo

Navigate to the C demo directory, compile, and run:

cd /home/pi/2.4inch LCD Display/lgpio/c
sudo make clean
sudo make
sudo ./main

2.3 Arduino Demo Code

2.3.1 Connecting to Arduino UNO

Connect the module to the Arduino UNO according to the following table:

Module Pin

Arduino UNO

Description

5V

5V

Power Positive

GND

GND

Power Ground

SCK

D13

SPI Clock Signal

DIN

D11

SPI Data Input

CS

D10

LCD Chip Select

BL

D9

LCD Backlight Control

DC

D8

LCD Data/Command Select

RST

D7

LCD Reset Signal

2.3.2 Uploading the Code

Select the board model and port number as shown in the figures below.After selection, click "Compile" and upload the code to the Arduino UNO.You will see the screen display lines, rectangles, filled blocks, circles, and characters.

III. Related Links

  • Demo
  • SCH