G6EJD / ESP32-e-Paper-Weather-Display

An ESP32 and 2.9", 4.2" or 7.5" ePaper Display reads Weather Underground data via their API and then displays the weather
Other
946 stars 206 forks source link

Waveshare 4.2, Column goes to grey scale #162

Closed muelli01 closed 2 years ago

muelli01 commented 2 years ago

I have a strange issue with a Waveshare 4.2 display module. This is the module I use: https://www.waveshare.com/product/displays/e-paper/epaper-2/4.2inch-e-paper-module.htm

One column seems to be displayed in gray scale tone, others are black as they should be. Looks like this (highlighted the column): https://postimg.cc/cKW0ZtNp

First I thought the display or controller/driver was faulty, but when I tried a simple "hello world" programm or displayed some bitmap, everything showed black as the other columns. Code on display init seems fine here, so I am quite puzzled on how to fix this. My only idea is, that there is something not 100% correct in the refresh code for this certain display. Might not even be an issue for this repo, but more for gxEPD2? Would appreciate any hint or advice.

G6EJD commented 2 years ago

There are some things to check:

  1. Cabling is correct and making contact, ideally test each connection end-to-end.
  2. All libraries are up-to-date.
  3. Is the display new, like just received, in which case its interface could have been changed.
  4. Try the GxEPD2 test to see if that works.
  5. Examine the display.init line in the code towards the end, some displays require a different initialIsation, there is a note there.
muelli01 commented 2 years ago

Thanks for the hints.

  1. Checked OK
  2. Re-Installed, checked OK
  3. Brandnew, received yesterday. From pictures it does not seem anything changed....
  4. GxEPD2 tests work just fine, that certain column goes to full black during the demos
  5. I tried that already, no success.

During boot/wakeup (display init) I can see the display going full white, then black and that as well turns that column black. That and the GxEPD2 demos and my little hello world test working, I would say a faulty display/controller is not the case here. Which leaves me even more puzzled.

G6EJD commented 2 years ago

OK, it’s puzzling and because I have a test setup I’ve just tried the code and it works as expected. Your using this line in display_init: display.init(115200, true, 2, false);

What is the serial port log saying towards the end, is it taking just 3-4 secs in total or longer, for example if you watch it in real time does it have a pronounced delay before entering sleep.

G6EJD commented 2 years ago

BTW what ESP board type are you using?

muelli01 commented 2 years ago

Your using this line in display_init: display.init(115200, true, 2, false);

Exactly

Serial output from the end:

11:01:21.295 -> _PowerOn : 39001 11:01:22.985 -> _Update_Full : 1517001 11:01:23.051 -> _PowerOff : 19001 11:01:23.051 -> _PowerOff : 0 11:01:23.051 -> Entering 220-secs of sleep time 11:01:23.051 -> Awake for : 5.388-secs 11:01:23.051 -> Starting deep-sleep period...

I use this ESP32 board: https://www.az-delivery.de/products/esp32-developmentboard It is nothing special.

G6EJD commented 2 years ago

OK, nothing strange there then. Unfortunately my display board has no version number on it, it's about 3-months old, but works ok. Try this:#

At line 127: display.display(false); // Full screen update mode

Change it to:

display.firstPage(); do { } while (display.nextPage());

muelli01 commented 2 years ago

Page buffer shows the same result.

edit: my display has Rev 2.1 printed on the back

G6EJD commented 2 years ago

OK, try a delay after: display.firstPage(); do { } while (display.nextPage()); delay(500);

It could be the display is slower now and needs times to complete the display before the ESP goes to sleep.

I notice in the specification that a full refresh takes 4-secs, and yet mine takes ~1-sec, the actual specification was 1.2-secs

muelli01 commented 2 years ago

well I suppose you ment this, right?

display.firstPage(); do { DisplayWeather(); } while (display.nextPage());

Would a delay after showing the buffer even make sense? I tried it and no matter what delay I put there (0.5s - 10s), effect is the same....

G6EJD commented 2 years ago

What display object line have you used?

The delay makes sense because if the display has not completed its update and the cpu goes to sleep before the display completes then it can leave a partial image on the display, giving it time enables it to complete, but it seems it's not that. You can call DisplayWeather() multiples times during the page refresh, but I don't think that is the issue, it is something to do with your new display, but what?

G6EJD commented 2 years ago

I've just checked the GxEPD2 non-paged update example and its identical, to my implementation, so this is not a software issue.

These problems are almost always to do with the Busy line, what are your pin definitions?

muelli01 commented 2 years ago

What display object line have you used?

// Connections for e.g. LOLIN D32 static const uint8_t EPD_BUSY = 4; // to EPD BUSY static const uint8_t EPD_CS = 5; // to EPD CS static const uint8_t EPD_RST = 16; // to EPD RST static const uint8_t EPD_DC = 17; // to EPD DC static const uint8_t EPD_SCK = 18; // to EPD CLK static const uint8_t EPD_MISO = 19; // Master-In Slave-Out not used, as no data from display static const uint8_t EPD_MOSI = 23; // to EPD DIN

GxEPD2_BW<GxEPD2_420, GxEPD2_420::HEIGHT> display(GxEPD2_420(/CS=D8/ EPD_CS, /DC=D3/ EPD_DC, /RST=D4/ EPD_RST, /BUSY=D2/ EPD_BUSY));

Ah OK, got the sense of the delay now. Just preventing an immediate sleep... Display update is reasonably fast around 1s i guess. So it seems it is in the range of your sample.

You can call DisplayWeather() multiples times during the page refresh, but I don't think that is the issue, it is something to do with your new display, but what?

Calling it multiple times makes no difference in theory, as this just fills the pageBuffer (and does not in reallity, I checked). It must have something to do with the display itself, but then again...why are the examples working? Weird.

muelli01 commented 2 years ago

Moved busy from 4 to 34, same result. I guess I just have to live with this phenomenon...

G6EJD commented 2 years ago

Does the GxEPD2_Example.ino work? Does the GxEPD2_NotPagedExample.ino (exactly the same as mine)?

G6EJD commented 2 years ago

There were a few complaints that Waveshare changed the display reset to suit the RPi boards and that stopped microcontroller boards like ESP8266/32 from working with the display, then GxEPD2 was modified to try and get around the problem, with the line: display.init(115200, true, 2, false); So try changing it back to default which is: display.init();

muelli01 commented 2 years ago

edit:

So try changing it back to default which is: display.init();

Already did, still the same.

Got some interesting results on these examples.

First, they both basically work and stuff is shown on the screen. BUT.... ...when an new image is shown, I can see faint shadows of what was before on this screen and the image is slightly grey-ish. Right up until the moment when the time runs out and a new image should be shown. Then, for the last few moments, the image turns to really dark black on those places, where the new image will be show. Even, if those parts of the new image are white, they still turn the old image black at those places. Hard to explain. Check attached foto for what I mean about shadows etc

P1051756 geaendert

I can offer to make a video and upload to youtube, so you see the examples running

G6EJD commented 2 years ago

Video would be good. I’m thinking it’s a faulty display. Is it a Waveshare? If so their warranty is very good even after a few years, they replaced mine if I send pictures.

muelli01 commented 2 years ago

Here is the video of some examples: https://youtu.be/7ORqsbZp_FY

G6EJD commented 2 years ago

And with the weather display?

muelli01 commented 2 years ago

and here a reset cycle of the weather display: https://youtu.be/aOFrm2Vo9JI

Not much to see here :)

G6EJD commented 2 years ago

So the code is working then, if the panel is displaying grey or streaks then it’s faulty you need to contact the supplier.

muelli01 commented 2 years ago

Indeed, they got back to me with some generic code from https://www.waveshare.com/wiki/E-Paper_ESP32_Driver_Board that starts a webserver, lets you select the display and upload an grey/black image and displays it. the complete line goes to grey. It is cleary not a code problem or library problem.

Thanks for your effort!