Waveshare e-paper displays with SPI

C:\Users\xxx\AppData\Local\Arduino15\packages\esp32\hardware\esp32\2.0.5\variants\esp32c3\pins_arduino.h:

static const uint8_t SS    = 7;
static const uint8_t MOSI  = 6;
static const uint8_t MISO  = 5;
static const uint8_t SCK   = 4;

and your constructor parameters need to match your wiring.
Maybe you need to enable "USB CDC on Boot".
Maybe you should use 115200 baud on ESP32.
Use GxEPD2_Example for more meaningful test and diagnostics. It enables diagnostics.

I changed. It works ! ZinggJM Thank you very much. You made me very happy.

static const uint8_t SDA = 4;
static const uint8_t SCL = 5;

static const uint8_t SS    = 7;
static const uint8_t MOSI  = 3;
static const uint8_t MISO  = 10;
static const uint8_t SCK   = 2;

Maybe you need to enable "USB CDC on Boot".

Unfortunately I don't know how to do it.
I Use 115200.
I downloaded the GXEPD2 Example as recommended, the display shows nicely, but unfortunately it does not show anything on the serial monitor.

In menu tab Tools select USB CDC On Boot -> "Enabled".

Seen here for ESP32S3 for T5-4.7 Plus: Get Started — T5-4.7 & T5-4.7 Plus Programming Guide master documentation (t5-47-t5-47-plus.readthedocs.io).

Sorry, I did not notice my oversight.
Works great! again, thank you so much for your tremendous help and patience

_Update_Full : 3831000
_PowerOff : 140000

Success!
Thanks @ZinggJM for a great library.

Although, from the perspective of a newbie, your examples are quite complicated and it took me a while to understand what I should edit.
I've attached my .ino for anyone else (@Luthi), and hopefully it can be used as an even easier example.
Also, for other newbies, MKR series requires double pressing reset button to enter upload mode (with breathing light).

Specs:
Arduino MKR Zero
Waveshare 5.65in 7color
Wiring: BUSY=5, RST=6, DC=7, CS=4, CLK=9, DIN=8

my_GxEPD2_SD_Example.ino (1.6 KB)

Hi @ZinggJM I need your help again. I am doing tests with various processors and I want to power the system from the battery.
I have an esp8266 12F chip only.
GXEPD2 library, BOARD ESP GENERIC 8266 Version 3.0.2.

This is how the chip is connected, after uploading the connection program.
ESP8266 12F EPAPER
GPIO13 DIN
GPIO14 SCK
GPIO15 CS
GPIO0 DC
GPIO2 RST
GPIO4 BUSY

I have chaos in the port monitor

Your "chaos" is boot messages of the processor at 74880 baud. Change baud rate in Serial Monitor to see.
You have a boot mode issue. Read README.md.

My mistake I did not read the instructions. I've added 4k7 PULL DOWN and 1k D4 RST PULL UP resistors and everything works.
Thank you.

Hello :wave:, new guy here - @ZinggJM I have tried to follow all the rules stated in the guidelines and I hope I am contributing as well as asking.

My end goal is to start my e-paper display with a basic output, then (eventually) update parts of the screen with the readouts of some sensors. These sensors will push an update every 10-15 seconds, so I want to be able to update the screen without having to clear the screen and redraw everything.

The example code provided by Waveshare works for a "HelloWorld" but is very limited. It also seems to update very quickly when I make changes. I.e. ~3 seconds for a full update (I haven't tried partial updates yet, I'm hoping these are even quicker and less intrusive (they don't force black/white/black/output type updates)).

Getting started with gxEPD2, using 5.83inch e-Paper HAT and E-Paper Shield was a small challenge having to read through a lot of the pages of this thread. Through a lot of trial and error (and a lot of BusyTimeout! responses) the key to getting any response from the display was related to The "clever" reset functionality "feature".

HelloWorld.ino


display.init(115200, true, 2, false);

GxEPD2_display_selection.h


GxEPD2_BW < GxEPD2_583_T8, GxEPD2_583_T8::HEIGHT / 2 > display(GxEPD2_583_T8(/*CS=D8*/ SS, /*DC=D3*/ 0, /*RST=D4*/ 2, /*BUSY=D2*/ 4)); // GDEW0583T8 648x480, GD7965

GxEPD2_display_selection.h


GxEPD2_BW <GxEPD2_583_T8, MAX_HEIGHT(GxEPD2_583_T8)> display(GxEPD2_583_T8(/*CS=10*/ SS, /*DC=*/ 9, /*RST=*/ 8, /*BUSY=*/ 7)); // GDEW0583T8 648x480, GD7965

*GxEPD2_display_selection.h*

I also tried out the none Universal e-paper Raw Panel Driver Shield versions, among others, before realising there was a shield version (the init() call above was key though). This wasted a lot of time, RTFM is all I can say.

Eureka! I can now make changes to the display!

To be clear, this solution works (again HelloWorld), the value of the libraries from @ZinggJM and Adafruit cannot be understated or underappreciated!

The issue I am having is that from the time I click Upload in the IDE - through to the time the display updates, so far seems to be random. I have included a sample of the output from the serial monitor below, I've added a blank line (turns out formatting here decides otherwise :grin:) between code uploads (assume `_PowerOn' is within 1-3 seconds of the code being uploaded).


22:21:32.792 -> _PowerOn : 174900

22:23:51.594 -> _Update_Full : 6680088

22:26:05.752 -> _PowerOff : 39840

22:47:37.391 -> _PowerOn : 174688

22:50:01.975 -> _Update_Full : 6680344

22:52:22.023 -> _PowerOff : 39876

23:23:57.384 -> _PowerOn : 174688

23:26:21.982 -> _Update_Full : 6680308

23:28:06.587 -> _PowerOn : 171636

23:30:14.497 -> _PowerOn : 184988

23:32:14.857 -> Busy Timeout!

23:32:14.857 -> _Update_Full : 20000636

23:32:34.884 -> Busy Timeout!

23:32:34.884 -> _PowerOff : 20000192

23:32:54.060 -> _PowerOn : 171640

23:35:03.812 -> _Update_Full : 6681468

23:37:08.672 -> _PowerOff : 39852

I've attached my current code for reference.

I'm not sure if this is a hardware issue (i.e. data transmission rates), a software issue, or a combination of both. I'm hoping someone can point me in the right direction.
EInk_Demo.ino (1.5 KB)

Hi @daveo91, welcome to the forum! Thanks for your effort to provide all information!

Maybe you have the RESE switch at the wrong position. It should be 0.47 ohms (B) for your panel.

If you post code, it should be complete and be able to be compiled.
Your GxEPD2_display_selection.h is missing.

The E-Ppaer_Shield_Schematic.pdf doesn't have the "clever reset circuit", as far as I see.
Or do you use the HAT that is available with the panel?

If any of these two options still has problems with the reset pulse, you could pull up the RST line first in setup(), add a short delay(), before calling init(), but use the constructor with -1 for the RST parameter.

I don't have the actual version of any of the two HATs.

You should start with GxEPD2_Example.ino, it does lots of tests, and provides more diagnostics.

Jean-Marc

1 Like

Thank you so much for your help, I am indeed using the HAT, it seems a short delay and pulling up RST has helped a lot so far and set me off in the right direction.

Thanks for your help, and for such an awesome library!

Hello, I'm new here, the level is a beginner.

First of all, I would like to thank @Jean-Marc for his many years of work, which has been going on since 2017!, and for helping us all, when it is certainly not easy at times. I really appreciate it, thank you very much und Vielen Dank!

After reading for a long time this forum, I managed to start the display, everything goes fine, unfortunately all the text is mirror-inverted and I don't know what next to do. I also tried changing the order of the pins, but it had no effect. This problem had also another user, see photo.

My hardware: Wemos D1 Mini
ePaper displej: 10.3inch e-Paper e-Ink Display HAT For Raspberry Pi IT8951, 1872×1404, Black / White, 16 Grey Scales, USB / SPI / I80
link: Waveshare ePaper 10.3" with HAT for Raspberry Pi

Connection (ePaper IT8951 HAT – Wemos D1 Mini):
GND – GND, MISO – D6 (GPIO12), MOSI – D7 (GPIO13), SCK – D5 (GPIO14) , CS – D3 (GPIO0) , RST – D4 (GPIO2) , HRDY – D2 (GPIO4)

Test code:

#include <GxEPD2_BW.h> // including both doesn't use more code or ram
#include <Fonts/FreeSansBold24pt7b.h>

GxEPD2_BW < GxEPD2_it103_1872x1404, GxEPD2_it103_1872x1404::HEIGHT / 8 > display(GxEPD2_it103_1872x1404(/*CS=*/ 0, /*DC=*/ 13, /*RST=*/ 2, /*BUSY=*/ 4));

void setup()
{
  display.init();
  display.setRotation(0);
  // comment out next line to have no or minimal Adafruit_GFX code
  display.setTextColor(GxEPD_BLACK);
  display.firstPage();
  do
  {
    display.fillScreen(GxEPD_WHITE);
    display.setFont(&FreeSansBold24pt7b);
    display.setCursor(400, 400);
    display.print("Hello World!");
  
    display.drawRect(900, 700, 200, 200, GxEPD_BLACK);
  }
  while (display.nextPage());
}

void loop() {};

So questions are:

  1. Does anyone have experience or an idea how to solve mirroring error?

  2. The description shows a wiring example (/CS=15/ EPD_CS, /DC=4/ 4, /RST=5/ 5, /BUSY=16/ 16), but Waveshare's HATs use signals HRDY , RST , CS, MISO, MOSI, SCK , but no DC signal. Is the hardware wiring which I listed before OK? I think that HRDY -> BUSY, RST -> RST, CS -> CS, SCK -> CLK, MOSI -> DIN, GND -> GND and MISO -> DC???

  3. I would like to ask about the possibility to display 16 levels of gray. I found that the GxEPD_HD_16G.h library supports this for the Waveshare ED060SCT on IT8951 Driver HAT. Would it be possible to extend support to a 10.3" display by modifying this library? (10.3" display uses the same HAT, 16 degrees of gray and have just a higher resolution of 1872×1404). I offer help if necessary...

Thank you kindly and have a nice day
John S.

@john_smith_22, Hi John, welcome to the forum!

You report an interesting issue. It is related to this:

The panel I got donated is the flexible one. It shows text normal, not flipped or mirrored.
I think the controller can be commanded to reverse this flipping. I will look at this later.
The code for the 7.8" 1872x1404 and the 10.3" 1872x1404 is identical, except for the vcom value.

In the meantime, you can use this method from GxEPD2_BW.h:

    bool mirror(bool m)
    {
      _swap_ (_mirror, m);
      return m;
    }

From GxEPD2_display_selection.h:

// grey levels parallel IF e-papers on Waveshare e-Paper IT8951 Driver HAT
// HRDY -> 4, RST -> 2, CS -> SS(15), SCK -> SCK(14), MOSI -> MOSI(D7(13)), MISO -> MISO(D6(12)), GND -> GND, 5V -> 5V
// note: 5V supply needs to be exact and strong; 5V pin of USB powered Wemos D1 mini doesn't work!
//GxEPD2_BW<GxEPD2_it60, GxEPD2_it60::HEIGHT / 8> display(GxEPD2_it60(/*CS=5*/ SS, /*DC=*/ 0, /*RST=*/ 2, /*BUSY=*/ 4));
//GxEPD2_BW < GxEPD2_it60_1448x1072, GxEPD2_it60_1448x1072::HEIGHT / 8 > display(GxEPD2_it60_1448x1072(/*CS=5*/ SS, /*DC=*/ 0, /*RST=*/ 2, /*BUSY=*/ 4));
//GxEPD2_BW < GxEPD2_it78_1872x1404, GxEPD2_it78_1872x1404::HEIGHT / 8 > display(GxEPD2_it78_1872x1404(/*CS=5*/ SS, /*DC=*/ 0, /*RST=*/ 2, /*BUSY=*/ 4));

GxEPD2_it103_1872x1404 is missing, I will have to add it.
But I use these panels only with ESP32, because I have a proto-board for ESP32 with 5V and MISO connectors.

DC is not needed. The controller uses a preamble for commands instead.
MISO is not required, but the driver tries to read from the controller for diagnostics.

The 10.3" 1872x1404 most likely will be added to GxEPD_HD sometime, but you can use your display with GxED078KC2 in the meantime. With the same flipping issue.

Jean-Marc

Hi all,
when using the GxEPD2_Wifi_Example.ino the image always seems to be downloaded correctly ('File size' in log always matches actual file size), and it is sometimes displayed correctly, but more often it is only partially displayed: part of the top or part of the bottom is missing. I've used the sample file betty_4.bmp, just to be sure about bitdepth etc. But the behaviour is simaliar when testing with my own images.

Some questions..

  1. What could be causing 'bitmap format not handled'
  2. What is 'image offset' ?
  3. What could be causing 'Busy Timeout!' ?

nb. when the image is displayed completely, there is no message in the log 'bitmap format not handled'. But the message 'Busy Timeout!' is always shown.

Function call:

showBitmapFrom_HTTPS_Buffered(host_bot, path_bot, "betty_4.bmp", fp_bot, w2 - 102, h2 - 126);

Serial monitor:

downloading file "betty_4.bmp"
connecting to neerslagbot.nl
requesting URL: https://neerslagbot.nl/static/img/betty_4.bmp
request sent
HTTP/1.1 200 OK
headers received
loaded in 1360 ms
bitmap format not handled.
_PowerOn : 124995
connecting to neerslagbot.nl
requesting URL: https://neerslagbot.nl/static/img/betty_4.bmp
request sent
HTTP/1.1 200 OK
headers received
File size: 26326
Image Offset: 118
Header size: 40
Bit Depth: 4
Image size: 204x252
bytes read 26326
loaded in 1926 ms
Busy Timeout!
_Update_Full : 20000028
_PowerOff : 1519001
GxEPD2_WiFi_Example done

@djwol, Hi,

This is not the first post from you in this topic. Note that I am too lazy to look at your previous posts to guess what e-paper you have, which processor you use, and how you connected them together. Please post complete information.

Look up BMP formats, e.g. in WikiPedia.

@ZinggJM sorry, was not aware that it was relevant for my question.. :hugs:

It could be relevant for the Busy Timeout.

I just compared my GxEPD2_WiFi_example.ino to the version on GitHub...
There is a known issue...
Opening GxEPD2_WiFi_example.ino took some time, there were some boards updates pending...

There may be a delay after the header part is received. This change should fix it:

  //if (read16(client) == 0x4D42) // BMP signature
  uint16_t signature = 0;
  for (int16_t i = 0; i < 50; i++)
  {
    if (!client.available()) delay(100);
    else signature = read16(client);
    //Serial.print("signature: 0x"); Serial.println(signature, HEX);
    if (signature == 0x4D42) break;
  }
  if (signature == 0x4D42) // BMP signature

I had planned to take another look at the https signatures use issues, so the fix is still pending.

Jean-Marc

Added:
Please also tell the inking you find on the flex connector of the panel, and the panel selected or constructor line you used. Maybe there is a mismatch.

7.5inch e-Paper HAT (B) Manual - Waveshare Wiki

V3 version: Currently shipped version with the same resolution as V2 version, compatible with hardware, software needs to be updated (using V2 routines, routines compatible with V2 and V3 versions, December 2020)

Most likely not supported by GxEPD2.

@ZinggJM thanks. I have tested with the new code and get the same result.
I've included two pictures, do these answer your questions?


Yes. FPC-8612 without anything else is typical for panels from DKE. Some of these panels have markings in the backside electrode of the panel.
None of the 7.5" 3-color panels I have has this inking; they have WFT... or HINK instead.

Hmm, that would be a pitty, any chance of V3 support in the future?

I have compared the serial monitor output for success (left) and partial render (right), see image.
I now understand that the two sequential requests correspond to image being loaded in two parts. When there is no image meta data shown in the log, that part of the image will not be rendered.

If the display V3 is the issue, I do not understand why it sometimes gives 'bitmap format not handled'. The same image is rendered 100% on other tries. I wonder where the randomness is coming from :thinking:

1 Like