3.5inch Capacitive Touch LCD

From Waveshare Wiki
Jump to: navigation, search
3.5inch Capacitive Touch LCD
3.5inch-Capacitive-Touch-LCD-details-1.jpg

320×480, I2C/SPI
{{{name2}}}

{{{name3}}}

{{{name4}}}

{{{name5}}}

{{{name6}}}

Overview

Introduction

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

Features

  • 320×480 resolution, 262K RGB colors, clear and colorful displaying effect
  • High touch screen transmittance, fast response and long lifetime
  • Embedded with ST7796S driver chip and FT6336U capacitive touch control chip, using SPI and I2C communication respectively, minimizes required IO pins
  • Equipped with a TF card slot for convenient storage of more pictures, videos, music, etc
  • Lead out LCD control interface, you can choose 15PIN terminal interface or 18PIN FPC slot access display screen
  • Onboard level conversion chip, supports 3.3V/5V two operating levels

Interfaces

3.5inch-Capacitive-Touch-LCD-details-11.jpg
The 3V3 pin can be used for power input or output. When used as output, ensure that the VCC pin input is 5V, and it is recommended to limit the output current to 200mA.

Dimensions

3.5inch-Capacitive-Touch-LCD-details-size.jpg

Specifications

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

Parameter Name Parameter
Supply Voltage 3.3V/5V
LCD Type IPS
Communication Interface Display: SPI
Touch: I2C
Controller Chip Display: ST7796S
Touch: FT6336U
Resolution 320(H) x 480(V)
Display Size 48.96 (H) x 73.44 (V) mm
Pixel Pitch 0.051 x 0.153mm
Dimensions 61.00 (H) x 92.44 (V) mm


Working with Raspberry Pi

Please note that the following examples are run on Raspberry Pi 4

Hardware connection

  • 15PIN connector
LCD Pin Raspberry Pi (BCM)
VCC 3.3V
GND GND
MISO 9
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 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

2.8inch Capacitive Touch LCD RaspberryPi explain 1.png

2.8inch Capacitive Touch LCD RaspberryPi explain 2.png

2.8inch Capacitive Touch LCD RaspberryPi explain 3.png

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

2.8inch Capacitive Touch LCD RaspberryPi explain 1.png

2.8inch Capacitive Touch LCD RaspberryPi explain 4.png

2.8inch Capacitive Touch LCD RaspberryPi explain 5.png

  • 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

2.8inch Capacitive Touch LCD RaspberryPi explain 6.png

  • 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* 

2.8inch Capacitive Touch LCD RaspberryPi explain 7.png

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/3.5inch%20Capacitive%20Touch%20LCD/3.5inch_Capacitive_Touch_LCD_Demo_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 3.5inch_Capacitive_Touch_LCD_Demo_Pi.zip -d ./3.5inch_Capacitive_Touch_LCD
  • Enter Python file folder
cd 3.5inch_Capacitive_Touch_LCD/Python
  • Run the example demo will display 3 images on the screen, and it will then enter the drawing function upon completion
python 3.5inch_Capacitive_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 version 70 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/3.5inch%20Capacitive%20Touch%20LCD/3.5inch_Capacitive_Touch_LCD_Demo_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 3.5inch_Capacitive_Touch_LCD_Demo_Pi.zip -d ./3.5inch_Capacitive_Touch_LCD
  • Enter C file folder
cd 3.5inch_Capacitive_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

  • 15PIN connector
LCD Pin Raspberry Pi Pico
VCC 3.3V
GND GND
MISO 12
MOSI 11
SCLK 10
LCD_CS 9
LCD_DC 14
LCD_RST 13
LCD_BL 15
TP_SDA 6
TP_SCL 7
TP_INT 8
TP_RST 5

Python Environment

Preparation

1. Install Thonny (Thonny installation package)
2. Press the "BOOTSEL" key on the Raspberry Pi Pico, and release it after powering
3. 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)
4. Open Thonny, click on "Python x.x.x" at the bottom right, and select "Configure interpreter"
5. Select "Interpreter" in the pop-up window -> select "MicroPython (Raspberry Pi Pico)" as the interpreter -> select "Auto-detect port" as the port
6. 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. " It means the connection is successful

  • The following is the procedure for steps 4 and 5:
软件调试前置操作.png
  • The successful connection is shown below:
软件调试前置操作5.png

Demo

  • Unzip the demo and open Thonny
  • Open the demo, the path is: 3.5inch_Capacitive_Touch_LCD_Demo_Pico/Python/3.5inch_Capacitive_Touch_LCD.py

2inch Capacitive Touch LCD RaspberryPi Pico demo 1.png

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

2inch Capacitive Touch LCD RaspberryPi Pico demo 2.png

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

2inch Capacitive Touch LCD RaspberryPi Pico demo 3.png 2inch Capacitive Touch LCD RaspberryPi Pico demo 4.png

Working with ESP32S3

Hardware connection

  • 15PIN connector
LCD Pin ESP32S3
VCC 3.3V
GND GND
MISO 42
MOSI 2
SCLK 1
SD_CS 38
LCD_CS 39
LCD_DC 41
LCD_RST 40
LCD_BL 6
TP_SDA 15
TP_SCL 7
TP_INT 17
TP_RST 16

Environment setup

Download and install Arduino IDE

  • Click to visit the official website, select the corresponding system and system bit to download.
    ESP32-S3-AMOLED-1.91-Ar-software-01.png
  • 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
  • Development board offline package: Arduino-ESP32 (V3.0.2) Offline component package

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 Name Description Library Installation Requirements
GFX_Library_for_Arduino LCD driver library Install Offline

Run the first Arduino demo

If you are just getting started with ESP32 and Arduino, and you don't know how to create, compile, flash, and run Arduino ESP32 programs, then please expand and take a look. Hope it can help you!

New Project

  • Run the Arduino IDE and select File -> New Sketch
    ESP32-S3-AMOLED-1.91-Ar-study-01.png
  • Enter the code:
void setup() {
  // put your setup code here, to run once:
  Serial.begin(115200);
}

void loop() {
  // put your main code here, to run repeatedly:
  Serial.println("Hello, World!");
  delay(2000);
}
  • Save the project and select File -> Save As.... In the pop-up menu, select the path to save the project, and enter a project name, such as Hello_World, click Save

ESP32-S3-AMOLED-1.91-Ar-study-02.png

Compile and flash demos

  • Select the corresponding development board, take the ESP32S3 motherboard as an example:

①. Click to select the dropdown menu option Select Other Board and Port;
②. Search for the required development board model esp32s3 dev module and select;
③. Select COM Port;
④. Save the selection.
ESP32-S3-AMOLED-1.91-Ar-study-03.png

  • Some development boards with specified version numbers support direct model selection, for example, "Waveshare ESP32-S3-LCD-1.69":

ESP32-S3-AMOLED-1.91-Ar-study-07.png

  • If the ESP32S3 mainboard only has a USB port, you need to enable USB CDC, as shown in the following diagram:

ESP32-S3-AMOLED-1.91-Ar-study-04.png

  • Compile and upload the program:

①. Compile the program; ②. Compile and download the program; ③. Download successful.
ESP32-S3-AMOLED-1.91-Ar-study-05.png

  • Open the Serial Monitor window, and the demo will print "Hello World!" every 2 seconds, and the operation is as follows:

ESP32-S3-AMOLED-1.91-Ar-study-06.png

Demo

  • Download the Demo and unzip it
  • Open the demo 3.5inch_Capacitive_Touch_LCD_Demo_ESP32S3/3.5inch_Capacitive_Touch_LCD

800px-3.5inch Capacitive Touch LCD Demo ESP32S3 1.png

  • Select the appropriate configuration based on the resources of your ESP32S3, compile and flash the demo

800px-3.5inch Capacitive Touch LCD Demo ESP32S3 2.png

  • Successfully flashed, and enter the drawing board function

800px-3.5inch Capacitive Touch LCD Demo ESP32S3 3.png

  • Open Serial Monitor, you can see the printout of the TF card's capacity size

800px-3.5inch Capacitive Touch LCD Demo ESP32S3 4.png

Working with Arduino UNO

Hardware connection

  • 15PIN connector
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

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 Name Description Library Installation Requirements
GFX_Library_for_Arduino LCD driver library Install Offline

Demo

  • Download the Demo and unzip it
  • Enter the sample demo file folder 3.5inch_Capacitive_Touch_LCD_Demo_Arduino/3.5inch_Capacitive_Touch_LCD , double click on 3.5inch_Capacitive_Touch_LCD.ino to open the demo

800px-3.5inch Capacitive Touch LCD Demo Arduino 1.png

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

800px-3.5inch Capacitive Touch LCD Demo Arduino 2.png

  • Successfully flashed, and enter the drawing board function

FAQ

 Answer:

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


Support



Technical Support

If you need technical support or have any feedback/review, please click the Submit Now button to submit a ticket, Our support team will check and reply to you within 1 to 2 working days. Please be patient as we make every effort to help you to resolve the issue.
Working Time: 9 AM - 6 PM GMT+8 (Monday to Friday)