Getting my Particle Boron to work with a Waveshare E-Paper display

I have been banging my head against this all day. I have a Waveshare 5.83 inch black and white E-Paper display with included HAT I’m trying to use. I’m using GxEDP2, which includes a wonderful example for Particle devices that I’m basing this off of.

No matter what I do, I can’t get anything to display. I’ve tried different pin mappings (outside of the pins that must be the same, like SS, MOSI, etc), new jumper wires, different breadboards, plugging the cables directly into the Boron, older versions of GxEPD – and I just can’t get it to work.

My pin mapping:

  • VCC → 3v3
  • GND → GND
  • DIN → MOSI
  • CLK → SCK
  • CS → SS (A5)
  • DC → A1
  • RST → A0
  • BUSY ← D4
  • PWR → 3v3

My code:

#include "Particle.h"

#include "GxEPD2.h"
#include "GxEPD2_BW.h"
#include "FreeSansBold18pt7b.h"

#define CS_PIN SS
#define DC_PIN A1
#define RST_PIN A0
#define BUSY_PIN D4

GxEPD2_BW<GxEPD2_583, GxEPD2_583::HEIGHT / 2> display(GxEPD2_583(CS_PIN, DC_PIN, RST_PIN, BUSY_PIN));

SYSTEM_MODE(MANUAL); // to prevent trying to connect to network on startup

void setup()
{
  Serial.begin();
  const char text[] = "Hello world!";
  display.init();
  display.setFont(&FreeSansBold18pt7b);
  display.setTextColor(GxEPD_BLACK);
  display.setTextSize(1);
  display.setRotation(0);

  int16_t tbx, tby;
  uint16_t tbw, tbh; // boundary box window
  display.getTextBounds(text, 0, 0, &tbx, &tby, &tbw, &tbh);
  uint16_t x = (display.width() - tbw) / 2;
  uint16_t y = (display.height() + tbh) / 2;
  display.setFullWindow();
  display.firstPage();
  do
  {
    display.fillScreen(GxEPD_WHITE);
    display.setCursor(x, y); // set the position to start printing text
    display.print(text);     // print some text
    Serial.println("tried to display");
    // end of part executed multiple times
  } while (display.nextPage());
}


void loop()
{
  delay(3000);
  Log.info("loop!");
}

It at least isn’t giving me the “Busy timeout” error on serial that I was getting at first, so my hunch is the display is initializing as least somewhat correctly. The switches on the HAT are definitely set to the correct position – “B” display config and “0” interface config (4 line SPI).

Two oddities I’ve noticed:

  • In the library code for GxEPD2_583, it defines the width and height as 600x448, but on Waveshare’s site it’s shown as 648x480. Changing this in the library code didn’t fix things though.

  • The display, over the course of a day of trying different attempts, has slowly developed this gray rectangle, which I have to guess has something to do with display.getTextBounds(), but I can’t say for certain. I tried drawing text in a different spot 10 or so times to see if it anything new showed up but nothing did. Here is an image:

Any help would be appreciated! I have delved into most threads I can find about using these displays, both within the Particle ecosystem and Arduino/ESP32.

I solved it after discovering that the version of GxEPD2 installed through Particle’s package manager is different than the original. The original has GxEPD2_583_T8, which is my display type. So, I removed the version installed by the Particle tooling, downloaded GxEPD2 from Github and moved the library under the lib directory in my project, and it worked like a charm.

5 Likes