# Waveshare 3.97-inch e-Paper
[](https://components.espressif.com/components/waveshare/epaper_3in97)
This driver supports monochrome full refresh, clearing, BUSY timeouts, and deep sleep on ESP-IDF 6.1.
| Display controller | Communication interface | Resolution | Datasheet |
| --- | --- | --- | --- |
| SSD1677 | 4-wire SPI | 800 × 480 | [Panel datasheet](https://files.waveshare.com/wiki/3.97inch_e-Paper_HAT%2B/3.97inch_e-Paper.pdf) |
## Add to project
```sh
idf.py add-dependency "waveshare/epaper_3in97==0.1.0"
```
## Hardware connections
The 24-pin bare panel requires the boost circuit shown in section 9 of the datasheet or a compatible adapter. Use 3.3 V logic, connect the grounds, and pull BS low to select 4-wire SPI. Follow the board's power instructions when using a HAT+.
| Panel signal | FPC pin | Host connection |
| --- | --- | --- |
| SCL | 13 | SPI clock |
| SDA | 14 | SPI MOSI |
| CSB | 12 | Active-low chip select |
| D/C | 11 | Low for commands, high for data |
| RST_N | 10 | Active-low reset |
| BUSY | 9 | High during refresh |
| BS | 8 | Ground |
## Initialization code
Initialize the SPI bus with DMA and a maximum transfer size of at least `EPAPER_3IN97_TRANSFER_BYTES`. The example below uses the control pins of the Waveshare ESP32-S3-ePaper-3.97.
```c
#include "epaper_3in97.h"
const epaper_3in97_config_t config = {
.spi_host = SPI2_HOST,
.cs_gpio = GPIO_NUM_10,
.dc_gpio = GPIO_NUM_9,
.reset_gpio = GPIO_NUM_46,
.busy_gpio = GPIO_NUM_3,
};
epaper_3in97_handle_t panel;
ESP_ERROR_CHECK(epaper_3in97_new(&config, &panel));
ESP_ERROR_CHECK(epaper_3in97_init(panel));
ESP_ERROR_CHECK(epaper_3in97_clear(panel, true));
ESP_ERROR_CHECK(epaper_3in97_sleep(panel));
ESP_ERROR_CHECK(epaper_3in97_del(panel));
```
Pass a 48,000-byte monochrome frame to `epaper_3in97_display()`. Each of the 480 rows contains 100 bytes in MSB-first order, with 1 for white and 0 for black. The default SPI clock is 4 MHz and the BUSY timeout is 10 seconds. Call `epaper_3in97_init()` to wake or recover the panel. Serialize calls for each handle.
## Test application
Build the checkerboard test from [test_apps](test_apps). Set the GPIOs under **3.97-inch e-paper wiring** in `menuconfig` for the attached board. The Waveshare ESP32-S3-ePaper-3.97 uses SCK 11, MOSI 12, CS 10, D/C 9, RESET 46, and BUSY 3.
```sh
cd test_apps
idf.py set-target esp32s3
idf.py build
```
The driver was built for 13 hardware targets with ESP-IDF v6.1. A Waveshare ESP32-S3-ePaper-3.97 displayed a complete 10 × 6 checkerboard, and its serial log confirmed that the refresh and sleep calls completed.
fb1948e5d82a6b979b2a410f8680f6600e9e8723
idf.py add-dependency "waveshare/epaper_3in97^0.1.0"