Waveshare e-paper displays with SPI

p.s. Sorry but I cannot include the library via library manager.

means what?

Did you search for GxEPD2 in Library Manager? Which version of Arduino IDE do you use?

You can also use GxEPD, it is not too old, but GxEPD2 is easier to use.

You wrote you use the Waveshare demo code. Note that the Waveshare demo uses different pins.

ZinggJM:
means what?

Did you search for GxEPD2 in Library Manager? Which version of Arduino IDE do you use?

1.8.3

By the way I included it manually and it works just fine.

You did a great job with GxEPD2! More than nice!

But including via library manager does not function, there is an error occuring while connecting to the library index.

Hy fellow arduino do-it-yourselfers

after reading 66pages iam still struggling to find out where it all went wrong.

The problem:

  • the 4.2inch waveshare color display in combination with the arduino 2560MEGA (as in picture)

I connected everything according to the waveshare wiki page (and every youtube video :wink: )
https://www.waveshare.com/wiki/4.2inch_e-Paper_Module_(B)

but after compiling the demo code and uploading the project the arduino the display doesnt do anything!? :sob:

Did anybody struggle with the same problem? Using resistors and or other voltages solve this problem?

Any advice would be much appreciated.

Read the 66 pages again. Search for MEGA AND e-paper. Don't power on before you have understood about 5V Arduino pins to not connect directly. Note that the Waveshare demo uses different pins than GxEPD and GxEPD2.

Pay attention to where SPI pins are on MEGA.

Arduino MEGA users get on my nerves, trying to use these e-paper displays.

ZinggJM:
Read the 66 pages again. Search for MEGA AND e-paper. Don't power on before you have understood about 5V Arduino pins to not connect directly. Note that the Waveshare demo uses different pins than GxEPD and GxEPD2.

Pay attention to where SPI pins are on MEGA.

Arduino MEGA users get on my nerves, trying to use these e-paper displays.

Hy ZingglM

I do understand that my knowledge regarding arduino is as my status indicates 'newbie'

That's why iam here for, to find Edison Members like you that may have had alike problems and can give helpful advise.

"Pay attention to where SPI pins are on MEGA." Thanks for that info, I will look in to it.

Building a voltage divider should be manageable. I will look in to the pinning

Best Regards
AN

ZinggJM:
Didn't you see the link to this post?

You will kill your display. I said at least series resistors on all data lines, dividers to make it work.

ZinggJM:
Connecting these e-papers to Arduino MEGA

You can use the e-papers with the same mapping suggestion as for Arduino UNO, but CLK(SCK) and DIN(MOSI) need to be connected either to the corresponding pin on the 6 pin ICSP header, or to the SPI pins on the double row header, 52, 51.

Connect the power line to 3.3V and protect the data lines either with level converters or voltage dividers.
Simple series resistors will not work or not work reliable! I use 2/3 voltage dividers with 4k7 to 10k resistors, see picture.

See also post #885

Hello ZinggJM

Sry for my late response.
It's a little bit hard for me to follow the red wires on your board.
How are the connections on the backside of your prototype expansion board?

I've figured out the following connections.
Can you telle me, if correct or wrong?

e-Paper | Arduino

3.3V    | 3V3
GND     | GND
DIN     | D11 and/or ICSP MOSI
CLK     | D10 and/or ICSP SCLK
CS      | D10
DC      | D8
RST     | D9
BUSY    | D13 and/or ICSP MISO

If I use the voltage divider. Is this correct?

Greetings

@TenchiMuyo1984,

you nearly got it, for your Arduino MEGA 2560 (in bold for other readers).

DIN is to MOSI, either on ICSP MOSI or 36 pin header D51 (same pin of MEGA)
CLK is to SCK, either on ICSP SCK or 36 pin header D52 (same pin of MEGA)

CS is to SS, on36 pin header D53 for default parameter SS

BUSY is to D7 for default parameter, can be any other pin, if you change the constructor parameter

CS can be to any other pin, if you change the constructor parameter.
My board also works with UNO, therefore I chose D10.

Your voltage dividers are correct. BUSY doesn't need a divider, but also works with one.
I use the series resistor on BUSY, in case the pin could be set as output be a previously loaded program.

On my proto board I have also connected ISCP MISO, for the connector for a SD card reader.

I use simple solder bridges where I need to connect neighbour points, on the backside.

Thank your for your response.

Is this correct?

e-Paper | Arduino
3.3V    | 3V3
GND     | GND
DIN     | MOSI (on ICSP or D51)
CLK     | SCLK (on ICSP or D52)
CS      | D53 (is not on ICSP)
DC      | <not needed?>
RST     | <not needed?>
BUSY    | D7

Edit:
Can you post the backside please?

Greetings

CS is not on ICSP is correct. Sorry, I didn't check.
DC not needed? is wrong.
RST not needed? is not wrong, but use is recommended.

Edit:
Can you post the backside please?

I could, but don't want to, as Arduino MEGA users get on my nerves and I spend too much time for this.

In my humble opinion it should be enough to tell Arduino MEGA users, they need voltage dividers for data lines, and need to look up where the SPI pins are on Arduino MEGA.
All other pins can be used as suggested for AVR, Arduino UNO.

In the post by TenchiMuyo1984 four posts ago, there is a diagram to use resistors to drive a 3.3v e-paper display from a 5v Arduino. I tried driving the WaveShare 2.13" tri-color display using GxEPD2_Example with the following connections and changes:

// mapping suggestion for AVR, UNO, NANO etc.
// BUSY -> 7, RST -> 9, DC -> 8, CS-> 10, CLK -> 13, DIN -> 11

#include "bitmaps/Bitmaps3c104x212.h" // 2.13" b/w/r
GxEPD2_3C<GxEPD2_213c, MAX_HEIGHT_3C(GxEPD2_213c)> display(GxEPD2_213c(/*CS=10*/ SS, /*DC=*/ 8, /*RST=*/ 9, /*BUSY=*/ 7));

The display faded, but nothing else. What else can I try?

P.S.: I tried posting all of the code, but it exceeded the maximum message size allowed.

Do you use an Arduino UNO or an Arduino MEGA?

Your mapping is correct for Arduino UNO.

For Arduino MEGA the MOSI and SCK pins have different numbers, and SS also.

As your "display has faded", it seems SPI has worked, at least partly.

You should observe diagnostic output in serial monitor; post it using code brackets.

Post a link to your e-paper display. It may be different from the one I have and the code is for.

Hi,

I have got the Adafruit Feather Huzzah ESP 8266 working now with the Waveshare 2.9 Inch E-Paper display. I had tried the previously suggested pin setup but that was giving me a espcomm sync error whenever i tried to do an upload:

// BUSY -> 4, RST -> 2, DC -> 0, CS -> 15, CLK -> 14, DIN -> 13, GND -> GND, 3.3V -> 3.3V

I have it working now with the following pin setup:

// BUSY -> 4, RST -> 2, DC -> 16, CS -> 5, CLK -> 14, DIN -> 13, GND -> GND, 3.3V -> 3.3V

For this to work you need to modify the pin definitions in the libraries/epdif.h file to the following:

// Pin definition
#define RST_PIN 2
#define DC_PIN 16
#define CS_PIN 5
#define BUSY_PIN 4

Hello,
I have problems doing partial update.
My intention is to do something like a clock, however I am not able to do the partial update.
My display is the 1.54inch B or 3 colors.
I already activated the partial mode in the library and the fast partial, I do not notice difference when doing the update.
And with my code, it does not update only part of the screen makes full update.

For example with your library, I am using this code.
Can you help me?

example my code.{

for (int i = 0; i <= 10; i++) {
display.setRotation(1);
display.setFont(&FreeMonoBold9pt7b);
display.setTextColor(GxEPD_BLACK);
display.setPartialWindow(50, 50, 60, 60);
display.setCursor(60, 60);
//display.fillScreen(GxEPD_WHITE);//When I use this function it clears the entire window
display.println(i);
display.nextPage();
}

}

And in your library I changed the following fields:{
void refresh(bool partial_update_mode = true);
static const bool hasPartialUpdate = true;
static const bool hasFastPartialUpdate = false; or true Because my screen is three colors ...
}

Can you help me?

No, nobody can help you.

The 1.54" 3-color e-paper has no partial update capability.

It is the only one of these e-papers that has a controller that has no window addressing capability.

So you can try to cheat in the library source, but this will not help.

If you use the unmodified GxEPD2_Example, it even tells you "no partial update".

I had seen it, but I was hoping it would.

Thank you for your time.

Another question if you can answer
Is there any epaper with color that has this functionality?

Yes, all other small 3-color e-paper displays supported by GxEPD or GxEPD2 have partial update support, but no 3-color has fast partial update, also known as differential update.

BTW, the 1.54" 3-color 154x154 has partial update support, but is only supported by GxEPD, not by GxEPD2, as I don't have it.

See also MyEPDs_UpdateInfos.pdf

Answering ZinggJM's reply to my post:

Do you use an Arduino UNO or an Arduino MEGA?

Your mapping is correct for Arduino UNO.

This if for the Arduino UNO.

As your "display has faded", it seems SPI has worked, at least partly.

You should observe diagnostic output in serial monitor; post it using code brackets.

I use the IDE's built in serial monitor. The baud rate in the Serial.begin(9600) is apparently overridden by the display.init(115200) so that is the rate I use.

C⸮setup
helloWorld
Busy Timeout!
_PowerOn : 20000612
Busy Timeout!
_Update_Full : 20000564
Busy Timeout!
_PowerOff : 20000560
helloWorld done
helloFullScreenPartialMode
Busy Timeout!
_PowerOn : 20000548
Busy Timeout!
_Update_Part : 20000456
helloFullScreenPartialMode done
helloArduino
Busy Timeout!
_Update_Part : 20000408
helloArduino done
helloEpaper
Busy Timeout!
_Update_Part : 20000496
helloEpaper done
Busy Timeout!
_Update_Full : 20000508
Busy Timeout!
_PowerOff : 20000528
Busy Timeout!
_PowerOn : 20000496
Busy Timeout!
_Update_Full : 20000424
Busy Timeout!
_PowerOff : 20000372
Busy Timeout!
_PowerOn : 20000372

It is apparently timing out waiting for the busy line. Am I correct in thinking that this line is from the display to the Arduino? Is it safe to connect this signal directly to the 5v Arduino? I'm thinking that it is because the e-paper outputs 3.3v and this is above the threshold for the Arduino to accept it as a HIGH signal.

Post a link to your e-paper display. It may be different from the one I have and the code is for.

I bought it from eBay, but because I don't know how long a link to that will stick around it is the same as this one from Amazon.

Okay, I put in a bi-directional level-shifter on the BUSY line and now that doesn't time out. The display still doesn't update but I get the following text:

C⸮setup
helloWorld
_PowerOn : 8
_Update_Full : 8
_PowerOff : 8
helloWorld done
helloFullScreenPartialMode
_PowerOn : 8
_Update_Part : 4
helloFullScreenPartialMode done
helloArduino
_Update_Part : 8
helloArduino done
helloEpaper
_Update_Part : 8
helloEpaper done
_Update_Full : 8
_PowerOff : 8
_PowerOn : 12
_Update_Full : 8
_PowerOff : 8
_PowerOn : 8
_Update_Full : 4
_PowerOff : 4
helloWorld
_PowerOn : 8
_Update_Full : 8
_PowerOff : 8
helloWorld done
_PowerOn : 8
_Update_Part : 4
_Update_Part : 8
_Update_Part : 8
_Update_Part : 8
_Update_Part : 8
_Update_Part : 8
_Update_Part : 8
_Update_Part : 4
_Update_Part : 8
_Update_Part : 4
_Update_Part : 8
_Update_Part : 8
_Update_Part : 8
_Update_Part : 8
_Update_Part : 8
_Update_Part : 8
_Update_Part : 8
_Update_Part : 8
_Update_Part : 8
_Update_Part : 8
_Update_Part : 8
_Update_Part : 8
_Update_Part : 8
_Update_Part : 8
_Update_Part : 8
_Update_Part : 8
_Update_Part : 4
_Update_Part : 4
_PowerOff : 8
setup done

I uncommented the Serial.print and Serial.println in the original code which is why there is additional information in the output.

On my breadboard I checked the resistor connections with a multimeter. The resistors are connected as in the schematic above (a few posts ago).

I even went to using all level-shifters, making sure that the BUSY line is still on a bi-directional line. Are there any other lines that need to be bi-directional?

It could be that I applied some wrong voltage and burned out the display (or it arrived with a problem). What else should I try to make sure that it works? I already verified that the Arduino's SPI interface works by attaching another SPI peripheral, but not at the same time.