• sales

    +86-0755-88291180

ESP32-S3-RLCD-4.2-EN User Guide

Features

  • Equipped with a high-performance Xtensa® 32-bit LX7 dual-core processor clocked at up to 240MHz
  • Supports 2.4GHz Wi-Fi and Bluetooth 5 (LE), with built-in antenna
  • Built-in 512KB SRAM, 384KB ROM, stacked with 16MB Flash and 8MB PSRAM integrated
  • Equipped with a 4.2inch fully reflective screen with a resolution of 300 × 400, featuring characteristics of reflection imaging and no backlight required
  • Equipped with a dual-microphone array for audio algorithms such as noise reduction and echo cancellation, suitable for accurate speech recognition and near-field/far-field wake-up applications
  • Onboard PCF85063 RTC real-time clock and SHTC3 temperature and humidity sensor for precise RTC time management and temperature and humidity monitoring
  • Onboard 18650 lithium battery holder and RTC backup battery holder (requires a rechargeable RTC battery), supporting dual modes of main power supply and independent RTC power backup
  • Built-in TF card slot, supports external storage of images or files
  • Onboard KEY and BOOT two side buttons with customizable functions, allowing for custom function development
  • Reserved 2 × 8 female header interface (2.54mm pitch) for convenient external expansion

Onboard Resources

  1. ESP32-S3-WROOM-1-N16R8 Wi-Fi and Bluetooth SoC, up to 240MHz operating frequency, stacked with 16MB Flash and 8MB PSRAM
  2. ES7210 ADC chip implements echo cancellation circuit
  3. ES8311 Low power audio codec IC
  4. BOOT Button Press and hold the BOOT button to power on again to enter download mode
  5. PWR Button Long press to power off, single click to power on
  6. KEY Button Customizable function button
  7. SHTC3 Temperature and Humidity Sensor Provides ambient temperature and humidity measurement, enabling environmental monitoring function
  8. PCF85063 RTC clock chip, supporting time-keeping functionality
  9. MX1.25 2PIN Speaker Interface Audio signal output, for connecting external speaker
  10. RTC Independent Power Interface Supports only PH1.0 rechargeable RTC battery
  11. 2 × 8PIN 2.54mm Pitch Female Header
  12. 18650 Battery Holder
  13. Dual Microphone Array Design Dual microphone array with ES7210 for echo cancellation
  14. CHG Charging Indicator Light The light turns off when the battery is fully charged
  15. WRN Warning Indicator Light The light stays on if the battery is reverse-connected
  16. Type-C Interface Used for program flashing and log printing
  17. TF Card Slot Supports FAT32-formatted TF card for data expansion

Interfaces

Dimensions


Working with Arduino

This chapter contains the following sections. Please read as needed:

Arduino Getting Started

New to Arduino ESP32 development and looking for a quick start? We have prepared a comprehensive Getting Started Tutorial for you.

Note: This tutorial uses the ESP32-S3-Zero as a reference example, and all hardware code is based on its pinout. Before you start, we recommend checking the pinout of your development board to ensure the pin configuration is correct.

Setting Up the Development Environment

1. Installing and Configuring the Arduino IDE

INFO

For the ESP32-S3-RLCD-4.2 development board, the Arduino IDE requires the installation of arduino-esp32 v3.3.0 or higher.

Please refer to the tutorial Installing and Configuring Arduino IDE to download and install the Arduino IDE and add ESP32 support.

2. Installing Libraries

  • When installing Arduino libraries, there are typically two methods: Install Online and Install Offline. If the library installation requires Install Offline, you must use the provided library file.
  • For most libraries, users can easily search for and install them via the Arduino IDE's online Library Manager. However, some open-source or custom libraries are not synchronized to the Arduino Library Manager and therefore cannot be found through online search. In this case, users can only install these libraries manually via offline methods.
  • The example program package for the ESP32-S3-RLCD-4.2 development board can be downloaded from here. The Arduino\libraries directory within the package already contains all the library files required for this tutorial.
Library/File NameDescriptionVersionInstallation Method
LVGLGraphics Libraryv8.3.11/v9.3.0"Install Offline"
SensorLibSensor libraryv0.3.1"Install Online" or "Install Offline"
VERSION COMPATIBILITY NOTES

There are strong dependencies between versions of LVGL and its driver libraries. For example, a driver written for LVGL v8 may not be compatible with LVGL v9. To ensure that the examples can be reproduced reliably, it is recommended to use the specific versions listed in the table above. Mixing different versions of libraries may lead to compilation failures or runtime errors.

3. Arduino Project Parameter Settings

Example

The Arduino examples are located in the Arduino/examples directory of the example package.

ExampleBasic Program DescriptionDependency Library
01_WIFI_APSet to AP mode to obtain the IP address of the access device-
02_WIFI_STASet to STA mode to connect to Wi-Fi and obtain an IP address-
03_ADC_TestGet the voltage value of the lithium battery-
04_I2C_PCF85063Print real-time time of RTC chipSensorLib
05_I2C_SHTC3Print temperature and humidity sensor data-
06_SD_CardLoad and display TF card information-
07_Audio_TestPlay the sound recorded by the microphone through the speakerLVGL V8.3.11
08_LVGL_V8_TestLVGLV8 exampleLVGL V8.3.11
09_LVGL_V9_TestLVGLV9 exampleLVGL V9.3.0
10_U8G2_TestU8G2 porting exampleU8G2 master

01_WIFI_AP

Example Description

  • This example can set the development board as a hotspot, allowing phones or other devices in STA mode to connect to the development board.

Hardware Connection

  • Connect the board to the computer using a USB cable.

Code Analysis

*In the file 01_WIFI_AP.ino, find ssid and password, then a phone or other device in STA mode can connect to the development board using these ssid and password.

const char *ssid = "ESP32_AP";
const char *password = "12345678";

Operation Result

  • After flashing the program, open the Serial Terminal. If a device successfully connects to the hotspot, the MAC address of that device will be output, as shown:

02_WIFI_STA

Example Description

  • This example configures the development board as a STA device to connect to a router, thereby accessing the system network.

Hardware Connection

  • Connect the board to the computer using a USB cable.

Code Analysis

  • In the file 02_WIFI_STA.ino, find ssid and password, then modify them to the SSID and Password of an available router in your current environment.

    const char *ssid = "you_ssid";
    const char *password = "you_password";

Operation Result

  • After flashing the program, open the Serial Terminal. If the device successfully connects to the hotspot, the obtained IP address will be output, as shown in the figure:

03_ADC_Test

Example Description

  • The analog voltage connected through the GPIO is converted to digital by the ADC, and then the actual lithium battery voltage is calculated and printed to the terminal.

Hardware Connection

  • Connect the board to the computer using a USB cable.

Code Analysis

  • Adc_PortInit(void): Initializes ADC1, including creating an ADC one-time trigger unit and configuring channel 3 for ADC1
  • float Adc_GetBatteryVoltage(int *data): Reads the value from ADC1 channel 3 and returns the actual voltage value.
  • uint8_t Adc_GetBatteryLevel(void): Returns the battery percentage.
  • void Adc_LoopTask(void *arg): Creates an ADC task that reads the ADC value and prints it to the serial port every second.

Operation Result

  • After the program is compiled and downloaded, you can view the printed ADC values and voltage output by opening the Serial Monitor, as shown in the following image:

04_I2C_PCF85063

Example Description

  • Through the I2C protocol, initialize the PCF85063 chip, set the time, and then periodically read the time and print it to the terminal

Hardware Connection

  • Connect the board to the computer using a USB cable.

Code Analysis

I2cMasterBus I2cbus(14,13,0); // Initialize I2C bus
void setup() {
Serial.begin(115200);
delay(1000);
Serial.printf("rtc-example run \n");
Rtc_Setup(&I2cbus, 0x51); // Initialize RTC, set RTC slave address to 0x51
Rtc_SetTime(2025, 9, 9, 20, 15, 30); // Set RTC time
}

void loop() {
rtcTimeStruct_t rtcData;
Rtc_GetTime(&rtcData); // Get the real-time clock (RTC) time
Serial.printf("%d/%d/%d %02d:%02d:%02d \n",
rtcData.year, rtcData.month, rtcData.day, rtcData.hour, rtcData.minute,
rtcData.second);
delay(1000);
}

Operation Result

  • After the program is compiled and downloaded, open the serial port monitoring to see the RTC time of the printout, as shown in the following figure:

05_I2C_SHTC3

Example Description

  • Initialize the SHTC3 chip through the I2C protocol, and then print the temperature and humidity information read every 1 second to the terminal

Hardware Connection

  • Connect the board to the computer using a USB cable.

Code Analysis

I2cMasterBus I2cbus(14,13,0);
Shtc3Port *shtc3port = NULL;

void setup() {
Serial.begin(115200);
delay(1000);
Serial.printf("shtc3-example run \n");
shtc3port = new Shtc3Port(I2cbus); // Initialize SHTC3
}

void loop() {
float rh,temp;
shtc3port->Shtc3_ReadTempHumi(&temp,&rh); // Get temperature and humidity data
Serial.printf("RH:%.2f%%,Temp:%.2f° \n",rh,temp);
delay(1000);
}

Operation Result

  • Open the serial port monitor, you can see the printed temperature and humidity data, as shown in the figure below:

06_SD_Card

Example Description

  • Drive the TF card through SDMMC, and print the TF card information to the terminal after successfully mounting.

Hardware Connection

  • Install a FatFs-formatted TF card into the board before powering on

Code Analysis

#define sdcard_write_Test

CustomSDPort *sdcardPort = NULL;

void setup()
{
Serial.begin(115200);
delay(2000);
sdcardPort = new CustomSDPort("/sdcard"); // Initialize SDMMC driver
}

uint32_t value = 1;
char sdcard_read[45] = {""};
char sdcard_write[45] = {""};

void loop()
{
#ifdef sdcard_write_Test // Test the TF card read/write functionality
snprintf(sdcard_write,45,"sdcard_writeTest : %ld \n",value);
sdcardPort->SDPort_WriteFile("/sdcard/writeTest.txt",sdcard_write,strlen(sdcard_write));
vTaskDelay(pdMS_TO_TICKS(500));
sdcardPort->SDPort_ReadFile("/sdcard/writeTest.txt",(uint8_t *)sdcard_read,NULL);
Serial.printf("read data:%s\n",sdcard_read);
vTaskDelay(pdMS_TO_TICKS(500));
value++;
#endif
}

Operation Result

  • Click on the serial port monitoring device, you can see the output information of the TF card, as shown in the figure below:

07_Audio_Test

Example Description

  • Demonstrates how to get data from the microphone and then play it through the speaker

Hardware Connection

  • Connect the board to the computer using a USB cable.

Code Analysis

  • CodecPort_SetInfo("es8311 & es7210",1,16000,2,16): Sets the sampling rate, number of channels, and bit depth of the Codec chip.
  • CodecPort_SetSpeakerVol(100): Set the playback gain to 100.
  • CodecPort_SetMicGain(35): Set the microphone gain to 35.
  • Codec_LoopTask(void *arg): Codec task, which implements recording, playback, and other functions.

Operation Result

  • After the program is flashed, as shown in the figure:

    TIP
    1. Double-click the BOOT button to enter recording mode, speak into the MIC, and it will automatically end after 3 seconds
    2. Click the BOOT button to play the sound you just recorded
    3. Double-click the KEY button to play a piece of music
    4. Click the KEY button to interrupt music playback

08_LVGL_V8_Test

Example Description

  • Demonstrates how to display images using LVGL V8, helping users get started quickly with LVGL V8.

Hardware Connection

  • Connect the board to the computer using a USB cable.

Code Analysis

/*Create an IMG1 widget */
ui->screen_img_1 = lv_img_create(ui->screen);
lv_obj_add_flag(ui->screen_img_1, LV_OBJ_FLAG_CLICKABLE);
lv_img_set_src(ui->screen_img_1, &_ein_alpha_400x300);
lv_img_set_pivot(ui->screen_img_1, 50,50);
lv_img_set_angle(ui->screen_img_1, 0);
lv_obj_set_pos(ui->screen_img_1, 0, 0);
lv_obj_set_size(ui->screen_img_1, 400, 300);
/*Create an IMG2 widget */
ui->screen_img_2 = lv_img_create(ui->screen);
lv_obj_add_flag(ui->screen_img_2, LV_OBJ_FLAG_CLICKABLE);
lv_img_set_src(ui->screen_img_2, &_2_alpha_400x300);
lv_img_set_pivot(ui->screen_img_2, 50,50);
lv_img_set_angle(ui->screen_img_2, 0);
lv_obj_set_pos(ui->screen_img_2, 0, 0);
lv_obj_set_size(ui->screen_img_2, 400, 300);
lv_obj_add_flag(ui->screen_img_2, LV_OBJ_FLAG_HIDDEN);

Operation Result

  • After the program is flashed, it is displayed alternately at intervals of 1.5 seconds, as shown in the figure:

09_LVGL_V9_Test

Example Description

  • Demonstrates how to display images using LVGL V9, helping users get started quickly with LVGL V9.

Hardware Connection

  • Connect the board to the computer using a USB cable.

Code Analysis

/*Create an IMG1 widget */
ui->screen_img_1 = lv_image_create(ui->screen);
lv_obj_set_pos(ui->screen_img_1, 0, 0);
lv_obj_set_size(ui->screen_img_1, 400, 300);
lv_obj_add_flag(ui->screen_img_1, LV_OBJ_FLAG_CLICKABLE);
lv_image_set_src(ui->screen_img_1, &_ein_RGB565A8_400x300);
lv_image_set_pivot(ui->screen_img_1, 50,50);
lv_image_set_rotation(ui->screen_img_1, 0);
/*Create an IMG2 widget */
ui->screen_img_2 = lv_image_create(ui->screen);
lv_obj_set_pos(ui->screen_img_2, 0, 0);
lv_obj_set_size(ui->screen_img_2, 400, 300);
lv_obj_add_flag(ui->screen_img_2, LV_OBJ_FLAG_HIDDEN);
lv_obj_add_flag(ui->screen_img_2, LV_OBJ_FLAG_CLICKABLE);
lv_image_set_src(ui->screen_img_2, &_2_RGB565A8_400x300);
lv_image_set_pivot(ui->screen_img_2, 50,50);
lv_image_set_rotation(ui->screen_img_2, 0);

Operation Result

  • After the program is flashed, it is displayed alternately at intervals of 1.5 seconds, as shown in the figure:

10_U8G2_Test

Example Description

  • Completes the porting of the U8G2 library, supporting fast screen refreshing, helping users precisely target product functions and display effects.

Hardware Connection

  • Connect the board to the computer using a USB cable.

Code Analysis

u8g2_clearBuffer(); // Clear screen
u8g2_setFont(); // Set font
u8g2_drawStr(); // Draw counter and text
u8g2_drawFrame(); // Draw border
u8g2_drawHLine(); // Draw bottom separator line
u8g2_sendBuffer(); // Refresh screen
u8g2_drawPixel(x, y); // Draw a pixel
u8g2_drawLine(x1, y1, x2, y2); // Draw an arbitrary line
u8g2_drawBox(x, y, w, h); // Filled rectangle
u8g2_drawCircle(x, y, r); // Hollow circle
u8g2_drawDisc(x, y, r); // Filled circle
u8g2_drawTriangle(x0, y0, x1, y1, x2, y2); // Filled triangle
u8g2_drawXBMP(x, y, w, h, bitmap); // Draw XBM format monochrome bitmap
u8g2_drawBitmap(x, y, cnt, h, bitmap); // Draw U8g2 bitmap

Operation Result

  • After the program is flashed, the screen displays as shown:


ESP-IDF

This chapter contains the following sections. Please read as needed:

ESP-IDF Getting Started

New to ESP32 ESP-IDF development and looking to get started quickly? We have prepared a general Getting Started Tutorial for you.

Please Note: This tutorial uses the ESP32-S3-Zero as a teaching example, and all hardware code is based on its pinout. Before you start, it is recommended that you check the pinout of your development board to ensure the pin configuration is correct.

Setting Up the Development Environment

INFO

For the ESP32-S3-RLCD-4.2 development board, ESP-IDF version V5.5.0 or above is required.

NOTE

The following guide uses Windows as an example, demonstrating development using VS Code + the ESP-IDF extension. macOS and Linux users should refer to the official documentation.

VERSION SELECTION

The screenshots in this section use ESP-IDF V5.5.2 as an example. When installing, please select the ESP-IDF version that matches your board's example.

Install the ESP-IDF Development Environment

  1. Download the installation manager from the ESP-IDF Installation Manager page. This is Espressif's latest cross-platform installer. The following steps demonstrate how to use its offline installation feature.

    Click the Offline Installer tab on the page, then select Windows as the operating system and the ESP-IDF version you need (the version shown in the screenshot is for reference only — choose the version that fits your actual needs).

    Download EIM and offline package

    After confirming your selection, click the download button. The browser will automatically download two files: the ESP-IDF Offline Package (.zst) and the ESP-IDF Installer (.exe).

    Download EIM and offline package 2

    Please wait for both files to finish downloading.

  2. Once the download is complete, double-click to run the ESP-IDF Installer (eim-gui-windows-x64.exe).

    The installer will automatically detect if the offline package exists in the same directory. Click Install from archive.

    Auto-detect offline package

    Next, select the installation path. We recommend using the default path. If you need to customize it, ensure the path does not contain Chinese characters or spaces. Click Start installation to proceed.

    Select installation path
  3. When you see the following screen, the ESP-IDF installation is successful.

    Installation successful
  4. We recommend installing the drivers as well. Click Finish installation, then select Install driver.

    Install drivers via ESP-IDF Installation Manager

Install Visual Studio Code and the ESP-IDF Extension

  1. Download and install Visual Studio Code.

  2. During installation, it is recommended to check Add "Open with Code" action to Windows Explorer file context menu to facilitate opening project folders quickly.

  3. In VS Code, click the Extensions icon Extensions Icon in the Activity Bar on the side (or use the shortcut Ctrl + Shift + X) to open the Extensions view.

  4. Enter ESP-IDF in the search box, locate the ESP-IDF extension, and click Install.

    Search and install ESP-IDF extension in VS Code

  5. For ESP-IDF extension versions ≥ 2.0, the extension will automatically detect and recognize the ESP-IDF environment installed in the previous steps, requiring no manual configuration.

Example

The ESP-IDF examples are located in the ESP-IDF directory of the example package.

ExampleBasic Program DescriptionDependency Library
01_WIFI_APSet to AP mode to obtain the IP address of the access device-
02_WIFI_STASet to STA mode to connect to Wi-Fi and obtain an IP address-
03_ADC_TestGet the voltage value of the lithium battery-
04_I2C_PCF85063Print real-time time of RTC chipSensorLib
05_I2C_SHTC3Print temperature and humidity sensor data-
06_SD_CardLoad and display TF card information-
07_Audio_TestPlay the sound recorded by the microphone through the speakerLVGL V8.3.11
08_LVGL_V8_TestLVGLV8 exampleLVGL V8.3.11
09_LVGL_V9_TestLVGLV9 exampleLVGL V9.3.0
10_FactoryProgramComprehensive exampleLVGL V8.3.11
11_U8G2_TestU8G2 porting exampleU8G2 master

01_WIFI_AP

Example Description

  • This example can set the development board as a hotspot, allowing phones or other devices in STA mode to connect to the development board.

Hardware Connection

  • Connect the board to the computer using a USB cable.

Code Analysis

  • In the file softap_example_main.c, find SSID and PASSWORD, and then your phone or other device in STA mode can use the SSID and PASSWORD to connect to the development board.

    #define EXAMPLE_ESP_WIFI_SSID "waveshare_esp32"
    #define EXAMPLE_ESP_WIFI_PASSWORD "wav123456"

Operation Result

  • After flashing the program, open the Serial Terminal. If a device successfully connects to the hotspot, it will output the device's MAC address and IP address, as shown in the figure:

02_WIFI_STA

Example Description

  • This example configures the development board as a STA device to connect to a router, thereby accessing the system network.

Hardware Connection

  • Connect the board to the computer using a USB cable.

Code Analysis

  • In the file esp_wifi_bsp.c, find ssid and password, then modify them to the SSID and Password of an available router in your current environment.

    wifi_config_t wifi_config = {
    .sta = {
    .ssid = "PDCN",
    .password = "1234567890",
    },
    };

Operation Result

  • After flashing the program, open the Serial Terminal. If the device successfully connects to the hotspot, the obtained IP address will be output, as shown in the figure:

03_ADC_Test

Example Description

  • The analog voltage connected through the GPIO is converted to digital by the ADC, and then the actual lithium battery voltage is calculated and printed to the terminal.

Hardware Connection

  • Connect the board to the computer using a USB cable.

Code Analysis

  • Adc_PortInit(void): Initializes ADC1, including creating an ADC one-time trigger unit and configuring channel 3 for ADC1
  • float Adc_GetBatteryVoltage(int *data): Reads the value from ADC1 channel 3 and returns the actual voltage value.
  • uint8_t Adc_GetBatteryLevel(void): Returns the battery percentage.
  • void Adc_LoopTask(void *arg): Creates an ADC task that reads the ADC value and prints it to the serial port every second.

Operation Result

  • After the program is compiled and downloaded, you can view the printed ADC values and voltage output by opening the Serial Monitor, as shown in the following image:

04_I2C_PCF85063

Example Description

  • Through the I2C protocol, initialize the PCF85063 chip, set the time, and then periodically read the time and print it to the terminal

Hardware Connection

  • Connect the board to the computer using a USB cable.

Code Analysis

  • void Rtc_LoopTask(void *arg): Create an RTC task to implement the RTC function, read the clock of the RTC chip every 1 second, and then output it to the terminal.

Operation Result

  • After the program is compiled and downloaded, open the serial port monitoring to see the RTC time of the printout, as shown in the following figure:

05_I2C_STHC3

Example Description

  • Initialize the SHTC3 chip through the I2C protocol, and then print the temperature and humidity information read every 1 second to the terminal

Hardware Connection

  • Connect the board to the computer using a USB cable.

Code Analysis

  • void Shtc3_LoopTask(void *arg): Create a SHTC3 sensor task that obtains temperature and humidity at intervals of 1 second.

Operation Result

  • Open the serial port monitor, you can see the printed temperature and humidity data, as shown in the figure below:

06_SD_Card

Example Description

  • Drive the TF card through SDMMC, and print the TF card information to the terminal after successfully mounting.

Hardware Connection

  • Install a FatFs-formatted TF card into the board before powering on

Code Analysis

  • Fatfs_LoopTask(void *arg): A task to test TF card read and write functionality. You need to uncomment the #define sdcard_write_Test macro definition.

Operation Result

  • Click on the serial port monitoring device, you can see the output information of the TF card, as shown in the figure below:

07_Audio_Test

Example Description

  • Demonstrates how to get data from the microphone and then play it through the speaker

Hardware Connection

  • Connect the board to the computer using a USB cable.

Code Analysis

  • CodecPort_SetInfo("es8311 & es7210",1,16000,2,16): Sets the sampling rate, number of channels, and bit depth of the Codec chip.
  • CodecPort_SetSpeakerVol(100): Set the playback gain to 100.
  • CodecPort_SetMicGain(35): Set the microphone gain to 35.
  • Codec_LoopTask(void *arg): Codec task, which implements recording, playback, and other functions.

Operation Result

  • After the program is flashed, as shown in the figure:

    TIP
    1. Double-click the BOOT button to enter recording mode, speak into the MIC, and it will automatically end after 3 seconds
    2. Click the BOOT button to play the sound you just recorded
    3. Double-click the KEY button to play a piece of music
    4. Click the KEY button to interrupt music playback

08_LVGL_V8_Test

Example Description

  • Demonstrates how to display images using LVGL V8, helping users get started quickly with LVGL V8.

Hardware Connection

  • Connect the board to the computer using a USB cable.

Code Analysis

/*Create an IMG1 widget */
ui->screen_img_1 = lv_img_create(ui->screen);
lv_obj_add_flag(ui->screen_img_1, LV_OBJ_FLAG_CLICKABLE);
lv_img_set_src(ui->screen_img_1, &_ein_alpha_400x300);
lv_img_set_pivot(ui->screen_img_1, 50,50);
lv_img_set_angle(ui->screen_img_1, 0);
lv_obj_set_pos(ui->screen_img_1, 0, 0);
lv_obj_set_size(ui->screen_img_1, 400, 300);
/*Create an IMG2 widget */
ui->screen_img_2 = lv_img_create(ui->screen);
lv_obj_add_flag(ui->screen_img_2, LV_OBJ_FLAG_CLICKABLE);
lv_img_set_src(ui->screen_img_2, &_2_alpha_400x300);
lv_img_set_pivot(ui->screen_img_2, 50,50);
lv_img_set_angle(ui->screen_img_2, 0);
lv_obj_set_pos(ui->screen_img_2, 0, 0);
lv_obj_set_size(ui->screen_img_2, 400, 300);
lv_obj_add_flag(ui->screen_img_2, LV_OBJ_FLAG_HIDDEN);

Operation Result

  • After the program is flashed, it is displayed alternately at intervals of 1.5 seconds, as shown in the figure:

09_LVGL_V9_Test

Example Description

  • Demonstrates how to display images using LVGL V9, helping users get started quickly with LVGL V9.

Hardware Connection

  • Connect the board to the computer using a USB cable.

Code Analysis

/*Create an IMG1 widget */
ui->screen_img_1 = lv_image_create(ui->screen);
lv_obj_set_pos(ui->screen_img_1, 0, 0);
lv_obj_set_size(ui->screen_img_1, 400, 300);
lv_obj_add_flag(ui->screen_img_1, LV_OBJ_FLAG_CLICKABLE);
lv_image_set_src(ui->screen_img_1, &_ein_RGB565A8_400x300);
lv_image_set_pivot(ui->screen_img_1, 50,50);
lv_image_set_rotation(ui->screen_img_1, 0);
/*Create an IMG2 widget */
ui->screen_img_2 = lv_image_create(ui->screen);
lv_obj_set_pos(ui->screen_img_2, 0, 0);
lv_obj_set_size(ui->screen_img_2, 400, 300);
lv_obj_add_flag(ui->screen_img_2, LV_OBJ_FLAG_HIDDEN);
lv_obj_add_flag(ui->screen_img_2, LV_OBJ_FLAG_CLICKABLE);
lv_image_set_src(ui->screen_img_2, &_2_RGB565A8_400x300);
lv_image_set_pivot(ui->screen_img_2, 50,50);
lv_image_set_rotation(ui->screen_img_2, 0);

Operation Result

  • After the program is flashed, it is displayed alternately at intervals of 1.5 seconds, as shown in the figure:

10_FactoryProgram

Example Description

  • The driver board integrates all hardware components and provides comprehensive examples, enabling users to quickly understand the product.

Hardware Connection

  • Connect the board to the computer using a USB cable.

Code Analysis

sdcardPort = new CustomSDPort("/sdcard"); // Initialize sdcard
Adc_PortInit(); // Initialize Adc
Custom_ButtonInit(); // Initialize buttons
Rtc_Setup(&I2cbus,0x51); // Initialize RTC
Rtc_SetTime(2026,1,5,14,30,30); // Set RTC time
shtc3port = new Shtc3Port(I2cbus); // Initialize Shtc3
espwifi_init(); // Initialize WiFi STA mode
CodecGroups = xEventGroupCreate();
codecport = new CodecPort(I2cbus,"S3_RLCD_4_2"); // Initialize Codec
codecport->CodecPort_SetInfo("es8311 & es7210",1,16000,2,16);
codecport->CodecPort_SetSpeakerVol(100); // Set the speaker gain
codecport->CodecPort_SetMicGain(35); // Set the microphone gain

Operation Result

  • After the program is flashed, the main interface is displayed, as shown in the figure:

    TIP
    1. Long press the KEY button to enter the image display interface
    2. Long press the BOOT button to enter the music playback interface
  • Image display interface, as shown in the figure:

    TIP
    1. Long press the KEY button to return to the main interface
  • Music playback interface, as shown in the figure:

    TIP
    1. Double-click the BOOT button to enter recording mode, speak into the MIC, and it will automatically end after 3 seconds
    2. Click the BOOT button to play the sound you just recorded
    3. Double-click the KEY button to play a piece of music
    4. Click the KEY button to interrupt music playback
    5. Long press the BOOT button to go back to the interface

11_U8G2_Test

Example Description

  • Completes the porting of the U8G2 library, supporting fast screen refreshing, helping users precisely target product functions and display effects.

Hardware Connection

  • Connect the board to the computer using a USB cable.

Code Analysis

u8g2_clearBuffer(); // Clear screen
u8g2_setFont(); // Set font
u8g2_drawStr(); // Draw counter and text
u8g2_drawFrame(); // Draw border
u8g2_drawHLine(); // Draw bottom separator line
u8g2_sendBuffer(); // Refresh screen
u8g2_drawPixel(x, y); // Draw a pixel
u8g2_drawLine(x1, y1, x2, y2); // Draw an arbitrary line
u8g2_drawBox(x, y, w, h); // Filled rectangle
u8g2_drawCircle(x, y, r); // Hollow circle
u8g2_drawDisc(x, y, r); // Filled circle
u8g2_drawTriangle(x0, y0, x1, y1, x2, y2); // Filled triangle
u8g2_drawXBMP(x, y, w, h, bitmap); // Draw XBM format monochrome bitmap
u8g2_drawBitmap(x, y, cnt, h, bitmap); // Draw U8g2 bitmap

Operation Result

  • After the program is flashed, the screen displays as shown:


XiaoZhi AI Application Tutorial

XiaozhiAI (XiaoZhi AI) is an open-source AI voice chatbot project based on the ESP32 development board, aiming to bring the general intelligence of large language models (LLMs) to edge devices. It provides a software-hardware integrated solution supporting full-duplex voice conversations and IoT device control, dedicated to assisting developers in building highly customized physical AI agents quickly and at low cost.

This article demonstrates how to flash firmware for Waveshare ESP32 development boards that support XiaoZhi AI, covering two methods: flashing without a development environment (directly flashing precompiled firmware) and flashing with a development environment (compiling from source and flashing).

0. Firmware Flashing Process Reference

INFO

This section uses the ESP32-S3-Touch-AMOLED-1.8 development board as an example. The steps are similar for other development boards.

Please first confirm that your hardware is listed in the XiaoZhi AI Supported Products List.

XiaozhiAI-Process

1. Flashing Without a Development Environment

1.1 Download Firmware from XiaoZhi Official GitHub

  1. Visit the XiaoZhi GitHub to download the firmware file for your device. Click Assets to expand the full file list:

    xiaozhi-GitHub

  2. Refer to the Flash Firmware Flashing and Erasing Tutorial to complete the firmware flashing.

1.2 Download Firmware from Waveshare GitHub

INFO

This repository aggregates firmware for Waveshare ESP32 development boards that support XiaoZhi AI. All firmware has been tested and verified on the corresponding boards, making it convenient for users to find and download. Firmware versions may be updated slightly later than the official XiaoZhi repository.

  1. Visit the Waveshare GitHub repository and download the appropriate firmware version for your needs:

    xiaozhi-GitHub

  2. Refer to the Flash Firmware Flashing and Erasing Tutorial to complete the firmware flashing.

2. Flashing with ESP-IDF Environment

2.1 Download the Project from XiaoZhi GitHub

Visit the XiaoZhi AI Chatbot repository to download the complete project code:

Chatbot

2.2 Environment Setup

Refer to the ESP-IDF Environment Setup Tutorial to configure the development environment.

2.3 Configuration and Compilation

  1. Click VSCode Select Target Device Icon to select the target device. Choose the chip model corresponding to your development board (e.g., esp32s3):

    VS Code Select Device Chip Option

    TIP

    When setting the target device, ESP-IDF will automatically configure the corresponding toolchain and libraries. This process may take some time, please be patient. For more details, please refer to the Official Documentation.

  2. Click VSCode Terminal Button to open the ESP-IDF terminal, then execute the command idf.py menuconfig to enter the configuration interface. Select Xiaozhi Assistant:

    Enter Terminal Configuration Interface

  3. Select Board Type to choose the development board type:

    Select Board Type

  4. Choose the product model corresponding to your development board:

    Select Product Model

  5. Choose XiaoZhi-AI default display language:

    Select Product Model

    Select Product Model

  6. Press the S key to save the configuration and exit. Then click the One-click Build, Flash, and Monitor Icon to automatically complete compilation, flashing, and serial monitoring.

2.4 Start Network Provisioning

  1. Connect your phone or computer to the device's Wi-Fi hotspot: Xiaozhi-xxxxxx. After successful connection, the configuration page should automatically pop up. If not, manually open a browser and visit http://192.168.4.1.

  2. On the network configuration page, select the Wi-Fi name you want to connect to (only 2.4G band is supported; to connect to an iPhone hotspot, enable Max Compatibility in your phone's system settings). The SSID will be auto-filled. Enter the password and click Connect to start connecting:

    Connect to Wi-Fi

2.5 Add a New Device to the Management Console

  1. Ensure the device has successfully connected to the Internet. The device will then broadcast a 6-digit device verification code (you can wake the device again to replay the code).

  2. Visit the XiaoZhi AI Console. If you haven't registered, complete the registration and log in:

    Console Interface

    Login Interface

    Add Device

  3. Enter the 6-digit verification code. The device will automatically activate and appear on the Device Management page, ready for normal use.

  4. Say the wake word "Hello XiaoZhi" to wake the device and start voice conversations.

  5. ESP32-S3-Touch-AMOLED-1.8 Button Instructions:

    • BOOT button: Press to wake XiaoZhi
    • PWR button: Short press to power on; long press for more than 6 seconds to power off

    Device Added Successfully

3. XiaoZhi Resources

Resources

1. Hardware Resources

2. Technical Manuals

3. Waveshare Official Example

Support

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

Email: services01@spotpear.com

TAG: Raspberry Pi Thermal imaging Raspberry Pi Camera ESP32 S3 LCD Camera Development Board 2 inch Display QMI8658 Sensor / Battery Port LVGL/HMI For Arduino Computer Monitor Screen Industrial Modbus POE ETH RJ45 To 8-Ch Relay B RTU/Modbus TCP-Ethernet For IOT 8inch LCD 1280x800 Computer PC Monitor Display Secondary Screen TypeC USB CPU RAM ESP32 S3 Development Board 2.8 inch Round LCD Display 480x480 QMI8658 Sensor / SD /MP3 Audio /Battery Port LVGL/HMI For Arduino Luckfox Pico Pro UGV Beast PT Kit AI OpenCV Robot Car MediaPipe For Jetson Orin ESP32 ST7789 configuration Raspberry Pi Pico 2 RP2350-Tiny/Tiny-Kit Super Mini Board RP2350A ESP32 S3 Development Board 1.64 inch AMOLED Display 1.64inch TouchScreen For Arduino LVGL With SD-Port/ QMI8658C 6-Axis Sensor ESP32-S3 A7670E 4G development board supports LTE Cat-1/2G/GNSS positioning/WiFi/Bluetooth ESP32-S3 Development Board 1.85 inch Round LCD N16R8 DeepSeek AI Voice Chat Robot BOX Magnetic-charging Arduino Thermal imaging camera DeepSeek AI Voice Chat Robot ESP32 S3 Development Board 2.8 inch Display 2.8inch Screen Raspberry Pi Pico 2 RP2350B 2.1 inch Round LCD Touch Display 480x480 HMI LVGL QMI8658 6-axis 65K Colors Raspberry Pi DSI display LuckFox SC3336 Raspberry Pi Pico 2 RP2350-One Mini Board Type-A RP2350A