Go Down

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

EthanWeise

This is a great library! Thanks JM.

I have a problem displaying grid icons I know this is a very simple thing I guess, but I am stuck on it for a while now.

I am using Arduino UNO and 2.9 e-paper of Waveshare. I got some sample codes working up until I want to display grid icon location

Code: [Select]
#include <GxEPD.h>
#include <GxGDEH029A1/GxGDEH029A1.h>      // 2.9" b/w
#include <GxIO/GxIO_SPI/GxIO_SPI.h>
#include <GxIO/GxIO.h>
// FreeFonts from Adafruit_GFX
#include <Fonts/FreeMonoBold9pt7b.h>
#include <Fonts/FreeMonoBold12pt7b.h>
#include <imglib/gridicons_location.h>
#include GxEPD_BitmapExamples
GxIO_Class io(SPI, /*CS=*/ SS, /*DC=*/ 8, /*RST=*/ 9); // arbitrary selection of 8, 9 selected for default of GxEPD_Class
GxEPD_Class display(io, /*RST=*/ 9, /*BUSY=*/ 7); // default selection of (9), 7
void setup(void)
{
  Serial.begin(115200);
  Serial.println();
  Serial.println("setup");
  display.init(115200); // enable diagnostic output on Serial
  Serial.println("setup done");
  display.setTextColor(GxEPD_BLACK);
  display.setFont(&FreeMonoBold9pt7b);
  display.setRotation(1);
  display.drawBitmap(10, 10, gridicons_location, 24, 24, GxEPD_BLACK);
  showPartialUpdate();
}

void dateValCallback()
{
//  uint16_t box_x = 10;
//  uint16_t box_y = 15;
//  uint16_t box_w = 170;
//  uint16_t box_h = 20;
//  uint16_t cursor_y = box_y + 16;
  display.fillRect(5, 5, 145, 42, GxEPD_WHITE);
  display.setCursor(5, 21);
  display.print("Oct 08 2020");
}

void showPartialUpdate()
{
//  uint16_t box_x = 10;
//  uint16_t box_y = 15;
//  uint16_t box_w = 170;
//  uint16_t box_h = 20;
//  uint16_t cursor_y = box_y + 14;
  display.drawPagedToWindow(dateValCallback, 0, 0, 145, 42);
}




I modified the sample code on PartialUpdateTest and explicitly set some of the values of drawPagedtoWindow and fillRect functions but nonetheless the code is working but the location icon is not showing on the screen.

I am new to this forum and I hope I am doing things right in posting my concerns. Thanks in advance.

ZinggJM

#2116
Oct 13, 2020, 11:59 am Last Edit: Oct 13, 2020, 12:00 pm by ZinggJM
@EthanWeise,

welcome to the Displays section and thank you for using code window and providing all information needed!

For new users or new projects I recommend to use the library GxEPD2, which is also available through Library Manager. You could still #include <GxEPD.h> to have the grid icons available, or you could copy some to your project.

You draw the icon to the graphics buffer. But the graphics buffer is smaller than the screen. So it may be in the buffer or offside; I am too lazy to find out, because of rotation 1. You can check if you call display.update().

You should place drawBitmap() into a callback function and show it on screen using display.drawPaged().

BTW: sorry, I am not so familiar with GxEPD anymore.

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.

valtos

Hi there,

i'm using an LOLIN D32 Pro with an Waveshare IT8951 Driver HAT and an ED060SCT Display.
So long... everything works fine.

But i cannot draw in Grayscale. No Text neither Lines nor Rectangles or something else.
Grayscale only works while drawing a Bitmap onto the screen.

How can i draw with grayscale? How can i print Text with grayscale?
Can i change something in the EPD-Code to make this possible (if it is not possible right now)?

ZinggJM

Hi valtos,

welcome to the forum. I hope you have already noticed and read  General Guidance and How to use the Forum.

So you can draw in b/w to your e-paper display. It would be helpful if you tell what library or code you use.

You might be using GxEPD2, which supports the IT8951 Driver HAT with the ED060SCT display, and is available with Library Manager.

This controller and display combination is not yet supported by GxEPD_HD, and GxEPD_HD doesn't support grey level graphics yet.
This is one of my current projects. But I have no time schedule for it. You would need some patience.

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.

E_Paper_User

Hi Jean-Marc

After you brought up support for the 7-colour E-Ink Display from Waveshare (Release 1.2.12) I was electrified and just bought it.
https://www.waveshare.com/product/displays/e-paper/epaper-1/5.65inch-e-paper-module-f.htm

For now I drive it with an ESP-07.
https://www.bastelgarage.ch/esp-07-esp8266-wifi-serial-modul-micro-controller

First I flashed the GxEPD2_GFX_Example on it to check my wiring. It is working properly as you can see on the attached picture Nr.1

Then I flashed the GxEPD2_WiFi_Example. After editing the WiFi values it is connecting to my WiFi and tries to download the example bmp´s. The first ones from the loop on line 298 can not be loaded.
Code: [Select]
void drawBitmaps_200x200()
{
  int16_t x = (display.width() - 200) / 2;
  int16_t y = (display.height() - 200) / 2;
  showBitmapFrom_HTTPS(host_rawcontent, path_rawcontent, "logo200x200.bmp", fp_rawcontent, x, y);
  delay(2000);
  showBitmapFrom_HTTPS(host_rawcontent, path_rawcontent, "first200x200.bmp", fp_rawcontent, x, y);
  delay(2000);
  showBitmapFrom_HTTPS(host_rawcontent, path_rawcontent, "second200x200.bmp", fp_rawcontent, x, y);
  delay(2000);
  showBitmapFrom_HTTPS(host_rawcontent, path_rawcontent, "third200x200.bmp", fp_rawcontent, x, y);
  delay(2000);
  showBitmapFrom_HTTPS(host_rawcontent, path_rawcontent, "fourth200x200.bmp", fp_rawcontent, x, y);
  delay(2000);
  showBitmapFrom_HTTPS(host_rawcontent, path_rawcontent, "fifth200x200.bmp", fp_rawcontent, x, y);
  delay(2000);
  showBitmapFrom_HTTPS(host_rawcontent, path_rawcontent, "sixth200x200.bmp", fp_rawcontent, x, y);
  delay(2000);
  showBitmapFrom_HTTPS(host_rawcontent, path_rawcontent, "seventh200x200.bmp", fp_rawcontent, x, y);
  delay(2000);
  showBitmapFrom_HTTPS(host_rawcontent, path_rawcontent, "eighth200x200.bmp", fp_rawcontent, x, y);
  delay(2000);
}

I put the serial-monitor Output on the end of this post that you can see whats going on. But I don´t care about the connetction failed issue.

My issue is that the bmp downloaded in line 326 (chanceflurries.bmp) is not displayed as a picture. The Display just shows a line. I attached a picture of it (Nr.2)

Here is the code line, where the bmp it loaded. When I put the link in my broweser I can see the bmp, so the link is working.
Code: [Select]
void drawBitmaps_other()
{
  int16_t w2 = display.width() / 2;
  int16_t h2 = display.height() / 2;
  showBitmapFrom_HTTP("www.squix.org", "/blog/wunderground/", "chanceflurries.bmp", w2 - 50, h2 - 50, false);


First question: Do you have an idea why the picture is only shown as a line? I want to show some bmp´s on the Display. As your example also other bmp´s I tried to load are shown only as a line.

Second question: As you described in the ReadMe for your release 1.2.12 the loading process of the bmp to the display is very slow. Do you have experience if it is significant faster with an ESP32? Which controller would you recommend for faster loding process to the display? A bmp with 24bit and 600x448 pixels takes almost 5min to load with the ESP-07.

As always: Thank you in advance for an answer!




Serial-monitor Output:

14:34:58.171 -> WiFi connected
14:34:58.171 -> xxx.xxx.xxx.xxx
14:34:58.171 ->
14:34:58.171 -> downloading file "logo200x200.bmp"
14:34:58.171 -> connecting to raw.githubusercontent.com
14:34:58.171 -> connection failed
14:35:00.197 ->
14:35:00.197 -> downloading file "first200x200.bmp"
14:35:00.197 -> connecting to raw.githubusercontent.com
14:35:00.197 -> connection failed
14:35:02.191 ->
14:35:02.191 -> downloading file "second200x200.bmp"
14:35:02.238 -> connecting to raw.githubusercontent.com
14:35:02.238 -> connection failed
14:35:04.246 ->
14:35:04.246 -> downloading file "third200x200.bmp"
14:35:04.246 -> connecting to raw.githubusercontent.com
14:35:04.246 -> connection failed
14:35:06.230 ->
14:35:06.230 -> downloading file "fourth200x200.bmp"
14:35:06.230 -> connecting to raw.githubusercontent.com
14:35:06.230 -> connection failed
14:35:08.261 ->
14:35:08.261 -> downloading file "fifth200x200.bmp"
14:35:08.261 -> connecting to raw.githubusercontent.com
14:35:08.261 -> connection failed
14:35:10.273 ->
14:35:10.273 -> downloading file "sixth200x200.bmp"
14:35:10.273 -> connecting to raw.githubusercontent.com
14:35:10.321 -> connection failed
14:35:12.298 ->
14:35:12.298 -> downloading file "seventh200x200.bmp"
14:35:12.344 -> connecting to raw.githubusercontent.com
14:35:12.344 -> connection failed
14:35:14.376 ->
14:35:14.376 -> downloading file "eighth200x200.bmp"
14:35:14.376 -> connecting to raw.githubusercontent.com
14:35:14.376 -> connection failed
14:35:16.403 ->
14:35:16.403 -> downloading file "chanceflurries.bmp"
14:35:16.403 -> connecting to www.squix.org
14:35:16.403 -> requesting URL: http://www.squix.org/blog/wunderground/chanceflurries.bmp
14:35:16.403 -> request sent
14:35:16.450 -> HTTP/1.1 200 OK

14:35:16.450 -> headers received
14:35:16.450 -> File size: 30138
14:35:16.450 -> Image Offset: 138
14:35:16.450 -> Header size: 124
14:35:16.450 -> Bit Depth: 24
14:35:16.450 -> Image size: 99x100
14:35:16.640 -> _PowerOn : 96101
14:35:28.651 -> _Update_Full : 11380673
14:36:48.091 -> downloaded in 91728 ms
14:36:59.490 -> _Update_Full : 11388771
14:36:59.537 -> _PowerOff : 60121
14:36:59.537 -> bytes read 30138






ZinggJM

@E_Paper_User, Hi Michael,

Thank you for reporting these issues; I have no solution unfortunately.

Download from the GitHub sites (https:) doesn't work anymore for me, too.
I will check if this is only with ESP8266 (BearSSL) or on ESP32 as well.

Direct drawing BMP files to controller memory doesn't work with this panel/controller, as this controller has no partial window addressing (direct BMP is written line per line to partial windows of one line).

The workaround doesn't work, because the graphics buffer doesn't fit in ESP8266 memory, so another workaround for paged drawing is used, that doesn't play with the buffered drawing of BMP files.

The workaround would be a change in line 277:

Code: [Select]
  if ((display.epd2.panel == GxEPD2::GDEW0154Z04) || true)
  {
    drawBitmapsBuffered_200x200();
    drawBitmapsBuffered_other();
  }

but this doesn't work with this panel/controller.

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.

klajoh

Hi,
I'm working on a display application that will download an image from a web server and display it on an e-paper display and run it on battery. I'm looking into the GxEPD2 library which looks nifty.  

I've got the a Waveshare 7.5 inch e-ink display with display HAT for Raspberry Pi (V2, 800x480, B/W) (SKU 13504):
https://www.waveshare.com/7.5inch-e-paper-hat.htm

The e-Paper Driver HAT that comes with the above package is Rev2.1.
The switches on the HAT are set as follows: Display Config=B (other), Interface Config=0 (4 line SPI).

I've also got a 2.7 inch e-ink display with display HAT for Raspberry Pi (3 color, 264x176) (SKU 13357):
https://www.waveshare.com/2.7inch-e-paper-hat-b.htm.

I have two boards that I'm trying out:


Both work fine with the smaller (2.7 inch) display (with the GxEPD2 library), but I cannot get either to work with the bigger 7.5 inch display.  Nothing shows up on the screen and I get "BUSY TIMEOUTs" in the serial console printed by the library.  Both screens work fine with a Raspberry Pi and the Waveshare example code.

This is the pin config I've used with the ESP8266:
Code: [Select]
BUSY -> D2, RST -> D1, DC -> D3, CS -> D8, CLK -> D5, DIN -> D7, GND -> GND, 3.3V -> 3.3V

This is constructor I've used with the 2.7 inch and ESP8266 (works):
Code: [Select]
GxEPD2_BW<GxEPD2_270, GxEPD2_270::HEIGHT> display(GxEPD2_270(/*CS=*/ D8, /*DC=*/ D3, /*RST=*/ D1, /*BUSY=*/ D2));

This is the constructor I've used with the 7.5 inch and ESP8266 (does not work) :
Code: [Select]
GxEPD2_BW < GxEPD2_750_T7, GxEPD2_750_T7::HEIGHT / 2 > display(GxEPD2_750_T7(/*CS=*/ D8, /*DC=*/ D3, /*RST=*/ D1, /*BUSY=*/ D2)); // GDEW075T7 800x480

The smaller screen works with the GxEPD2_Example sketch (updates are swift and there are no busy timeouts), but I cannot get the bigger to work.
I.e. I've kept the cabling the same on the ESP board between both of these, and only reprogrammed and moved the white connector from one driver board to the other.
For all combinations I describe here, I'm connecting the colored cables directly to the ESP:s and running everything from the USB cable.

The corresponding for the ESP 32 board:
Code: [Select]
BUSY -> 14, RST -> 32, DC -> 15, CS -> 33, CLK -> SCK/5, DIN -> MOSI/18, GND -> GND, 3.3V -> 3.3V

GxEPD2_BW<GxEPD2_270, GxEPD2_270::HEIGHT> display(GxEPD2_270(/*CS=*/ 33, /*DC=*/ 15, /*RST=*/ 32, /*BUSY=*/ 14));

GxEPD2_BW<GxEPD2_750_T7, GxEPD2_750_T7::HEIGHT> display(GxEPD2_750_T7(/*CS=*/ 33, /*DC=*/ 15, /*RST=*/ 32, /*BUSY=*/ 14)); // GDEW075T7 800x480


Again, the smaller screen works, but I cannot get the bigger to work.
I've yet again used the same pin config that worked on the smaller display when trying the bigger display.

Serial console output for ESP8266 and 7.5 inch display:
Code: [Select]
setup
Busy Timeout!
_PowerOn : 10000480
Busy Timeout!
_Update_Full : 10000395
Busy Timeout!
_PowerOff : 10001100
Busy Timeout!
_PowerOn : 10000820
Busy Timeout!
_Update_Part : 10000747
Busy Timeout!
_Update_Part : 10000946


Serial console output for ESP32 and 7.5 inch display:

Code: [Select]
rst:0x1 (POWERON_RESET),boot:0x12 (SPI_FAST_FLASH_BOOT)
configsip: 0, SPIWP:0xee
clk_drv:0x00,q_drv:0x00,d_drv:0x00,cs0_drv:0x00,hd_drv:0x00,wp_drv:0x00
mode:DIO, clock div:1
load:0x3fff0018,len:4
load:0x3fff001c,len:1044
load:0x40078000,len:8896
load:0x40080400,len:5816
entry 0x400806ac

setup
Busy Timeout!
_PowerOn : 10001016
Busy Timeout!
_Update_Full : 10001014
Busy Timeout!
_PowerOff : 10001014
Busy Timeout!
_PowerOn : 10001014
Busy Timeout!
_Update_Part : 10001013
Busy Timeout!
_Update_Part : 10001015
Busy Timeout!
_Update_Part : 10001015
Busy Timeout!



I've read that there may be some changes to the Waveshare e-Paper Driver HAT board revisions, and that some have had better luck with older versions of the HAT itself (or different brands, like the Goodisplay DESPI-C02 board).

Any ideas on what might be the problem here?

Would be very thankful for any advice that could get me in the right direction.  Thanks!

/Klas

Versions:
  • Arduino IDE 1.8.13
  • GxEPD2 1.2.13
  • esp8266 2.5.0
  • esp32 1.0.4

ZinggJM

#2122
Oct 25, 2020, 06:47 am Last Edit: Oct 25, 2020, 07:16 am by ZinggJM
@klajoh, Hi Klas, Hi All,


In my personal opinion and recommendation: avoid use of the current Waveshare e-paper HAT with 3.3V processors!


The current Waveshare e-paper HAT has 2 issues with 3.3V processors:

The LDO reduces the voltage to a level below specs for the e-paper when fed from 3.3V.
This causes problems especially with the bigger e-paper displays.

The RST line pulled low switches off power to the e-paper. This may cause malfunction of the e-paper controller, as no proper reset can be achieved, and data loss of the controller memory.

You can feed the HAT with 5V, but then you should use at least a series resistor (e.g. 10k) on the BUSY line to protect the processor.

With GxEPD2 you can use the init method with a reset_duration parameter of 2 (ms); this has been reported to help.

Jean-Marc

E-Paper-Driver-HAT-Schematic.pdf
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.

E_Paper_User

Good Mornig Jean-Marc,

thank you for responding so quickly. I understand the problem with the ESP memory is to small for the graphics buffer. Is this also a problem with the ESP32 or does it have enough memory for that? I do not have an ESP32 yet but if it will work (better) I´ll going to buy some.

@klajoh

I agree with Jean-Marc, the new HAT ist weak with 3.3V. I use a (old version 640x384) 7,5" 3-colour Display with an ESP-07 for showing a bmp file that is downloaded all 15min. As deep sleep of the ESP where not very stable I did a workaround with an Texas-Instruments Timer TPL5110. It just switch on a Mosfet that ist feeding the LDO for the ESP and the Dislay. After donwloading the bmp the ESP sends a done signal to the timer and it cuts off everything again. Quietcent current of the timer arround 30nA!

https://www.waveshare.com/product/7.5inch-e-paper-b.htm  (Link is to the newer one)
https://www.bastelgarage.ch/esp-07-esp8266-wifi-serial-modul-micro-controller
https://www.ti.com/lit/ds/symlink/tpl5110.pdf

I had some problems with busy time out as well. For me I changed the wiring and using different Pins. But be aware of the HW SPI Pins. Don´t use them for other signals here.

I recommend you to override the HAT LDO and Levelshifter as you don´t need them with the ESP.

ZinggJM

#2124
Oct 25, 2020, 09:42 am Last Edit: Oct 25, 2020, 10:21 am by ZinggJM
@E_Paper_User,

Quote
Is this also a problem with the ESP32 or does it have enough memory for that?
In the examples you can see that 2 pages are used for ESP32 for the 7 color display.
The native format of the controller is 2 pixels per byte, and GxEPD2_7C.h uses the same format.
600*480/2 is 134'400, which is above the 96k limit for static RAM. And I think the maximum chunk of heap memory is 128k, so this would also not be enough (you could allocate the display instance from heap with new).

I think you can use this display also with b/w only, using GxEPD2_BW.h (or did I forget to implement?), but this is less of interest. :)

Jean-Marc

Addition:

You could download your BMP file to Spiffs, and draw it buffered from Spiffs.
In GxEPD2_Spiffs_Example.ino there is also a function drawBitmapFromSpiffs_Buffered(). I have not tested with the 7 color display, and haven't checked if it works with colors (yet).
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.

klajoh

Hi,

Thanks a lot @ZinggJM and @E_Paper_User for your fast replies and input!

@ZinggJM, I missed the reset_duration in the release notes.  I'm happy to report that the 7.5 inch V2 waveshare screen works with the adafruit feather huzzah32 (ESP32) with this change to the setup() in the GxEPD2_Example:

Code: [Select]
 // before: display.init(115200);
  // now:
  display.init(115200, true, 2, false);


(I haven't tested the wemos d1 mini pro, ESP8266)

@E_Paper_User, I've seen the approach with the timer and I'll keep this in mind. For my application I want the ESP to wake up once every our, at the hour, and refresh the screen. It will download a new image for the next hour over http(s) and my idea is to use the timestamps in the http reply to calculate how long to sleep until waking up the next time.


With this input I can get started on the code, while looking into a reliable HW setup. Yay!

Does anyone have any hints on a good adapter board, preferably within the EU? I've tried to find the Goodisplay DESPI-C02 someplace "local" but so far without success.  I've found sources for the waveshare e-paper driver boards, if that would be an option:
https://www.waveshare.com/e-paper-esp8266-driver-board.htm
https://www.waveshare.com/e-paper-esp32-driver-board.htm


Thanks a lot for the quick assistance!


/Klas

ZinggJM

@klajoh,

Both driver boards are good options. The original ESP8266 driver boards had an issue with use of D0, which is needed for processor deep sleep wake-up. But this seems to be fixed in the actual version.
The ESP32 driver board has an issue with SPI pins used, they need be re-mapped for HW SPI use. There is the example GxEPD2_WS_ESP32_Driver.ino to show how this can be done for GxEPD2.
I would choose the ESP8266 for display only use, the ESP32 for more flexibility with more IO pins and memory.

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.

klajoh


E_Paper_User

@ Jean-Marc

Good point about the SPIFFS example. I will look at it and try it on the 7 colour panel. Thank you!

ZinggJM

#2129
Oct 26, 2020, 05:46 pm Last Edit: Oct 26, 2020, 05:52 pm by ZinggJM
@ Jean-Marc

Good point about the SPIFFS example. I will look at it and try it on the 7 colour panel. Thank you!
Unfortunately, drawBitmapFromSpiffs_Buffered() of GxEPD2_Spiffs_Example.ino is "optimized" for b/w or 3-color.
But changing it for true color shouldn't be too difficult. You could try, else I might do it later.
And for paged drawing the method call would need to be put into a page loop. Needed for the 7-color display.
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.

Go Up