1

Please help!

I purchased a 3-inch e-Paper Display from Waveshare, which appeared to suit my project well. The exemplary little code to show an image was easy to set up and to demonstrate functionality:

#include <SPI.h>
#include "epd3in0g.h"
#include "imagedata.h"

Epd epd;

void setup() {
  // put your setup code here, to run once:
  Serial.begin(115200);
  Serial.print("e-Paper init ");
  if (epd.Init() != 0) {
      Serial.print("e-Paper init failed");
      return;
  }

  Serial.print("White \r\n");
  epd.Clear(white);
  delay(2000);

  epd.Init();
  Serial.print("Image \r\n");
  epd.Display(IMAGE_DATA);
  delay(2000);

  epd.Init();
  Serial.print("Small Image \r\n");
  epd.Display_part(IMAGE_DATA, 0 ,0, 168, 400);
  delay(2000);

  epd.Init();
  Serial.print("Clear...\r\n");
  epd.Clear(white);
  delay(2000);

  Serial.print("Goto Sleep...\r\n");
  epd.Sleep();
}

void loop() {

}

I will not just have images displayed, I aim for strings with text and numbers and those partial refreshed. Wild guesses if a

epd.Display_Text('''Hello World''');

might work is pointless. Thus, the existence and usage of possible commands for the epd. appears to me not well documented (or I was unable to find something even after a thoroughly search).

I had a look at other examples using GxEPD libraries and it seemed as a good starting point for me.

Within the GxEPD2 Library it seems a class for 3-inch EPD is missing as it is nowhere declared (I assume there should be something like a GxEPD_300 to set display dimensions etc.).

So, I reckon I need to wrap up something to meet the specs of the 400x168 pixel display but I don't know where to start.

I tried around with the GxEPD_MinimumExample.ino, like

  • replacing the display specific lib with the epd3in0g.h from the example
  • adjusted the right pins according to the Waveshare Wiki
// GxEPD_MinimumExample by Jean-Marc Zingg

#include <GxEPD.h>

// select the display class to use, only one, copy from GxEPD_Example
//#include <GxGDEH0154D67/GxGDEH0154D67.h>  // 1.54" b/w -> from org. example.
#include "epd3in0g.h" //my 3-inch display

#include <GxIO/GxIO_SPI/GxIO_SPI.h>
#include <GxIO/GxIO.h>

// constructor for AVR Arduino, copy from GxEPD_Example else
GxIO_Class io(SPI, /*CS=*/ 10, /*DC=*/ 9, /*RST=*/ 8); // arbitrary selection of 8, 9 selected for default of GxEPD_Class
GxEPD_Class display(io, /*RST=*/ 8, /*BUSY=*/ 7); // default selection of (9), 7

void setup()
{
  display.init();
  display.eraseDisplay();
  // comment out next line to have no or minimal Adafruit_GFX code
  display.drawPaged(drawHelloWorld); // version for AVR using paged drawing, works also on other processors
}

void drawHelloWorld()
{
  display.setTextColor(GxEPD_BLACK);
  display.print("Hello World!");
}

void loop() {};

During the verification prior the upload I get errors pointing back to the libs:

error: 'GxEPD_Class' does not name a type; did you mean 'GxIO_Class'?*

I assume this is because the call to initiate the display is not working.

Thank you for any advice!

2
  • have you ran HelloWorld example?
    – jsotola
    Commented Oct 6, 2023 at 20:17
  • Thank you @jsotola for getting back to me. I edited my question in the hope of clearing thins up. It is now shown at which point the HelloWorld example got stuck (probably due to my modifications).
    – nick
    Commented Oct 7, 2023 at 10:25

1 Answer 1

0

Waveshare examples, by and large, suck. They're usually a bunch of register writes, undocumented. I had to write a library for an EPD once - OEM version, which later popped up on Waveshare's website as their own - and the OEM's documentation and code were good enough (just...) to produce a functional library.

Looking at the example for your specific screen, I see it is indeed the usual SendCommand() crap. Although it seems slightly more evolved, with an Epd class. But still, useless.

EPD code is HARD, and requires a lot of information from the manufacturer. And producing a library that handles text is also a little harder to get right.

I don't think trying to transplant their crappy code onto an existing library is going to work. I figure you have two solutions:

  • Rewrite a library for this epaper from scratch.
  • Half-ass something by adding text handling to their code by converting text to pixels in the buffer, and push that.

In both cases, painful.

3
  • 1
    Thanks @dda for your answer. I was afraid of exactly these circumstances.. However I am unable to write a new library because this would be far beyond my knowledge and skills (for now). The third option for me is to purchase different displays for my project and taking great care for available libs and good examples this time, which I did naively not for those.
    – nick
    Commented Oct 7, 2023 at 10:31
  • waveshare.com/3.52inch-e-paper.htm If you want to stick to Waveshare (and recycle the base plate), get this one. It's b&w only but works weel.
    – dda
    Commented Oct 7, 2023 at 14:30
  • Thank you for the suggestion, I will consider the 3.52inch module.
    – nick
    Commented Oct 7, 2023 at 17:49

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.