Skip to content

Latest commit

 

History

History
109 lines (79 loc) · 6.15 KB

File metadata and controls

109 lines (79 loc) · 6.15 KB

e-Paper Example

The SSD1681 e-paper display drive uses esp_lcd APIs and provides some additional APIs because of the specificity of e-paper panel.

This example shows how to use SSD1681 e-paper display driver from Component manager and will draw a few bitmaps to the e-paper panel using the SSD1681 e-paper display driver.

How to use the example

Hardware Required

  • An ESP development board
  • An SSD1681 or SSD1680 e-paper panel, with SPI interface
  • An USB cable for power supply and programming

Hardware Connection

The connection between ESP Board and the LCD is as follows:

       ESP Board                              SSD1681 e-Paper Panel
┌──────────────────────────────┐              ┌────────────────────┐
│      GND                     ├─────────────►│ GND                │
│                              │              │                    │
│      3V3                     ├─────────────►│ VCC                │
│                              │              │                    │
│      EXAMPLE_PIN_NUM_SCLK    ├─────────────►│ CLK                │
│                              │              │                    │
│      EXAMPLE_PIN_NUM_MOSI    ├─────────────►│ DIN                │
│                              │              │                    │
│      EXAMPLE_PIN_NUM_EPD_RST ├─────────────►│ RST                │
│                              │              │                    │
│      EXAMPLE_PIN_NUM_EPD_DC  ├─────────────►│ DC                 │
│                              │              │                    │
│      EXAMPLE_PIN_NUM_EPD_CS  ├─────────────►│ CS                 │
│                              │              │                    │
│      EXAMPLE_PIN_NUM_EPD_BUSY│◄─────────────│ BUSY               │
└──────────────────────────────┘              └────────────────────┘

The GPIO number used by this example can be changed in main.c.

Software configuration

  • Change all the EXAMPLE_PIN macro definition according to your hardware connection.
  • Select the display model in esp_lcd_panel_ssd1681.h. Supported displays are 1.54 inch 200x200 and 2.7 inch 176x264. The 2.7 inch display has a SSD1680 controller.
  • If you are not using waveshare 1.54 inch V2 e-paper panel, please use the waveform lut provided by your panel vendor instead of using the demo built-in ones, or just simply comment out the epaper_panel_set_custom_lut call and use the panel built-in waveform lut. NOTE: Waveshare and GooDisplay epaper displays can default to use built-in LUT.

Build and Flash

Run idf.py -p PORT build flash monitor to build, flash and monitor the project.

The first time you run idf.py for the example will cost extra time as the build system needs to address the component dependencies and downloads the missing components from registry into managed_components folder.

(To exit the serial monitor, type Ctrl-].)

See the Getting Started Guide for full steps to configure and use ESP-IDF to build projects.

Example Output

...
I (310) epaper_demo_plain: Initializing SPI Bus...
I (320) epaper_demo_plain: Initializing panel IO...
I (330) gpio: GPIO[9]| InputEn: 0| OutputEn: 1| OpenDrain: 0| Pullup: 0| Pulldown: 0| Intr:0 
I (330) epaper_demo_plain: Creating SSD1681 panel...
I (340) gpio: GPIO[4]| InputEn: 0| OutputEn: 1| OpenDrain: 0| Pullup: 0| Pulldown: 0| Intr:0 
I (350) lcd_panel.epaper: Add handler for GPIO 18
I (350) gpio: GPIO[18]| InputEn: 1| OutputEn: 0| OpenDrain: 0| Pullup: 0| Pulldown: 1| Intr:2 
I (360) epaper_demo_plain: Resetting e-Paper display...
I (490) epaper_demo_plain: Initializing e-Paper display...
I (610) epaper_demo_plain: Turning e-Paper display on...
I (720) epaper_demo_plain: Drawing bitmap...
...

Show Test Images

Images are found in img_bitmap.c and bitmaps_176x264.c. If you want to test other size panels you should make your own bitmap image files. Choosing the display (see Software COnfiguration) also selects an appropriate test image.

As you could see from the demo, each bitmap is stored as an array. If you want to display your custom image, you need to convert your image to a bitmap array first.

Monochrome as the panel is, every bit (not byte) of the array corresponds to a pixel of the e-paper panel.

You could convert your image to bitmap array by the following steps:

  • Resize your image to the size you want.
  • Go to the LVGL Online Image Converter website
  • Upload your resized image.
  • Select the Color format to CF_ALPHA_1_BIT, select the Output format to C array.
  • You could select the Dither images (can improve quality) to get better (gray-scale like) image quality
  • Do not select the Output in big-endian format option.
  • Click Convert and you get a .c file containing the bitmap array.

Programs image2cpp or img2cpp can generate bitmap.c files from JPEG or PNG inputs. There are plenty of software alternative with such functionality, please pay attention to the scan mode if you prefer to use them.

The driver writes bitmap array to the vram in the sequence below by default:

scan_mode

Please make sure that the scan mode identical to the image above. Otherwise you might have to mirror or rotate the bitmap using software implemented functions.

Troubleshooting

  • Why the e-paper is not displaying properly?
    • Maybe your GPIO pin num is not correctly set, check in main.c.
    • Maybe your waveform lut is incorrect, try stop using your custom waveform lut.