Communicate with 2.9" DEPG0290B0 ePaper Module by DKE Group using SPI interface of ESP32 and ESP-IDF or Arduino.
This driver has been developed as preparation for esp32-everest-run-badge project.
Check driver for a similar size display esp-epaper-29-ws by Waveshare.
ePaper displays are great for low power applications. They do not need much energy when operated. They retain the last image at zero energy consumed. You can buy them cheaply as they are produced in high volumes to be used in stores as electronic shelf labels. If your do not need fast update of displayed information, go ahead and use ePaper display for your project! This is what I decided to do. Unfortunately I could not find a driver that would easy integrate into my code. Also documentation how to drive them is still somewhat obscure (December 2017). Fortunately with help of great resources mentioned in Credits I was able to develop the driver I was looking for.
Sample screen with graphics / Arduino driver | Sample screen with graphics / Arduino driver |
Sample screen with graphics / ESP-IDF driver | Sample screen with graphics / ESP-IDF driver |
The quickest way check this software in action is in Arduino environment. It should work with all Arduino boards that have SPI interface. Some concern may be the size of memory to store the image. To display the full memory buffer you need 4736 bytes of RAM. If you do not have enough memory, then you can update display where it changed, using smaller chunks of memory. As this project is oriented to use ESP32 chip, there is no concern, it has more than enough RAM. To load the application use instructions in espressif/arduino-esp32 repository.
To use the example code with ESP-IDF framework, please follow ESP32 Get Started.
Signal Name | ePaper Module | ESP32 |
---|---|---|
Module Busy | BUSY | GPIO22 |
Reset | RST | GPIO23 |
Data / Command | DC | GPIO21 |
Slave Select | CS | GPIO19 |
Serial Clock | CLK | GPIO18 |
Master Out Slave In | DIN | GPIO5 |
Ground | GND | GND |
Power Supply | 3.3V | 3V3 |
Application 'epd2in9-badge.ino' started
Hardware reset done.
Writing LUT done.
Clearing frame memory done.
Displaying frame............. done.
Writing LUT done.
Writing frame memory done.
Displaying frame............. done.
Displaying frame............. done.
Displaying frame............. done.
I (254) ePaper Example: Starting example
I (254) ePaper Example: Before ePaper driver init, heap: 297848
I (274) ePaper Example: e-Paper Display Espressif logo
I (274) ePaper Driver: SPI data sent 70
I (274) ePaper Driver: SPI data sent 4736
I (474) ePaper Driver: SPI data sent 70
I (474) ePaper Driver: SPI data sent 4736
I (6734) ePaper Example: e-Paper Display sample graphics
I (6794) ePaper Driver: SPI data sent 70
I (6804) ePaper Driver: SPI data sent 4736
I (8064) ePaper Example: EPD Display update count: 0
I (8064) ePaper Example: After ePaper driver delete, heap: 302288
I have discovered that there are plenty of similar e-paper displays on the market that look exactly the same, but require some modifications in the driver code. In my case I have modified the following:
- Display initialization sequence in function
iot_epaper_spi_init()
- LUT tables, they differ in size and quantity and dictate how the image is "developed" on the screen
- Commands to to configure image data transfer to the display, two extra functions have been added -
iot_set_ram_area()
andiot_set_ram_address_counter()
. - Commands to show up the image
- Other minor things like configuration of checking the BUSY signal, command to put the ePaper into sleep mode, display resolution, etc.
I have decided to make some updates to the SPI code in original epaper component. In particular I have configured DMA transfer instead of sending image data byte by byte. Also I have removed pre and post transfer delays.
To convert an exiting image to the C header file, use an application recommended by Waveshare in their Wiki. See a picture below what parameters to set. I have discovered that you need to mirror the image and this was not documented in the Wiki.
Feel free to contribute to the project in any way you like!
If you find any issues with code or description please report them using Issues tab above.
This repository has been prepared thanks to great work of the following teams and individuals:
- Espressif team that develops and maintains esp-idf repository
- esp-iot-solution team that developed cleanly coded epaper component for another type of display
- SHA2017 Badge Team, love the hardware and the software you have carefully designed and implemented for SHA2017!
- Waveshare that provides great documentation and demo code for various displays they supply