GxEPD2_PP : Particle Display Library for SPI E-Paper Displays


Ok, I agree. But I need a break from Particle now.


Published Version 1.0.7
drawImage(…) overloaded methods signature matching ambiguity resolved.
drawImage(…) method with b/w and color bitmap has no default parameter values to avoid ambiguity.


Interestingly, the same compiler has no ambiguity issue with a normal class instead of a template class. Example:

// This #include statement was automatically added by the Particle IDE.
#include <GxEPD2_PP.h>

 * Project GxEPD2_PP_BaseExample
 * Description: one step towards a PxEPD2 library
 * Author: Jean-Marc Zingg
 * Date: 10.12.2018

#include <epd/GxEPD2_154.h>
#include <epd3c/GxEPD2_750c.h>
#include "bitmaps/Bitmaps200x200.h" // 1.54" b/w
#include "bitmaps/Bitmaps640x384.h" // 7.5"  b/w

// A5 MOSI
// A4 MISO
// A3 SCK
// A2 SS
// mapping suggestion from Waveshare SPI e-Paper to Particle Photon
// BUSY -> D4, RST -> A0, DC -> A1, CS -> A2, CLK -> A3, DIN -> A5, GND -> GND, 3.3V -> 3.3V
// NOTE: it looks like MISO can't be used as general input pin for BUSY.

//GxEPD2_154 display(/*CS=D5*/ SS, /*DC=*/ A1, /*RST=*/ A0, /*BUSY=*/ D4);
GxEPD2_750c display(/*CS=D5*/ SS, /*DC=*/ A1, /*RST=*/ A0, /*BUSY=*/ D4);

void setup()
   display.drawImage(logo200x200, 0, 0, 200, 200);
   display.drawImage(Bitmap640x384_1, 0, 0, 640, 384);

void loop()

With methods in GxEPD2_750c.h:

    // write to controller memory, with screen refresh; x and w should be multiple of 8
    void drawImage(const uint8_t bitmap[], int16_t x, int16_t y, int16_t w, int16_t h, bool invert = false, bool mirror_y = false, bool pgm = false);
    void drawImage(const uint8_t* black, const uint8_t* red, int16_t x, int16_t y, int16_t w, int16_t h, bool invert = false, bool mirror_y = false, bool pgm = false);


Yup, templating usually makes things a bit messier (less transaprent) and I’m getting out of my own depths with that too :blush: Whenever I use templates I stumble over unexpected implications that have cost me hours to circumvent (let alone understand :flushed:).

But the way how I “understand” (or conviced myself to live with) it is that with templated types the compiler first performs a template instantiation for the potential template types (losing some definitive distinctions in the process due to rule-based action and lack of understanding for the actual code) and with the subsequent template specialisation and on top of that implict conversion (as mentioned above) the risk to “create” and later “find” two somewhat fitting definitions increases “potentially”.

But I’d love if someone with more experience with templates could shed some more light on it for both of us to learn :see_no_evil:


@ZinggJM Firstly, this library is great in terms of getting e-paper displays working. Thanks for placing this on the community libraries.

I have successfully used the library with Photons to drive 3 colour and BW displays of different sizes. I have now just tried to get the same code and library working with a Xenon. All I am getting back is “Busy Timeout” on the serial output and nothing happening on screen. To save me digging into the code would you be able to propose a reason? I am assuming this is something to do with the SPI bus on the Xenon.



Thank you for the feedback, good to know this library is actually used with Particle device(s).

You need to find out which pins to use with Xenon. DIN(MOSI) and CLK(SCK) are given by the standard SPI class for the device. On Arduinos this information is found in pins_arduino.h of the specific board. I forgot where I found the information for my Photon.

For CS the pre-defined SS of the SPI class usually can be used, but you can use any other io pin.

For the other pins any free and available general io pin can be used. Some pins can’t, e.g. if used for boot mode or dedicated for other functions.

The constructor parameters for your board and display need to correspond to your wiring.

If you get busy timeout and no update on the display, then your SPI communication does not work. Or you might have a constant active RST to the display (I should not forget to remember to mention this).

I even had a report from a user that forgot to connect GND!

You can also observe the BUSY line with a voltmeter; the BUSY active time is long enough to notice.


You can also connect it to the D7 pin while it is set to INPUT (or not set at all) and use the onboard LED as indicator.

Probably here


Thanks for those pointers. A bit of a Mea Culpa

I even had a report from a user that forgot to connect GND!

I just realised that I had plugged the GND into the MD pin! I am so used to the Photon where the VIN and GND pins are right next to one another and now there is a space between them.

I tried it again and I get some update going on but no clear write to screen - looks like noise on the screen.

I tried the same code with a Photon and got the same result.

I tried swapping the DESPI-CO2 board and the display and still no output.

Just to confirm the display I have is a Good Display GDEH0213B72 whereas your driver/ Wavetables.h file refers to GxGDE0213B1_LUTDefault_? Is this likely to be a cause?


I don’t know the GDEH0213B72 and can’t actually access the Good Display website. It may use a different controller.


Here is what it says on the GD site!

250*122 resolution 2.13 inch e-paper e-ink display usb GDEH0213B72 substitute for GDEH0213B1
The differences between GDEH0213B72 and GDEH0213B1 :

  1. Different IC driver but be compatible for demo kit
  2. Different parameter but almost be the same

I think I ordered the 0213B1 and got the 0213B72 instead! Could you highlight what you think the parameter differences might be and how I could check they align with the ones in the code?

BTW, Have you ever read the temperature from the display?


Different IC Driver and so new that they don’t provide a link to the driver IC spec. At least the site is accessible again. Maybe it is IL0373. You can verify by trying with GxEPD2_213_flex, it would draw to a part of the display.
If this works, you could adapt the dimension in GxEPD2_213_flex.h. But with Particle libraries this might not be as easy as with Arduino libraries.

No, I have not yet tried. I don’t know if it would work if you connect DIN also to MISO.


For the MISO connection I would need to create my own interface circuit ( I am using their SPI interface adaptors).

I have asked for technical specification (inc. IC driver) for the B72.

I will try what you suggest - not sure I understand your Particle libraries comment. BTW, the library you have posted does not build in the IDE without changes - the #includes do not need “…epd/”. I also use a different GFX library which includes the fonts.


Thank you for the information, I will check. I thought it worked when I checked.
Are you referring to the published GxEPD2_PP library?
I will have to find out how to make changes for test to a published library without publishing the changes before final.

I am still struggling with the Particle development environment, can’t install Particle CLI to this PC, so I am not active for this environment for now.


can’t install Particle CLI to this PC,

I assume you are on Windows 10, in which case try - search for CLI Installing as there are posts on issues experienced with this. https://docs.particle.io/tutorials/developer-tools/cli/#installing


I have tried. And I have posted a topic: Windows CLI Installer fails


Have you tried with the Windows CLI Installer or with npm installs? I have had others issues on Windows and I mostly work off of macOS. I do not have Windows 10 Pro with USB3.0 so I can’t confirm or otherwise whether it works.


As you can see in the other post I tried both. I have enough work to do for my Arduino users, so I leave Particle for now.


@ZinggJM It’s understandable - I wasn’t expecting it to be such a hard challenge. I thank you for all your time and effort that you put into it.


I contacted Good Display and they sent me a demo Arduino code for the GDEH0213B72. It took me about 15 minutes to hack it into Particle compatible but now it works pretty well. The update speed is a huge improvement on the previous displays and I understand they have a new technology in development which improves the speed x2. Link to website documents is here: http://www.e-paper-display.com/products_detail/productId=423.html

I now need to roll this into the Adafruit_GFX library so that I can print nice fonts and primitives rather than display stored images.



You didn’t answer these questions so far. If you used the published GxEPD2 library, how do you use it? With the WEB-IDE or the Desktop IDE or Particle CLI, or the new Visual based IDE?

I am still a beginner with Particle tools, and if you report an issue, even if it is just as BTW, then I need complete information.

I do not know how a user can make changes to a published library, nor how the publisher can do that without publishing a new version. All this is no problem in the Arduino world. But with Particle I can’t even easily test as a different user, as I would need to transfer ownership of my Photon every time.