ESP32 Heltec wifi LoRa, Waveshare e-Paper 4.2", how to connect via SPI and how to display something on the display (which library to use)?

I am trying to connect a Waveshare e-Paper display via SPI to the ESP32 board, but I can’t get it to work. I am new to the electronics aspect, so I am not sure if I am connecting the pins correctly. Waveshare provides example code for Arduino (https://github.com/soonuse/epd-library-arduino/blob/master/4.2inch_e-paper/epd4in2/examples/epd4in2-demo/epd4in2-demo.ino) but when I flash it to my board the display does not do anything. I can see in the serial output that the sketch is flashing fine and running on the board.

I tried editing the code in the example code where the SPI.begin() happens and pass in the pins I am using. (on this line: https://github.com/soonuse/epd-library-arduino/blob/master/4.2inch_e-paper/epd4in2/epdif.cpp#L60)

After doing that, the code runs past the following block, so it appears the epd.init() works now.

  if (epd.Init() != 0) {
    Serial.print("e-Paper init failed");
    return;
  }

The hardware I am using:

E-Paper display: Waveshare 4.2inch E-Ink display module (https://www.waveshare.com/4.2inch-e-paper-module.htm)

Driver board: ESP32 Heltec wifi LoRa (V1) (https://heltec.org/project/wifi-lora-32/)

ESP32 datasheet: https://resource.heltec.cn/download/WiFi_LoRa_32/WIFI_LoRa_32_V1.pdf

If I am on a wrong path all together or if I am meant to use a different library (I came across GxEPD2 , not sure if I am meant to use that one instead?), please feel free to correct me and point me in the right direction. Any help is much appreciated!

My main questions:

  • How do I connect the SPI display, which Pins to use?
  • Which library to use to display stuff on the display?
  • Example code of how to get started?

Thank you!

Hello, I have read your question, and in response to your question, I will make the following answer:

  1. WIFI_ LoRa_ 32_ V1 default MOSI pin is GPIO27, SCK pin is GPIO5. Other pins are set by yourself.

  2. I’m sorry, I haven’t used this library before.

  3. From the code link with you provided, you maybe use Arduino IDE. Select the corresponding ePaper demo and upload it. If you need to modify the pin, please refer answer 1. If you need to change the image, first get the modulus array of the corresponding image, and change imagedata.h and imagedata.cpp