• sales

    +86-0755-88291180

1.9inch-Touch-LCD User Guide

Overview

Introduction

The 1.9inch Touch LCD features a 170 × 320 resolution capacitive touchscreen, supporting either a 12PIN terminal interface or an 18PIN FPC slot for connection. It also provides example documentation for Raspberry Pi, ESP32, Pico, Arduino, etc.

Features

  • 170×320 resolution, 262K RGB colors, clear and colorful displaying effect
  • High touch screen transmittance, fast response and long lifetime
  • Embedded with ST7789V2 driver chip and CST816 capacitive touch control chip, using SPI and I2C communication respectively, minimizes required IO pins
  • Lead out LCD control interface, you can choose 12PIN terminal interface or 18PIN FPC slot access display screen
  • Onboard level conversion chip, supports 3.3V/5V two operating levels

Interfaces

LCD PinPin description
VCCPower positive (3.3V / 5V power input)
GNDGround
LCD_DINSPI communication MOSI pin
LCD_LCKSPI communication SCLK pin
LCD_CSLCD chip select pin, active low
LCD_DCLCD data/command pin, low level indicates command, high level indicates data
LCD_RSTLCD reset pin, active low
LCD_BLLCD backlight pin
TP_SDATP data pin
TP_SCLTP clock pin
TP_RSTTP reset pin, active low
TP_IRQTP interrupt pin

Dimensions


Specifications

(Please ensure that the supply voltage and logic voltage are consistent, otherwise, it may fail to function properly)

Parameter NameParameter
Supply voltage3.3V/5V
LCD typeIPS
Communication interfaceDisplay: SPI
Touch: I2C
Controller ChipDisplay: ST7789V2
Touch: CST816
Resolution170 (H) x 320 (V)


Working with Raspberry Pi

Hardware Connection

  • 12PIN cable connector
LCD PinRaspberry Pi (BCM)
VCC3.3V
GNDGND
LCD_DIN10
LCD_CLK11
LCD_CS8
LCD_DC25
LCD_RST27
LCD_BL18
TP_SDA2
TP_SCL3
TP_IRQ4
TP_RST17

Enable SPI and I2C Interfaces

  • Open the Raspberry Pi terminal and enter the following command to enter the configuration interface:
sudo raspi-config
  • Select Interface Options -> SPI -> Yes to enable the SPI interface






  • Continue to enter the config interface:
sudo raspi-config
  • Select Interface Options -> I2C -> Yes to enable the I2C interface







  • Restart Raspberry Pi
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 that SPI is not occupied, it is recommended that other driver overlays be temporarily turned off. You can use ls /dev/spi* to check the SPI occupancy. The terminal output /dev/spidev0.0 and /dev/spidev0.1 indicates that the SPI situation is normal
ls /dev/spi* 



Python Environment

Install Libraries Files

  • 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 apt-get install python3-spidev

Demo Operations

  • Download the demo
cd
wget https://files.waveshare.com/wiki/1.9inch_Touch_LCD/1.9inch_Touch_LCD_Pi.zip
  • Install decompression environment (optional, skip this step if you have used the command to unzip)
sudo apt-get install unzip
  • Enter the file location, and execute the command to unzip
unzip 1.9inch_Touch_LCD_Pi.zip -d ./1.9inch_Touch_LCD
  • Enter Python file folder
cd 1.9inch_Touch_LCD/Python
  • Run the example demo will display 3 images on the screen, and it will then enter the drawing function upon completion
sudo python 1.9inch_Touch_LCD.py 

C Environment

Install Libraries Files

  • Install libraries
git clone https://github.com/WiringPi/WiringPi
cd WiringPi
./build
gpio -v
  • Run gpio -v and corresponding version will appear. If it does not appear, there is an installation error.
  • Download the demo file
  • Enter the file directory, and run the demo

Demo Operations

  • Download the demo
cd
wget https://files.waveshare.com/wiki/1.9inch_Touch_LCD/1.9inch_Touch_LCD_Pi.zip
  • Install decompression environment (optional, skip this step if you have used the command to unzip)
sudo apt-get install unzip
  • Enter the file location, and execute the command to unzip
unzip 1.9inch_Touch_LCD_Pi.zip -d ./1.9inch_Touch_LCD
  • Enter C file folder
cd 1.9inch_Touch_LCD/C
  • Clean compilation files and compile again
sudo make clean
sudo make -j
  • Successfully compiled, run the example demo to perform RGB refresh on the screen, and it will then enter the drawing function upon completion
sudo ./main

Working with Raspberry Pi Pico

Hardware Connection

  • 12PIN cable connector
LCD PinRaspberry Pi Pico
VCC3.3V
GNDGND
LCD_DINGP11
LCD_CLKGP10
LCD_CSGP9
LCD_DCGP14
LCD_RSTGP13
LCD_BLGP15
TP_SDAGP6
TP_SCLGP7
TP_IRQGP8
TP_RSTGP5

Environment Setup


Python Environment Demo

  • Unzip the demo and open Thonny
  • Open the demo, the path is: 1.9inch_Touch_LCD_Pico/Python/1.9inch_Touch_LCD.py


  • Run the demo to achieve the drawing board function on the screen


  • If you want to run the demo automatically at power-on, change the file name to main.py


Working with ESP32

(Please note that the following examples run with ESP32S3, please adjust the pin definition for other ESP32 models)

Hardware Connection

  • 12PIN cable connector
LCD PinESP32S3
VCC3.3V
GNDGND
LCD_DIN2
LCD_CLK1
LCD_CS39
LCD_DC41
LCD_RST40
LCD_BL6
TP_SDA15
TP_SCL7
TP_IRQ17
TP_RST16

Arduino Environment

Download and Install Arduino IDE

  • Click to visit the Arduino official website, select the corresponding system and system bit to download

  • Run the installer and install all by default

Install Arduino-ESP32

  • To use ESP32-related motherboards in Arduino IDE, you must first install the Arduino-ESP32 Board library
  • In some areas, it may not be able to Install online due to network factors, and Install offline is generally recommended
  • To install the Arduino-ESP32 tutorial, please refer to Arduino board manager tutorial

Install Library

  • When installing Arduino libraries, there are usually two ways to choose from: Install online and Install offline.
    For most libraries, users can easily search and install them through the online library manager of the Arduino software. However, some open-source libraries or custom libraries are not synchronized to the Arduino Library Manager, so they cannot be acquired through online searches. In this case, users can only manually install these libraries offline.
  • For library installation tutorial, please refer to Arduino library manager tutorial
Library NameDescriptionVersionLibrary Installation Requirement
GFX_Library_for_ArduinoLCD driver library---Install Offline
CST816Touch driver library---"Install Offline"
lvglGraphical libraryv8.4.0"Install Offline"

Run the First Arduino Demo

Demo

  • Download the Demo and unzip it

LVGL_Arduino_v8


【Demo description】


This demo demonstrates how to use 1.9inch Touch LCD to run the lvgl demos

【Hardware connection】


  • Connect the board to the computer

【Code analysis】


  • Select the lvgl demos to run
lv_demo_widgets();
// lv_demo_benchmark();
// lv_demo_keypad_encoder();
// lv_demo_music();
// lv_demo_stress();

【Result demonstration】





ESP-IDF Environment

Environment Setup

Demo

  • Download the Demo and unzip it

lvgl_exampla


【Demo description】


This demo demonstrates how ESP32S3 uses 1.9inch Touch LCD to run the lvgl demo in the ESP-IDF environment

【Hardware connection】


  • Connect the board to the computer

【Code analysis】


    I2c_bus_init();         // Initialize I2C
    spi_bus_init();         // Initialize SPI
    display_init();          // Initialize display screen
    touch_init();           // Initialize touchscreen driver
    brightness_init();       // Initialize backlight control module
    brightness_set_level(20); // Set the backlight brightness to 20% (support 0-100 level adjustment)
    lv_port_init(); // Initialize LVGL
    if (lvgl_lock(-1)) // Obtain LVGL thread lock (-1 indicates blocking wait) to ensure multi-threaded safety
    {
        // lv_demo_benchmark();
        // lv_demo_music();
        lv_demo_widgets();  // Start LVGL demo
        lvgl_unlock();  // Release LVGL thread lock
    }

【Result demonstration】




Working with Arduino UNO

Hardware Connection

  • 12PIN cable connector
LCD PinArduino
VCC5V
GNDGND
LCD_DIN11
LCD_CLK13
LCD_CS10
LCD_DC7
LCD_RST8
LCD_BL9
TP_SDASDA
TP_SCLSCL
TP_IQR3
TP_RST4

Install Libraries

  • When installing Arduino libraries, there are usually two ways to choose from: Install online and Install offline.
    For most libraries, users can easily search and install them through the online library manager of the Arduino software. However, some open-source libraries or custom libraries are not synchronized to the Arduino Library Manager, so they cannot be acquired through online searches. In this case, users can only manually install these libraries offline.
  • For library installation tutorial, please refer to Arduino library manager tutorial
Library NameDescriptionLibrary Installation Requirement
GFX_Library_for_ArduinoLCD driver library"Install Online" or "Install Offline"
CST816Touch driver library"Install Offline"

Demo

  • Download the Demo and unzip it
  • Enter the sample demo file 1.9inch_Touch_LCD_Arduino/examplas/1.9inch_Touch_LCD.ino, double click on 1.9inch_Touch_LCD.ino to open the demo


  • Select the device and the port, compile and flash the demo


  • Successfully flashed, and enter the drawing board function

FAQ

Question: The demo fails to run and cannot communicate?

 Answer:

Please note whether the GPIO level on the board matches the power supply voltage of the product!


Support

Monday-Friday (9:30-6:30) Saturday (9:30-5:30)

Email: services01@spotpear.com