Parameters
(Please make sure the power supply voltage and logic voltage are the same, otherwise it will not work properly.)
Items | Parameters |
Supply Voltage | 3.3V/5V |
|
LCD Type | TFT |
|
Communication Interface | Display: SPI |
Touch: I2C |
|
Controller | Display: ST7789 |
Touch: CST328 |
|
Resolution | 240(H) x 320(V) |
|
Display Size | 43.20 (H) x 57.60 (V) mm |
|
Pixel Pitch | 0.180 x 0.180 mm |
|
Dimensions | 73.06(H)x 50.54(V) mm |
Interface Description
LCD PIN | FUNC | Description |
VCC | 3.3V/5V | Please make sure the power supply voltage and logic voltage are the same, otherwise it will not work properly |
GND | GND | Ground |
MISO | SPI Input | SPI Slave Device |
MOSI | SPI Output | SPI Slave Device |
SCLK | SPI Clock Pin | SPI Clock Pin |
LCD_CS | SPI Chip Selection | SPI Chip Selection Pin |
LCD_DC | LCD Selection Signal Pin | LCD Signal Control Pin, L: Command; H: Data |
LCD_RST | LCD Reset | LCD Reset Pin, Low Active |
LCD_BL | LCD Backlight Control | LCD Backlight Control, Adjust PWM Duty Cycle Control |
TP_SDA | Touchpad Data Pin | Touchpad Data Pin |
TP_SCL | Touchpad Clock Pin | Touchpad Clock Pin |
TP_INT | Touchpad Interrupt Pin | Touchpad Interrupt Pin, Interrupt When Press It |
TP_RST | Touchpad Reset Pin | Touchpad Reset Pin, Low Active |
PIN NO. | LCD PIN | FUNC |
1 | VCC | 3.3V/5V (Please make sure the power supply voltage and logic voltage are the same, otherwise it will not work properly) |
2 | LCD_BL | LCD Backlight Control |
3 | GND | GND |
4 | SCLK | SPI Clock Pin |
5 | MOSI | SPI Output |
6 | MISO | SPI Input |
7 | LCD_DC | LCD Signal Selection Pin |
8 | LCD_RST | LCD Reset |
9 | LCD_CS | SPI Chip Selection |
10 | NC | Not Connected, internally not connected |
11 | NC | Not Connected, internally not connected |
12 | TP_RST | Touchpad Reset Pin |
13 | TP_SCL | Touchpad Clock Pin |
14 | TP_SDA | Touchpad Data Pin |
15 | TP_INT | Touchpad Interrupt Pin |
16 | NC | Not Connected, internally not connected |
17 | NC | Not Connected, internally not connected |
18 | NC | Not Connected, internally not connected |
Working with Raspberry Pi
Please note that the following example is run on Raspberry Pi 4.
Hardware Connection
LCD PIN | Raspberry Pi (BCM) |
VCC | 3.3V |
GND | GND |
MISO | NC |
MOSI | 10 |
SCLK | 11 |
LCD_CS | 8 |
LCD_DC | 25 |
LCD_RST | 27 |
LCD_BL | 18 |
TP_SDA | 2 |
TP_SCL | 3 |
TP_INT | 4 |
TP_RST | 17 |
Enable SPI & I2C Interface
- Open the Raspberry Pi terminal and input the following commands to enter the config interface:
sudo raspi-config
- Select "Interfacing Options -> SPI -> Yes" to enable the SPI interface.
- Continue to enter the config interface:
sudo raspi-config
- Select "Interfacing Options -> I2C -> Yes" to enable the I2C interface:
sudo reboot
- Check /boot/config.txt, you can see 'dtparam=i2c_arm=on' and 'dtparam=spi=on' are written.
more /boot/config.txt
- To ensure SPI is not occupied, it is recommended to disable other drivers. You can use "ls /dev/spi*" to check whether SPI is occupied, and when the terminal outputs "/dev/spidev0.0" and "/dev/spidev0.1", SPI works normally.
ls /dev/spi*
Python Environment Usage
Install Libraries
sudo apt-get update
sudo apt-get install python3-pip
sudo apt-get install python3-pil
sudo apt-get install python3-numpy
sudo pip3 install spidev
sudo pip3 install Pillow
Examples
- Download the following demos:
cd
wget https://files.waveshare.com/wiki/2.8inch-Capacitive-Touch-LCD/2.8inch_Capacitive_Touch_LCD_RaspberryPi.zip
- Install unzip environment (optional, skip this step if using the command to unzip):
sudo apt-get install unzip
- Enter the file location, and execute the command to unzip:
unzip 2.8inch_Capacitive_Touch_LCD_RaspberryPi.zip -d ./2.8inch_Capacitive_Touch_LCD
- Enter Python file folder:
cd 2.8inch_Capacitive_Touch_LCD/Python
- Run the sample demo and you can see the LCD displays three pictures, and then input:
sudo python 2inch8_LCD_test.py
Usage in C Environment
Install Libraries
git clone https://github.com/WiringPi/WiringPi
cd WiringPi
./build
gpio -v
- Run "gpio -v" to check whether it is 2.70 version, if not, the installation fails.
- Download example files.
- Enter the file directory, and run the demo.
Example Operation
- Download the sample demo:
cd
wget https://files.waveshare.com/wiki/2.8inch-Capacitive-Touch-LCD/2.8inch_Capacitive_Touch_LCD_RaspberryPi.zip
- Install unzip environment (optional, skip this step if using the command to unzip):
sudo apt-get install unzip
- Enter the file location, and execute the command to unzip:
unzip 2.8inch_Capacitive_Touch_LCD_RaspberryPi.zip -d ./2.8inch_Capacitive_Touch_LCD
cd 2.8inch_Capacitive_Touch_LCD/C
- Clean compilation files and compile again:
sudo make clean
sudo make -j
- Run the sample demo and you can see the LCD displays three pictures, and then input:
sudo ./main
Working with Raspberry Pi Pico
Hardware Connection
LCD PIN | Raspberry Pi Pico |
VCC | 3.3V |
GND | GND |
MISO | NC |
MOSI | 11 |
SCLK | 10 |
LCD_CS | 9 |
LCD_DC | 14 |
LCD_RST | 13 |
LCD_BL | 15 |
TP_SDA | 6 |
TP_SCL | 7 |
TP_INT | 17 |
TP_RST | 16 |
Python Environment
Preparation
- Install Thonny. (Thonny Python IDE (Windows V3.3.3))
- Press the "BOOTSEL" key on the Raspberry Pi Pico, and release it after powering.
- A new disk will appear on your computer, extract the Raspberry Pi Pico firmware and copy the firmware (suffix uf2) to that disk (the disk will automatically disappear if the copy is successful).
- Open Thonny, click on "Python x.x.x" at the bottom right, and select "Configure interpreter".
- Select "Interpreter" in the pop-up window -> select "MicroPython (Raspberry Pi Pico)" as the interpreter -> select "Auto-detect port" as the port.
- Click on "Stop", and the Shell window will show "MicroPython v1.20.0-50-g786013d46 on 2023-05-04; Raspberry Pi Pico with RP2040 Type "help()" for more information. " is a successful connection.
The following is the procedure for points 4 and 5:
The successful connection is shown below:
Sample Demo
- Download the sample demo.
- Unzip the sample demo and open Thonny.
- Enter the sample file folder and open "RaspberryPi_Pico/Python" file folder.
- Upload the " LCD_2inch8_Touch.py" file to "Raspberry Pi Pico".
- Run the demo to realize touchpad functions:
- Please modify the file name "LCD_2inch8_Touch.py" as "main.py " if you want the demo to automatically run after powering on.
Working with ESP32S3
Please note that the following examples use firmware version 2.0.11. Higher versions may cause the functions to be incompatible and fail to display.
Hardware Connection
LCD Pin | ESP32S3 |
VCC | 3.3V |
GND | GND |
MISO | NC |
MOSI | 45 |
SCLK | 40 |
LCD_CS | 42 |
LCD_DC | 41 |
LCD_RST | 39 |
LCD_BL | 5 |
TP_SDA | 1 |
TP_SCL | 3 |
TP_INT | 4 |
TP_RST | 2 |
Environment Set-up
- Enter Arduino IDE after installation.
- Go to the board manager, search for esp32, select the latest version of esp32 by Espressif Systems at the bottom, and click install (if it doesn't install correctly, you can try using a phone hotspot).
- Restart the Arduino IDE after installation, and then you can use it.
Install Libraries
- Please note whether the library has been previously installed, if so, please save the original library to prevent errors and failures when running other programs.
- Enter "2.8inch_Capacitive_Touch_LCD\ESP32S3\LVGL_Arduino" file folder, double-click LVGL_Arduino.ino to open the example.
- Search the lvgl library and install it (this step is for setting the library file folder in Arduino environment, if you have installed other libraries (the following file folders exist), you do not need to execute this step.)
- Enter the storage path of the library file: "c:\Users\Waveshare\AppData\Local\Arduino15\packages\libraries" ("Waveshare" is the computer username).
- Delete the lvgl library downloaded before (skip this step if not installed):
- Install two libraries in the sample file.
- Copy the provided library to "c:\Users\Waveshare\AppData\Local\Arduino15\packages\libraries" ("Waveshare" is the computer username):
- Finish library installation.
Sample Demo
- Open the sample demo again.
- Select the model and COM port, compile and program the sample.
- Three operation interfaces can be observed after successful programming.
Working with Arduino
Hardware Connection
LCD Pin | Arduino |
VCC | 5V |
GND | GND |
MISO | NC |
MOSI | 11 |
SCLK | 13 |
LCD_CS | 10 |
LCD_DC | 7 |
LCD_RST | 8 |
LCD_BL | 9 |
TP_SDA | SDA |
TP_SCL | SCL |
TP_INT | 3 |
TP_RST | 4 |
Sample Demo
- Download and unzip sample demo.
- Enter the sample demo file folder "2.8inch_Capacitive_Touch_LCD\Arduino\LCD_2inch8_Touch", double click on LCD_2inch8_Touch.ino to open the sample:
- Select the device and the port, compile and program the demo:
Resource
Document
Schematic
Datasheet
Drawing
Demo
FAQ
Question:Sample demo not working, communication failure?
Answer:
Please check if the GPIO levels of the board are consistent with the product's supply voltage!
Support
To:
Dear Customers, There may be a lag of several hours before we could process your order, depending on the time difference between your location and ours. Sincerely hoping your understanding!
Email(support)
services01@spotpear.com