ESP32-S3-Touch-LCD-4

From Waveshare Wiki
Jump to: navigation, search
ESP32-S3-Touch-LCD-4
ESP32-S3-Touch-LCD-4-P.jpg

ESP32-S3-N16R8
Type C USB
{{{name2}}}

{{{name3}}}

{{{name4}}}

{{{name5}}}

{{{name6}}}

Overview

Introduction

ESP32-S3-Touch-LCD-4 is a microcontroller development board with 2.4GHz WiFi and BLE 5 support, integrates 16MB Flash and 8MB PSRAM. Onboard 4inch 480 × 480 capacitive touch screen can smoothly run GUI programs such as LVGL. Combined with various peripheral interfaces to quickly develop the HMI of ESP32-S3, suitable for scenarios such as smart control panel, home gateway, intelligent interactive panel, industrial control, and smart lighting control.

Features

  • Equipped with Xtensa 32-bit LX7 dual-core processor, up to 240MHz main frequency.
  • Supports 2.4GHz Wi-Fi (802.11 b/g/n) and Bluetooth 5 (LE), with onboard antenna.
  • Built in 512KB SRAM and 384KB ROM, with onboard 16MB Flash and 8MB PSRAM.
  • Onboard 4inch capacitive touch display, 480×480 resolution, 65K color.
  • Supports capacitive touch control via I2C interface, 5-point touch with interrupt support.
  • Onboard CAN, RS485, I2C interface and TF card slot, and integrates full-speed USB port.
  • Onboard RTC and lithium battery recharge/discharge IC for mobile scenarios.
  • Supports flexible clock, module power supply independent setting and other controls to realize low power consumption in different scenarios.

Hardware Description

Interface Description

  • CAN Interface: realize the transmission control, data analysis, collection and monitoring of CAN bus.
  • I2C Interface: ESP32-S3 provides multi-channel hardware I2C. Currently, GPIO8(SDA1), GPIO9(SCL1) pins are used as I2C bus mount IO expansion chip; use GPIO7(SCL0), GPIO15(SDA0) pins as touch interface and I2C interface.
  • RS485 Interface: the development board has onboard RS485 interface circuit, can be directly connected to RS485 device for communication, and can automatically switch to RS485 circuit transmission mode.
  • PH2.0 Battery Header: the development board adopts high-performance recharge/discharge chip SW6106, support I2C to read battery level.
Pin Connection
ESP32-S3-WROOM-x LCD USB SD UART CAN RTC OTS
GPIO0 CANRX
GPIO1 LCD_SDA MOSI
GPIO2 LCD_SCL SCK
GPIO3 R2
GPIO4 MISO
GPIO5 B1
GPIO6 CANTX
GPIO7 TP_SCL RTC_SCL SCL
GPIO8 R3 Expander_SDA
GPIO9 G5 Expander_SCL
GPIO10 G4
GPIO11 G3
GPIO12 G2
GPIO13 G1
GPIO14 G0
GPIO15 TP_SDA RTC_SDA SDA
GPIO16 TP_INT
GPIO17 R5
GPIO18 R4
GPIO19 USB_DN
GPIO20 USB_DP
GPIO21 B5
GPIO38 HSYNC
GPIO39 VSYNC
GPIO40 DE
GPIO41 LCD_PCLK
GPIO42 LCD_CS
GPIO43 RS485_RX
GPIO44 RS485_TX
GPIO45 B2
GPIO46 R1
GPIO47 B4
GPIO48 B3
TCA9554PWR - - - - - - -
EXIO0 TP_RST
EXIO1 BL_EN
EXIO2 LCD_RST
EXIO3 SD_CS
EXIO4 BLC
EXIO5 BEE_EN
EXIO6 RTC_INT
EXIO7 DO1

Hardware Connection

ESP32-S3-Touch-LCD-4-details-5.jpg

  • The development board uses USB to download the demo, if the COM port cannot be normally identified, please enter boot mode (press the boot key, connect it to the PC and then release the boot key). After downloading the demo, press the RESET key to run the demo.
  • Please pay attention to the PCB antenna area when using and avoid other meatal materials and plastic component from the PCB antenna.
  • The development board can be adapted to peripheral pins such as CAN, I2C, RS485 and isolated IO through 3.5mm wiring terminal.
  • CAN and RS485 peripheral devices do not connect to the 120 ohm resistor through the switch by default, and it is optional to switch ON to connect to the terminal resistor.
  • The TF card supports SPI communication. Please note that the SD_CS pin is driven by the EXIO3 driver of TCA9554PWR.

Other Notes

  • Currently, running the LVGL benchmark example on ESP-IDF v5.3 with a single core has an average frame rate limit of 26, corresponding to an interface frame rate of 41 (PCLK 21 MHz). Before compiling, you need to configure ESP32 and LVGL through menuconfig.
CONFIG_FREERTOS_HZ=1000
CONFIG_ESP_DEFAULT_CPU_FREQ_MHZ_240=y
CONFIG_ESPTOOLPY_FLASHMODE_QIO=y
CONFIG_ESPTOOLPY_FLASHFREQ_120M=y [should align with PSRAM]
CONFIG_SPIRAM_MODE_OCT=y
CONFIG_IDF_EXPERIMENTAL_FEATURES=y and CONFIG_SPIRAM_SPEED_120M=y [should align with PSRAM]
CONFIG_SPIRAM_FETCH_INSTRUCTIONS=y
CONFIG_SPIRAM_RODATA=y
CONFIG_ESP32S3_DATA_CACHE_LINE_64B=y
CONFIG_COMPILER_OPTIMIZATION_PERF=y
#The following LVGL configuration can improve the frame rate (LVGL v8.3):
#define LV_MEM_CUSTOM 1 or CONFIG_LV_MEM_CUSTOM=y
#define LV_MEMCPY_MEMSET_STD 1 or CONFIG_LV_MEMCPY_MEMSET_STD=y
#define LV_ATTRIBUTE_FAST_MEM IRAM_ATTR or CONFIG_LV_ATTRIBUTE_FAST_MEM=y

Dimensions

ESP32-S3-Touch-LCD-4-details-size.jpg

Environment Setting

The software framework for ESP32 series development boards is completed, and you can use MicroPython, and C/C++ (Arduino, ESP-IDF) for rapid prototyping of product development. Here's a brief introduction to these three development approaches:

  • Official C/C++ library installation:
    • ESP32 series Arduino development tutorial.
    • ESP32 series ESP-IDF development tutorial.
  • Environment setting is supported on Windows 10. Users can select Arduino/Visual Studio Codes (ESP-IDF) as IDE to develop. For Mac/Linux, users can refer to official introduction.


ESP-IDF

  • It is recommended to develop with the VSC plug-in.

Develop with VSCode Plug-in

Install VSCode

  • 1. Open the download page of the official VSCode website, and select the corresponding system and system bit to download.
ESP32-S3-Pico 05.jpg
  • 2. After running the installation package, the rest can be installed by default, but here for the subsequent experience, it is recommended to check boxes 1, 2, and 3.
    • After the first and second items are enabled, you can open VSCode directly by right-clicking files or directories, which can improve the subsequent user experience.
    • After the third item is enabled, you can select VSCode directly when you choose how to open it.
ESP32-S3-Pico 06.jpg

Install Espressif IDF Plug-in

  • Note: The latest version of the current plug-in is V1.7.1, for a consistent experience, users can choose the same version as us.
1. Open VSCode and use the shortcut key Shift + Ctrl + X to enter the plugin manager.

ESP32-S3-Pico 07.jpg

2. In the search bar, type Espressif IDF, select the corresponding plug-in, and click install.

ESP32-S3-Pico 08.jpg

3. Press F1 to enter:
esp-idf: configure esp-idf extension

ESP32-S3-Pico 09.jpg

4. Choose express (This tutorial is for first-time users, so only the first general installation tutorial is covered.)

ESP32-S3-Pico 10.jpg

5. Open and display this screen.

ESP32-S3-Pico 11.jpg

6. Choose a server to download.

ESP32-S3-Pico 12.jpg

7. Select the ESP-IDF version you want now, we choose the latest V5.3 (note that ESP-IDF started to support ESP32-S3 only after V4.4).

ESP32-S3-Touch-LCD-7-18.jpg

8. The following two are the ESP-IDF directory installation address and the ESP-IDF required tools installation address respectively.

ESP32-S3-Pico 14.jpg

    • Note: If you have installed ESP-IDF before, or if it has failed, please make sure to delete the file completely or create a new path.
9. Once the configuration is finished, click "install" to download.

ESP32-S3-Pico 15.jpg

10. After the installation is completed, it will enter the following screen, indicating that the installation is finished.

ESP32-S3-Pico 17.jpg

Offline Package
  • If it fails to download "esp-idf", you can try this offline package while the tool package should be downloaded online first.
  • Double-click on it after downloading, and then type the path as shown below:

ESP32-S3-Touch-LCD-7-14.jpg

1. Click on "Extract" to unzip the package:
2. After unzipping, create a file folder to store the compile tool in the unzipped file folder named "Espressif".

ESP32-S3-Touch-LCD-7-15.jpg

3. Enter the seventh STEP in the installation process of the Espressif IDF, we can set it according to the following picture and then click on "Install":

ESP32-S3-Touch-LCD-7-16.jpg

4. It is successfully installed as shown below:

ESP32-S3-Touch-LCD-7-17.jpg

Official Demo

Create Demo
1. Using the shortcut F1, type:
esp-idf:show examples projects

ESP32-S3-Pico 18.jpg

2. Choose your current IDF version:

ESP32-S3-Touch-LCD-7-20.jpg

3. Take "Hello World" as an example:

ESP32-S3-Pico 20.jpg

4. ① Choose the corresponding demo.
5. ② The readme file will explain which chip the demo is suitable for (the following section will introduce how to use the demo and its file structure, which is omitted here).
6. ③ Click to create the demo.
7. Choose the path to place the demo and ensure that there is no folder with the same name as the demo.

ESP32-S3-Pico 21.jpg

Modify COM Port
1. The corresponding COM port is displayed here, click on it to modify.

ESP32-S3-Pico 22.jpg

2. We check the device manager COM port, and select COM5, please select your corresponding COM port:

ESP32-S3-Pico 23.jpg

3. Choose the project and demo.

ESP32-S3-Pico 24.jpg

4. Then the COM port is modified.
Modify the Driver
1. Here shows the driver used, click here to modify the corresponding driver:

ESP32-S3-Pico 25.jpg

2. Choose the project or demo:

ESP32-S3-Pico 24.jpg

3. Wait for a few seconds after clicking.

ESP32-S3-Pico 27.jpg

4. Choose the driver we need, that is, the main chip ESP32S3.

ESP32-S3-Pico 28.jpg

5. Choose the openocd path, we can just choose one at random as it doesn't matter.

ESP32-S3-Pico 29.jpg


The Rest of the Status Bar Introduction

ESP32-S3-Pico 30.jpg

  • ① SDK configuration editor: many functions and configurations of ESP-IDF can be modified within it.
  • ② Clean up everything and delete all compiled files.
  • ③ Compile.
  • ④ Current download method, default is UART.
  • ⑤ Program the current firmware, please do it after compiling.
  • ⑥ Open the serial monitor to view serial information.
  • ⑦ Combined button for compiling, programming, and opening the serial monitor (most commonly used during debugging).


Compile, Program, and Serial Port Monitoring
1. Click on the Compile, Program, and Open Serial Monitor buttons we described earlier.

ESP32-S3-Pico 31.jpg

2. It may take a long time to compile, especially for the first time.

ESP32-S3-Pico 32.jpg

  • During this process, ESP-IDF may take up a lot of CPU resources and therefore may cause system lag.
3. Because we use CH343 as a USB to serial port chip, and the on-board automatic download circuit, it can be downloaded automatically without manual operation.

ESP32-S3-Pico 33.jpg

4. After successful download, it will automatically enter the serial monitor, and you can see the corresponding information output from the chip and prompt to reboot after 10s.

ESP32-S3-Pico 34.jpg

Arduino

  • If you do not use arduino-esp32 before, you can refer to this link.

Install Arduino IDE

1. Open the official software download webpage, and choose the corresponding system and system bits to download.

ESP32-S3-Pico 35.jpg

2. You can choose "Just Download", or "Contribute & Download".

ESP32-S3-Pico 36.jpg

3. Run to install the program and install it all by default.

Install arduino-esp32 Online

1. Open Preferences.

ESP32-S3-Pico 37.jpg

2. Add the corresponding board manager URLs and click the button.

ESP32-S3-Pico 38.jpg

3. Add the following content in the first blank.
https://raw.githubusercontent.com/espressif/arduino-esp32/gh-pages/package_esp32_index.json

ESP32-S3-Pico 39.jpg

4. Save the setting.
5. Open the board manager, enter ESP32 in the search bar, and select version 3.0.2.

ESP32-S3-Touch-LCD-4 240812 01.png

6. Wait for downloading.

ESP32-S3-Pico 41.jpg

7. arduino-esp32 is downloaded.

ESP32-S3-Pico 42.jpg

Use Arduino Demo

1. Select the demo, here we choose the demo to get the chip ID.

ESP32-S3-Pico 43.jpg

2. Select the board as ESP32S3 Dev Module.

ESP32-S3-Pico 44.jpg

3. Choose the COM5 port of ESP32-S3 USB.

ESP32-S3-Pico 45.jpg

4. Click the download button, then it compiles and downloads automatically.

ESP32-S3-Pico 47.jpg

5. Finish.

ESP32-S3-Pico 48.jpg

6. Open the Serial Port Monitor.

ESP32-S3-Pico 49.jpg

7. See the chip ID of the loop output.

ESP32-S3-Pico 50.jpg
Note: This product uses USB to connect to Type-C. If it cannot output the chip information, please modify "Serial.print" function to "printf" function, or you can enable the USB CDC function to directly send the serial port message to the USB.

I2C

Two Way I2C

ESP32-S3 supports 2x I2C to work at the same time. This development board uses the 2-ch I2C driver, and SDA0(IO8), SCL0(IO9) I2C 0 to drive the chip TCA9554PWR.
SDA1(IO15), SCL1(IO7) I2C 1 drives other I2C slave devices.

Sample Demo

Arduino

Note: Before using the Arduino demos, please check whether the Arduino IDE environment and download settings are correctly configured, for details, please check the Arduino Configure.
  • Please configure as shown below, otherwise the USB port will not output information:
USB CDC On Boot sets Enabled
Flash Size sets 16MB(128Mb)

Configure as shown below before using the screen:

Set USB CDC On Boot as Enabled
Set Flash Size as 16MB(128Mb)
Set PSRAM as OPI PSRAM
  • Before using the Arduino example, the software library should be set as shown below:
    • Using the library file we provided.
    • Install Arduino esp32.
    • The username of Arduino IDE must be English!

If you install a different version of Arduino esp32, there may be errors, we recommend installing the version we provide for testing and development.

RS485_Test

RS485_Test example is for testing RS-485 socket, and this interface can connect to GPIO44(TXD) and GPIO43(RXD) for RS485 communication.

  • This demo require USB TO RS485 (B). After programming the code, the RS-485 socket can connect to USB TO RS485 (B) through a "HY2.0 2P to DuPont male head 2P 10cm" and then connect it to the PC.
  • Open the serial port debugging assistant and send an RS485 message to ESP32-S3-Touch-LCD-4. The ESP32-S3-Touch-LCD-4 will return the received message to the serial port debugging assistant. Ensure to select the correct COM port and baud rate. Before sending the message, check "AddCrLf" to add a carriage return and line feed.

ESP32-S3-Touch-LCD-4.3-UART-test.png

SD_Test

The SD_Test example is used to testing the SD card socket. Before using it, insert an SD card.

  • After flashing the code, the ESP32-S3-Touch-LCD-4 will recognize the type and size of the SD card and proceed with file operations such as creating, deleting, modifying, and querying files.

ESP32-S3-Touch-LCD-4.3-SDtest01.png

RTC_Test

RTC_Test example is for using RTC clock and RTC interrupt.

  • After burning the code it will set the time, start the alarm, then read the current time and wait for the alarm to be entered.
  • The arrow is triggering the alarm and the red box is reading the time.

ESP32-S3-Touch-LCD-4.3B-04.jpg

TWAItransmit

TWAItransmit example is for testing CAN socket, and this interface can connect to GPIO15(TXD) and GPIO16(RXD) for CAN communication.

  • After programming the code, using the "HY2.0 2P to DuPont male head 2P red-black 10cm" cable, and connect the CAN H and CAN L pins of the ESP32-S3-Touch-LCD-4 to the USB-CAN-A.
  • Once you open the serial port debugging assistant, you should observe that the Esp32-s3-touch-lcd-4 has started sending CAN messages.

ESP32-S3-Touch-LCD-4-110.png

  • Connect the USB-CAN-A to the computer and open the USB-CAN-A_TOOL_2.0. Select the corresponding COM port, set the baud rate to 2000000 as shown in the image, and set the CAN baud rate to 50.000Kbps. This configuration will allow you to view the CAN messages sent by the Esp32-s3-touch-lcd-4.

ESP32-S3-Touch-LCD-4.3-PORtest102.png

TWAIreceive

TWAIreceive example is for testing CAN socket, and this interface can connect to GPIO15(TXD) and GPIO16(RXD) for CAN communication.

  • After uploading the code, use the "HY2.0 2P to DuPont male head 2P red-black 10cm" cable to connect the CAN H and CAN L pins of the ESP32-S3-Touch-LCD-4 to the USB-CAN-A.
  • Connect the USB-CAN-A to the computer and open the USB-CAN-A_TOOL_2.0. Select the corresponding COM port, set the port baud rate to 2000000 as indicated in the image, and set the CAN baud rate to 500.000Kbps. With these settings, you'll be able to send CAN messages to the Esp32-s3-touch-lcd-4.

ESP32-S3-Touch-LCD-4.3-PORtest03.png

  • Open the serial port debugging assistant, and you should observe that the Esp32-s3-touch-lcd-4 has started receiving CAN messages. If there are any reception errors, try resetting the devices multiple times and restarting the software. Please be patient and allow some time for the reception process.

ESP32-S3-Touch-LCD-4.3-PORtest04.png

lvgl_Porting

lvgl_Porting example is for testing RGB touch screen.

  • After uploading the code, you can try to touch it. Also, we provide LVGL porting examples for users (If there's no screen response after burning the code, check if the Arduino IDE -> Tools settings are correctly configured: choose the corresponding Flash (16MB) and enable PSRAM (8MB OPI)).
  • Here runs the LVGL demo, and the bottom layer uses ESP Display Panel. FAQ.

DrawColorBar

DrawColorBar example is for testing RGB screen.

  • After uploading the code, you should observe the screen displaying bands of blue, green, and red colors. If the screen shows no response after burning the code, check if the Arduino IDE -> Tools settings are correctly configured: choose the corresponding Flash (16MB) and enable PSRAM (8MB OPI).

ESP-IDF

Note: Before using ESP-IDF examples, please ensure that the ESP-IDF environment and download settings are correctly configured. You can refer to the ESP-IDF environment setting for specific instructions on how to check and configure them.

RS485_Test

RS485_Test is for testing the RS485 socket.

  • After uploading the code, connect the USB to RS485 to the A and B pins of the ESP32-S3-Touch-LCD-4. After connecting the USB to RS485 to the computer, open the SSCOM and select the corresponding COM port for communication.
  • Choose a baud rate of 115200 as shown in the diagram below. Sending any character will result in a loopback display. Testing of the RS485 socket has passed.

ESP32-S3-Touch-LCD-4.3-UART-test.png

SD_Test

SD_Test example is for testing SD card slot. The SD card should be inserted first, and then program the code to read/write the SD card.

  • After programming the code, ESP32-S3-Touch-LCD-4 will print the related information such as name, type, capacity and the maximum supported frame rate. Re-create file, write file, rename file, read renamed file:

ESP32-S3-Touch-LCD-4.3B-02.jpg

RTC_Test

RTC_Test example is for using RTC clock and RTC interrupt.

  • After burning the code it will set the time, start the alarm, then read the current time and wait for the alarm to be entered.
  • The arrow as shown below is for triggering the alarm, and the red frame is for reading time.

ESP32-S3-Touch-LCD-4.3B-05.jpg

TWAItransmit

TWAItransmit example is for testing CAN socket, and this interface can connect to GPIO15(TXD) and GPIO16(RXD) for CAN communication.

  • After programming the code, using the "HY2.0 2P to DuPont male head 2P red-black 10cm" cable, and connect the CAN H and CAN L pins of the ESP32-S3-Touch-LCD-4 to the USB-CAN-A.
  • Once you open the serial port debugging assistant, you should observe that the Esp32-s3-touch-lcd-4 has started sending CAN messages.

ESP32-S3-Touch-LCD-7-11.jpg

  • Connect the USB-CAN-A to the computer and open the USB-CAN-A_TOOL_2.0. Select the corresponding COM port, set the baud rate to 2000000 as shown in the image, and set the CAN baud rate to 50.000Kbps. This configuration will allow you to view the CAN messages sent by the Esp32-s3-touch-lcd-4.

ESP32-S3-Touch-LCD-4.3-PORtest102.png

TWAIreceive

TWAIreceive example is for testing CAN socket, and this interface can connect to GPIO15(TXD) and GPIO16(RXD) for CAN communication.

  • After uploading the code, use the "HY2.0 2P to DuPont male head 2P red-black 10cm" cable to connect the CAN H and CAN L pins of the ESP32-S3-Touch-LCD-4 to the USB-CAN-A.
  • Connect the USB-CAN-A to the computer and open the USB-CAN-A_TOOL_2.0. Select the corresponding COM port, set the port baud rate to 2000000 as indicated in the image, and set the CAN baud rate to 500.000Kbps. With these settings, you'll be able to send CAN messages to the Esp32-s3-touch-lcd-4.

ESP32-S3-Touch-LCD-4.3-PORtest03.png

  • Open the serial port debugging assistant, send data in USB-CAN-A_TOOL_2.0 and you should observe that the Esp32-s3-touch-lcd-4 has started receiving CAN messages. If there are any reception errors, try resetting the devices multiple times and restarting the software. Please be patient and allow some time for the reception process.

ESP32-S3-Touch-LCD-7-13.jpg

lvgl_Porting

lvgl_Porting example is for testing RGB touch screen.

  • After uploading the code, you can test the touching on the screen, and the demo also supports LVGL porting for users.
  • For RGB LCD driver, you can refer to this link.
  • For GT911 driver, you can refer to this link.

Resource

Document

Demo

Software

Datasheet

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)