Go Down

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

luki_v11

Thank you Jean-Marc!

I will have a look. Have a nice day!

Lukas

david_ng

#2176
Nov 22, 2020, 04:45 am Last Edit: Nov 22, 2020, 07:32 am by david_ng
I try to show to 2 row of text in different font style and size, changing position with partial update with deep sleep
in TTGO T5 v2.3 ESP32 with its 2.13 inch eink display.
I am using GxEPD2 v1.2.13

I have this problem in the below simple demo code.
click to view the problem demo image.
while I display the current frame font, and it is 100% clear.
however you will see the previous frame "hello world" still like 30% visible after I refresh the whole screen with background white.
but the previous previous frame is not visible, so I am sure this is a program issue, not the eink issue.
do you know what I did wrong?

Code: [Select]
#define ENABLE_GxEPD2_GFX 0
#include <GxEPD2_BW.h>
#include <Fonts/FreeSansBold12pt7b.h>
#include <Fonts/FreeSerifBoldItalic12pt7b.h>

// TTGO T5 v2.3 with 2.13 eink
GxEPD2_BW<GxEPD2_213_B73, GxEPD2_213_B73::HEIGHT> display(GxEPD2_213_B73(/*CS=5*/ SS, /*DC=*/ 17, /*RST=*/ 16, /*BUSY=*/ 4)); // GDEH0213B73

RTC_DATA_ATTR int bootCount = 0;
#define uS_TO_S_FACTOR 1000000  /* Conversion factor for micro seconds to seconds */

int TIME_TO_SLEEP = 5;
int box_width = 50;


void setup()
{
  Serial.begin(115200);
  delay(1000); //Take some time to open up the Serial Monitor

 
  if (bootCount == 0)
  {
    display.init(115200); // uses standard SPI pins, e.g. SCK(18), MISO(19), MOSI(23), SS(5)
  }
  else
  {
    display.init(115200, false); // uses standard SPI pins, e.g. SCK(18), MISO(19), MOSI(23), SS(5)
  }
 
 
  display.setTextColor(GxEPD_BLACK);
  display.setPartialWindow(0, 0, display.width(), display.height());
 

  int x = random(0, display.width() - box_width);
  int y = random(0, display.height() - box_width*2);
 
 

  display.firstPage();
  do
  {
    display.fillScreen(GxEPD_WHITE);

    display.setFont(&FreeSansBold12pt7b);
    display.setCursor(x, y);
    display.print("Hello");

   
    display.setFont(&FreeSerifBoldItalic12pt7b);
    display.setCursor(x, y+30);
    display.print("World");
  }
  while (display.nextPage());
 

  // do not use   display.hibernate()   , as previous screen shadow will show after wake up.
  display.powerOff();

 
  //Increment boot number and print it every reboot
  Serial.println("Boot number: " + String(++bootCount));

 

  esp_sleep_enable_timer_wakeup(TIME_TO_SLEEP * uS_TO_S_FACTOR);
  Serial.println("set to sleep for every " + String(TIME_TO_SLEEP) + " Seconds");
  Serial.flush();
  esp_deep_sleep_start();
}

void loop() {};

ZinggJM

#2177
Nov 22, 2020, 09:38 am Last Edit: Nov 22, 2020, 09:46 am by ZinggJM
@david_ng,

thank you for your example! I didn't know about RTC_DATA_ATTR.

I don't like the 2.31" e-paper displays. They all have some quirk. And I put all TTGO boards aside.

I tested your example with a GDEH0213B73 on a Wemos LOLIN Lite. It works fine.
There is a faint ghost effect, nearly invisible. But this is normal with differential refresh.

I see the ghosting on your picture. This looks like the waveform is not optimal for your panel.
You could check to see if the example or library of TTGO uses a waveform table different from GxEPD2.
GxEPD2 uses the waveform table from the Good Display demo. Looks like the controller doesn't have waveform table in OTP, like all older controllers.
You could also check your example without processor deep sleep, it might show the same ghosting.

You could report the inking on the flex connector of the panel, if it is visible, so I can compare to mine.

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.

david_ng

#2178
Nov 22, 2020, 11:56 am Last Edit: Nov 22, 2020, 12:16 pm by david_ng
TTGO said their eInk all come from waveshare
the label on 2.13 inch eink disply on the TTGO T5 v2.3 is
HINK - E0213A22 - A0
SLH 2028

I test my code with waveahare ESP32 driver board + waveahare 7.5 inch 800*480 BW
it works fine, no ghosting.

however, when I try to use
TTGO T5v2.3 + waveahare 7.5 inch 800*480 BW, the display dont work, give me timeout error.
but last time it was working... I also try it without extension cable, also dont work. no idea why.

ZinggJM

I have SLH1914. Seems to be a batch number, not the year of production :)



Quote
however, when I try to use
TTGO T5v2.3 + waveahare 7.5 inch 800*480 BW, the display dont work, give me timeout error.
but last time it was working... I also try it without extension cable, also dont work. no idea why.
I assume the TTGO board doesn't have a RESE switch, but a fixed resistor of 3 ohms for the small e-ink displays.
Big panels should have 0.47 ohms. See reference circuit in the panel specs.
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.

david_ng

it was my coding, somehow I don't know where I copy the wrong GxEPD2_BW config, causing the "TTGO T5v2.3 + waveahare 7.5 inch 800*480 BW" don't work.
with the correct info, I am able to confirm the code above test with no ghost on the waveshare 7.5 as well.


GxEPD2_BW<GxEPD2_750_T7, GxEPD2_750_T7::HEIGHT> display(GxEPD2_750_T7(/*CS=5*/ SS, /*DC=*/ 17, /*RST=*/ 16, /*BUSY=*/ 4)); // GDEW075T7 800x480


then I try waveshare e32 driver board + TTGO T5 2.13 inch eInk display.
I put the switch to small eInk side, but the display does not work...

so, how do we find the waveform info of my 2.13 inch eInk display?

david_ng

I finally realize my mistake on the coding, it is the header again

Code: [Select]
// TTGO T5 v2.3 board should use below
//GxEPD2_BW<GxEPD2_213_B73, GxEPD2_213_B73::HEIGHT> display(GxEPD2_213_B73(/*CS=5*/ SS, /*DC=*/ 17, /*RST=*/ 16, /*BUSY=*/ 4)); // GDEH0213B73
//GxEPD2_BW<GxEPD2_750_T7, GxEPD2_750_T7::HEIGHT> display(GxEPD2_750_T7(/*CS=5*/ SS, /*DC=*/ 17, /*RST=*/ 16, /*BUSY=*/ 4)); // GDEW075T7 800x480
void setup()
{
  display.init(115200);

  display.firstPage();
  do
  {
     //
  }
  while (display.nextPage());
}
void loop() {};


// Waveshare ESP32 Driver board should use below
GxEPD2_BW<GxEPD2_213_B73, GxEPD2_213_B73::HEIGHT> display(GxEPD2_213_B73(/*CS=*/ 15, /*DC=*/ 27, /*RST=*/ 26, /*BUSY=*/ 25)); // GDEH0213B73
//GxEPD2_BW<GxEPD2_750_T7, GxEPD2_750_T7::HEIGHT> display(GxEPD2_750_T7(/*CS=*/ 15, /*DC=*/ 27, /*RST=*/ 26, /*BUSY=*/ 25)); // GDEW075T7 800x480
void setup()
{
  display.init(115200);

  // *** special handling for Waveshare ESP32 Driver board *** //
  SPI.end(); // release standard SPI pins, e.g. SCK(18), MISO(19), MOSI(23), SS(5)
  //SPI: void begin(int8_t sck=-1, int8_t miso=-1, int8_t mosi=-1, int8_t ss=-1);
  SPI.begin(13, 12, 14, 15); // map and init SPI pins SCK(13), MISO(12), MOSI(14), SS(15)
  // *** end of special handling for Waveshare ESP32 Driver board *** //
  // **************************

  display.firstPage();
  do
  {
     //
  }
  while (display.nextPage());
}
void loop() {};


after that, the waveshare e32 driver board + TTGO T5 2.13 inch eInk display   is working
but with ghosting, same as with the TTGO T5 v2.3 board.


since I know the display will not have the ghost from previous previous frame.
so I try white the whole screen 2 times, but no help.
Code: [Select]
   display.firstPage();
  do
  {
    display.fillRect(0, 0, display.width(), display.height(), GxEPD_WHITE);
  }
  while (display.nextPage());

  display.firstPage();
  do
  {
    display.fillRect(0, 0, display.width(), display.height(), GxEPD_WHITE);
  }
  while (display.nextPage());
 
  display.firstPage();
  do
  {
    display.fillRect(x, y, box_width, box_width, GxEPD_BLACK);
  }
  while (display.nextPage());


I also try, write it two times, no help
Code: [Select]
  display.firstPage();
  do
  {
    display.fillScreen(GxEPD_WHITE);
    display.fillRect(x, y, box_width, box_width, GxEPD_BLACK);
  }
  while (display.nextPage());

  display.firstPage();
  do
  {
    display.fillScreen(GxEPD_WHITE);
    display.fillRect(x, y, box_width, box_width, GxEPD_BLACK);
  }
  while (display.nextPage());


also try power off and init with partial update again, no help
Code: [Select]
  display.powerOff();
  display.init(115200, false);
  display.powerOff();


the question become
why the previous previous frame has no ghosting...
but the previous frame has ghosting...

luki_v11

Hi Jean-Marc

I build a small Test-Script to convert PNGs to Bitmaps on the Server. 
I have an ESP32 Waveshare Driver Board and this 3-Color eink Display.

This works fine with 2-colors.
https://www.vision11.ch/web/inklay/convertbmp2col.php

And also 3-colors:
https://www.vision11.ch/web/inklay/convertbmp3col.php

I use the Imagemagick Library with the following command:
Code: [Select]
    exec('/usr/bin/convert inklay.png -resize 800x600^ -gravity center -extent 800x480 -ordered-dither o2x2 -define dither:diffusion-amount=85% -remap eink-3color.png BMP3:inklay.bmp');


I then load the image with your wifi-Example code. This works also fine but i just get a black-white image.
The red color is missing.

This is the image i am loading:
https://www.vision11.ch/web/inklay/inklay.bmp

Do you have an idea or can you check if the .bmp is in the correct format?

Thank you,
Lukas

ZinggJM

#2183
Nov 23, 2020, 05:03 pm Last Edit: Nov 23, 2020, 05:06 pm by ZinggJM
@luki_v11,

there is something very strange with your link: https://www.vision11.ch/web/inklay/inklay.bmp

If I right-click and open it in a new tab, I see a totally different picture than if I right-click and "save link as" and then open it. The saved file has depth 1 and is b/w only. Issue with your webserver?
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.

luki_v11

Hi Jean-Marc

It should look like this: 
https://vision11.ch/share/temp/inklay-picture.png

Somehow the pictures get cached. I always have to force-reload to really get the picture i want.

Anyway here is a .zip of that picture:
http://vision11.ch/share/temp/inklay.bmp.zip

Lukas

ZinggJM

What depth is reported when the color is missing? I have not time to analyze your issue.
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.

david_ng

Hi @ZinggJM

I use the waveshare ESP32 driver board + sd card module.
connect them like
http://wei48221.blogspot.com/2018/11/esp32-working-with-sd-card.html
use the code in above website works.

but the problem when I use the SD card with this board with GxEPD2.
in the below demo code, the SD card also fail to init.
I know it is relate to the SPI.begin that remap the pin, but I don't know how to fix it.
could you help?

Code: [Select]
#define ENABLE_GxEPD2_GFX 0

#include <GxEPD2_BW.h>
#include "FS.h"
#include "SD.h"
#include "SPI.h"
#define SdFile File
#define seekSet seek


GxEPD2_BW<GxEPD2_750_T7, GxEPD2_750_T7::HEIGHT> display(GxEPD2_750_T7(/*CS=*/ 15, /*DC=*/ 27, /*RST=*/ 26, /*BUSY=*/ 25)); // GDEW075T7 800x480


void setup()
{
  Serial.begin(115200);
  
  display.init(115200);

  // ********************************************************* //
  // *** special handling for Waveshare ESP32 Driver board *** //
  SPI.end(); // release standard SPI pins, e.g. SCK(18), MISO(19), MOSI(23), SS(5)
  //SPI: void begin(int8_t sck=-1, int8_t miso=-1, int8_t mosi=-1, int8_t ss=-1);
  SPI.begin(13, 12, 14, 15); // map and init SPI pins SCK(13), MISO(12), MOSI(14), SS(15)
  // *** end of special handling for Waveshare ESP32 Driver board *** //
  // **************************

  Serial.print("Initializing SD card...");
  if (!SD.begin(15))
  {
    Serial.println("SD failed!");
    Serial.flush();
    return;
  }
  Serial.println("SD OK!");
  Serial.flush();
}

void loop(){}



ZinggJM

#2187
Nov 23, 2020, 06:20 pm Last Edit: Nov 23, 2020, 06:59 pm by ZinggJM
@david_ng, I have no solution for this. Maybe you need to use a different HW SPI or SW SPI for SD.
Did you try to wire the SD pins to the same pins the e-paper connector uses, except SS: 13, 12, 14 ?
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.

luki_v11

#2188
Nov 23, 2020, 06:56 pm Last Edit: Nov 23, 2020, 11:00 pm by luki_v11
Hi Jean Marc

This is my console log. Bit Depth is 4. I have added some Serial.Prints inside the Loop "Create Full Buffer".

Lukas
Code: [Select]
Connecting to WiFi ...
Connected to the WiFi network
Connect to server via port 443
Connected to server!
Waiting for response ...
valid connection: HTTP/1.1 200 OK

headers received
File size: 235842
Image Offset: 118
Header size: 40
Image size: 880x528
16346248831
Bit Depth: 4
Compression Method: 0
Lukas: Bit Depth is with color
Lukas: Depth Loop is running
Lukas: Depth Loop is running
Lukas: Depth Loop is running
Lukas: Depth Loop is running
Lukas: Depth Loop is running
Lukas: Depth Loop is running
Lukas: Depth Loop is running
Lukas: Depth Loop is running
Lukas: Depth Loop is running
Lukas: Depth Loop is running
Lukas: Depth Loop is running
Lukas: Depth Loop is running
Lukas: Depth Loop is running
Lukas: Depth Loop is running
Lukas: Depth Loop is running
Lukas: Depth Loop is running
_PowerOn : 82001
_Update_Full : 20106001
downloaded in 31874 ms
bytes read 232438
_Update_Full : 20105000
_PowerOff : 223001


Result: Only B/W Image is drawn to the Screen. 

Update:
The Color Buffer is empty. I have tested it with:
Code: [Select]
display.writeImage(output_row_color_buffer, output_row_color_buffer, x, yrow, w, 1);

I tried also with indexed 4bit and 24bit Bitmaps.

Question 1:
What are the requirements for the 3-color bitmap format? Does it need to have indexed colors with depth < 16? Or is a 24 bit RGB bitmap also ok? I have trouble to understand this from the code. 

luki_v11

Found the issue, i forgot to pass the
Code: [Select]
with_color = true;
 into
Code: [Select]
loadBitmapFromHTTPS

Everything working fine now!

Go Up