Google Chat:---
+86-0755-88291180
sales@spotpear.com
dragon_manager@163.com
tech-support@spotpear.com
zhoujie@spotpear.com
WhatsApp:13246739196
WhatsApp:13424403025




This chapter contains the following sections. Please read as needed:
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.
For the ESP32-C6-ePaper-1.54 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.
Arduino\libraries directory within the package already contains all the library files required for this tutorial.| Library/File Name | Description | Version | Installation Method |
|---|---|---|---|
| LVGL | Graphical library | v8.3.11/v9.5.0 | "Install Offline" |
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.

The Arduino demos are located in the Arduino/examples directory of the demo package.
| Demo | Basic Program Description | Dependency Library |
|---|---|---|
| 01_ADC_Test | Get the voltage value of the lithium battery | - |
| 02_I2C_PCF85063 | Print real-time time from the RTC chip | - |
| 03_I2C_STHC3 | Get data from SHTC3 temperature & humidity sensor | - |
| 04_SD_Card | Load and display TF card information | - |
| 05_WIFI_AP | Set to AP mode to obtain the IP address of the access device | - |
| 06_WIFI_STA | Set to STA mode to connect to Wi-Fi and obtain an IP address | - |
| 07_BATT_PWR_Test | When powered by a lithium battery alone, control power via the PWR button | LVGL V9.5.0 |
| 08_Audio_Test | Play the sound recorded by the microphone through the speaker | LVGL V9.5.0 |
| 09_LVGL_V8_Test | LVGLV8 demo | LVGL V8.3.11 |
| 10_LVGL_V9_Test | LVGLV9 demo | LVGL V9.5.0 |
Demo Description
Hardware Connection
Code Analysis
BoardAdc_Init(); // Initialize ADC
xTaskCreatePinnedToCore(Adc_LoopTask, "Adc_LoopTask", 4 * 1024, NULL, 4, NULL, 0); // Create ADC test task
Operation Result
After the program is compiled and uploaded, open the serial monitor to see the printed voltage and battery capacity, as shown below:

Demo Description
Hardware Connection
Code Analysis
pcf85063a_init(&pcf85063, i2c_bus->Get_I2cBusHandle(), PCF85063A_ADDRESS); // Initialize RTC chip
pcf85063a_set_time_date(&pcf85063, datatime); // Set time
pcf85063a_get_time_date(&pcf85063, ¤t_time); // Get time
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:

Demo Description
Hardware Connection
Code Analysis
Shtc3_Init(i2c_bus); // Initialize temperature and humidity sensor
Shtc3_ReadTempHumi(&t,&h); // Get temperature and humidity from the sensor
Operation Result
Open the serial port monitor, you can see the printed temperature and humidity data, as shown in the figure below:

Demo Description
Hardware Connection
Code Analysis
sdcardinitflag = Sdcard_Init(); // Initialize TF card
Sdcard_WriteFile("/sdcard/sdcard.txt",sdcard_test1); // Write data to TF card
Sdcard_ReadFile("/sdcard/sdcard.txt",sdcard_test2,NULL); // Read data from TF card
Operation Result
Open the serial monitor to see the TF card information and read/write test output, as shown:

Demo Description
Hardware Connection
Code Analysis
In the 05_WIFI_AP.ino file, locate ssid and password. Phones or other STA mode devices can then connect to the board using this 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:

Demo Description
Hardware Connection
Code Analysis
In the 06_WIFI_STA.ino file, locate ssid and password, and modify them to match 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:

Demo Description
Hardware Connection
Code Analysis
i2c_bus = I2cMasterBus::requestInstance(ESP32_I2C_SCL_PIN, ESP32_I2C_SDA_PIN, ESP32_I2C_DEV_NUM); // I2C initialization
assert(i2c_bus);
ESP_ERROR_CHECK(esp_io_expander_new_i2c_tca9554(i2c_bus->Get_I2cBusHandle(), ESP_IO_EXPANDER_I2C_TCA9554_ADDRESS_000, &io_expander)); // I/O expander initialization
ESP_ERROR_CHECK(esp_io_expander_set_dir(io_expander, IO_EXPANDER_PIN_NUM_0 | IO_EXPANDER_PIN_NUM_1 | IO_EXPANDER_PIN_NUM_5, IO_EXPANDER_OUTPUT));
ESP_ERROR_CHECK(esp_io_expander_set_level(io_expander, IO_EXPANDER_PIN_NUM_0 | IO_EXPANDER_PIN_NUM_1 | IO_EXPANDER_PIN_NUM_5, 1));
InitializeButtons(); // Button event initialization
PortLvgl_Start_Init();// LVGL initialization
xTaskCreatePinnedToCore(Button_LoopTask, "Button_LoopTask", 4 * 1024, NULL, 4, NULL, 0); // Implement the lithium battery power switch via software control
Operation Result
After the program is flashed, disconnect the USB power supply and connect the lithium battery. Power on by pressing and holding the PWR button, as shown in the figure:

Demo Description
Hardware Connection
Code Analysis
PortLvgl_Start_Init(); // Initialize the screen
InitializeButtons(); // Initialize button events
Lvgl_PortInit(Lvgl_flush_cb); // Initialize LVGL interface
Codec_StartInit(); // Initialize audio codec IC
ESP_ERROR_CHECK(esp_io_expander_set_dir(io_expander, IO_EXPANDER_PIN_NUM_0 | IO_EXPANDER_PIN_NUM_1 | IO_EXPANDER_PIN_NUM_3, IO_EXPANDER_OUTPUT));
ESP_ERROR_CHECK(esp_io_expander_set_level(io_expander, IO_EXPANDER_PIN_NUM_0 | IO_EXPANDER_PIN_NUM_1 | IO_EXPANDER_PIN_NUM_3, 1)); // EXIO3 enables the amplifier
Operation Result
After the program is flashed, as shown in the figure:

Demo Description
Hardware Connection
Code Analysis
PortLvgl_Start_Init(); // Initialize the screen
Lvgl_PortInit(Lvgl_flush_cb); // Initialize LVGL V8
xTaskCreatePinnedToCore(Lvgl_LoopTask, "Lvgl_LoopTask", 4 * 1024, NULL, 4, NULL,0); // LVGL test task
Operation Result
After the program is flashed, the device operation result is as follows:

Demo Description
Hardware Connection
Code Analysis
PortLvgl_Start_Init(); // Initialize the screen
Lvgl_PortInit(Lvgl_flush_cb); // Initialize LVGL V9
xTaskCreatePinnedToCore(Lvgl_LoopTask, "Lvgl_LoopTask", 4 * 1024, NULL, 4, NULL,0); // LVGL test task
Operation Result
After the program is flashed, the device operation result is as follows:

This chapter contains the following sections. Please read as needed:
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.
For the ESP32-C6-ePaper-1.54 development board, ESP-IDF version V5.5.0 or above is required.
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.
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 choose your desired version from the filter bar.

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).

Please wait for both files to finish downloading.
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.

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.

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

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

Download and install Visual Studio Code.
During installation, it is recommended to check Add "Open with Code" action to Windows Explorer file context menu to facilitate opening project folders quickly.
In VS Code, click the Extensions icon in the Activity Bar on the side (or use the shortcut Ctrl + Shift + X) to open the Extensions view.
Enter ESP-IDF in the search box, locate the ESP-IDF extension, and click Install.

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.
The ESP-IDF demos are located in the ESP-IDF directory of the demo package.
| Demo | Basic Program Description | Dependency Library |
|---|---|---|
| 01_ADC_Test | Get the voltage value of the lithium battery | - |
| 02_I2C_PCF85063 | Print real-time time from the RTC chip | - |
| 03_I2C_STHC3 | Get data from SHTC3 temperature & humidity sensor | - |
| 04_SD_Card | Load and display TF card information | - |
| 05_WIFI_AP | Set to AP mode to obtain the IP address of the access device | - |
| 06_WIFI_STA | Set to STA mode to connect to Wi-Fi and obtain an IP address | - |
| 07_BATT_PWR_Test | When powered by a lithium battery alone, control power via the PWR button | LVGL V9.5.0 |
| 08_Audio_Test | Play the sound recorded by the microphone through the speaker | LVGL V9.5.0 |
| 09_LVGL_V8_Test | LVGLV8 demo | LVGL V8.3.11 |
| 10_LVGL_V9_Test | LVGLV9 demo | LVGL V9.5.0 |
| 11_FactoryProgram | Comprehensive demo | LVGL V9.5.0 |
Demo Description
Hardware Connection
Code Analysis
i2c_bus = I2cMasterBus::requestInstance(ESP32_I2C_SCL_PIN,ESP32_I2C_SDA_PIN,ESP32_I2C_DEV_NUM); // Initialize I2C
assert(i2c_bus);
ESP_ERROR_CHECK(esp_io_expander_new_i2c_tca9554(i2c_bus->Get_I2cBusHandle(), ESP_IO_EXPANDER_I2C_TCA9554_ADDRESS_000, &io_expander)); // Initialize IO expander
ESP_ERROR_CHECK(esp_io_expander_gpio_wrapper_append_handler(io_expander, GPIO_NUM_MAX)); // I/O expander GPIO wrapper initialization
BoardPower_Init(); // Power initialization
BoardPower_EPD_ON(); // Enable e-Paper power
BoardPower_Audio_ON(); // Enable audio power
BoardPower_VBAT_ON(); // Enable VBAT power
BoardAdc_Init(); // Initialize ADC
Operation Result
After the program is compiled and uploaded, open the serial monitor to see the printed voltage and battery capacity, as shown below:

Demo Description
Hardware Connection
Code Analysis
pcf85063a_init(&pcf85063, i2c_bus->Get_I2cBusHandle(), PCF85063A_ADDRESS); // Initialize RTC chip
pcf85063a_set_time_date(&pcf85063, datatime); // Set time
pcf85063a_get_time_date(&pcf85063, ¤t_time); // Get time
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:

Demo Description
Hardware Connection
Code Analysis
Shtc3_Init(i2c_bus); // Initialize temperature and humidity sensor
Shtc3_ReadTempHumi(&t,&h); // Get temperature and humidity from the sensor
Operation Result
Open the serial port monitor, you can see the printed temperature and humidity data, as shown in the figure below:

Demo Description
Hardware Connection
Code Analysis
sdcardinitflag = Sdcard_Init(); // Initialize TF card
Sdcard_WriteFile("/sdcard/sdcard.txt",sdcard_test1); // Write data to TF card
Sdcard_ReadFile("/sdcard/sdcard.txt",sdcard_test2,NULL); // Read data from TF card
Operation Result
Open the serial monitor to see the TF card information and read/write test output, as shown:

Demo Description
Hardware Connection
Code Analysis
main.c file. A phone or other STA‑mode device can then use this SSID and PASSWORD to connect to the 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 the device is successfully connected to the hotspot, the MAC address and IP address of the device will be output, as shown in the figure:

Demo Description
Hardware Connection
Code Analysis
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:

Demo Description
Hardware Connection
Code Analysis
boot_button = new Button(BOOT_BUTTON_PIN); // Initialize the corresponding button
power_button = new Button(PWR_BUTTON_PIN); // Initialize the corresponding button
PortLvgl_Start_Init(); // Initialize the display
InitializeButtons(); // Initialize button events
Lvgl_PortInit(Lvgl_flush_cb); // LVGL initialization
Operation Result
After the program is flashed, disconnect the USB power supply and connect the lithium battery. Power on by pressing and holding the PWR button, as shown in the figure:

Demo Description
Hardware Connection
Code Analysis
PortLvgl_Start_Init(); // Initialize the screen
InitializeButtons(); // Initialize button events
Lvgl_PortInit(Lvgl_flush_cb); // Initialize LVGL interface
Codec_StartInit(); // Initialize audio codec IC
ESP_ERROR_CHECK(gpio_set_direction(EXIO_NUM_3, GPIO_MODE_OUTPUT)); // Enable amplifier
gpio_set_level(EXIO_NUM_3,1);
Operation Result
After the program is flashed, as shown in the figure:

Demo Description
Hardware Connection
Code Analysis
PortLvgl_Start_Init(); // Initialize the screen
Lvgl_PortInit(Lvgl_flush_cb); // Initialize LVGL V8
xTaskCreatePinnedToCore(Lvgl_LoopTask, "Lvgl_LoopTask", 4 * 1024, NULL, 4, NULL,0); // LVGL test task
Operation Result
After the program is flashed, the device operation result is as follows:

Demo Description
Hardware Connection
Code Analysis
PortLvgl_Start_Init(); // Initialize the screen
Lvgl_PortInit(Lvgl_flush_cb); // Initialize LVGL V9
xTaskCreatePinnedToCore(Lvgl_LoopTask, "Lvgl_LoopTask", 4 * 1024, NULL, 4, NULL,0); // LVGL test task
Operation Result
After the program is flashed, the device operation result is as follows:

Demo Description
Hardware Connection
Code Analysis
i2c_bus = I2cMasterBus::requestInstance(ESP32_I2C_SCL_PIN, ESP32_I2C_SDA_PIN, ESP32_I2C_DEV_NUM); // I2C initialization
assert(i2c_bus);
FacTestEventGroup = xEventGroupCreate(); // Event group handle initialization
ESP_ERROR_CHECK(esp_io_expander_new_i2c_tca9554(i2c_bus->Get_I2cBusHandle(), ESP_IO_EXPANDER_I2C_TCA9554_ADDRESS_000, &io_expander)); // I/O expander initialization
ESP_ERROR_CHECK(esp_io_expander_gpio_wrapper_append_handler(io_expander, GPIO_NUM_MAX));
BoardPower_Init(); // Power initialization
BoardPower_EPD_ON(); // Enable e-Paper power
BoardPower_Audio_ON(); // Enable audio power
BoardPower_VBAT_ON(); // Enable battery power
PortDisplay_Init(); // Initialize local UI
esp_err_t ret = pcf85063a_init(&pcf85063, i2c_bus->Get_I2cBusHandle(), PCF85063A_ADDRESS); // Initialize RTC
boot_button = new Button(BOOT_BUTTON_PIN); // Initialize button
power_button = new Button(PWR_BUTTON_PIN); // Initialize button
while(0 == gpio_get_level(PWR_BUTTON_PIN)) { // Wait for the power button to be released
vTaskDelay(pdMS_TO_TICKS(100));
}
BoardAdc_Init(); // Initialize ADC
Shtc3_Init(i2c_bus); // Initialize temperature and humidity sensor
sdcardinitflag = Sdcard_Init(); // Initialize TF card
PortLvgl_Start_Init(); // Initialize LVGL
InitializeButtons(); // Initialize button events
ESP_ERROR_CHECK(gpio_set_direction(EXIO_NUM_3, GPIO_MODE_OUTPUT));
gpio_set_level(EXIO_NUM_3,1); // Enable amplifier
Codec_StartInit(); // Initialize codec
Operation Result
After the program is flashed, the device operation result is as follows:

Development Board Design Files
ESP32-C6 Chip Official Manuals
Datasheets
Monday-Friday (9:30-6:30) Saturday (9:30-5:30)
Email: services01@spotpear.com