Go Down

Topic: Waveshare e-paper displays with SPI (Read 299291 times) previous topic - next topic

dadokkio

Hi,
I'm successfully using SPI library with GDEW029T5 display and I'm actually able to create nice gui and render pictures.
The only little issue is that my board's display [ https://github.com/sqfmi/badgy ver 2c] supports 4 color (grayscale) so I'm curious if support for 4 color will be implemented.
At the moment I've combined the grayscale example available on the badgy repo with SPI library and I need to switch between them when needed.

Thanks for any reply


ZinggJM

#1711
Feb 19, 2020, 02:51 pm Last Edit: Feb 19, 2020, 02:53 pm by ZinggJM
@dadokkio,

you forgot to mention which library you use! What do you mean by SPI library?

You could take a look at library GxEPD2_4G

Note that this library is experimental.

You would need to download it as ZIP-file, and install it with the Add ZIP-file method of Library Manager.

Jean-Marc
No personal message please; any question may be useful for other users. Use code tags for code. Make links clickable with URL tags. Provide links to the product in question.

dadokkio

Sorry.. the import, based on the main badgy example, at the moment are:

#include <SPI.h>
#include <GxEPD.h>
#include <GxGDEW029T5/GxGDEW029T5.h>
#include <GxIO/GxIO_SPI/GxIO_SPI.h>
#include <GxIO/GxIO.h>

Thanks for the quick reply, I'm going to test that now.

ZinggJM

#1713
Feb 19, 2020, 03:59 pm Last Edit: Feb 19, 2020, 04:23 pm by ZinggJM
@dadokkio,

Quote
I'm successfully using SPI library with GDEW029T5 display
Thanks, now I know what you mean :)

GxEPD is the e-paper display library you use; GxEPD uses the SPI library for the connection through SPI.

Quote
I need to switch between them when needed.
I still don't know what you mean by this.

Now I know. I need to teach each Newbie to provide clickable links to things they mention!

https://github.com/sqfmi/badgy/tree/master/examples/grayscale

This is a standalone example not using an e-paper library.

Please also read General Guidance and How to use the Forum
No personal message please; any question may be useful for other users. Use code tags for code. Make links clickable with URL tags. Provide links to the product in question.

dadokkio

For a first post I've made some mistakes  ::)  .. sorry again.
In any case, you are correct. When I need to plot a 4 color bitmap I had to to reinitialize the display and use all the boilerplate code.

Now it's way better  :D  :D  I just need to change the logic I used to update the display but everything is working.

Thanks again! I'll provide feedback soon.


xetolosch

Hey, I'm new to this stuff. I was trying to run your example code "GxEPD2_Example" but cannot get anything to the e-ink display.

Used hardware:
Waveshare E-Paper ESP32 Driver Board (https://www.waveshare.com/wiki/E-Paper_ESP32_Driver_Board)
Waveshare 4.2inch e-Paper, the raw version without the module (https://www.waveshare.com/wiki/4.2inch_e-Paper_Module)
Connected directly over the e-paper connector.

In your code I did uncomment the line:
GxEPD2_BW<GxEPD2_420, GxEPD2_420::HEIGHT> display(GxEPD2_420(/*CS=5*/ SS, /*DC=*/ 17, /*RST=*/ 16, /*BUSY=*/ 4));
and I commented out all the #include "bitmaps/..." except for the one for 4.2".

Apart from that I did not change anything.

If I see that correctly the pinout needs to be changed, since the e-paper connector uses different pins (https://www.waveshare.com/w/upload/8/80/E-Paper_ESP32_Driver_Board_Schematic.pdf), but even when I change the pins in "GxEPD2_BW<GxEPD2_420, GxEPD2_420::HEIGHT> display(GxEPD2_420(/*CS=5*/ SS, /*DC=*/ 17, /*RST=*/ 16, /*BUSY=*/ 4));" i still cannot get any image to the display.

Does anybody know, what I'm missing out on?

ZinggJM

No personal message please; any question may be useful for other users. Use code tags for code. Make links clickable with URL tags. Provide links to the product in question.

dadokkio

Just a small question, is normal that after a bitmap is rendered with the following code:

Code: [Select]

//image.h
const unsigned char image[18944] = { .... };

//samplecode.ino
display.setFullWindow();
display.firstPage();
do
{
  display.fillScreen(GxEPD_WHITE);
  display.drawImage_4G(image, 4, 0, 0, 128, 296);
}while (display.nextPage());


the display turns white after few milliseconds? There is something I need to do to make the image persistent?

O.T. Can you suggest a valid link or guide to a proper greyscale bitmap -> byte array conversion?
To create the sample image I've used image2lcd as suggested on badgy example but it does not work on linux

ZinggJM

@dadokkio,

It looks like you have still not learned that you need to provide complete information to get any useful answer.

Please always state processor used, library used, e-paper used, and connection board used.

Your code extract provides no clues. Attach the complete code.

Did you try the example?
No personal message please; any question may be useful for other users. Use code tags for code. Make links clickable with URL tags. Provide links to the product in question.

dadokkio

Ok, I'll try to be more precise.
The board is the badgy one, esp8266 and GDEW029T5 as display.

The minimal working code with flashing image is:

Code: [Select]
#define ENABLE_GxEPD2_GFX 1

#include <GxEPD2_4G.h> // needs be first include
#include <GxEPD2_BW.h>
GxEPD2_4G<GxEPD2_290_T5, GxEPD2_290_T5::HEIGHT> display(GxEPD2_290_T5(/*CS=D8*/ SS, /*DC=D3*/ 0, /*RST=D4*/ 2, /*BUSY=D2*/ 4));

#include "grayscale.h"

void setup(){ 
    display.init(115200);
    display.setFullWindow();
      display.firstPage();
      do
      {
          display.fillScreen(GxEPD_WHITE);
          display.drawImage_4G(image, 4, 0, 0, 128, 296);
      }while (display.nextPage());
}

void loop(){}


I've tried to run drawBitmaps128x296 function from  the example with Bitmaps128x296 and it works (the image is 90° rotated but I think beceause badgy display is rotated by default) but even in this case after showing the two images it clears everything.

ZinggJM

@dadokkio,

Ok, now I see the error. I should have seen it in your previous post, but expected something else.

You use a mixture of drawing a bitmap directly to the screen, and clearing the screen using buffered drawing.

See in GxEPD2_4G.h:

// write to controller memory, with screen refresh; x and w should be multiple of 8
Code: [Select]
    // 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)
    {
      epd2.drawImage(bitmap, x, y, w, h, invert, mirror_y, pgm);
    }
    void drawImage_4G(const uint8_t bitmap[], uint8_t bpp, int16_t x, int16_t y, int16_t w, int16_t h, bool invert = false, bool mirror_y = false, bool pgm = false)
    {
      epd2.drawImage_4G(bitmap, bpp, x, y, w, h, invert, mirror_y, pgm);
    }



Try this:

Code: [Select]
#define ENABLE_GxEPD2_GFX 1

#include <GxEPD2_4G.h> // needs be first include
#include <GxEPD2_BW.h>
GxEPD2_4G<GxEPD2_290_T5, GxEPD2_290_T5::HEIGHT> display(GxEPD2_290_T5(/*CS=D8*/ SS, /*DC=D3*/ 0, /*RST=D4*/ 2, /*BUSY=D2*/ 4));

#include "grayscale.h"

void setup(){ 
    display.init(115200);
    display.drawImage_4G(image, 4, 0, 0, 128, 296);
    display.powerOff();
}

void loop(){}


Jean-Marc
No personal message please; any question may be useful for other users. Use code tags for code. Make links clickable with URL tags. Provide links to the product in question.

dadokkio

Thanks! It worked perfectly.
And yes, I need to understand a lot of things better  :)


plo-koon

#1722
Feb 23, 2020, 10:59 am Last Edit: Feb 23, 2020, 11:19 am by plo-koon
Hello @ZinggJM,

First of all, I would like to thank for the great library you have made. I am using it quite a lot and it worked flawlessly so far.
Recently, I have bought a 3-color (yellow) 4.2 e-Paper display from Waveshare. I have tested it with NodeMCU 32S, also bought from Waveshare. I have tried with GXEPD2_Example and GXEPD2_NotPagedExample (even with GXEPD library) but the display is still not functioning properly. It flickers as seen in the attached video. The wiring is the same as the one provided in the example (I have checked it multiple times).

I will be very grateful if you could help me with this display.

P.S. I couldn't compress the video to 2MB MPG, so I am attaching it as a link:
https://1drv.ms/v/s!AkeXa4tRiGJ7ltk6xshYlxNGv8iWxg?e=4yvFfd

ZinggJM

#1723
Feb 23, 2020, 11:52 am Last Edit: Feb 23, 2020, 11:56 am by ZinggJM
@plo-koon,

welcome to the forum. Please read General Guidance and How to use the Forum

This is the first 3-color e-paper you use? Flickering is normal, and refresh time and flickering in your video is normal for 4.2" 3-color e-paper.

You could just search for "3-color e-paper" in the forum to find explanations, e.g.

https://forum.arduino.cc/index.php?topic=436411.msg3547790#msg3547790

https://forum.arduino.cc/index.php?topic=487007.msg3697340#msg3697340

Jean-Marc
No personal message please; any question may be useful for other users. Use code tags for code. Make links clickable with URL tags. Provide links to the product in question.

plo-koon

Hi Jean-Marc,

I want to apologise. I didn't read enough about the 3-color display before buying it and writing in the forum.

This is my first 3-color display. I have used many b/w displays and I've never had any problems with them.

So if it's normal, then it's my mistake. I was expecting similar refresh time to the b/w variant.

Thank you for the help! Great work with the library, its very intuitive and easy to work with.

Sotir

Go Up