Go Down

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

mackjjr

Hey ZinggJM thank you so much for the help! I have everything up and running smoothly. The library is great, kudos for putting all the work in!

cepics

#106
Sep 20, 2017, 09:48 pm Last Edit: Sep 21, 2017, 12:18 am by cepics
tnks for answering..

Quote
I would guess, either your D1 mini clone is broken, or the display.
me too

Quote
Make sure the connector on the display is firmly pushed in; these connectors are made to not get loose on vibrations, and need some force to be pushed in.
done

Quote
https://www.amazon.de/XCSOURCE-Drahtlos-Internet-Entwicklungsboard-TE441/dp/B01ELFAF1S

It looks exactly like the first version of the Wemos D1 mini V1 from Wemos.
I think so too

Quote
look at the signals with a scope or logic analyzer
I've not such competence

Quote
- add or enable debug output for the Serial Monitor; start with uncommenting debug output of the _waitWhileBusy() method in GxGDEH029A1.cpp.
I will try.

tnks a lot

cepics

#107
Sep 20, 2017, 11:48 pm Last Edit: Sep 20, 2017, 11:56 pm by cepics
Code: [Select]
And you can also try u8g2 with your 2.9", caution: it has a different default wiring.

I tried this sketch:

Code: [Select]
#include <Arduino.h>
#include <SPI.h>
#include <U8g2lib.h>

/* Constructor */
//U8G2_UC1701_DOGS102_1_4W_SW_SPI u8g2(U8G2_R0, /* clock=*/ 13, /* data=*/ 11, /* cs=*/ 10, /* dc=*/ 9, /* reset=*/ 8); //demo but not for WaveShare 2.9
//U8G2_IL3820_296X128_1_4W_SW_SPI u8g2(U8G2_R0, /* clock=*/ 13, /* data=*/ 11, /* cs=*/ 10, /* dc=*/ 9, /* reset=*/ 8);  // WaveShare 2.9 inch eInk/ePaper Display, enable 16 bit mode for this display! For Arduino
U8G2_IL3820_296X128_1_4W_SW_SPI u8g2(U8G2_R0, /* clock=*/ D5, /* data=*/ D7, /* cs=*/ D8, /* dc=*/ D2, /* reset=*/ D3);  // WaveShare 2.9 inch eInk/ePaper Display, enable 16 bit mode for this display! For Nodemcu v2 BUSY = D1 - RST = D3 - DC = D2 - CS = D8 - CLK = D5 - DIN = D7 - GND = GND = 3.3V = 3V3




/* u8g2.begin() is required and will sent the setup/init sequence to the display */
void setup(void) {
  u8g2.begin();
}

/* draw something on the display with the `firstPage()`/`nextPage()` loop*/
void loop(void) {
  u8g2.firstPage();
  do {
    u8g2.setFont(u8g2_font_ncenB14_tr);
    u8g2.drawStr(0,20,"Hello World!");
  } while ( u8g2.nextPage() );
  delay(1000);
}


with this setup For Nodemcu v2  (not for d1 mini)

BUSY = D1 - RST = D3 - DC = D2 - CS = D8 - CLK = D5 - DIN = D7 - GND = GND = 3.3V = 3V3

https://github.com/olikraus/u8g2/issues/318#issuecomment-326766349

arduino ide 1.8.4
esp8266 d1 mini clone
waveshare 2inch9 e-paper

I also tried:

Code: [Select]
#include <Arduino.h>
#include <SPI.h>
#include <U8g2lib.h>

/* Constructor */
//U8G2_UC1701_DOGS102_1_4W_SW_SPI u8g2(U8G2_R0, /* clock=*/ 13, /* data=*/ 11, /* cs=*/ 10, /* dc=*/ 9, /* reset=*/ 8); //demo but not for WaveShare 2.9
U8G2_IL3820_296X128_1_4W_SW_SPI u8g2(U8G2_R0, /* clock=*/ 13, /* data=*/ 11, /* cs=*/ 10, /* dc=*/ 9, /* reset=*/ 8);  // WaveShare 2.9 inch eInk/ePaper Display, enable 16 bit mode for this display! For Arduino
//U8G2_IL3820_296X128_1_4W_SW_SPI u8g2(U8G2_R0, /* clock=*/ D5, /* data=*/ D7, /* cs=*/ D8, /* dc=*/ D2, /* reset=*/ D3);  // WaveShare 2.9 inch eInk/ePaper Display, enable 16 bit mode for this display! For Nodemcu v2 BUSY = D1 - RST = D3 - DC = D2 - CS = D8 - CLK = D5 - DIN = D7 - GND = GND = 3.3V = 3V3




/* u8g2.begin() is required and will sent the setup/init sequence to the display */
void setup(void) {
  u8g2.begin();
}

/* draw something on the display with the `firstPage()`/`nextPage()` loop*/
void loop(void) {
  u8g2.firstPage();
  do {
    u8g2.setFont(u8g2_font_ncenB14_tr);
    u8g2.drawStr(0,20,"Hello World!");
  } while ( u8g2.nextPage() );
  delay(1000);
}


 /* clock=*/ 13, /* data=*/ 11, /* cs=*/ 10, /* dc=*/ 9, /* reset=*/ 8 ;  // WaveShare 2.9 inch eInk/ePaper Display, enable 16 bit mode for this display! For Arduino

arduino uno
arduino IDE1.8.4
waveshare 2inch9 e-paper


but nothing happens..

cepics

Quote
- add or enable debug output for the Serial Monitor; start with uncommenting debug output of the _waitWhileBusy() method in GxGDEH029A1.cpp.
this is my new _waitWhileBusy() function:

Code: [Select]
void GxGDEH029A1::_waitWhileBusy(const char* comment)
{
  unsigned long start = micros();
  while (1)
  {
    if (!digitalRead(_busy)) break;
    delay(1);
  }
  if (comment)
  {
    unsigned long elapsed = micros() - start;
    Serial.print(comment);
    Serial.print(" : ");
    Serial.println(elapsed);
  }
}


tried with:

Code: [Select]
// PartialUpdateExample : example for Waveshare 1.54", 2.31" and 2.9" e-Paper and the same e-papers from Dalian Good Display Inc.



and

Code: [Select]
/************************************************************************************
   GxEPD_SPI_IconGrid_Example : test example for e-Paper displays from Dalian Good Display Co., Ltd.: www.good-display.com






arduino IDE 1.8.4
esp8266 d1 mini clone
2inch9 waveshare e-paper display

but nothing....
no error compiling
no activity on e-paper

ZinggJM

#109
Sep 21, 2017, 04:29 am Last Edit: Sep 21, 2017, 04:36 am by ZinggJM
Good, you did uncomment debug output.

But you also need to observe the debug output with Serial Monitor, and report the result.

Maybe you just have bad solder joints on your D1 mini clone. Pins take some energy until the solder flows and makes reliable contact (you can see the capillarity  effect sucking solder into the hole).
I had to discard some STM32 BluePill clones because pins could not be reliably soldered to them.

Or the ESP-12 sub-module is not soldered correctly to the base plate.

See also the feedback posts on the link I posted; I can't believe pins are mis-labeled, but maybe some just don't work on some of these clones.

And you can also try this:

Code: [Select]
void GxGDEH029A1::_waitWhileBusy(const char* comment)
{
  unsigned long start = micros();
  while (1)
  {
    if (!digitalRead(_busy)) break;
    delay(1);
    if (micros() - start > 10000000)
     {
       Serial.println("Busy Timeout!");
       break;
     }
  }
  if (comment)
  {
    unsigned long elapsed = micros() - start;
    Serial.print(comment);
    Serial.print(" : ");
    Serial.println(elapsed);
  }
}


(not checked)
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.

ZinggJM

...
Good to know there is need for AVR support for the 4.2" display; I will add the additions to the smaller displays to the 4.2" as well.
Added additions for AVR support to GxGDEW042T2, same as for the smaller e-papers.

Partial Update on GDEW042T2 with GxGDEW042T2 is suboptimal.

I do not have a waveform table for partial update for this device;
this may be the reason for the slow and not so nice partial update.

Partial Update support for AVR with GxGDEW042T2 works, but is even less optimal. Does it make sense?

For drawPagedToWindow() a page mechanism is used with 5 x 4 tiles of 80x75 pixels each.
This to reduce the number of partial updates to the screen needed per window.

It is better to avoid windows that cross tile boundaries when using this function, for minimal number of partial updates to the screen.

This was an interesting exercise, but mostly a waste of time.
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.

djmusic

Hey, ZinggJM

I'm testing the library GxGDEH029A1 on the Arduino Mega with 2.9inch e-Paper. It very nicely displays images (2.9inch1.jpg).
I needs refreshing to the project. I used some of the code from the example IoT_SHT31LP_Example_1.54inchEPD.ino but something is wrong.

Code: [Select]


void loop()
{

  pot = analogRead(A2);
  wolty();

  //display.drawPaged(wolty);
}


void wolty()
{
  float volt = (pot * 5.0)/1024;
  display.setRotation(3);
  display.fillScreen(GxEPD_WHITE);
  display.setTextColor(GxEPD_BLACK);
  display.setFont(&FreeMonoBold24pt7b);
  display.setTextSize(1);
  display.setCursor(210, 40);
  display.print(volt, 1);
  display.setCursor(210, 80);
  display.print(pot, 1);
  //display.update();
  display.updateWindow(0, 0, GxEPD_WIDTH, GxEPD_HEIGHT, false);
}



By calling wolt() I had to move and set display.setCursor (210, 40) ;. I do not know why with this configuration does not display anything on the screen from position 0 to 210. It looks like I have a screen of 1.54" or less (2.9inch2.jpg)

What I must to do, to display the full screen.


arduino Mega 2560
arduino IDE1.8.1
waveshare 2inch9 e-paper

ZinggJM

#112
Sep 21, 2017, 07:33 pm Last Edit: Sep 21, 2017, 07:43 pm by ZinggJM
Hi djmusic

Congratulation that you found out how to get some output to the screen with your setup.

I deliberately made the examples to compile also with AVR processors, and to produce at least some output.
The IoT_SHT31LP_Example_1.54inchEPD.ino is an exception, it is for ESP8266 only.

AVR processors do not have enough RAM to buffer the whole display content.
Drawing to the buffer will only draw to the available RAM (all Adafruit_GFX methods draw to the buffer).To where drawing occurs is rotation dependent. On update() or updateWindow() to full screen, the content of the buffer is sent to the display, and the remainder is filled with white.
Full screen bitmaps can be drawn directly to the display, so you see the whole bitmap.

For buffered output to the full screen with AVR processors a paged drawing method is available, see example PagedDisplayExampleSmallRam.ino.

With the newest version of the GxEPD library you can also use partial update with AVR, see example PartialUpdateExample.ino

Good luck!

Looking at your code again, it seems you had the solution already:

Code: [Select]


void loop()
{

  pot = analogRead(A2);
  //wolty();

  display.drawPaged(wolty);
  delay(10000); // avoid early death of the display
}


void wolty()
{
  float volt = (pot * 5.0)/1024;
  display.setRotation(3);
  display.fillScreen(GxEPD_WHITE);
  display.setTextColor(GxEPD_BLACK);
  display.setFont(&FreeMonoBold24pt7b);
  display.setTextSize(1);
  display.setCursor(210, 40);
  display.print(volt, 1);
  display.setCursor(210, 80);
  display.print(pot, 1);
  //display.update();
  //display.updateWindow(0, 0, GxEPD_WIDTH, GxEPD_HEIGHT, false);
}
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.

djmusic

Thank you for your answer.

I tested the example you provided earlier. Everything is displayed correctly. Only this blinking is annoying. I know the screen can quickly fall but will not be used for a long time. I guess? ;D

Look at the movies I made.

The first one is from an example, called by display.drawPaged(wolty);

https://youtu.be/uq58pu4cxcs

Second called wolty(); as i said in the previous post.

https://youtu.be/yTpZEocsNBE

In my project, I have the same solution as in the second film. My opinion is definitely better.

PartialUpdateExample.ino example I tested too but for me it was too slow with a larger font. Data will be downloaded from multiple sensors and viewing parties will look bad.

I have an ESP-12-E. Can this solution be implemented on this?

ZinggJM

A picture or a video is better than a thousand words.

But you could also state clearly what you want to achieve.

Your opinion is correct, the partial update is "better", nicer to look at.
You want to use partial update to the whole screen. This works well with enough buffer RAM.
It also works for AVR, using method drawPagedToWindow() to full screen, but this uses 4 pages for 2.9", meaning 4 partial updates to the screen. This takes time, and is purposely slowed a bit by delays, to not stress the display. A lifetime of 12 days is a bit short, see previous posts.

ESP-12E is a normal ESP8266 with enough RAM for the full buffer. Make sure your ESP-12E has all IO pins available.
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.

AETU69

Hi ZinggJM

I am trying to make my 2.9'' to work with my Wemos D1 mini but with no luck.

I tested both of them separately to be sure that they are working. I tested the 2.9'' EPD with WaveShare demo code and a Uno board. Wemos D1 mini is ok with my sketches.

But when I put them together and use your library and examples... Compilation is OK but nothing happens on the EPD.

I use the following

  • Arduino IDE 1.8.1
  • Wemos D1 mini (official)
  • Waveshare 2.9" EPD 3 colors
  • Wiring BUSY -> D2, RST -> D4, DC -> D3, CS -> D8, CLK -> D5, DIN -> D7, GND -> GND, 3.3V -> 3.3V
  • GxEPD_SPI_TestExample.ino  Uncomment #include <GxGDEH029A1/GxGDEH029A1.cpp>

I am problably doing something wrong... Any help would be appreciated.

ZinggJM

Hi AETU69

You are not doing anything wrong, except using a display class created for use with the black/white 2.9" e-paper display.

I do not have the 2.9" black/white/red display, so I have not created a GxEPD class for it.
I have many e-paper displays, as you can see from the GxEPD classes supporting them.
But I only invest in hardware that I either intend to use for myself, or want to learn about.

Sponsors for the e-paper displays (from Waveshare or Dalian Good Display) that I do not yet support are welcome, I would create a GxEPD class for these out of the demo code.

Waveshare and Dalian Good Display both have my address (Jean-Marc Zingg); they would know where to send the 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.

AETU69

Thanks ZinngJM,

Damned that's it !!!
I would be pleased to provide you my 1.54" EPD 3 colors and 2.9" EPD 3 colors if it can help...
Just let me know

Eric

ZinggJM

Thanks ZinngJM,

Damned that's it !!!
I would be pleased to provide you my 1.54" EPD 3 colors and 2.9" EPD 3 colors if it can help...
Just let me know

Eric
Eric

Thank you for your offer, this could help to add the classes for these to the GxEPD library.
For continued support this offer would need to be permanent, as I need to re-test after every update.
I send my address in a personal message, so you can decide.
Or we can wait until a company sees a need or benefit and becomes a sponsor.

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.

mackjjr

#119
Sep 28, 2017, 05:24 am Last Edit: Sep 28, 2017, 05:30 am by mackjjr
Hey ZinggJM - I've been running into a strange issue with drawPaged for the 4.2" WaveShare screen.

When I start up, the first draw to the screen works perfectly well. However, after the first draw, running the same drawPaged call again only refreshes a square area of the screen. It looks like a perfect square, starting 0,0 to about 250,250. And, the area that is refreshed is garbled, and just shows static, if there was supposed to be anything there. If I restart my board, the first draw again works fine, but every one after that is messed up again.

Have you seen anything like this before? Not sure if it is due to something in my code, or something in the actual wiring I have right now, or maybe my screen is just busted.

[Edit] Looks like this happens for all draws, even just a normal display.update, not just drawPaged. I think I might have something mis-wired.

Thanks!

Go Up