Extension to two displays
2 minute read
Intro
In this part, the esp32 software will be extended to control two displays. The described solution mainly comes because of the great support from the creator of gxEPD2, so credits to him.
Hardware struggles
The used 7.5 inch display, comes with an e-Paper Driver HAT. When connecting it as intended - 3.3V of this ESP32 connected to the 3.3 V of the e-paper HAT - it turns out very unreliable. It becomes more unreliable when combining more than one e-paper to the display (or it can be my cognitive bias).
The solution is to bypass the voltage converter and directly connect the 3.3V from the ESP32 according the picture below (see scematics):
Software ESP32
SPI
One common SPI is used for both displays; the busy, reset and CS pin are separate pins for each display. (Using two different SPI’s for both displays, was too much work to make it work.)
#define ENABLE_GxEPD2_GFX 1
#include <GxEPD2_BW.h>
//SPI pins, common for both displays
static const uint8_t EPD_DC = 22; // to EPD DC
static const uint8_t EPD_SCK = 18; // to EPD CLK
static const uint8_t EPD_MISO = 19; // Master-In Slave-Out not used, as no data from display
static const uint8_t EPD_MOSI = 23; // to EPD DIN
// display two:
static const uint8_t EPD_BUSY2 = 4; // to EPD BUSY
static const uint8_t EPD_CS2 = 5; // to EPD CS
static const uint8_t EPD_RST2 = 21; // to EPD RST
GxEPD2_BW<GxEPD2_750, GxEPD2_750::HEIGHT> display2(GxEPD2_750(/*CS=*/ EPD_CS2, /*DC=*/ EPD_DC, /*RST=*/ EPD_RST2, /*BUSY=*/ EPD_BUSY2)); // B/W display
//display one:
static const uint8_t EPD_BUSY1 = 25; // to EPD BUSY
static const uint8_t EPD_RST1 = 34; // to EPD RST
static const uint8_t EPD_CS1 = 15; // to EPD CS
GxEPD2_BW<GxEPD2_750, GxEPD2_750::HEIGHT> display1(GxEPD2_750(/*CS=*/ EPD_CS1, /*DC=*/ EPD_DC, /*RST=*/ EPD_RST1, /*BUSY=*/ EPD_BUSY1)); // B/W display
Displaying
Two images are downloaded now, one for each display: black1.bmp and black2.bmp
Full script is available on github.
Software Home assistant
Generate black1.bmp image