Arduino Forum

Using Arduino => Displays => Topic started by: ZinggJM on Jul 02, 2017, 12:01 pm

Title: Waveshare e-paper displays with SPI
Post by: ZinggJM on Jul 02, 2017, 12:01 pm
Hi E-Paper Fans

Waveshare has extended their range of small e-papers with SPI interface.

These e-paper displays are quite easy to use, and Waveshare has wiki pages for them with complete information, schematics, pdf specification, and code example.

Be aware of the difference between e-papers and TFTs: update of e-papers is rather slow, ~1s, so they make sense for slowly changing information.

E-paper display keep showing the information when powered off, and consume little power on update.

This topic is related to topic Good Display ePaper for Arduino (http://forum.arduino.cc/index.php?topic=436411.0)

links:
https://waveshare-developmentkit.aliexpress.com/store/group/e-Paper-E-ink/216233_259057242.html (https://waveshare-developmentkit.aliexpress.com/store/group/e-Paper-E-ink/216233_259057242.html)
http://www.waveshare.com/wiki/1.54inch_e-Paper_Module (http://www.waveshare.com/wiki/1.54inch_e-Paper_Module)
http://www.waveshare.com/wiki/2.13inch_e-Paper_HAT (http://www.waveshare.com/wiki/2.13inch_e-Paper_HAT)

The 1.54 and 2.13 inch Waveshare e-paper modules are also supported by my GxEPD library; they use the same e-paper displays (Dalian Good Display Inc.).

Added support for 2.9 inch e-paper display to GxEPD (GxGDEH029A1) and more.

https://github.com/ZinggJM/GxEPD (https://github.com/ZinggJM/GxEPD)

(http://forum.arduino.cc/index.php?action=dlattach;topic=487007.0;attach=217379)


(http://forum.arduino.cc/index.php?action=dlattach;topic=487007.0;attach=217377)
Title: Re: Waveshare e-paper displays with SPI
Post by: ZinggJM on Jul 13, 2017, 09:23 am
IoT example wiring 1.54inch e-Paper to Wemos D1 Mini:

BUSY->D6(MISO), RST->D4, DC->D3, CS->D8(SS), CLK->D5(SCK), DIN->D7(MOSI), GND->GNG, 3.3V->3.3V

SHT_SCL->D1, SHT_SDA->D2, 5V->300k->A0, D0->0.1k->RST(deep sleep wakeup)

BUSY wired to MISO to free D2 for 2-wire SHT31

2.9inch example:

BUSY->D2, RST->D4, DC->D3, CS->D8(SS), CLK->D5(SCK), DIN->D7(MOSI), GND->GND, 3.3V->3.3V
Title: Re: Waveshare e-paper displays with SPI
Post by: TeK32 on Jul 22, 2017, 10:29 am
This is great, thank you!

Would you care to make your code compatible with the ESP32 as well?
Title: Re: Waveshare e-paper displays with SPI
Post by: ZinggJM on Jul 22, 2017, 06:40 pm
I just got my ESP-32, so this may happen after my short holidays.
Title: Re: Waveshare e-paper displays with SPI
Post by: Helmut_number_one on Jul 22, 2017, 08:41 pm
I'm user from germany, i try your scetch for 1.54 E-paper on wemos and it is running very well, but i will use a german-font.

Did you have a link to the fontgenerator so i will make a german font and perhaps graphic

Best regards, Helmut
Title: Re: Waveshare e-paper displays with SPI
Post by: ZinggJM on Jul 23, 2017, 07:50 am
Hallo Helmut

I am also interested in German fonts, but have no experience so far. Maybe you could ask for help in the German section of the Forum. Or wait for a response from an expert.

Jean-Marc
Title: Re: Waveshare e-paper displays with SPI
Post by: bogus105 on Jul 24, 2017, 02:28 am
Dear ZinggJM,

could you tell us more how to use 2.9inch Waveshare display with Arduino Nano/Uno. Let's leave 5V-3.3V voltage conversion issues.
I don't know pin assignments and library usage:/

I tried to figure out pinout shown in i.e. GxGDEH029A1.cpp file but it is for DESTM32-S2 connection board for STM32 system not for Arduino:/

Please put some light how to talk to WaveShare e-papers from Arduino.

One of the problems i found during compilation is that variable used to store screen resolution is uint8_t. 2.9inch screen has 296 x 128 pixels so 296 is greater that uint8_t can handle so overflow errors appeard. This is just one of the errors.
Title: Re: Waveshare e-paper displays with SPI
Post by: ZinggJM on Jul 24, 2017, 08:05 am
Hi,

I will look at this when I am back home.
Just to be sure what you are referring to: GxEPD library or Waveshare library?

I have not yet tried to use the Waveshare library, as I use Adafruit_GFX.
But Arduino UNO has not enough RAM for full screen buffer, as used in my GxEPD.
As far as I have looked into the Waveshare code, they use a smaller (line-) buffer for text output.
Title: Re: Waveshare e-paper displays with SPI
Post by: ZinggJM on Jul 24, 2017, 02:24 pm
Dear ZinggJM,

could you tell us more how to use 2.9inch Waveshare display with Arduino Nano/Uno. Let's leave 5V-3.3V voltage conversion issues.
I don't know pin assignments and library usage:/

I tried to figure out pinout shown in i.e. GxGDEH029A1.cpp file but it is for DESTM32-S2 connection board for STM32 system not for Arduino:/

Please put some light how to talk to WaveShare e-papers from Arduino.

One of the problems i found during compilation is that variable used to store screen resolution is uint8_t. 2.9inch screen has 296 x 128 pixels so 296 is greater that uint8_t can handle so overflow errors appeard. This is just one of the errors.
I have decided that I will look at your problems as soon as your post is more specific, more clearly stated, and more correct.

My code is generic as far as possible, with target processor specific default values for the constructor.
The DESTM32-S2 connection board is NOT STM32 specific, but its pinout matches the DESTM32-S1 STM32 demo board from Good Display.
Please state which uint8_t variable (name it!) you mean, and what other errors you refer to.
Title: Re: Waveshare e-paper displays with SPI
Post by: bogus105 on Jul 25, 2017, 04:59 am
Thank you ZinggJM for your answer.

You're right there was no much details in my previous post. It was rather indication:)
The only progress i made so far after playing with various libraries was when i modified Waveshare 'string' example found here:
http://www.waveshare.com/wiki/File:2.9inch_e-Paper_Module_code.7z

in arduino/string/ folder.
The following files are in this folder:
Display_Lib.h
EPD_drive.cpp
EPD_drive.h
EPD_drive_gpio.cpp
EPD_drive_gpio.h
string.ino

As you said: Nano doesn't have enough RAM for these files so i included

#include <avr/pgmspace.h>

in two files:
Display_Lib.h
EPD_drive.h

and then i changed big data tables like:

const unsigned char waveshare[4736] = {........ton of data....};

to

const unsigned char waveshare[4736] PROGMEM = {........ton of data....};

Now compilation is errorless.
Loaded things up to Nano and my progress is e-paper screen was cleared (waveshare logo that was on screen when i bought it disappeared).
No test text string was displayed.

On serial monitor i can see this:
-------------------------------------------------
------------Clear full screen-----------------
full init
***********set register Start**********
send data  :
send data  :
send data  :
send data  :
send data  :
send data  :
send data  :
send data  :
send data  :
send data  :
***********set register  end**********
send data  :
Busy is Low

full clear   

send data  :
send data  :
>>>>>>------start send display data!!---------<<<<<<<
Busy is Low

send data1
Busy is Low

full over
***********set register Start**********
send data  :
send data  :
send data  :
send data  :
send data  :
send data  :
send data  :
send data  :
send data  :
send data  :
***********set register  end**********
send data  :
Busy is Low

po operacji clear full
--------------Clear part screen------------
***********set register Start**********
send data  :
send data  :
send data  :
send data  :
send data  :
send data  :
send data  :
send data  :
send data  :
send data  :
***********set register  end**********
send data  :
Busy is Low

>>>>>>------start send display data!!---------<<<<<<<
send data  :
send data  :
send data  :
send data  :
Busy is Low

Busy is Low

send data  :
send data  :
send data  :
send data  :
Busy is Low

po czyszczeniu czesciowym ekranu
h
FFFFFFD5 FFFFFFD5 FFFFFFD5 FFFF
---------------------------------------------------------
and so on. I seems Nano resets itself.

I wonder why BUSY line on display module is low?

The code part that checks this looks like this:

/*******************************************************************************
function:
         read busy
*******************************************************************************/
unsigned char WaveShare_EPD::ReadBusy(void)
{
  unsigned long i=0;
  for(i=0;i<400;i++){
   //   println("isEPD_BUSY = %d\r\n",isEPD_CS);
      if(isEPD_BUSY==EPD_BUSY_LEVEL) {
            Serial.println("Busy is Low \r\n");
         return 1;
      }
     driver_delay_xms(10);
  }
  return 0;
}

In for loop that you can see that during first loop execution BUSY line is compared with EPD_BUSY_LEVEL, if its true "Busy is Low" is printed and the whole ReadBusy procedure is terminated with " return 1; ".
Why this procedure returns 0 or 1 if it is not checked anywhere in the code whether 0 or 1 is returned?

Then i modified main program loop to check BUSY line status: it is LOW all the time. Maybe there is sth wrong with my module?
I checked BUSY line with multimeter and in fact it is 0 V almost all the time:/




Title: Re: Waveshare e-paper displays with SPI
Post by: bogus105 on Jul 25, 2017, 06:52 am
I'm using modified Nano board for 3.3V operation. Brief description is here:

https://forum.arduino.cc/index.php?topic=491012.0
Title: Re: Waveshare e-paper displays with SPI
Post by: ZinggJM on Jul 25, 2017, 07:12 am
Hi bogus105

Please use code tags for code, "</>" at top left, it makes your post more pleasant to read.

You do not provide any info concerning errors, so I forget about those.

When you put data into PROGMEM, you need to read it with the corresponding read function; there are tutorials about this.

The BUSY line is active when the controller takes time for commands, e.g. on update to display.

I have not yet tried to use the Waveshare code; I may do this, but not with UNO or NANO to avoid the need for level converters or series resistors.

Jean-Marc

I may reconsider to try with UNO and NANO, as I just received level converters that I want to use anyway:

https://www.aliexpress.com/item/8-channel-level-conversion-module-two-way-conversion-between-3-3V-and-5V-IO-access-5V/32811827434.html (https://www.aliexpress.com/item/8-channel-level-conversion-module-two-way-conversion-between-3-3V-and-5V-IO-access-5V/32811827434.html)

I think any Arduino UNO or NANO user should have some of those ready at hand, or some other make.
Title: Re: Waveshare e-paper displays with SPI
Post by: ZinggJM on Jul 25, 2017, 02:42 pm
This is great, thank you!

Would you care to make your code compatible with the ESP32 as well?
Yes, I did. I have updated GxEPD on GitHub.

(http://forum.arduino.cc/index.php?action=dlattach;topic=487007.0;attach=220149)
Title: Re: Waveshare e-paper displays with SPI
Post by: ZinggJM on Jul 25, 2017, 07:11 pm
Thank you ZinggJM for your answer.

You're right there was no much details in my previous post. It was rather indication:)
The only progress i made so far after playing with various libraries was when i modified Waveshare 'string' example found here:
http://www.waveshare.com/wiki/File:2.9inch_e-Paper_Module_code.7z

in arduino/string/ folder.
The following files are in this folder:
Display_Lib.h
EPD_drive.cpp
EPD_drive.h
EPD_drive_gpio.cpp
EPD_drive_gpio.h
string.ino

As you said: Nano doesn't have enough RAM for these files so i included

#include <avr/pgmspace.h>

in two files:
Display_Lib.h
EPD_drive.h

and then i changed big data tables like:

const unsigned char waveshare[4736] = {........ton of data....};

to

const unsigned char waveshare[4736] PROGMEM = {........ton of data....};

Now compilation is errorless.
Loaded things up to Nano and my progress is e-paper screen was cleared (waveshare logo that was on screen when i bought it disappeared).
No test text string was displayed.
...
I could compile the Waveshare string example successfully for Arduino UNO and NANO.

The waveshare array is referenced nowhere in the code, and therefore not included in the link process, at least with the actual Arduino IDE 1.8.3.

Do you use an older version of Arduino, or have you done other changes to the code?

I would just ignore your posts, but try to answer, so other users interested in these displays do not become insecure.
Title: Re: Waveshare e-paper displays with SPI
Post by: jpg63 on Jul 26, 2017, 04:49 pm
Hello
I would like to use the "waveshare" 1.54 inch screen with an arduino MKR Zero, do you think this is possible?
Are the changes to be made to your library important?
Title: Re: Waveshare e-paper displays with SPI
Post by: ZinggJM on Jul 26, 2017, 07:05 pm
This should be simple. The device has 32kB RAM, so the ~5kB display buffer is no problem.

I need to fix the GxIO_SPI class for AVR and SAM or all non-ESP processors, and will add SAMD.
I will make sure it compiles with SAMD, and try to check it with my MKR-1000 (sitting idle in some drawer waiting to be used).

I can't promise a deadline, but should be ready in less than a week or so.
Title: Re: Waveshare e-paper displays with SPI
Post by: jpg63 on Jul 26, 2017, 08:37 pm
Thank you
No problem for the delai, it will be a pleasure to use your library when it is ready
Title: Re: Waveshare e-paper displays with SPI
Post by: bogus105 on Jul 28, 2017, 05:45 pm
Sorry i'm not writing everyday ZinggJM nut i'm at work and i can't read this forum every day:)

Youv'e said you compiled Waveshare string example on Uno/Nano with no issues.
How?

I use Arduino IDE 1.6.8

When attempt to compile original 'string.ino' example from waveshare i got error: global variables use 3 313 bytes (161%) od dynamic memory, leaving -1 265 bytes for local variables. Maxiumum is 2 048 bytes.

So 'string' exmple simply won't fit in Uno/Nano:/

I also tried to load an example from your library: GxEPD_SPI_TestExample
The following errors came up:

Code: [Select]


In file included from C:\Users\Raport\Documents\Arduino\libraries\GxEPD-master/GxGDEH029A1/GxGDEH029A1.cpp:31:0,

                 from C:\Users\Raport\Documents\Arduino\libraries\GxEPD-master\examples\GxEPD_SPI_TestExample\GxEPD_SPI_TestExample.ino:37:

C:\Users\Raport\Documents\Arduino\libraries\GxEPD-master/GxGDEH029A1/GxGDEH029A1.h:37:30: warning: integer overflow in expression [-Woverflow]

 #define GxGDEH029A1_Y_PIXELS 296

                              ^

C:\Users\Raport\Documents\Arduino\libraries\GxEPD-master/GxGDEH029A1/GxGDEH029A1.h:41:28: note: in expansion of macro 'GxGDEH029A1_Y_PIXELS'

 #define GxGDEH029A1_HEIGHT GxGDEH029A1_Y_PIXELS

                            ^

C:\Users\Raport\Documents\Arduino\libraries\GxEPD-master/GxGDEH029A1/GxGDEH029A1.h:43:53: note: in expansion of macro 'GxGDEH029A1_HEIGHT'

 #define GxGDEH029A1_BUFFER_SIZE GxGDEH029A1_WIDTH * GxGDEH029A1_HEIGHT / 8

                                                     ^

C:\Users\Raport\Documents\Arduino\libraries\GxEPD-master/GxGDEH029A1/GxGDEH029A1.h:85:21: note: in expansion of macro 'GxGDEH029A1_BUFFER_SIZE'

     uint8_t _buffer[GxGDEH029A1_BUFFER_SIZE];

                     ^

C:\Users\Raport\Documents\Arduino\libraries\GxEPD-master/GxGDEH029A1/GxGDEH029A1.h:85:44: error: overflow in constant expression

     uint8_t _buffer[GxGDEH029A1_BUFFER_SIZE];

                                            ^

C:\Users\Raport\Documents\Arduino\libraries\GxEPD-master/GxGDEH029A1/GxGDEH029A1.h:85:44: error: size of array '_buffer' is negative

C:\Users\Raport\Documents\Arduino\libraries\GxEPD-master/GxGDEH029A1/GxGDEH029A1.cpp: In member function 'virtual void GxGDEH029A1::fillScreen(uint16_t)':

C:\Users\Raport\Documents\Arduino\libraries\GxEPD-master/GxGDEH029A1/GxGDEH029A1.h:37:30: warning: integer overflow in expression [-Woverflow]

 #define GxGDEH029A1_Y_PIXELS 296

                              ^

C:\Users\Raport\Documents\Arduino\libraries\GxEPD-master/GxGDEH029A1/GxGDEH029A1.h:41:28: note: in expansion of macro 'GxGDEH029A1_Y_PIXELS'

 #define GxGDEH029A1_HEIGHT GxGDEH029A1_Y_PIXELS

                            ^

C:\Users\Raport\Documents\Arduino\libraries\GxEPD-master/GxGDEH029A1/GxGDEH029A1.h:43:53: note: in expansion of macro 'GxGDEH029A1_HEIGHT'

 #define GxGDEH029A1_BUFFER_SIZE GxGDEH029A1_WIDTH * GxGDEH029A1_HEIGHT / 8

                                                     ^

C:\Users\Raport\Documents\Arduino\libraries\GxEPD-master/GxGDEH029A1/GxGDEH029A1.cpp:112:28: note: in expansion of macro 'GxGDEH029A1_BUFFER_SIZE'

   for (uint16_t x = 0; x < GxGDEH029A1_BUFFER_SIZE; x++)

                            ^

C:\Users\Raport\Documents\Arduino\libraries\GxEPD-master/GxGDEH029A1/GxGDEH029A1.cpp: In member function 'virtual void GxGDEH029A1::drawBitmap(const uint8_t*, uint32_t)':

C:\Users\Raport\Documents\Arduino\libraries\GxEPD-master/GxGDEH029A1/GxGDEH029A1.h:37:30: warning: integer overflow in expression [-Woverflow]

 #define GxGDEH029A1_Y_PIXELS 296

                              ^

C:\Users\Raport\Documents\Arduino\libraries\GxEPD-master/GxGDEH029A1/GxGDEH029A1.h:41:28: note: in expansion of macro 'GxGDEH029A1_Y_PIXELS'

 #define GxGDEH029A1_HEIGHT GxGDEH029A1_Y_PIXELS

                            ^

C:\Users\Raport\Documents\Arduino\libraries\GxEPD-master/GxGDEH029A1/GxGDEH029A1.h:43:53: note: in expansion of macro 'GxGDEH029A1_HEIGHT'

 #define GxGDEH029A1_BUFFER_SIZE GxGDEH029A1_WIDTH * GxGDEH029A1_HEIGHT / 8

                                                     ^

C:\Users\Raport\Documents\Arduino\libraries\GxEPD-master/GxGDEH029A1/GxGDEH029A1.cpp:147:28: note: in expansion of macro 'GxGDEH029A1_BUFFER_SIZE'

   for (uint32_t i = 0; i < GxGDEH029A1_BUFFER_SIZE; i++)

                            ^

exit status 1
Error compiling for board Arduino Nano.


Does it mean it's not suitable for Arduino Nano because of Nano's poor memory reservours?
Have a good day.
Title: Re: Waveshare e-paper displays with SPI
Post by: ZinggJM on Jul 28, 2017, 08:33 pm
Now you have understood what I need from you if I should try to help you.

First, as I already told you, the waveshare string example can be successfully compiled for Arduino Nano.
I did not yet try to run it on my Nano, but I have it ready complete with level converter.

Second, the current version of my GxEPD on GitHub is not suitable for UNO or Nano, as it needs a buffer of ~5kB in RAM. And the current GxIO_SPI only works correctly on ESP8266 and ESP32, because the setFrequency() method only works for these. I work on a fix for this. For these displays max SPI frequency is 4MHz.

Third, you need to upgrade your Arduino IDE to the actual version (1.8.3) to compile the waveshare string example, as I already told you. And GxEPD most likely will need version 1.8.x, at least for UNO, Nano.

Fourth, I will provide a new version of the small e-paper GxEPD classes for AVR (UNO and Nano) with reduced buffer and support for bitmaps in PROGMEM. Only the reduced part of the display will be available for use with Adafruit_GFX. An initial version for 2.9inch runs on my Nano. But this is not my priority.

Bear in mind that I am a hobby Arduino user like you; I do this for fun, and provide help only as long as I consider it a pleasure.
Title: Re: Waveshare e-paper displays with SPI
Post by: bogus105 on Jul 28, 2017, 09:33 pm
Now i understand:) Thank you for your time. Your reply convinced me to order esp8266. Too much constrains with Nano - RAM size being the most anoying.
I'll try to change IDE to the newest one but as i said - i can play with arduino at work only and IDE must be installed by company's administrator (he's not at work now and it's not easy to convience him to do it thanks to company policy:(:(:(
Title: Re: Waveshare e-paper displays with SPI
Post by: ZinggJM on Jul 29, 2017, 08:03 am
...
And the current GxIO_SPI only works correctly on ESP8266 and ESP32, because the setFrequency() method only works for these. I work on a fix for this. For these displays max SPI frequency is 4MHz.
...
Interim fix applied to GxIO_SPI, GxEPD updated on GitHub https://github.com/ZinggJM/GxEPD (https://github.com/ZinggJM/GxEPD)
Title: Re: Waveshare e-paper displays with SPI
Post by: UlrichKu on Jul 29, 2017, 10:41 am
Hi. Thank's for this library. I'm using it with a nodemcu (esp8266) and a Waveshare 2.9 e-paper. And it works showing decent text in my case.

However I am trying to write a "partial update" function and I am a bit at a loss understanding the protocol used in communicating with the display. Also and especially after looking in the datasheet by Waveshare.   :o
There seems to be some code/communication dedicated to this (_SetRamArea, _SetRamPointer)? But I don't understand the parameters used there and if they really are what I hope them to be.
Title: Re: Waveshare e-paper displays with SPI
Post by: ZinggJM on Jul 29, 2017, 10:45 am
...
Fourth, I will provide a new version of the small e-paper GxEPD classes for AVR (UNO and Nano) with reduced buffer and support for bitmaps in PROGMEM. Only the reduced part of the display will be available for use with Adafruit_GFX. An initial version for 2.9inch runs on my Nano. But this is not my priority.
...
And finally the idea trickled into my head ("s'zwänzgi isch abegheit") - I had a short look at U8g2, for a ST7565 display. Divide the display into 4 pages, let the user draw or print his picture 4 times, each time updating one page window to the display using the "partial update" function of these displays.

Not really my recommendation to use UNO or Nano with e-paper displays, but interesting coding practice for me anyway.
Title: Re: Waveshare e-paper displays with SPI
Post by: ZinggJM on Jul 29, 2017, 10:52 am
Hi. Thank's for this library. I'm using it with a nodemcu (esp8266) and a Waveshare 2.9 e-paper. And it works showing decent text in my case.

However I am trying to write a "partial update" function and I am a bit at a loss understanding the protocol used in communicating with the display. Also and especially after looking in the datasheet by Waveshare.   :o
There seems to be some code/communication dedicated to this (_SetRamArea, _SetRamPointer)? But I don't understand the parameters used there and if they really are what I hope them to be.
I wrote my last post at the same time, there you can see that I intend to use partial update.

And Good Display have the actual demo code available on their downloade page, with improved partial update.

http://www.good-display.com/download_list/downloadcategoryid=35&isMode=false.html (http://www.good-display.com/download_list/downloadcategoryid=35&isMode=false.html)

(_SetRamArea, _SetRamPointer) basically are the same functions as for TFT displays (e.g. setWindow or setWindowAddress), but the x-address is not a pixel number but a byte address (x/8). This fact, combined with the missing read GRAM function, makes direct pixel draw to GRAM impossible.
Title: Re: Waveshare e-paper displays with SPI
Post by: UlrichKu on Jul 29, 2017, 11:00 am
I wrote my last post at the same time, there you can see that I intend to use partial update.
I noticed that. :) Funny conincidence.
However in my case I'm looking for it to speedup thing and/or improve redraw.

And Good Display have the actual demo code available on their downloade page, with improved partial update.
What environment does this target? My knowledge stops as C++ and Arduino IDE at the moment.
Title: Re: Waveshare e-paper displays with SPI
Post by: UlrichKu on Jul 29, 2017, 11:05 am
(_SetRamArea, _SetRamPointer) basically are the same functions as for TFT displays (e.g. setWindow or setWindowAddress), but the x-address is not a pixel number but a byte address (x/8). This fact, combined with the missing read GRAM function, makes direct pixel draw to GRAM impossible.
But you could update ie only 8 pixels (1 byte) with this if you wanted to?
Title: Re: Waveshare e-paper displays with SPI
Post by: ZinggJM on Jul 29, 2017, 11:05 am
The demo code is for STM32 using Keil5 programming environment. The - earlier version of the - code is the base of the waveshare code and of my GxEPD display classes.

Write single byte may be possible, I have no experience, but display update time will not be shorter than for a full line, I guess.
Title: Re: Waveshare e-paper displays with SPI
Post by: UlrichKu on Jul 29, 2017, 11:17 am
Write single byte may be possible, I have no experience, but display update time will not be shorter than for a full line, I guess.
Probably not. The question was just if I understood this correctly.

So one would:
* Use correct LUT
* Set ram pointer and area correctly
* Write partial data
* Update display (with 0x04 data instead of 0xc7)

?
Title: Re: Waveshare e-paper displays with SPI
Post by: ZinggJM on Jul 29, 2017, 11:32 am
May well be the case, I would need to look at the code. But I have no time, guest coming. Bye for now.
Title: Re: Waveshare e-paper displays with SPI
Post by: UlrichKu on Jul 29, 2017, 01:26 pm
May well be the case, I would need to look at the code. But I have no time, guest coming. Bye for now.
Ok, have fun.
I got this working - sort of.
And created a pull request to show you my code.

However it is working quite nicely:
Especially the double or tripple flickering of a full screen update is not present with it (probably some sort of configuration in the different LUT or the different command parameter).
And of course it is faster.
Title: Re: Waveshare e-paper displays with SPI
Post by: bogus105 on Jul 29, 2017, 02:31 pm
UlrichKu - do you recommend esp8266-12e for this display? Does it have enough room inside to store, say 100 full screen bitmaps in memory to display them randomly on 2.9inch e-paper? I guess SD card is a must in this case.
Title: Re: Waveshare e-paper displays with SPI
Post by: UlrichKu on Jul 29, 2017, 02:47 pm
Does it have enough room inside to store, say 100 full screen bitmaps in memory to display them randomly on 2.9inch e-paper?
One image would have 5kb (stored in the format of the display). So you could fit approx. 200 images in the 1MB of the chip.

But my question would be: Why would you want to?
Title: Re: Waveshare e-paper displays with SPI
Post by: bogus105 on Jul 29, 2017, 10:34 pm
I'd like to make a small gadget for my son (he's 20 months old). He likes letters and digits so much so the gadget should be battery powered for long time (hence e-paper) and have just one button - this button will display random letter or digit in random font style. And then he will guess what letter/digit is it and will be happy:)
Title: Re: Waveshare e-paper displays with SPI
Post by: ZinggJM on Jul 30, 2017, 05:20 pm
I'd like to make a small gadget for my son (he's 20 months old). He likes letters and digits so much so the gadget should be battery powered for long time (hence e-paper) and have just one button - this button will display random letter or digit in random font style. And then he will guess what letter/digit is it and will be happy:)
Please be careful with bare EPD and children: a broken EPD glass releases toxic fluid.
Maybe adding a touch overlay is enough to protect the EPD glass, but this format is uncommon.
Title: Re: Waveshare e-paper displays with SPI
Post by: bogus105 on Jul 30, 2017, 11:00 pm
Thank you for warning. I plan to hide EPD behind plexiglass shield anyway. I know my son - shield is a must:)
Title: Re: Waveshare e-paper displays with SPI
Post by: vstrelk on Aug 01, 2017, 06:34 pm
Ok, have fun.
I got this working - sort of.
And created a pull request to show you my code.

However it is working quite nicely:
Especially the double or tripple flickering of a full screen update is not present with it (probably some sort of configuration in the different LUT or the different command parameter).
And of course it is faster.
I tried you changes and it really works for my 1,5 ws epd.

UlrichKu - could you share a code for testing particular
GxGDEH029A1::updatePartial(uint16_t y1, uint16_t y2)?
Title: Re: Waveshare e-paper displays with SPI
Post by: UlrichKu on Aug 01, 2017, 08:32 pm
UlrichKu - could you share a code for testing particular
GxGDEH029A1::updatePartial(uint16_t y1, uint16_t y2)?
I was pondering a bit about it but I don't think I get the meaning of your question. :-)

And in any case my code is nothing that anyone should try out at the moment.
Title: Re: Waveshare e-paper displays with SPI
Post by: bytecrusher on Aug 01, 2017, 11:18 pm
Hi,
i use a waveshare 2.9" with an esp32.
First of all: thanks for the library and the example sketch.
I know ZinggJM have currently no experience in drawing bitmaps on the display.
Maybe someone can help me.
I already have running the gxedp library and the example sketch. Ich can show bitmaps in fullscreen and text at all. (  display.drawBitmap(BitmapExample1, sizeof(BitmapExample1)); )
But when i try to show particular bitmaps ( display.drawBitmap(0, 0, BitmapExample1, GxEPD_WIDTH, h, GxEPD_BLACK); ), the bitmap always shows mirrored.
In the libraries itself i didn't find any hint to this.
maybe someone have an idea?
thanks.
Title: Re: Waveshare e-paper displays with SPI
Post by: UlrichKu on Aug 01, 2017, 11:26 pm
I already have running the gxedp library and the example sketch. Ich can show bitmaps in fullscreen and text at all.
But when i try to show particular bitmaps, the bitmap always shows mirrored.
Which of the "drawBitmap" functions are you using. There is one with 2 and one with 6 parameters.
I take it the one with 6 should be working correctly?
Title: Re: Waveshare e-paper displays with SPI
Post by: bytecrusher on Aug 01, 2017, 11:35 pm
the one with less parameters (fullscreen) works well.
the other one with 6 parameters does not, as expected.
It shows the image too, but its mirrored. I can resize it or put it to defines coordinates.
Title: Re: Waveshare e-paper displays with SPI
Post by: ZinggJM on Aug 02, 2017, 06:53 pm
Preliminary support for partial update and paged drawing (AVR, low RAM), for test.
To use on AVR (UNO, NANO) Arduino IDE 1.8.x is required (optimizing linker) for code space.
Only for GxGDEP015OC1 and GxGDEH029A1 for now. More tests to be done; use cases?

Added to GxEPD on GitHub: https://github.com/ZinggJM/GxEPD (https://github.com/ZinggJM/GxEPD)

Added Warning: use level converters or series resistors with UNO, NANO or MEGA.
Title: Re: Waveshare e-paper displays with SPI
Post by: UlrichKu on Aug 02, 2017, 10:51 pm
Preliminary support for partial update and paged drawing (AVR, low RAM), for test.

Works also on my GxGDEH029A1.

The new updateWindow (also) does not consider rotation?
Is the doubled _writeData block with the two delay(300) deliberate?

Funnily I had uncommited local code which also got rid of the numerous _wakeUp calls. :-)

As an idea for improvement (for me) I also thought of an automatic tracking of one or two update windows. So a library user could just invoke an "updateMyLatetestChanges" without actually knowing which window this would be.
Title: Re: Waveshare e-paper displays with SPI
Post by: TeK32 on Aug 03, 2017, 12:09 am
Jean-Marc, thank you for adding support for ESP32. This works great as already mentioned!
Title: Re: Waveshare e-paper displays with SPI
Post by: ZinggJM on Aug 03, 2017, 06:01 am
Works also on my GxGDEH029A1.

The new updateWindow (also) does not consider rotation?
Is the doubled _writeData block with the two delay(300) deliberate?

Funnily I had uncommited local code which also got rid of the numerous _wakeUp calls. :-)

As an idea for improvement (for me) I also thought of an automatic tracking of one or two update windows. So a library user could just invoke an "updateMyLatetestChanges" without actually knowing which window this would be.
By design, rotation is handled on drawing only, in method drawPixel, not on update to display, and not on direct drawing of bitmaps.

Edit: now I see the point: parameters of updateWindow should be logical points, not physical, should be transformed to physical address. I will fix this.

I think of adding a drawBitmap to buffer method with mirroring, for the bitorder of the demo bitmaps.

The doubled write seems required for subsequent partial updates, same as in demo code, I did not check about the delay.

I still consider my GxEPD library as an example, a starting point for users. I am open for modification suggestions, but major extensions are best handled by cloning it.
Title: Re: Waveshare e-paper displays with SPI
Post by: ZinggJM on Aug 03, 2017, 03:21 pm
...
I know ZinggJM have currently no experience in drawing bitmaps on the display.
...
But when i try to show particular bitmaps ( display.drawBitmap(0, 0, BitmapExample1, GxEPD_WIDTH, h, GxEPD_BLACK); ), the bitmap always shows mirrored.
In the libraries itself i didn't find any hint to this.
maybe someone have an idea?
thanks.
It used to work, as I know from experience earlier.

But the compiler now correctly calculates uint_16(200)*int(200) to be a negative number, even in a expression with uint16_t result.

This is now fixed (at least from my current experience), and per default bitmaps are now mirrored correctly for the example bitmaps in drawBitmap to buffer.

Added preliminary support for partial update and paged drawing also for GxGDE0213B1.

Other enhancements are pending.
Title: Re: Waveshare e-paper displays with SPI
Post by: bytecrusher on Aug 04, 2017, 10:04 pm
Great work ZinggJM,
the example bitmap now shows correct.
i converted some other pictures in different sized.
But there seems to be some issues if i draw the picture to other coordinates then "0,0".
sometimes it look like the defines coordinates (i.e. 50,50) is the first pixel to draw (thats ok), but it also seems to be the first pixel, that will be read from the picture (50,50).  so the picture will not be shifted, but it will be reduce by the given size and beginn to draw at this.
Currently i only own a GDEH029A1. maybe i will order the smaller one (1,53") in the future.
Title: Re: Waveshare e-paper displays with SPI
Post by: ZinggJM on Aug 05, 2017, 07:33 am
Thank you, bytecrusher, for this important feedback.

The error is obvious when looking at my code; and I obviously never tried other than 0,0.
When I decided to put my code on GitHub, I was aware I should start with a test plan, but was too lazy.
No time for now to create a test plan, so I rely on feedback.

I will look to find the bitmaps I originally used with my first e-paper, a LinkSprite 4.3; I even used image2lcd then (the experience with this display kept me away from e-papers until I discovered Good Display).

Maybe you could share some of your bitmaps and add them to your post.

Jean-Marc
Title: Re: Waveshare e-paper displays with SPI
Post by: ZinggJM on Aug 05, 2017, 09:47 am
Added update to logical coordinates for updateWindow and an example for partial update.
Fixed the drawBitmap to buffer origin issue, needs more tests.
Title: Re: Waveshare e-paper displays with SPI
Post by: bytecrusher on Aug 06, 2017, 11:44 pm
I have to thank you for this great library.
Attached is one of my picture. I will send you more in the future. But for the first it might be ok.
I tested your actual lib with this picture and have to say it will work. :-)
There is only one thing that sticked out: The automatic calculated size of the picture does not work, when the picture is not full screen. My workaround: replace the vars "GxEPD_WIDTH" and "h" by the size of the picture (see "IMG_0001.h" for the right size).

Code: [Select]
display.drawBitmap(50, 50, gImage_IMG_0001, 64, 180, GxEPD_BLACK);

I have currently not so much time, but i will make some more tests the next days.
Title: Re: Waveshare e-paper displays with SPI
Post by: ZinggJM on Aug 07, 2017, 07:00 am
Thank you for the picture, I will use it for my test.

Code: [Select]
   // to buffer, may be cropped, drawPixel() used, update needed, new signature, mirror default for example bitmaps
    void  drawBitmap(const uint8_t *bitmap, uint16_t x, uint16_t y, uint16_t w, uint16_t h, uint16_t color, bool mirror = true);


If you use the method with the new signature, the parameters meanings should be clearer.

The limiting of the height in the example is no longer needed - I will remove it - as the limit is now handled in the drawPixel method.

Explanation: the picture display is cropped to the limits of the display - width and height of the display -
and limited to the limits of the buffer - which is smaller for AVR (UNO, NANO, MEGA) - in drawPixel.
Title: Re: Waveshare e-paper displays with SPI
Post by: bytecrusher on Aug 10, 2017, 11:30 pm
Here i will share my icon library with you.
I begin to convert some icons for everyone.
Based on the "Gridicons" project (its  GNU General Public License v2) i converted the Icons.
Maybe ZinggJM will put them into the great GxEDP library.
If you find it helpful, i will create more icons in the future.

Code: [Select]
...
#include "imglib/gridicons_add_image.h"
#include "imglib/gridicons_add_outline.h"
#include "imglib/gridicons_add.h"
#include "imglib/gridicons_align_center.h"
#include "imglib/gridicons_align_image_center.h"
#include "imglib/gridicons_align_image_left.h"
#include "imglib/gridicons_align_image_none.h"
#include "imglib/gridicons_align_image_right.h"
#include "imglib/gridicons_align_justify.h"
#include "imglib/gridicons_align_left.h"
#include "imglib/gridicons_align_right.h"
#include "imglib/gridicons_arrow_down.h"
#include "imglib/gridicons_arrow_left.h"
#include "imglib/gridicons_arrow_right.h"
#include "imglib/gridicons_arrow_up.h"
...
  display.drawBitmap(0, 0, gridicons_add_image, 24, 24, GxEPD_BLACK);
  display.drawBitmap(25, 0, gridicons_add_outline, 24, 24, GxEPD_BLACK);
  display.drawBitmap(50, 0, gridicons_add, 24, 24, GxEPD_BLACK);
  display.drawBitmap(75, 0, gridicons_align_center, 24, 24, GxEPD_BLACK);
  display.drawBitmap(0, 25, gridicons_align_image_center, 24, 24, GxEPD_BLACK);
  display.drawBitmap(25, 25, gridicons_align_image_left, 24, 24, GxEPD_BLACK);
  display.drawBitmap(50, 25, gridicons_align_image_none, 24, 24, GxEPD_BLACK);
  display.drawBitmap(75, 25, gridicons_align_image_right, 24, 24, GxEPD_BLACK);
  display.drawBitmap(0, 50, gridicons_align_justify, 24, 24, GxEPD_BLACK);
  display.drawBitmap(25, 50, gridicons_align_left, 24, 24, GxEPD_BLACK);
  display.drawBitmap(50, 50, gridicons_align_right, 24, 24, GxEPD_BLACK);
  display.drawBitmap(75, 50, gridicons_arrow_down, 24, 24, GxEPD_BLACK);
  display.drawBitmap(0, 75, gridicons_arrow_left, 24, 24, GxEPD_BLACK);
  display.drawBitmap(25, 75, gridicons_arrow_right, 24, 24, GxEPD_BLACK);
  display.drawBitmap(50, 75, gridicons_arrow_up, 24, 24, GxEPD_BLACK);
...
Title: Re: Waveshare e-paper displays with SPI
Post by: ZinggJM on Aug 11, 2017, 06:48 am
Added grid icons to GxEPD, thank you, bytecrusher.
Title: Re: Waveshare e-paper displays with SPI
Post by: bytecrusher on Aug 13, 2017, 11:00 pm
I added a lot of icons to the new library.
I also made a pull request on GitHub and i am sure ZinggJM will added it to the project.
Otherwise i will share my link, if anybody is interested.
Attached you will find some prevue pictures.
Have a nice day.
Title: Re: Waveshare e-paper displays with SPI
Post by: ZinggJM on Aug 14, 2017, 07:35 am
I added a lot of icons to the new library.
I also made a pull request on GitHub and i am sure ZinggJM will added it to the project.
Otherwise i will share my link, if anybody is interested.
Attached you will find some prevue pictures.
Have a nice day.
ZinggJM doesn't like this kind of communication. Prefers direct addressing of issues, whishes or suggestions.

ZinggJM has merged this pull request anyway. Thank you, bytecrusher, for the contribution.
Title: Re: Waveshare e-paper displays with SPI
Post by: ZinggJM on Aug 28, 2017, 09:27 am
I have updated GxEPD with code taken from the actual demo code from Dalian Good Display.

The GxGDEW042T2 should be suitable for the Waveshare 4.2inch 300x400 e-paper display.
I will do more tests (e.g. for AVR) when my Waveshare 4.2 arrives.

Good News is the coming support for Waveshare e-papers in u8g2 from Oliver!

WaveShare 2.9 inch e-paper support (IL3820) #318  (https://github.com/olikraus/u8g2/issues/318)
Title: Re: Waveshare e-paper displays with SPI
Post by: jpg63 on Aug 29, 2017, 11:57 am
Hello ZinggIM

I would like to know if you were able to advance on the compatibility of your library with the SAMD21 (arduino zero, MKRzero, ..)

For the evolution of our project of gnuvario based on M0 and an I-INK screen, your library will be of a precious help to us


https://github.com/prunkdump/arduino-variometer

https://github.com/prunkdump/variometer-kits

http://www.parapentiste.info/forum/developpements-hardware-software/diy-gnuvario-variometre-opensource-openhardware-arduino-t48334.0.html;new;topicseen#new
Title: Re: Waveshare e-paper displays with SPI
Post by: ZinggJM on Aug 29, 2017, 12:17 pm
Yes, I had fixed GxIO_SPI to be compatible with SAMD and tested it with MKR-1000.

However I am busy working on improvements and can't do full regression tests for every update on GitHub; I usually do some compile tests, but mostly only for ESP8266, with some run test.

So please report any issues here, and I will try to fix it.

Jean-Marc
Title: Re: Waveshare e-paper displays with SPI
Post by: Kedae on Aug 29, 2017, 12:37 pm
Hi,

I'm all new in this arduino/e-paper stuff and a bit lost here.
I have a 2.9 waveshare display, and had it working with waveshare exemples. But, I am on a UNO and there is of course a memory issue when I want to do stuff a little bit more usefull than just text.

That's why I landed on this forum, have you succesfully made something for UNO ?
I've tried using both your "SPI_IconGrid" without bitmap examples and your new "TestRamDataEntryMode" but nothing happens. Memory is good but nothing happens on the screen.

I plugged it directly on the uno this way :

BUSY->D2, RST -> D4, DC->D3, CS->D8, CLK->D5, DIN->D7

Am I missing something ? Do I need to modify stuff in the code ?

Thx,
Title: Re: Waveshare e-paper displays with SPI
Post by: ZinggJM on Aug 29, 2017, 01:03 pm
You took the wiring for ESP8266. You need to take the wiring for AVR, e.g. the standard SPI pins.

// GxIO_SPI(SPIClass& spi, int8_t cs, int8_t dc, int8_t rst = -1, int8_t bl = -1);
GxIO_Class io(SPI, SS, 8, 9);
// GxGDEP015OC1(GxIO& io, uint8_t rst = 9, uint8_t busy = 7);
GxEPD_Class display(io, 9, 3);

#else

// pins_arduino.h, e.g. AVR
//#define PIN_SPI_SS    (10)
//#define PIN_SPI_MOSI  (11)
//#define PIN_SPI_MISO  (12)
//#define PIN_SPI_SCK   (13)

GxIO_Class io(SPI, SS, 8, 9); // arbitrary selection of 8, 9 selected for default of GxEPD_Class
GxEPD_Class display(io);

#endif

BUSY-> 7, RST -> 9, DC-> 8, CS-> 10, CLK-> 13, DIN-> 11

You should see at least something with the GxEPD_SPI_TestExample, but for UNO, try PagedDisplayExampleForNanoRam.

I have not checked with SPI_IconGrid.
Title: Re: Waveshare e-paper displays with SPI
Post by: Kedae on Aug 29, 2017, 01:42 pm
My bad. It works now.
PagedDisplay[...] works correctly as well as TestRam[...] But i've noticed "uint" instead of "int" in the loops, in that a thing or an error ?

SPI_Icons does'nt seem to work.

Thanks for your help.
Title: Re: Waveshare e-paper displays with SPI
Post by: ZinggJM on Aug 29, 2017, 02:41 pm
Thank you for the feedback. Not your fault, my description and comments should be improved.
uint8_t or uint16_t in loops is ok, depending on usage. Avoid it in decrement loops, as <0 never gets true.
uint is a typo, it is ok on some platforms, but may be unknown on others.

In TestRamDataEntryMode uint8_t would have been on purpose, because the parameter is uint8_t.
This test program has a specific purpose for verifying a function of the controller of the display.

I will check GxEPD_SPI_IconGrid_Example, it comes from contributor bytecrusher.

I will update GxEPD_SPI_IconGrid_Example for AVR (UNO, NANO) use with paged drawing.

This will require more changes in the imglib (add PROGMEM), interim fix done, GxEPD_SPI_TestExample should compile for AVR again.
Title: Re: Waveshare e-paper displays with SPI
Post by: jpg63 on Aug 29, 2017, 03:02 pm
Thank you very much,
I do tests tonight.
I will then post a return on the proper functioning
Title: Re: Waveshare e-paper displays with SPI
Post by: davidjwatts on Aug 29, 2017, 07:50 pm
Hi,

Has anyone got a guide on creating bitmaps to display using GxEPD? I have tried image2LCD based off the waveshare wiki and all of the images come out distorted. The attached are before and after using the code form the C array.

It looks to me like all of the pixels are actually there but it is in the wrong format going in so it is not parse in right order. I have of course gone through several different images and every combination of export options from image2LCD that I can think of but no luck.

Abridged code:
Code: [Select]

static unsigned char youtube[800] = { /* 0X01,0X01,0X64,0X00,0X3D,0X00, */
0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XF8,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XF8,
0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XF8,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XF8,
0XFF,0XFF,0XFF,0XFF,0X1F,0XFF,0XFF,0XF8,0XFF,0X81,0XC2,0X00,0X00,0X0E,0X7F,0XF8,
0XFF,0X00,0X00,0X00,0X00,0X00,0X07,0XF8,0XFE,0X00,0X00,0X27,0XFC,0X00,0X07,0XF8,
0XFE,0X3E,0XFF,0XFF,0XFF,0XFF,0XE3,0XF8,0XFE,0X3F,0XFF,0XFF,0XFF,0XFF,0XE3,0XF8,
0XFC,0X3F,0XFF,0XFF,0XFF,0XFF,0XE3,0XF8,0XFC,0X3F,0XFF,0XFF,0XFF,0XFF,0XE3,0XF8,
0XFC,0X3F,0XFF,0XFF,0XFF,0XFF,0XF3,0XF8,0XF8,0X3F,0XFF,0XFF,0XFF,0XFF,0XE3,0XF8,
0XFC,0X3F,0XFF,0XFF,0XFF,0XFF,0XE3,0XF8,0XFC,0X3F,0XFF,0XFF,0XFF,0XFF,0XE3,0XF8,
0XFC,0X3F,0XFF,0XFF,0XFF,0XFF,0XE3,0XF8,0XFC,0X3F,0XFF,0XFF,0XFF,0XFF,0XE3,0XF8,
0XFC,0X3F,0XFF,0XFF,0XFF,0XFF,0XE3,0XF8,0XFC,0X3F,0XFF,0XFF,0XFF,0XFF,0XE3,0XF8,
0XFC,0X3F,0XFF,0XFF,0XFF,0XFF,0XE3,0XF8,0XFC,0X7F,0XFF,0XFF,0XFF,0XFF,0XE3,0XF8,
0XFC,0X7F,0XFF,0XFF,0XFF,0XFF,0XE3,0XF8,0XFC,0X7F,0XFF,0XFF,0XFF,0XFF,0XE3,0XF8,
0XFC,0X7F,0XFF,0XFF,0XFF,0XFF,0XE3,0XF8,0XFC,0X7F,0XFF,0XFF,0XFF,0XFF,0XE3,0XF8,
0XFC,0X7F,0XFF,0XFF,0XFF,0XFF,0XE3,0XF8,0XFC,0X7F,0XFF,0XFF,0XFF,0XFF,0XF3,0XF8,
0XFC,0X7F,0XFF,0XFF,0XFF,0XFF,0XE3,0XF8,0XFC,0X7F,0XFF,0XFF,0XFF,0XFF,0XF3,0XF8,
0XFC,0X7F,0XFF,0XFF,0XFF,0XFF,0XF3,0XF8,0XFC,0X7F,0XFF,0XFF,0XFF,0XFF,0XF1,0XF8,
0XFC,0X7F,0XFF,0XFF,0XFF,0XFF,0XF1,0XF8,0XFC,0X7F,0XFF,0XFF,0XFF,0XFF,0XF1,0XF8,
0XFC,0X7F,0XFF,0XFF,0XFF,0XFF,0XF1,0XF8,0XFE,0X3F,0XFF,0XFF,0XFF,0XFF,0XF3,0XF8,
0XFE,0X3F,0XFF,0XFF,0XFF,0XFF,0XF3,0XF8,0XFE,0X3F,0XFF,0XFF,0XFF,0XFF,0XF1,0XF8,
0XFE,0X3F,0XFF,0XFF,0XFF,0XFF,0XF1,0XF8,0XFE,0X3F,0XFF,0XFF,0XFF,0XFF,0XF3,0XF8,
0XFE,0X1F,0XC0,0X03,0XDF,0XFF,0XF3,0XF8,0XFE,0X1F,0X80,0X00,0X00,0X0F,0XF3,0XF8,
0XFC,0X3F,0XCE,0X00,0X00,0X0F,0XF3,0XF8,0XFC,0X3F,0XCF,0XFE,0X80,0X07,0XF1,0XF8,
0XFE,0X1F,0XC7,0XFF,0XFF,0X0F,0XF3,0XF8,0XFE,0X1F,0XC7,0XFF,0XFE,0X1F,0XF3,0XF8,
0XFC,0X3F,0XE3,0XFF,0XFC,0X3F,0XF3,0XF8,0XFC,0X3F,0XE1,0XFF,0XFC,0X7F,0XE3,0XF8,
0XFE,0X3F,0XF8,0XFF,0XF8,0XFF,0XE3,0XF8,0XFE,0X3F,0XF8,0XFF,0XF0,0XFF,0XF3,0XF8,
0XFC,0X3F,0XFC,0X7F,0XE1,0XFF,0XF3,0XF8,0XFC,0X3F,0XFC,0X3F,0XC3,0XFF,0XE3,0XF8,
0XFE,0X3F,0XFE,0X3F,0XCF,0XFF,0XE3,0XF8,0XFC,0X3F,0XFF,0X3F,0X8F,0XFF,0XE3,0XF8,
0XFC,0X3F,0XFF,0X1F,0X8F,0XFF,0XE3,0XF8,0XFC,0X3F,0XFF,0X1F,0X1F,0XFF,0XE3,0XF8,
0XFE,0X3F,0XFF,0X8E,0X3F,0XFF,0XE3,0XF8,0XFE,0X3F,0XFF,0X8E,0X7F,0XFF,0XF3,0XF8,
0XFE,0X3F,0XFF,0XC4,0X7F,0XFF,0XF3,0XF8,0XFE,0X3F,0XFF,0XC0,0XFF,0XFF,0XF3,0XF8,
0XFE,0X3F,0XFF,0XE0,0XFF,0XFF,0XF3,0XF8,0XFE,0X3F,0XFF,0XE1,0XFF,0XFF,0XF3,0XF8,
0XFE,0X3F,0XFF,0XFB,0XFF,0XFF,0XF3,0XF8,0XFE,0X3F,0XFF,0XFF,0XFF,0XFF,0XF3,0XF8,
0XFC,0X3F,0XFF,0XFF,0XFF,0XFF,0XF3,0XF8,0XFC,0X7F,0XFF,0XFF,0XFF,0XFF,0XF3,0XF8,
0XFC,0X7F,0XFF,0XFF,0XFF,0XFF,0XF3,0XF8,0XFC,0X7F,0XFF,0XFF,0XFF,0XFF,0XE3,0XF8,
0XF8,0X7F,0XFF,0XFF,0XFF,0XFF,0XE3,0XF8,0XF8,0X7F,0XFF,0XFF,0XFF,0XFF,0XE3,0XF8,
0XF8,0X7F,0XFF,0XFF,0XFF,0XFF,0XE3,0XF8,0XF8,0XFF,0XFF,0XFF,0XFF,0XFF,0XE3,0XF8,
0XF8,0XFF,0XFF,0XFF,0XFF,0XFF,0XE3,0XF8,0XF8,0XFF,0XFF,0XFF,0XFF,0XFF,0XE3,0XF8,
0XF8,0XFF,0XFF,0XFF,0XFF,0XFF,0XE3,0XF8,0XF8,0XFF,0XFF,0XFF,0XFF,0XFF,0XE3,0XF8,
0XF8,0XFF,0XFF,0XFF,0XFF,0XFF,0XE3,0XF8,0XF8,0XFF,0XFF,0XFF,0XFF,0XFF,0XF3,0XF8,
0XF8,0XFF,0XFF,0XFF,0XFF,0XFF,0XF3,0XF8,0XF8,0XFF,0XFF,0XFF,0XFF,0XFF,0XE3,0XF8,
0XF8,0XFF,0XFF,0XFF,0XFF,0XFF,0XF3,0XF8,0XF8,0X7F,0XFF,0XFF,0XFF,0XFF,0XF3,0XF8,
0XFC,0X7F,0XFF,0XFF,0XFF,0XFF,0XF3,0XF8,0XF8,0X7F,0XFF,0XFF,0XFF,0XFF,0XF3,0XF8,
0XF8,0X7F,0XFF,0XFF,0XFF,0XFF,0XF3,0XF8,0XF8,0X7F,0XFF,0XFF,0XFF,0XFF,0XE3,0XF8,
0XF8,0X7F,0XFF,0XFF,0XFF,0XFF,0XE3,0XF8,0XF8,0X3F,0XFF,0XFF,0XFF,0XFF,0XE3,0XF8,
0XFC,0X1F,0XFF,0XFF,0XFF,0XFF,0XC7,0XF8,0XFC,0X01,0XFF,0XFF,0XFF,0XFF,0X07,0XF8,
0XFE,0X00,0X7F,0XFF,0XFF,0XF0,0X07,0XF8,0XFF,0X00,0X00,0X00,0X10,0X00,0X07,0XF8,
0XFF,0X80,0X00,0X00,0X00,0X00,0X3F,0XF8,0XFF,0XFF,0X00,0X00,0X00,0X00,0XFF,0XF8,
0XFF,0XFF,0XF0,0X00,0X00,0X0F,0XFF,0XF8,0XFF,0XFF,0XFE,0X7F,0XFF,0XFF,0XFF,0XF8,
0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XF8,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XF8,
0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XF8,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XF8,
};

display.drawBitmap(youtube, 0, 0, 100, 61, GxEPD_BLACK);


Any tips would be appreciated :-)
Title: Re: Waveshare e-paper displays with SPI
Post by: ZinggJM on Aug 29, 2017, 08:14 pm
I should be able to help tomorrow, but you can download info from the Good Display site:

http://www.good-display.com/download_index.html (http://www.good-display.com/download_index.html)

On this page I found a youtube link:

https://www.aliexpress.com/store/product/GDE029-with-demo-2-9-EPD-display-e-paper-display-panel-with-development-kit/600281_32810074356.html (https://www.aliexpress.com/store/product/GDE029-with-demo-2-9-EPD-display-e-paper-display-panel-with-development-kit/600281_32810074356.html)

https://www.youtube.com/watch?v=JUQKQ4mF4AY (https://www.youtube.com/watch?v=JUQKQ4mF4AY)
Title: Re: Waveshare e-paper displays with SPI
Post by: davidjwatts on Aug 29, 2017, 08:20 pm
Thanks mate, unfortunately http://www.good-display.com/download_index.html doesn't load for me it tries to connect but ultimately fails. Looks like my IP doesn't like it or the website is down.
Title: Re: Waveshare e-paper displays with SPI
Post by: ZinggJM on Aug 29, 2017, 08:39 pm
link works for me; sometimes this site is slow to access.

maybe scan should be horizontal, MSB first, I will try to find the information.

try horizontal dimension as a multiple of 8.
Title: Re: Waveshare e-paper displays with SPI
Post by: davidjwatts on Aug 29, 2017, 09:16 pm
multiple of 8!!! That was it, it worked when I changed my image from 100px wide to 96px. Thank you!
Title: Re: Waveshare e-paper displays with SPI
Post by: jpg63 on Aug 29, 2017, 10:50 pm

I have just done tests unfortunately I can not operate my waveshare 1.54''

board : Arduino MkrZero
E-Ink  : waveshare 1.54''  - 4 SPI communication modes

code : GxEPD_SPI_TestExample.ino

pins :

BUSY   ->D10(MISO)
RST     ->D4
DC      ->D3
CS      ->D5
CLK    ->D9(SCK)
DIN    ->D8(MOSI)
GND   ->GNG
3.3V   ->3.3V


GxIO_Class io(SPI, 5, 3, 4);

If you have an idea
Title: Re: Waveshare e-paper displays with SPI
Post by: ZinggJM on Aug 30, 2017, 05:00 am
You could try to connect CS to SS, the standard SPI Slave Select pin.
And BUSY to a different pin than MISO, it may not work as standard IO when SPI is used.

I assume D4 means digital pin 4; I do not know if D4 is defined for MkrZero.

I don't have a MkrZero, but I will test with MKR-1000.

Have you tried to use this pin mapping:

#elif defined(ARDUINO_ARCH_SAMD)

// variant.h of MKR1000
//#define PIN_SPI_MISO  (10u)
//#define PIN_SPI_MOSI  (8u)
//#define PIN_SPI_SCK   (9u)
//#define PIN_SPI_SS    (24u) // should be 4?
// variant.h of MKRZERO
//#define PIN_SPI_MISO  (10u)
//#define PIN_SPI_MOSI  (8u)
//#define PIN_SPI_SCK   (9u)
//#define PIN_SPI_SS    (4u)

GxIO_Class io(SPI, 4, 7, 6);
GxEPD_Class display(io, 6, 5);


looking at this I see a conflict with your mapping, as 4 is the standard SS pin on MkrZero.

make sure you have selected the appropriate display class for your 1.54" display:

#include <GxGDEP015OC1/GxGDEP015OC1.cpp>

My test with MKR-1000 and above pin mapping is successful.

(http://forum.arduino.cc/index.php?action=dlattach;topic=487007.0;attach=224081)
Title: Re: Waveshare e-paper displays with SPI
Post by: jpg63 on Aug 30, 2017, 06:54 am
Thank you for this wonderful work and for your help.
The library works perfectly with the Arduino MKRZero

Board: Arduino MkrZero
E-Ink: waveshare 1.54 '' - 4 SPI communication modes

Pins:

BUSY -> D5
RST -> D6
DC -> D7
CS -> D4 (SS)
CLK -> D9 (SCK)
DIN -> D8 (MOSI)
GND -> GNG
3.3V -> 3.3V


Gx10_Class (SPI, 4, 7, 6);
#endif

GxEPD_Class display (io, 6,5);
Title: Re: Waveshare e-paper displays with SPI
Post by: ZinggJM on Aug 30, 2017, 07:58 am
multiple of 8!!! That was it, it worked when I changed my image from 100px wide to 96px. Thank you!
Thank you for the feedback.

This multiple of 8 restriction is an error of my implementation, maybe from an earlier implementation in Adafruit_GFX, or from some other source I copied it from. The actual implementation in Adafruit_GFX is tricky, but from first sight is general and should work without this restriction.

Unfortunately my implementation overrides one of the Adafruit_GFX methods, because I needed mirroring for the demo bitmaps of the small e-papers.

I intend to fix this restriction and remove the overriding method, but I need to apply this change to all my e-paper classes in one update to GitHub, which will require time and testing time.

So for now the width dimension of bitmaps needs to be a multiple of 8.
Title: Re: Waveshare e-paper displays with SPI
Post by: ZinggJM on Aug 30, 2017, 03:25 pm
I received my Waveshare 4.2 300x400 e-paper display. Supported by my GxEPD library.

(http://forum.arduino.cc/index.php?action=dlattach;topic=487007.0;attach=224138)
Title: Re: Waveshare e-paper displays with SPI
Post by: bytecrusher on Sep 03, 2017, 10:27 pm
Hi ZinggJM,
i updated my local lib from your GitHub.
but the example with the icons will not work correctly.
I think there is a mistake with the coordination system. The coordinate 0, 0 is somewhere in the center of the first line?! If i use a negative value i can put more icons.
Did i made a mistake?
i use a esp32 with an 2.9inch waveshare.
Thanks.
Title: Re: Waveshare e-paper displays with SPI
Post by: ZinggJM on Sep 04, 2017, 06:23 am
Hi ZinggJM,
i updated my local lib from your GitHub.
but the example with the icons will not work correctly.
I think there is a mistake with the coordination system. The coordinate 0, 0 is somewhere in the center of the first line?! If i use a negative value i can put more icons.
Did i made a mistake?
i use a esp32 with an 2.9inch waveshare.
Thanks.
Fixed (rotation was not taken into account). I "saw" the error on regression test, but didn't realize it was wrong.

Thank you, bytecrusher.
Title: Re: Waveshare e-paper displays with SPI
Post by: bytecrusher on Sep 04, 2017, 12:15 pm
I have to thank you for your effort and fast response.
And also for this great library.
Title: Re: Waveshare e-paper displays with SPI
Post by: bytecrusher on Sep 04, 2017, 07:37 pm
Hey ZinggJM,
the coordinate 0,0 is now in the upper right corner, but it seems to be in the upper left corner, right?
Is this issue only on not fullscreen bitmaps?
Thanks.
regards bytecrusher
Title: Re: Waveshare e-paper displays with SPI
Post by: ZinggJM on Sep 04, 2017, 09:18 pm
The 0,0 coordinates are now at the origin of the display screen, the way the screen is addressed by the controller. This was not the case before, because of the y-decrement Ram Data Entry Mode used by the display class, combined with the un-mirroring code I had added for the display buffer.
For the buffered graphics you just use setRotation as you need.

For the direct drawing of bitmaps to the screen I have kept the original orientation; one flip mode is already implemented, more may be added later.

I currently spend too much time on this, need to slow down a bit, but will try to fix reported errors as soon as possible.
Title: Re: Waveshare e-paper displays with SPI
Post by: ZinggJM on Sep 06, 2017, 07:38 pm
Waveshare 2.9inch display is now also supported by u8g2, available with Library Manager.

It is on GitHub: https://github.com/olikraus/U8g2_Arduino (https://github.com/olikraus/U8g2_Arduino)
 
Title: Re: Waveshare e-paper displays with SPI
Post by: ZinggJM on Sep 10, 2017, 05:25 pm
I noticed that Waveshare has several shops on AliExpress, so I provide some links for e-papers here:

Waveshare Electronics (http://www.waveshare.com/product/modules/oleds-lcds/e-paper.htm)

WS Development Tool Store (https://waveshare.aliexpress.com/store/group/e-paper-e-link/407494_211162533.html)

Waveshare Development Kit Store (https://waveshare-developmentkit.aliexpress.com/store/group/e-Paper-E-ink/216233_259057242.html)

Development Board Store (https://wvshare.aliexpress.com/store/group/E-paper-E-ink/418423_258180300.html)

There may be more, and the prices may differ, and the e-papers sold also
Title: Re: Waveshare e-paper displays with SPI
Post by: bytecrusher on Sep 11, 2017, 10:51 pm
Hi,

does anybody know a way to print a degree sign ° on the display?
thanks.
Title: Re: Waveshare e-paper displays with SPI
Post by: ZinggJM on Sep 12, 2017, 01:21 pm
Hi,

does anybody know a way to print a degree sign ° on the display?
thanks.
I had this need also. For one of my OLED displays I had found a font that has this symbol.
For one of my e-paper displays I used drawing text at cursor positions, and draw an "o" separately at elevated position.

Searching for a font with this symbol, and with same format as the free fonts is not high on my priority, but I will gladly add such a font to GxEPD.

Are there free font compatible fonts that contain additional symbols, such as ° ?
Title: Re: Waveshare e-paper displays with SPI
Post by: bytecrusher on Sep 12, 2017, 03:40 pm
Hi ZinggJM,

another posibility would be to draw a circle, or to create a custom icon.
This will also work for me.
so, not to much effort for searching a font for it.
Thanks.
Title: Re: Waveshare e-paper displays with SPI
Post by: bytecrusher on Sep 12, 2017, 11:13 pm
Hi ZinggJM,

i trying to do some partial update, but it doesn't work as i expected. what am i do wrong?
first i made display.drawBitmap and do display.update (something like a boot screen).
in the next step i clear the screen with display.fillScreen and print some text with display.println.
now i want to update some partial with display.print again and display.updatewindow with the correct coordinates.
but thats what happened now:
i get the screen with the drawbitmap again and only the partial text. But not the text i print before.
this sounds like the text is not in the same memory as the picture? am i right?

Update: maybe i fond my issue: after the display.update i have to make a display.updatewindow without rotation. now it works.
But, on every updatewindow the display lost a bit of contrast. is it possible to fix this?
Title: Re: Waveshare e-paper displays with SPI
Post by: UlrichKu on Sep 13, 2017, 07:53 am
Update: maybe i fond my issue: after the display.update i have to make a display.updatewindow without rotation. now it works.
But, on every updatewindow the display lost a bit of contrast. is it possible to fix this?
I take it that there are some hidden "features" in those displays still. Like this flashing between two screen contents...
To avoid this the display content needs to be written a second time to the display memory after the first update finishes (wait until not busy). This is what updateWindow does. Your first update call should be superfluous.

The "partial update" doesn't really do a partial update - at least not from the perspective of the display. That one always draws the full area.
What it does is a fast(er) update that is missing the double flashing that really refreshes all the pixel. So after some fast updates there should always be a full update to improve unchanged pixels.
Title: Re: Waveshare e-paper displays with SPI
Post by: ZinggJM on Sep 13, 2017, 10:35 am
Hi ZinggJM,
...
Update: maybe i fond my issue: after the display.update i have to make a display.updatewindow without rotation. now it works.
But, on every updatewindow the display lost a bit of contrast. is it possible to fix this?
Did you forget to call update() after the first println?

I assume you use the 2.9inch display.

A display.updateWindow to the full screen is required to avoid strange effects. Loss of contrast occurs after many partial updates or after long delay without full refresh.

Did you observe this also with the PartialUpdateExample?, or modification of it with more repetitions and longer delays?

You could also post your example for investigation. Thank you for the feedback.
Title: Re: Waveshare e-paper displays with SPI
Post by: ZinggJM on Sep 13, 2017, 10:47 am
I take it that there are some hidden "features" in those displays still. Like this flashing between two screen contents...
To avoid this the display content needs to be written a second time to the display memory after the first update finishes (wait until not busy). This is what updateWindow does. Your first update call should be superfluous.

The "partial update" doesn't really do a partial update - at least not from the perspective of the display. That one always draws the full area.
What it does is a fast(er) update that is missing the double flashing that really refreshes all the pixel. So after some fast updates there should always be a full update to improve unchanged pixels.
I am not sure if this is really so. I see a difference between the displays that have partial update with separate partial update LUT (waveform table), and those that have only some of the functions needed for partial update, and even in between those.

The e-paper display controllers use double buffering; one buffer contains the new data for refresh, and one for the old data. It looks like for full update the old data is used to first turn the display to full white, then the new data to produce the picture. For partial update the difference is used to turn the pixels that need be changed.
And turning pixels happens in multiple steps or phases.
Title: Re: Waveshare e-paper displays with SPI
Post by: bytecrusher on Sep 13, 2017, 10:10 pm
Did you forget to call update() after the first println?

I assume you use the 2.9inch display.

A display.updateWindow to the full screen is required to avoid strange effects. Loss of contrast occurs after many partial updates or after long delay without full refresh.

Did you observe this also with the PartialUpdateExample?, or modification of it with more repetitions and longer delays?

You could also post your example for investigation. Thank you for the feedback.
Yes, i didn't call update(), because i thought if i use updatewindow this will be enough.
Yes, your right. I use the 2.9inch one.
A few weeks ago, i tried an example from waveshare and did notice the issue with the contrast.
Then i tried your library with partialupdate and i didn't notice the contrast lost.
But today i notice again the lost of contrast. Maybe i am wrong with my remember to no lost contrast. This might be the only explanation.
Title: Re: Waveshare e-paper displays with SPI
Post by: bytecrusher on Sep 13, 2017, 10:34 pm
Attached you will find a short example of my code.
Here i have the following situation:
not every pixel has the lost contrast issue.
only, that pixel that is in the updatewindow area.
Not every pixel of a number has the same contrast.

is there any other way, to update partial area (or the hole screen), without flickering?
Title: Re: Waveshare e-paper displays with SPI
Post by: jpg63 on Sep 14, 2017, 04:12 pm
Vous trouverez ci-joint une petite demo utilisant un ecran 1,54 pouce. Cet example pourra peut être servir à d'autre, il presente le futur ecran de notre variometre

(https://img11.hostingpics.net/thumbs/mini_44060520170906232933.jpg) (https://www.hostingpics.net/viewer.php?id=44060520170906232933.jpg)
Title: Re: Waveshare e-paper displays with SPI
Post by: ZinggJM on Sep 16, 2017, 09:33 am
Attached you will find a short example of my code.
Here i have the following situation:
not every pixel has the lost contrast issue.
only, that pixel that is in the updatewindow area.
Not every pixel of a number has the same contrast.

is there any other way, to update partial area (or the hole screen), without flickering?
I have re-introduced delays of 2 x 300ms in the partial update code, that was present in the demo code from Waveshare. This delay is now declared as a macro #define PU_DELAY 300 in the classes .cpp files to allow easy experimentation. It should improve contrast degradation.

Note that these e-paper displays have a specified lifetime of 5 years or 1'000'000 update cycles.
So they are not really suitable for 1s update cycles (as in your example with the modification), which could result in serious degradation or end of life after 12 days. You can download the specification from good-display.com.

I found one specification with more details on lifetime:

(http://forum.arduino.cc/index.php?action=dlattach;topic=487007.0;attach=226135)

So update interval should be at least 3 minutes of long lifetime.

Fortunately I took this interval for my temperature and humidity displays.
Title: Re: Waveshare e-paper displays with SPI
Post by: bytecrusher on Sep 17, 2017, 12:00 pm
Hi ZinggJM,
Thanks for the great hint.
Yes, you are right.
Update every Second might reduce the life Time.
But for a device to Display rpm an Update every 3 Minuten is Not a Great Deal.
I have to think about a Dynamic Update (only if rpm is less or more than for example 100 changed).
The display doesn't run 24h per day. So I will also have a lot of fun over the years.
Title: Re: Waveshare e-paper displays with SPI
Post by: ZinggJM on Sep 17, 2017, 01:06 pm
The specification is certainly on the pessimistic side. But it is a physical process turning particles in a fluid.

I would suggest to use a minimum interval of 5 to 10 seconds, dynamic partial updates, count the updates, and do a full refresh after a number of partial updates or time elapsed.

And please report your experience again, thanks.
Title: Re: Waveshare e-paper displays with SPI
Post by: bytecrusher on Sep 17, 2017, 08:52 pm
yes, i will keep you up to date.
Title: Re: Waveshare e-paper displays with SPI
Post by: mackjjr on Sep 18, 2017, 05:47 am
Hey - I just received my WaveShare 4.2 inch E Ink module, and I got your library working, but only a small portion of the screen renders when I print to screen, and everything else is cut off. Using the WaveShare library I am able to write to the entire screen - any idea what might be causing that?

Thanks! The library looks awesome, I'm very excited to get it all up and running.
Title: Re: Waveshare e-paper displays with SPI
Post by: ZinggJM on Sep 18, 2017, 07:33 am
Hey - I just received my WaveShare 4.2 inch E Ink module, and I got your library working, but only a small portion of the screen renders when I print to screen, and everything else is cut off. Using the WaveShare library I am able to write to the entire screen - any idea what might be causing that?

Thanks! The library looks awesome, I'm very excited to get it all up and running.
Hi mackjjr

From the symptom you describe I assume you run it with a AVR Arduino (e.g. UNO, NANO).
These Arduinos do not have enough RAM to buffer the content for the full screen.

CAUTION: use level converters or resistor voltage dividers with 5V Arduinos!

Drawing full screen bitmaps directly to the screen should work.
For buffered drawing you need to use the drawPaged() method, see example PagedDisplayExampleForNanoRam.

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.
Title: Re: Waveshare e-paper displays with SPI
Post by: cepics on Sep 18, 2017, 07:37 pm
Hi, I can't display nothing on the 2.9 inch e-paper display. No errors when I compile the sketch but also no activity on the display when I upload the sketch. I'm trying the examples with GxEPD library, but nothing happens

maybe I have to comment/uncomment something in the code?

I'm intersted on partial update of big font to display int or float numeric variables

 I'm on d1 mini clone
2.9 inch waveshare e-paper display
arduino ide 1.8.4

sorry for my basic question

tnks a lot
Title: Re: Waveshare e-paper displays with SPI
Post by: ZinggJM on Sep 18, 2017, 08:21 pm
Not easy to diagnose your issue for me. Information about your wiring would help.

I have seen this symptom when the wiring of the busy signal did not correspond to the value used in the constructor (I have 2 variants, the wiring I propose, and the wiring I use for my IoT sensor node).

Make sure the SPI connection is correct for your D1 clone, the hardware SPI is used.
Title: Re: Waveshare e-paper displays with SPI
Post by: cepics on Sep 18, 2017, 09:05 pm
I wired it up like the sketch said:


BUSY -> D6,
RST -> D4,
DC -> D3,
CS -> D8,
CLK -> D5,
DIN -> D7,
GND -> GND,
3.3V -> 3.3V

and clone seems to have the same pinout of wemos
https://hackaday.com/2017/05/15/attack-on-the-clones-a-review-of-two-common-esp8266-mini-d1-boards/

tnks
Title: Re: Waveshare e-paper displays with SPI
Post by: ZinggJM on Sep 18, 2017, 09:23 pm
I wired it up like the sketch said:


BUSY -> D6,
RST -> D4,
DC -> D3,
CS -> D8,
CLK -> D5,
DIN -> D7,
GND -> GND,
3.3V -> 3.3V

tnks
This is my IoT configuration. Do you use this constructor, by uncommenting it?

Which example do you use?

// my IoT connection, busy on MISO
GxEPD_Class display(io, D4, D6);
Title: Re: Waveshare e-paper displays with SPI
Post by: cepics on Sep 18, 2017, 09:49 pm
Quote
This is my IoT configuration. Do you use this constructor, by uncommenting it?
sorry but I'm not sure  where to uncomment for my D1 mini... maybe here?
Code: [Select]

// generic/common.h
//static const uint8_t SS    = 15;
//static const uint8_t MOSI  = 13;
//static const uint8_t MISO  = 12;
//static const uint8_t SCK   = 14;
// pins_arduino.h
//static const uint8_t D8   = 15;
//static const uint8_t D7   = 13;
//static const uint8_t D6   = 12;
//static const uint8_t D5   = 14;


Quote
Which example do you use?
PartialUpdateExample

Title: Re: Waveshare e-paper displays with SPI
Post by: ZinggJM on Sep 18, 2017, 10:39 pm
Ok, now I see the error, thank you.

The mapping comment in the PartialUpdateExample is wrong. Busy -> D2 would be correct.
Busy -> D6 is the configuration for my IoT use.

For Busy -> D6 you need to take the other constructor.

The mapping comment in GxEPD_SPI_TestExample is correct.
Title: Re: Waveshare e-paper displays with SPI
Post by: cepics on Sep 18, 2017, 11:11 pm
this is my new wiring:

// mapping from Waveshare 2.9inch e-Paper to Wemos D1 mini
// BUSY -> D2, RST -> D4, DC -> D3, CS -> D8, CLK -> D5, DIN -> D7, GND -> GND, 3.3V -> 3.3V

but when I upload PartialUpdateExample sketch nothing happens.... is it normal?
also GxEPD_SPI_TestExample don't give any output on the display

sorry i'm a super noob
Title: Re: Waveshare e-paper displays with SPI
Post by: ZinggJM on Sep 19, 2017, 05:38 am
It is not normal that nothing happens. I checked with the examples before uploading to GitHub.

Just to make sure: do you compile for "Wemos D1 R2 & mini" ?

And please post a link to your actual D1 mini clone.

Did you try the Waveshare demo code, does it run?

And you can also try u8g2 with your 2.9", caution: it has a different default wiring.
Title: Re: Waveshare e-paper displays with SPI
Post by: cepics on Sep 19, 2017, 09:47 am
Quote
Just to make sure: do you compile for "Wemos D1 R2 & mini" ?
yes

Quote
And please post a link to your actual D1 mini clone.
theres nothing on line about xcsource d1 mini clone, I refer to wemos datasheet

Quote
Did you try the Waveshare demo code, does it run?
yes and nothing happens, for that reason I'm trying yours examples

Code: [Select]
And you can also try u8g2 with your 2.9", caution: it has a different default wiring.

I will
Title: Re: Waveshare e-paper displays with SPI
Post by: ZinggJM on Sep 19, 2017, 12:19 pm
I would guess, either your D1 mini clone is broken, or the display.

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.

I searched for "xcsource d1 mini clone", and found a link with good pictures:

https://www.amazon.de/XCSOURCE-Drahtlos-Internet-Entwicklungsboard-TE441/dp/B01ELFAF1S (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.

There are several things you can try:

- look at the signals with a scope or logic analyzer

- add or enable debug output for the Serial Monitor; start with uncommenting debug output of the _waitWhileBusy() method in GxGDEH029A1.cpp.
Title: Re: Waveshare e-paper displays with SPI
Post by: mackjjr on Sep 20, 2017, 02:32 am
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!
Title: Re: Waveshare e-paper displays with SPI
Post by: cepics on Sep 20, 2017, 09:48 pm
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
Title: Re: Waveshare e-paper displays with SPI
Post by: cepics on Sep 20, 2017, 11:48 pm
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..
Title: Re: Waveshare e-paper displays with SPI
Post by: cepics on Sep 21, 2017, 12:09 am
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
Title: Re: Waveshare e-paper displays with SPI
Post by: ZinggJM on Sep 21, 2017, 04:29 am
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)
Title: Re: Waveshare e-paper displays with SPI
Post by: ZinggJM on Sep 21, 2017, 01:57 pm
...
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.
Title: Re: Waveshare e-paper displays with SPI
Post by: djmusic on Sep 21, 2017, 06:22 pm
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
Title: Re: Waveshare e-paper displays with SPI
Post by: ZinggJM on Sep 21, 2017, 07:33 pm
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);
}
Title: Re: Waveshare e-paper displays with SPI
Post by: djmusic on Sep 21, 2017, 10:48 pm
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 (https://youtu.be/uq58pu4cxcs)

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

https://youtu.be/yTpZEocsNBE (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?
Title: Re: Waveshare e-paper displays with SPI
Post by: ZinggJM on Sep 22, 2017, 06:54 am
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.
Title: Re: Waveshare e-paper displays with SPI
Post by: AETU69 on Sep 27, 2017, 10:56 am
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


I am problably doing something wrong... Any help would be appreciated.
Title: Re: Waveshare e-paper displays with SPI
Post by: ZinggJM on Sep 27, 2017, 12:01 pm
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
Title: Re: Waveshare e-paper displays with SPI
Post by: AETU69 on Sep 27, 2017, 01:40 pm
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
Title: Re: Waveshare e-paper displays with SPI
Post by: ZinggJM on Sep 27, 2017, 03:09 pm
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
Title: Re: Waveshare e-paper displays with SPI
Post by: mackjjr on Sep 28, 2017, 05:24 am
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!
Title: Re: Waveshare e-paper displays with SPI
Post by: ZinggJM on Sep 28, 2017, 07:38 am
Sounds like the display class got confused.

In drawCallback methods only methods to draw to buffer are to be used, the methods of Adafruit_GFX.
No direct drawing to screen (bitmaps), no update methods.

Thanks for detecting this issue, I will have to add defensive checks (ignore calls if inside paged).

If this is not the reason of your issue, then I would need your code to check (or a compilable part showing the issue).
Title: Re: Waveshare e-paper displays with SPI
Post by: ZinggJM on Sep 28, 2017, 09:34 am
Some of my newest wiring examples.

My experiments with PCB etching are decades ago and of limited success, unfortunately.
And I don't know any PCB facilities for inexpensive small lots.

(http://forum.arduino.cc/index.php?action=dlattach;topic=487007.0;attach=227645)
Title: Re: Waveshare e-paper displays with SPI
Post by: ZinggJM on Sep 28, 2017, 01:27 pm
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
There will be support for 1.54" 3 colors and 2.9" 3 colors e-papers in GxEPD, thanks to the sponsor Eric (AETU69).

And I have ordered
Universal e-Paper Raw Panel Driver HAT Used to drive various SPI interface e-Paper from Waveshare Raspberry Pi connectivity (https://www.aliexpress.com/item/Universal-e-Paper-Raw-Panel-Driver-HAT-Used-to-drive-various-SPI-interface-e-Paper-from/32833050422.html)
from Waveshare. This should make connection of the raw e-paper displays easier.

I have tried to get the attention of Waveshare for this topic and my GxEPD library.
But unfortunately they seem to have decided to ignore it:

Quote
Dear Jean,
Hoping you will like it,thanks!
Sorry ,i don't know more about GxEPD library on GitHub. but thanks for your support and trust.
Now we have updated an new size of display.7.5inch.if you have interested in it,maybe you can have a try.
Best Regards
Maggie
Title: Re: Waveshare e-paper displays with SPI
Post by: vertigo72 on Sep 29, 2017, 08:23 am
Im interested in learning more about the side effects of using partial updates; has anyone been brave enough to test a device with a short, say 1 second partial update cycle, and leave it running for a few weeks to see if it actually degrades/kills the display? If not, I will probably do this myself. ereaders do partial updates, and those dont seem to die quickly.

I read somewhere that you need to do a full refresh every now and then to limit the damage? No idea if that is accurate, or its its just to 'clean' the display. I also read that high temperature has a positive influence on the damage done by partial updates?

As for how it looks;  I also wonder, does the the ghosting effect get incrementally worse? If you alternate numbers from 0 to 9 in a loop, does there come a point where you cant read the number anymore and it becomes a smear, or is the ghosting just fairly constant and with every partial refresh, you also get a "partial cleaning" ?

You asked for use cases earlier; here is my use case: a glider variometer (vertical speed indicator). This is my current prototype:

https://youtu.be/7Zbjo2WrcWk (https://youtu.be/7Zbjo2WrcWk)

It uses an OLED display to show average climb and some other info. The OLED looks great as long as there is no direct sunlight; which unfortunately makes it useless in a glider.  There arent many alternatives either; I will also test sharp memory displays, but those are hard to find. And newhaven has some small sunlight readable TFTs but with precious little arduino support.

So Im looking at eink. A refresh rate of 1 per second, or maybe a few seconds is acceptable here, minutes is clearly not. Whats also not acceptable is doing periodic full refreshes: that would just be too distracting in a cockpit. However, a short life span is acceptable to me. The glider flies no more than maybe 100 hours per year. If I need to replace a €7 display every year, so be it. I'll just stockpile them :).
Title: Re: Waveshare e-paper displays with SPI
Post by: ZinggJM on Sep 29, 2017, 09:20 am
Thank you for this important and interesting question.

I am a bit reluctant to give my answer; I hope you get more answers from users with more experience.

It depends on the e-paper display you want to use. My impression is, the smaller, the less degradation with fast partial updates.

I noticed degradation mostly outside the partial update window, so maybe a periodic partial update to the full screen helps.

I would not use a update period less than 2 seconds, and update only if needed (dynamic change).

I may start a one-week test with one of my bare 1.54" e-paper displays.

Please change your youtube link, so it can be played without logging in.

Jean-Marc

Maybe this kind of display would be better suited for your application. But its a different price range, and I have no idea how to connect and program it:

2.6" inch Complete LCD DF1624V1 FPC-1 LCDs for Garmin eTrex Touch 35 Handheld GPS LCD display Screen with Touch screen digitizer (https://www.aliexpress.com/item/2-6-inch-Complete-LCD-DF1624V1-FPC-1-LCDs-for-Garmin-eTrex-Touch-35-Handheld-GPS/32822569949.html)
Title: Re: Waveshare e-paper displays with SPI
Post by: vertigo72 on Sep 29, 2017, 10:17 am
I fixed the youtube link. Im looking forward to your test results, while I wait for my einks to arrive
Title: Re: Waveshare e-paper displays with SPI
Post by: ZinggJM on Oct 03, 2017, 03:42 pm
The 1.54inch e-paper display shows no noticeable degradation after 1 day of partial updates every second.
The test program used makes only partial updates to the window with the values, no partial or full updates to the full screen (which may be needed for longer continuous use). The test goes on.

(https://forum.arduino.cc/index.php?action=dlattach;topic=487007.0;attach=228355)
Title: Re: Waveshare e-paper displays with SPI
Post by: witchole on Oct 06, 2017, 03:31 pm
Hi Jean-Marc,

First of all many thanks for your GxEPD library, it is great work and much appreciated.

I've encountered a problem with drawing bitmaps to a 1.54" WaveShare screen, I don't know whether this is because I'm doing something wrong or whether there is a bug in the library.

I'm referring to the drawBitmap() method:

Code: [Select]

display.drawBitmap(x, y, score1, w, h, GxEPD_BLACK);


From my tests it appears that the "x" parameter is actually the co-ordinate of the right-hand side of the bitmap, not the left-hand side as with the other functions, e.g. updateWindow().

i.e. the bitmap is only positioned correctly if I use the following:

Code: [Select]

display.drawBitmap(GxEPD_WIDTH - w - x, y, score1, w, h, GxEPD_BLACK);


Is this a bug, or am I doing something wrong?

Code: [Select]

#include <GxEPD.h>
#include <GxGDEP015OC1/GxGDEP015OC1.cpp>

[...]

 //display.drawBitmap(91,  36, score1, 85, 57, GxEPD_BLACK);
 // x co-ordinate appears to be right of bitmap, not left!
 // so left 91 -> 200 - (91 + 85) = 24
 display.drawBitmap(24, 36, score1, 85, 57, GxEPD_BLACK);

 display.updateWindow(91, 36, 85, 57, false);
Title: Re: Waveshare e-paper displays with SPI
Post by: ZinggJM on Oct 06, 2017, 05:00 pm
Hi witchole,

All drawBitmap methods behave per default so that the example bitmaps are drawn correctly.

The method you use has no additional parameter to change the behavior.

You can use the method:

Code: [Select]
    // to buffer, may be cropped, drawPixel() used, update needed, different signature, mode default for example bitmaps

    void  drawBitmap(const uint8_t *bitmap, uint16_t x, uint16_t y, uint16_t w, uint16_t h, uint16_t color, int16_t mode = bm_flip_v | bm_invert);



with parameter mode GxEPD::bm_normal

for your bitmap.

Look in GxEPD.h for the enumeration bitvalues for mode.

I hope this solves your issues, otherwise post your bitmap, so I can test.
Title: Re: Waveshare e-paper displays with SPI
Post by: witchole on Oct 06, 2017, 05:27 pm
Thanks Jean-Marc,
I've got to go away for the weekend but will test it on my return.

For reference, this is an example bitmap I have been testing:

Code: [Select]

const unsigned char gImage_S30[627] = { /* 0X00,0X01,0X55,0X00,0X39,0X00, */
0XFF,0X80,0X00,0X03,0XFF,0XFF,0XFE,0X00,0X00,0X0F,0XF8,0XFF,0X00,0X00,0X01,0XFF,
0XFF,0XFC,0X00,0X00,0X07,0XF8,0XFE,0X00,0X00,0X00,0XFF,0XFF,0XF8,0X00,0X00,0X03,
0XF8,0XFC,0X00,0X00,0X00,0X7F,0XFF,0XF0,0X00,0X00,0X01,0XF8,0XF8,0X00,0X00,0X00,
0X3F,0XFF,0XE0,0X00,0X00,0X00,0XF8,0XF4,0X00,0X00,0X00,0X5F,0XFF,0XD0,0X00,0X00,
0X01,0XF8,0XE2,0X00,0X00,0X00,0X8F,0XFF,0X88,0X00,0X00,0X03,0XF8,0XC1,0X00,0X00,
0X01,0X07,0XFF,0X04,0X00,0X00,0X07,0XF8,0X80,0X80,0X00,0X02,0X03,0XFE,0X02,0X00,
0X00,0X0F,0XF8,0X00,0X7F,0XFF,0XFC,0X01,0XFC,0X01,0XFF,0XFF,0XFF,0XF8,0X00,0X7F,
0XFF,0XFC,0X01,0XFC,0X01,0XFF,0XFF,0XFF,0XF8,0X00,0X7F,0XFF,0XFC,0X01,0XFC,0X01,
0XFF,0XFF,0XFF,0XF8,0X00,0X7F,0XFF,0XFC,0X01,0XFC,0X01,0XFF,0XFF,0XFF,0XF8,0X00,
0X7F,0XFF,0XFC,0X01,0XFC,0X01,0XFF,0XFF,0XFF,0XF8,0X00,0X7F,0XFF,0XFC,0X01,0XFC,
0X01,0XFF,0XFF,0XFF,0XF8,0X00,0X7F,0XFF,0XFC,0X01,0XFC,0X01,0XFF,0XFF,0XFF,0XF8,
0X00,0X7F,0XFF,0XFC,0X01,0XFC,0X01,0XFF,0XFF,0XFF,0XF8,0X00,0X7F,0XFF,0XFC,0X01,
0XFC,0X01,0XFF,0XFF,0XFF,0XF8,0X00,0X7F,0XFF,0XFC,0X01,0XFC,0X01,0XFF,0XFF,0XFF,
0XF8,0X00,0X7F,0XFF,0XFC,0X01,0XFC,0X01,0XFF,0XFF,0XFF,0XF8,0X00,0X7F,0XFF,0XFC,
0X01,0XFC,0X01,0XFF,0XFF,0XFF,0XF8,0X00,0X7F,0XFF,0XFC,0X01,0XFC,0X01,0XFF,0XFF,
0XFF,0XF8,0X00,0X7F,0XFF,0XFC,0X01,0XFC,0X01,0XFF,0XFF,0XFF,0XF8,0X00,0X7F,0XFF,
0XFC,0X01,0XFC,0X01,0XFF,0XFF,0XFF,0XF8,0X80,0XFF,0XFF,0XFE,0X03,0XFE,0X02,0X00,
0X00,0X0F,0XF8,0XC1,0XFF,0XFF,0XFF,0X07,0XFF,0X04,0X00,0X00,0X07,0XF8,0XE3,0XFF,
0XFF,0XFF,0X8F,0XFF,0X88,0X00,0X00,0X03,0XF8,0XF7,0XFF,0XFF,0XFF,0XDF,0XFF,0XD0,
0X00,0X00,0X01,0XF8,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XE0,0X00,0X00,0X00,0XF8,0XF7,
0XFF,0XFF,0XFF,0XDF,0XFF,0XD0,0X00,0X00,0X01,0XF8,0XE3,0XFF,0XFF,0XFF,0X8F,0XFF,
0X88,0X00,0X00,0X03,0XF8,0XC1,0XFF,0XFF,0XFF,0X07,0XFF,0X04,0X00,0X00,0X07,0XF8,
0X80,0XFF,0XFF,0XFE,0X03,0XFE,0X02,0X00,0X00,0X0F,0XF8,0X00,0X7F,0XFF,0XFC,0X01,
0XFC,0X01,0XFF,0XFF,0XFF,0XF8,0X00,0X7F,0XFF,0XFC,0X01,0XFC,0X01,0XFF,0XFF,0XFF,
0XF8,0X00,0X7F,0XFF,0XFC,0X01,0XFC,0X01,0XFF,0XFF,0XFF,0XF8,0X00,0X7F,0XFF,0XFC,
0X01,0XFC,0X01,0XFF,0XFF,0XFF,0XF8,0X00,0X7F,0XFF,0XFC,0X01,0XFC,0X01,0XFF,0XFF,
0XFF,0XF8,0X00,0X7F,0XFF,0XFC,0X01,0XFC,0X01,0XFF,0XFF,0XFF,0XF8,0X00,0X7F,0XFF,
0XFC,0X01,0XFC,0X01,0XFF,0XFF,0XFF,0XF8,0X00,0X7F,0XFF,0XFC,0X01,0XFC,0X01,0XFF,
0XFF,0XFF,0XF8,0X00,0X7F,0XFF,0XFC,0X01,0XFC,0X01,0XFF,0XFF,0XFF,0XF8,0X00,0X7F,
0XFF,0XFC,0X01,0XFC,0X01,0XFF,0XFF,0XFF,0XF8,0X00,0X7F,0XFF,0XFC,0X01,0XFC,0X01,
0XFF,0XFF,0XFF,0XF8,0X00,0X7F,0XFF,0XFC,0X01,0XFC,0X01,0XFF,0XFF,0XFF,0XF8,0X00,
0X7F,0XFF,0XFC,0X01,0XFC,0X01,0XFF,0XFF,0XFF,0XF8,0X00,0X7F,0XFF,0XFC,0X01,0XFC,
0X01,0XFF,0XFF,0XFF,0XF8,0X00,0X7F,0XFF,0XFC,0X01,0XFC,0X01,0XFF,0XFF,0XFF,0XF8,
0X80,0X80,0X00,0X02,0X03,0XFE,0X02,0X00,0X00,0X0F,0XF8,0XC1,0X00,0X00,0X01,0X07,
0XFF,0X04,0X00,0X00,0X07,0XF8,0XE2,0X00,0X00,0X00,0X8F,0XFF,0X88,0X00,0X00,0X03,
0XF8,0XF4,0X00,0X00,0X00,0X5F,0XFF,0XD0,0X00,0X00,0X01,0XF8,0XF8,0X00,0X00,0X00,
0X3F,0XFF,0XE0,0X00,0X00,0X00,0XF8,0XFC,0X00,0X00,0X00,0X7F,0XFF,0XF0,0X00,0X00,
0X01,0XF8,0XFE,0X00,0X00,0X00,0XFF,0XFF,0XF8,0X00,0X00,0X03,0XF8,0XFF,0X00,0X00,
0X01,0XFF,0XFF,0XFC,0X00,0X00,0X07,0XF8,0XFF,0X80,0X00,0X03,0XFF,0XFF,0XFE,0X00,
0X00,0X0F,0XF8,};
Title: Re: Waveshare e-paper displays with SPI
Post by: witchole on Oct 10, 2017, 05:05 pm
I hope this solves your issues, otherwise post your bitmap, so I can test.
Many thanks Jean-Marc, yes that version of drawBitmap() does work correctly, and it also solves the other inconvenience I was having with the other form: having to invert and mirror the bitmap left to right.

But do you agree that there is actually a bug with the form of drawBitmap() that I was using?

I've attached a sample .ino project to illustrate the issue.
Title: Re: Waveshare e-paper displays with SPI
Post by: ZinggJM on Oct 10, 2017, 06:52 pm
Many thanks Jean-Marc, yes that version of drawBitmap() does work correctly, and it also solves the other inconvenience I was having with the other form: having to invert and mirror the bitmap left to right.

But do you agree that there is actually a bug with the form of drawBitmap() that I was using?

I've attached a sample .ino project to illustrate the issue.
I do not agree, as I am quite sure I tested it with the GxEPD_TestExample.ino, and it displayed the example bitmaps correctly. As I explained, the drawBitmap() method with the signature without mode parameter is made to display the example bitmaps. It just calls the other method with the default mode parameter.

So this is by design, and any test example you provide is not relevant for me.

But of course I will re-check with the test example when I soon put updates on GitHub.
Title: Re: Waveshare e-paper displays with SPI
Post by: witchole on Oct 10, 2017, 07:19 pm
I tested it with the GxEPD_TestExample.ino, and it displayed the example bitmaps correctly.
[...]
But of course I will re-check with the test example when I soon put updates on GitHub.
Thanks JM.

If you are referring to this example from GxEPD_TestExample.ino:
Code: [Select]

  display.drawBitmap(0, 0, BitmapExample1, GxEPD_WIDTH, GxEPD_HEIGHT, GxEPD_BLACK);


then obviously it will still work because

(GxEPD_WIDTH - w - x) is equal to (GxEPD_WIDTH - GxEPD_WIDTH - 0); i.e. it is equal to 0.
Title: Re: Waveshare e-paper displays with SPI
Post by: witchole on Oct 10, 2017, 09:09 pm
the drawBitmap() method with the signature without mode parameter is made to display the example bitmaps. It just calls the other method with the default mode parameter.
I've looked at your source code and I now see what you mean, sorry for being dense! So basically for my own development I should only use the new method signature, there is no point at all in using the older form.

Code: [Select]

void  GxGDEP015OC1::drawBitmap(int16_t x, int16_t y, const uint8_t *bitmap, int16_t w, int16_t h, uint16_t color)
{
  drawBitmap(bitmap, x, y, w, h, color);
}
Title: Re: Waveshare e-paper displays with SPI
Post by: ZinggJM on Oct 10, 2017, 10:37 pm
I've looked at your source code and I now see what you mean, sorry for being dense! So basically for my own development I should only use the new method signature, there is no point at all in using the older form.

Code: [Select]

void  GxGDEP015OC1::drawBitmap(int16_t x, int16_t y, const uint8_t *bitmap, int16_t w, int16_t h, uint16_t color)
{
  drawBitmap(bitmap, x, y, w, h, color);
}


That is correct.

I just decided I will replace the method with the old signature with a method drawExampleBitmap() with the new signature. So the Adafruit_GFX methods with similar signature will not be hidden any more.

This will make this clearer, but will happen step by step.
Title: Re: Waveshare e-paper displays with SPI
Post by: Q24H on Oct 11, 2017, 08:01 am
Hi ZinggJM,

Excellent library, didn't take long for me to get my 1.54in waveshare b/w working on the ESP32! just curious, I noticed there is a pixel and rectangle fill function, is there a simple way to draw lines? I can do vertical and horizontal with the rectangle function, but diagonally it gets tricky.

Also great to hear that you are looking into other b/w/r tri colors displays! Thanks!
Title: Re: Waveshare e-paper displays with SPI
Post by: witchole on Oct 11, 2017, 09:00 am
is there a simple way to draw lines? I can do vertical and horizontal with the rectangle function, but diagonally it gets tricky.
The E-Paper display base class is a subclass of Adafruit_GFX, so look at the documentation for adafruit gfx graphics primitives (https://learn.adafruit.com/adafruit-gfx-graphics-library/graphics-primitives).

in particular, you want the following methods:

Code: [Select]
void drawLine(uint16_t x0, uint16_t y0, uint16_t x1, uint16_t y1, uint16_t color);
void drawFastVLine(uint16_t x0, uint16_t y0, uint16_t length, uint16_t color);
void drawFastHLine(uint8_t x0, uint8_t y0, uint8_t length, uint16_t color);
Title: Re: Waveshare e-paper displays with SPI
Post by: witchole on Oct 11, 2017, 10:34 am
I will replace the method with the old signature with a method drawExampleBitmap()
Good idea!

Having experimented further, the issue I reported originally is caused by the bm_flip_v mode: if I use that mode in the example I posted, the bitmap is displayed at the wrong co-ordinates.  I'm assuming that it is supposed to mirror the bitmap, but still display it at the same screen location.

Can you confirm this?

Also, the bm_flip_h mode doesn't appear to do anything at all.
Title: Re: Waveshare e-paper displays with SPI
Post by: ZinggJM on Oct 11, 2017, 12:17 pm
Any such issues will be investigated later, as I can't duplicate myself.
I concentrate on the small black/white/red e-papers.
Title: Re: Waveshare e-paper displays with SPI
Post by: witchole on Oct 11, 2017, 12:24 pm
Any such issues will be investigated later, as I can't duplicate myself.
I concentrate on the small black/white/red e-papers.
Of course, that is a much better use of your time, and I really do appreciate all the amazing work you have put into this.

(I'm also looking forward to trying the coloured e-paper myself).
Title: Re: Waveshare e-paper displays with SPI
Post by: ZinggJM on Oct 12, 2017, 04:04 pm
My Arduino library GxEPD for e-paper displays is updated on GitHub with classes for 3-color displays 1.54", 2.13" and 2.9".

GitHub - ZinggJM/GxEPD - A simple E-Paper display library with common base class and separate IO class. (https://github.com/ZinggJM/GxEPD)

Thanks to Sponsor Eric.
Title: Re: Waveshare e-paper displays with SPI
Post by: ZinggJM on Oct 13, 2017, 09:40 am
Im interested in learning more about the side effects of using partial updates; has anyone been brave enough to test a device with a short, say 1 second partial update cycle, and leave it running for a few weeks to see if it actually degrades/kills the display? If not, I will probably do this myself. ereaders do partial updates, and those dont seem to die quickly.

I read somewhere that you need to do a full refresh every now and then to limit the damage? No idea if that is accurate, or its its just to 'clean' the display. I also read that high temperature has a positive influence on the damage done by partial updates?

As for how it looks;  I also wonder, does the the ghosting effect get incrementally worse? If you alternate numbers from 0 to 9 in a loop, does there come a point where you cant read the number anymore and it becomes a smear, or is the ghosting just fairly constant and with every partial refresh, you also get a "partial cleaning" ?

You asked for use cases earlier; here is my use case: a glider variometer (vertical speed indicator). This is my current prototype:

https://youtu.be/7Zbjo2WrcWk (https://youtu.be/7Zbjo2WrcWk)

It uses an OLED display to show average climb and some other info. The OLED looks great as long as there is no direct sunlight; which unfortunately makes it useless in a glider.  There arent many alternatives either; I will also test sharp memory displays, but those are hard to find. And newhaven has some small sunlight readable TFTs but with precious little arduino support.

So Im looking at eink. A refresh rate of 1 per second, or maybe a few seconds is acceptable here, minutes is clearly not. Whats also not acceptable is doing periodic full refreshes: that would just be too distracting in a cockpit. However, a short life span is acceptable to me. The glider flies no more than maybe 100 hours per year. If I need to replace a €7 display every year, so be it. I'll just stockpile them :).
I got the following answer from Dalian Good Display for your question:

Quote
With great pleasure to receive your email.
I read the question, and I think your answer is good and correct.

 Here is the video show our 1.54 inch e-paper, in new code, quick full screen update ( realized by partial refresh function)

https://youtu.be/M8kAfMiLMRY

If keep refreshing like this, there will be ghosting after dozens of pictures.

But for 1.54'', the ghosting is slight, while for 2.13 and 2.9 inch will be obvious.

Also because each customer's acceptable level of ghosting is different, so hard to give out a precise level, need to test themselves.

Another point it, e-paper is not that suitable for projects that require quick refreshing all the time.

Although customer do not care about lifetime, it still against the natural feature of e-paper display.

But in another hand, from technical point of view, e ink is always trying to realize faster and faster refreshing, also with more colors, also with larger size.

There is still a long way for e ink technology to go,  but obviously, will be a bright future.


At last, about the suitable display for sunlight readable needed projects, as I know, there are several choices:

1)      Reflective type monochrome lcd display

2)      Transflective TFT lcd display

3)      Transmissive TFT lcd display, but with super high brightness ( We have one 5.6 inch TFT module, with 800-1600cd/m2 brightness, had been used on outdoor monitor for UAV)

4)      E-paper display (We have customers that use e-papers on motorcycle or similar.)

 
But for this case, size is small, recommend to try more with e-paper displays.

And my test shows that the 1.54inch black/white e-paper display can be used with continuous partial updates every second, but shows some degradation after 9 days. So I recommend at least one full update per day for continuous use.

(http://forum.arduino.cc/index.php?action=dlattach;topic=487007.0;attach=229580)
Title: Re: Waveshare e-paper displays with SPI
Post by: witchole on Oct 13, 2017, 10:20 am
And my test shows that the 1.54inch black/white e-paper display can be used with continuous partial updates every second, but shows some degradation after 9 days. So I recommend at least one full update per day for continuous use.
Very useful, thanks J-M!

What about the specified lifetime of "5 years or 1 million update cycles" - is there any sign of permanent degradation on your screen now?  You must have performed close to a million partial updates.

Title: Re: Waveshare e-paper displays with SPI
Post by: ZinggJM on Oct 13, 2017, 01:49 pm
I just restarted the test to find out, and the display looks as good as new.

I will modify my test code to do one full update per day for the 1.54" display, and start another long term test.

I do the long term test only for the 1.54", as this is the only e-paper I have 2 spares of it.

I initially bought the demo system with 2 1.54" e-paper displays from Dalian Good Display, and it was worth every cent, as you can see from my interest in e-paper displays.
Title: Re: Waveshare e-paper displays with SPI
Post by: ZinggJM on Oct 15, 2017, 10:37 am
Good idea!

Having experimented further, the issue I reported originally is caused by the bm_flip_v mode: if I use that mode in the example I posted, the bitmap is displayed at the wrong co-ordinates.  I'm assuming that it is supposed to mirror the bitmap, but still display it at the same screen location.

Can you confirm this?

Also, the bm_flip_h mode doesn't appear to do anything at all.
... and bm_flip_h and bm_flip_v are also "flipped"!

With the updated version bm_flip_h and bm_flip_v are deprecated and replaced by bm_flip_x and bm_flip_y.

drawBitmap to buffer is fixed to flip bitmaps in place for non-fullscreen bitmaps; bm_flip_x and bm_flip_y are both implemented.

bm_flip_h and bm_flip_v will be removed when all display classes are updated.

Note that bm_flip_y for drawBitmap to screen is not available for 2.13" b/w, as the controller of this display does not support y-increment ram data entry mode.
Title: Re: Waveshare e-paper displays with SPI
Post by: witchole on Oct 15, 2017, 09:19 pm
With the updated version bm_flip_h and bm_flip_v are deprecated and replaced by bm_flip_x and bm_flip_y.

drawBitmap to buffer is fixed to flip bitmaps in place for non-fullscreen bitmaps; bm_flip_x and bm_flip_y are both implemented.
Great work Jean-Marc!

It now works correctly on the 1.54" B/W display, and the new naming is clearer, thanks.
Title: Re: Waveshare e-paper displays with SPI
Post by: vertigo72 on Oct 16, 2017, 12:01 pm
Thanks a lot for the 'endurance' test. That looks promising!  I'll add my own results later, as I received my 1.54" waveshare display today.  However, I cant make it work.

Im using the adafruit huzzah32 (ESP32). I wired it like this:

3.3 > 3.3
GND > GND
CS > 17
RESET > 5
DC > 16
DIN > 23
CLK > 18
BUSY > 19

(following this example:https://www.youtube.com/watch?v=AeYbX0zaJTY)

I commented out
Code: [Select]
#include <GxGDEP015OC1/GxGDEP015OC1.cpp>    // 1.54" b/w

And modified the pinout here:

Code: [Select]
#elif defined(ESP32)

// pins_arduino.h, e.g. LOLIN32
//static const uint8_t SS    = 5;
//static const uint8_t MOSI  = 23;
//static const uint8_t MISO  = 19;
//static const uint8_t SCK   = 18;

// GxIO_SPI(SPIClass& spi, int8_t cs, int8_t dc, int8_t rst = -1, int8_t bl = -1);
GxIO_Class io(SPI, 17, 16, 5); // arbitrary selection of 17, 16
// GxGDEP015OC1(GxIO& io, uint8_t rst = D4, uint8_t busy = D2);
GxEPD_Class display(io, 5,19); // arbitrary selection of (16), 4


When I run the test example,  the serial monitor shows:

setup
setup done
Busy Timeout!
Busy Timeout!
Busy Timeout!
Busy Timeout!
Busy Timeout!

And the display istn doing anything. Idea's?
Title: Re: Waveshare e-paper displays with SPI
Post by: ZinggJM on Oct 16, 2017, 04:41 pm
I have not installed the package for huzzah32, and do not intend to install it.
So I can't check the wiring for hardware or standard SPI for it. Nor the defaults and implementation of its SPI class.

But when using SPI, I would avoid to use the standard SS pin for anything else than CS.

So I propose to use SS for CS, and use some other pin for RST.
Maybe you have continuous reset to your display, or no reset to wake it up.

Busy Timeout indicates that either the display or some other source ties your busy pin continuously low.
Wrong busy wiring could produce this, but with the timeout the display might still work, but slower.

The continued endurance test shows noticeable degradation after 10 hours, but clean again after restart.
So I will reduce the full update period to 6 hours for next test.
Title: Re: Waveshare e-paper displays with SPI
Post by: vertigo72 on Oct 16, 2017, 10:12 pm
Yeay, I got it working!  Thanks for pushing me in the right direction. Turns out there is no default SS pin on this board and I had everything else wrong too :).

Being a newbie, I did have a hard mapping the commented constants with the pins on the board to the pins on the display and with the calls for the class.  In case it helps anyone else:

GxIO_Class io(SPI, A, B, C);


A="slave select"   =  CS on the display -> I chose 21 on ESP (there is no default SS pin on this board!)
B=" DC "            =  DC  on the display ->I chose 23 on ESP
C= "Reset"          =  RST on the display ->I chose 22 on ESP

GxEPD_Class display(io, D, E);

D="Reset"           =  RST on the display ->I chose 22on ESP
E= "Busy"            =  BUSY on the display ->I chose 17 on ESP

Furthermore,

CLK on the display should be connected to  SCK on the ESP
DIN on the display should be connected to  MOSI on the ESP

Okay, off to do some real testing now :)
Title: Re: Waveshare e-paper displays with SPI
Post by: ZinggJM on Oct 17, 2017, 08:54 am
My wife just told me I should learn to speak "Newbie-Language"! :)

I will try to add example mappings to the examples for ESP32 also.

First I had to re-discover how to get the ESP32 package, this time the actual one, it also contains feather_esp32:

GitHub - espressif/arduino-esp32: Arduino core for the ESP32 (https://github.com/espressif/arduino-esp32)

Then I downloaded the package as zip-file, unpacked it, and copied it to Arduino/hardware (I renamed it to remove "-master").

This does not work; there is a document in .docs how to install esp32.

So I just changed the path of the package to:
C:\Users\ZinggJ\Documents\Arduino\hardware\espressif\esp32
and double clicked:
C:\Users\ZinggJ\Documents\Arduino\hardware\espressif\esp32\tools\get.exe

This compiler obviously is more strict than the (assumed same) compiler for ESP8266; it produces warnings with the examples.
But it compiled anyway with my settings in preferences.


And in a subdirectory the variants can be found, e.g.:

C:\Users\ZinggJ\Documents\Arduino\hardware\espressif\esp32\variants\feather_esp32\pins_arduino.h

And of course the SPI pins can be found there, including SS:

Code: [Select]
static const uint8_t LED_BUILTIN = 13;
#define BUILTIN_LED  LED_BUILTIN // backward compatibility

static const uint8_t TX = 17;
static const uint8_t RX = 16;

static const uint8_t SDA = 23;
static const uint8_t SCL = 22;

static const uint8_t SS    = 2;
static const uint8_t MOSI  = 18;
static const uint8_t MISO  = 19;
static const uint8_t SCK   = 5;


These pin definitions are different from the LOLIN32 I have - I hope they are correct - so I can't provide a general mapping suggestion for ESP32.

Most variants have this SPI mapping, but there are various different ones:

Code: [Select]
static const uint8_t SS    = 5;
static const uint8_t MOSI  = 23;
static const uint8_t MISO  = 19;
static const uint8_t SCK   = 18;
Title: Re: Waveshare e-paper displays with SPI
Post by: vertigo72 on Oct 17, 2017, 10:01 am
Noobspeak is hard to master. It took me 40 years of mostly not programming!

Zingg, a few more questions if I may;

- Have you published the code you are running for the partial update degradation test?
- Did you modify: #define PU_DELAY 300

With the default PU_DELAY it takes about a full second to achieve a partial update. The weird thing is, that it doesnt seem to matter if you're updating a single pixel or the entire screen, it takes about the same time?

But lowering the number increases the speed by a lot. Im currently running with PU_DELAY 30, and Im getting ~3FPS.  Im not sure why lowering the delay by 10x 'only' results in a ~3x speedup, and lowering it even further doesnt seem to make a difference; but 3FPS is usable for my application. I assume degradation will be a lot worse too, but I have no idea yet about the correlation. After 30 minutes, the screen still looks good to me, and I can live with a full refresh every 30 minutes or so.

Lastly, this may not be the place to ask.. but display.updateWindow is blocking. I cant really afford a blocking process running 100s of milliseconds, as I will be driving a stepper motor too. The ESP32 is a dual core, and Ive seen it can be used in Arduino. I'll have to read and try, but do you have any thoughts on running the display driver on its own cpu core/thread?
Title: Re: Waveshare e-paper displays with SPI
Post by: vertigo72 on Oct 17, 2017, 11:29 am
The camera doesnt lie; or does it? I was shooting some video to show the display to my brother, and I was rather shocked how bad the ghosting looked on camera when using partial updates (and immediately) :


https://www.youtube.com/watch?v=QyDnSLHg484 (https://www.youtube.com/watch?v=QyDnSLHg484)

With my own eyes, I can only barely perceive it, and it doesnt bother me at all.
Weird?
Title: Re: Waveshare e-paper displays with SPI
Post by: ZinggJM on Oct 17, 2017, 01:15 pm
Be prepared for delayed answers. I have more updates to do, and fixes to incomplete updates.

The PartialUpdateTest example will be put on GitHub, as soon as I have done initial tests with 2.9".

Adding a isBusy() method and changing to method update(bool nonblocking = false) would be an option, but I leave that to the advanced user who modifies the library anyway.

The initial idea of GxEPD was to give e-paper users something to start with, something more than was available from the e-paper suppliers. It IS intended to be adapted by experienced users.
Title: Re: Waveshare e-paper displays with SPI
Post by: vertigo72 on Oct 18, 2017, 09:59 am
Modifying your library in to a non blocking one is way above my paygrade, but I like this display and so I'll find a solution. If using 2 cores / threading doesnt work, or I cant do with a timing interrupt,  at worst I can go back to using 2 microcontrollers. I did that initially when I only had nano's and ran out of memory running an LCD, stepper, menu library,..  Its not elegant, but its cheap and it works :).

Anyway, just wanted to thank you for all your work on this, and your help!

Title: Re: Waveshare e-paper displays with SPI
Post by: Michel53 on Oct 19, 2017, 03:06 pm
hi, in your lib the "GxGDEW029Z10" especially for 2.9bwr don't work, generate an error

Code: [Select]
In file included from sketch\GxGDEW029Z10.cpp:33:0:

sketch\GxGDEW029Z10.h:36:22: fatal error: ../GxEPD.h: No such file or directory

 #include "../GxEPD.h"

                      ^

compilation terminated.

exit status 1
Erreur de compilation pour la carte Arduino Nano



i use the "GxEPD_SPI_TestExample" modified for my nano+2.9bwr with differents images that i made

Test pour 2.9bwr (https://www.dropbox.com/s/e4k7m4e3u5b7mxq/GxEPD_SPI_TestExMic.zip?dl=0)

(https://www.dropbox.com/sh/twomq5uwphhww2b/AACbxHlkaJF3ouXfrPsSclZ7a?dl=0)
Title: Re: Waveshare e-paper displays with SPI
Post by: ZinggJM on Oct 19, 2017, 05:29 pm
You need to add GxEPD as library.

Download library as zip-file, add zip-file with Library-Manager.

Compile and run GxEPD_SPI_TestExample with uncommented
#include <GxGDEW029Z10/GxGDEW029Z10.cpp>

If this fails, you can complain again.

#include "../GxEPD.h" fails, if the display class is not included from the library path.
Title: Re: Waveshare e-paper displays with SPI
Post by: Michel53 on Oct 20, 2017, 11:58 am
when i Compile and run GxEPD_SPI_TestExample with uncommented

#include <GxGDEW029Z10/GxGDEW029Z10.cpp>


Code: [Select]
Le croquis utilise 31452 octets (102%) de l'espace de stockage de programmes. Le maximum est de 30720 octets.
Les variables globales utilisent 1743 octets (85%) de mémoire dynamique, ce qui laisse 305 octets pour les variables locales. Le maximum est de 2048 octets.


Now is good on my GxGDEW029Z10 with this file (https://www.dropbox.com/s/ypu8txtrjgyhsap/GxEPD_SPI_TestExample_2.9bwr.zip?dl=0)

thanks for your job ;-))
Title: Re: Waveshare e-paper displays with SPI
Post by: devros on Oct 25, 2017, 01:18 pm
hello, thanks for great library works perfect on my wemos mini 8266
with 4,2 http://waveshare.com e-ink

now i want to try it on esp32 with my module (afaik it should work as pocket32)
https://www.aliexpress.com/store/product/WEMOS-WiFi-Bluetooth-Battery-ESP32-development-tool/2090076_32814163663.html

here is my config

GxIO_Class io(SPI, 5, 17, 14); //cs/dc/reset
GxEPD_Class display(io, 14, 15); //reset/busy

//static const uint8_t SS    = 5;
//static const uint8_t MOSI  = 23; /DIN
//static const uint8_t MISO  = 19;
//static const uint8_t SCK   = 18;  /CK

but so far no luck....
serial output is empty
any idea what could be wrong? (tried several pin setting without success)


My goal is to create e-ink display for my domoticz home system, battery powered with deep sleep refreshed every 5 min. Thinking about generate on my orangePC from json values image file, and then download it every 5 minutes over WIFI.
Title: Re: Waveshare e-paper displays with SPI
Post by: ZinggJM on Oct 25, 2017, 05:35 pm
Thank you for pointing to that interesting ESP32 device. I had seen it on AliExpress, but not noticed that it takes a battery on the backside. Double the price of a Wemos D1 mini Pro, but perfect for my IoT network.

I have tested once with Wemos LOLIN32 V1.0.0, but not re-tested (regression test) on updates of GxEPD.
I will do that, but would be surprised if it doesn't work.

The pin mapping should be correct for your device, from the picture on the website.
There are ESP32 devices with different pin mappings, see Arduino.h of the variant you compile for.

All my examples set up Serial with 115200 and print at least "setup", so I am surprised you don't see this in Serial Monitor.

Some devices need a push on the reset button after download, or sometimes reset helps, but I see no reset button on the picture of your device, and "boot" may cause it to wait for download, maybe.

I suggest you make sure a "blink" example and a serial output example works.

I will look what "pocket32" is. You could also try if your device works as LOLIN32, for basic functions.

Google found "pocket32" for me, but I don't know which ESP32 Board you use for it, is it in a different Arduino package?

The GxEPD_SPI_TestExample works fine with LOLIN32 Lite:

(http://forum.arduino.cc/index.php?action=dlattach;topic=487007.0;attach=231020)
Title: Re: Waveshare e-paper displays with SPI
Post by: devros on Oct 26, 2017, 08:22 am
thanks for all help, its still not working
board looks good, it would be interesting how long it could work with deepsleep + battery and E-ink together

-tried blink and serial communication it works without problem

-im using this board setting (https://github.com/espressif/arduino-esp32/blob/master/variants/pocket_32/pins_arduino.h) looks ok, BUILTIN_LED 16 works.....

- mine board looks little different compare
 https://www.tindie.com/products/lspoplove/pocket-32-v2esp3218650-battery/
vs
https://www.aliexpress.com/store/product/WEMOS-WiFi-Bluetooth-Battery-ESP32-development-tool/2090076_32814163663.html

- [boot] button is for uploading and [en] button is for reset on board

- i used sketch without serial output (PagedDisplayExampleSmallRam) when i use  GxEPD_SPI_TestExample
 iget normally setup and setup done in terminal


- tried also LOLIN config (the have same SS, MOSI, MISO, CK pin numbers) ... but still no response from display...

-display worked on Wemos 8266 so maybe my clone board have different pins compare to original board

my pins:
CS = 5
DC = 17
RESET = 14
BUSY = 15
DIN = 23
SCK = 18
GND = GND
3V = VIN

any idea what else should i check
thanks a lot
Title: Re: Waveshare e-paper displays with SPI
Post by: vertigo72 on Oct 26, 2017, 08:31 am
Try a few leds on the digital pins to check if the pins are working and correctly numbered?
Title: Re: Waveshare e-paper displays with SPI
Post by: devros on Oct 26, 2017, 08:42 am
Try a few leds on the digital pins to check if the pins are working and correctly numbered?
thanks.. that could help, i will try tonight
Title: Re: Waveshare e-paper displays with SPI
Post by: ZinggJM on Oct 26, 2017, 09:00 am
... and check your solder connections of the pins.

The small solder rings around the holes can provoke cold joints. Solder should clearly flow and be sucked into the hole.

I found pocket_32 - thanks to your link - it is on my other notebook. I need to update the ESP package on my development notebook.
Title: Re: Waveshare e-paper displays with SPI
Post by: vertigo72 on Oct 26, 2017, 09:56 am
has anyone by any chance found or made some fritzing components for these displays?
Title: Re: Waveshare e-paper displays with SPI
Post by: Q24H on Oct 27, 2017, 12:03 am
thanks.. that could help, i will try tonight
I have the same board you've got, assuming it's not a dud, I can assure you it does work with e-paper once you've figured out how to connect it. This video was very helpful https://www.youtube.com/watch?v=AeYbX0zaJTY
Title: Re: Waveshare e-paper displays with SPI
Post by: devros on Oct 27, 2017, 08:20 am
I have the same board you've got, assuming it's not a dud, I can assure you it does work with e-paper once you've figured out how to connect it. This video was very helpful https://www.youtube.com/watch?v=AeYbX0zaJTY
Thanks figured out that my pin 23 wasnt working

unfortunately, the usb connector from the board has broken yesterday (and its so tiny that i cant fix it)
i will have to setup FTDI connection, then it should work
Title: Re: Waveshare e-paper displays with SPI
Post by: gdudas on Oct 27, 2017, 08:57 pm
Hi,

I have Uno and 1.54 BWR display. I've tryed GxEPD_SPI_TestExample with pins BUSY-> 7, RST -> 9, DC-> 8, CS-> 10, CLK-> 13, DIN-> 11 and 3.3V->3.3V, GND->GND

#include <GxGDEW0154Z04/GxGDEW0154Z04.cpp>  // 1.54" b/w/r

Nothing happens.


I have tryed to create a simplified code but this also not works:
#include <GxEPD.h>
#include <GxGDEW0154Z04/GxGDEW0154Z04.cpp>  // 1.54" b/w/r

#include <Fonts/FreeMonoBold9pt7b.h>
#include <Fonts/FreeMonoBold12pt7b.h>
#include <Fonts/FreeMonoBold18pt7b.h>
#include <Fonts/FreeMonoBold24pt7b.h>

#include <GxIO/GxIO_SPI/GxIO_SPI.cpp>
#include <GxIO/GxIO.cpp>

#define PIN_SPI_SS    (10)
#define PIN_SPI_MOSI  (11)
#define PIN_SPI_MISO  (12)
#define PIN_SPI_SCK   (13)

GxIO_Class io(SPI, SS, 8, 9);
GxEPD_Class display(io);

void setup() {
  display.init();
}

void loop() {
  display.fillScreen(GxEPD_WHITE);
  display.println();
  display.println(" !\"#$%&'()*+,-./");
  display.update();
}

Could You help me?
Title: Re: Waveshare e-paper displays with SPI
Post by: ZinggJM on Oct 27, 2017, 09:18 pm
I do not know where I should place this IMPORTANT WARNING:

Do NOT use these e-paper displays directly with normal 5V UNO, NANO, MEAGA ...

They are for 3.3V and these processors can source up to 40mA into any anti-latch-up diodes of the controller!

Your mapping looks ok. Use at least series resistors.

Does Serial Monitor show anything?

I have tested this combination with 3.3V Arduino Pro Mini.
Title: Re: Waveshare e-paper displays with SPI
Post by: gdudas on Oct 27, 2017, 10:29 pm
I have used the 3.3V PIN on my UNO.
The serial monitor don't show anything.
Title: Re: Waveshare e-paper displays with SPI
Post by: ZinggJM on Oct 27, 2017, 10:35 pm
I have used the 3.3V PIN on my UNO.
The serial monitor don't show anything.

All output pins will source 5V !!!

GxEPD_SPI_TestExample does initialize Serial with 115200; you should see at least "setup" and then "setup done".
Title: Re: Waveshare e-paper displays with SPI
Post by: gdudas on Oct 27, 2017, 10:46 pm
Ops... Thanks for clearing. When I tested GxEPD_SPI_TestExample then the serial wrote:


setup
setup done
Busy Timeout!
Busy Timeout!


and so on...
Title: Re: Waveshare e-paper displays with SPI
Post by: ZinggJM on Oct 28, 2017, 06:14 am
Busy Timeout with no reaction on the display means you have a bad SPI connection, most likely.
Busy Timeout with display output would mean bad BUSY line connection.

Make sure the connector to the display is firmly pushed in.
Make sure your DuPont connectors make good contact (I had to replace them in one case).
Make sure your UNO has good solder joints (I have some clones with questionable soldering).

Verify connections with a voltmeter or a scope.
Title: Re: Waveshare e-paper displays with SPI
Post by: tull on Oct 28, 2017, 08:18 am
Hello ZinggJM,

it is possible to add support for this display?

https://www.waveshare.com/wiki/4.2inch_e-Paper_Module_(B)

It's a three-colors variant GDEW042T2.

Thanks you for your answer.
Title: Re: Waveshare e-paper displays with SPI
Post by: ZinggJM on Oct 28, 2017, 08:44 am
Hello ZinggJM,

it is possible to add support for this display?

https://www.waveshare.com/wiki/4.2inch_e-Paper_Module_(B)

It's a three-colors variant GDEW042T2.

Thanks you for your answer.
Yes, it is possible to add support for this display.

But I add only support for displays I have and can test with.
And I only buy displays I want to use for myself, or are interested in learning how to use.

So I would need a Sponsor for this display;
Waveshare provides their own demo examples and have not discovered that GxEPD may also help them sell more of these displays.
Title: Re: Waveshare e-paper displays with SPI
Post by: tull on Oct 28, 2017, 08:54 am
I understand ... it is not enough to write it alone ;-)
Title: Re: Waveshare e-paper displays with SPI
Post by: jones12ax7 on Oct 28, 2017, 11:14 pm
Hello guys,

Any plans to make partial update to work on the black/white/red display? More specifically on the GxGDEW0154Z04

Thanks!
Title: Re: Waveshare e-paper displays with SPI
Post by: ZinggJM on Oct 29, 2017, 06:38 am
Hello guys,

Any plans to make partial update to work on the black/white/red display? More specifically on the GxGDEW0154Z04

Thanks!
There are two prerequisites for partial update:

1. capabilities of the controller: setting a partial update window for the device RAM and writing to that window

2. availability of a waveform table for partial update (LUT table) for fast update.

For the controller of the GDEW0154Z04 both prerequisites are not available, see the specs of the controller.

For the e-papers with controllers that have the partial update capability, but no fast update method yet, I would like to experiment with partial update waveforms, but I do not have the knowledge to do it.

So any information for creation of partial update waveforms for the e-papers that officially have no partial update is welcome.

The controller specs of the GDEH029A1 has quite detailed information about the waveform table: IL3820 (http://www.good-display.com/download_detail/downloadsId=540.html)
Title: Re: Waveshare e-paper displays with SPI
Post by: vertigo72 on Oct 29, 2017, 10:02 am
Im happy to report my 1.54 B/W screen should have done well over 1 million partial update cycles now, andn after a full refresh, it still looks like new. In fairness, Im not updating every pixel every cycle, Im just showing incremental numbers, but still, this is good news.

I would like to come back to the matter of speed though. The current library seems to max out at ~2FPS despite a fast microcontoller (esp32). Further decreasing #define PU_DELAY  has no effect. When I look at some other demo's like this one:

https://www.youtube.com/watch?v=enzUbiSWenQ (https://www.youtube.com/watch?v=enzUbiSWenQ)

I wonder if either Im doing something wrong, or if there is something that can be done to achieve that kind of speed? For my application, generally 2FPS is ok. But when navigating menu's with a click encoder, its kind of painful and it  would be really nice to be able to temporarily trade extra speed for more ghosting.
Title: Re: Waveshare e-paper displays with SPI
Post by: jones12ax7 on Oct 29, 2017, 03:02 pm
Thank you very much! That's all I needed to know to decide my goals.
I think will be easier to use the B&W version instead.

I'm not an expert on programming (just an electronics enthusiast), but will have a check on the partial update waveforms.

Thanks!



There are two prerequisites for partial update:

1. capabilities of the controller: setting a partial update window for the device RAM and writing to that window

2. availability of a waveform table for partial update (LUT table) for fast update.

For the controller of the GDEW0154Z04 both prerequisites are not available, see the specs of the controller.

For the e-papers with controllers that have the partial update capability, but no fast update method yet, I would like to experiment with partial update waveforms, but I do not have the knowledge to do it.

So any information for creation of partial update waveforms for the e-papers that officially have no partial update is welcome.

The controller specs of the GDEH029A1 has quite detailed information about the waveform table: IL3820 (http://www.good-display.com/download_detail/downloadsId=540.html)
Title: Re: Waveshare e-paper displays with SPI
Post by: ZinggJM on Oct 29, 2017, 05:34 pm
Im happy to report my 1.54 B/W screen should have done well over 1 million partial update cycles now, andn after a full refresh, it still looks like new. In fairness, Im not updating every pixel every cycle, Im just showing incremental numbers, but still, this is good news.

I would like to come back to the matter of speed though. The current library seems to max out at ~2FPS despite a fast microcontoller (esp32). Further decreasing #define PU_DELAY  has no effect. When I look at some other demo's like this one:

https://www.youtube.com/watch?v=enzUbiSWenQ (https://www.youtube.com/watch?v=enzUbiSWenQ)

I wonder if either Im doing something wrong, or if there is something that can be done to achieve that kind of speed? For my application, generally 2FPS is ok. But when navigating menu's with a click encoder, its kind of painful and it  would be really nice to be able to temporarily trade extra speed for more ghosting.
The pervasive demo looks impressive. I do not know these e-paper displays, and don't know their actual prices.
I assume the pervasive displays use higher voltages to achieve higher update speed.


You do nothing wrong, the update time is mostly defined by the waveform table.

I had added the delays to give the displays a chance to live longer and show less degradation. Code execution time should be negligible compared to the update time, maybe except for paged display for AVR.

But these e-papers are not made for fast and frequent updates; their original destination was for shelf labels.

Thanks to Dalian Good Display we get affordable e-papers to play with.

Jean-Marc

Title: Re: Waveshare e-paper displays with SPI
Post by: jones12ax7 on Oct 29, 2017, 09:20 pm
Today, Ben Krasnow from Applied Science Youtube channel released an interesting video about refresh rate and how he hacked it.
I think it can be of interest for you guys.
https://www.youtube.com/watch?v=MsbiO8EAsGw

Cheers



There are two prerequisites for partial update:

1. capabilities of the controller: setting a partial update window for the device RAM and writing to that window

2. availability of a waveform table for partial update (LUT table) for fast update.

For the controller of the GDEW0154Z04 both prerequisites are not available, see the specs of the controller.

For the e-papers with controllers that have the partial update capability, but no fast update method yet, I would like to experiment with partial update waveforms, but I do not have the knowledge to do it.

So any information for creation of partial update waveforms for the e-papers that officially have no partial update is welcome.

The controller specs of the GDEH029A1 has quite detailed information about the waveform table: IL3820 (http://www.good-display.com/download_detail/downloadsId=540.html)
Title: Re: Waveshare e-paper displays with SPI
Post by: ZinggJM on Oct 29, 2017, 10:38 pm
Thank you very much for this link. This is exactly the information I was looking for.

It will take some time for me to digest this information and add the "fast LUT" as partial update LUT to my 4.2" b/w e-paper class. I knew about the LUT tables available in the older demo sources, but not really used by the demo.

And because the 1.54, 2.13 and 2.9 inch classes have LUTs for partial and for full update, we can verify the concept of getting to the "fast LUT".

Great, thank you!

Jean-Marc
Title: Re: Waveshare e-paper displays with SPI
Post by: vertigo72 on Oct 29, 2017, 11:33 pm
Quote
The pervasive demo looks impressive. I do not know these e-paper displays, and don't know their actual prices.
I assume the pervasive displays use higher voltages to achieve higher update speed.
I incorrectly actually assumed they where the same panels, but clearly they are not as the pervasive ones have far lower resolution. Dont know prices either, they seem to be discontinued.

Quote
You do nothing wrong, the update time is mostly defined by the waveform table.

I had added the delays to give the displays a chance to live longer and show less degradation. Code execution time should be negligible compared to the update time, maybe except for paged display for AVR.

But these e-papers are not made for fast and frequent updates; their original destination was for shelf labels.

Thanks to Dalian Good Display we get affordable e-papers to play with.
Understood. The technology is evolving rapidly, but Arduino support seems to be pretty low on the priority list of  display manufacturers. And the ones that do care about Arduino, dont seem to care about sunlight readability. Leaving me with less choices than I would have wanted. Basically only the 1.54 eink with barely passable refresh rates, and the 1.3" sharp memory display which is a tad small, and not very readable in low light conditions.

Anyway, Im ranting, but if you're wondering what Im using them for, and thus your library for, here are my current prototypes of my openvario VSI with both kinds of displays:
https://www.youtube.com/watch?v=abkQcF7Kuv4 (https://www.youtube.com/watch?v=abkQcF7Kuv4)

(Note that the refresh rate in that video is only about half what I get when running one display, as both are controlled by the same microcontroller).

I still havent decided which one I should use. A sunlight readable color TFT  from newhaven would have been my first choice. If ever you decide to write an arduino library for that, please do let me know :)
Title: Re: Waveshare e-paper displays with SPI
Post by: jones12ax7 on Oct 30, 2017, 03:11 am
Glad to help! If you look carefully at 10:33 of the video, you can see a GxEPD folder there. Maybe he is playing around  :-D

Thank you very much for this link. This is exactly the information I was looking for.

Title: Re: Waveshare e-paper displays with SPI
Post by: vertigo72 on Nov 01, 2017, 07:41 pm
Learned something today. Partial update is extremely sensitive to temperature. I knew temperature mattered, but I didnt realize quite how much. Today I was field testing outside, it was 13-14C, and within  minutes the screen became garbled and barely readable. At >20C, it works great, for hours!

This is a problem for my application. Im now considering adding a heating element to the back of the display, although Im unsure how well that will work with the PCB inbetween. Has anyone tried removing the the display from the PCB ? I guess its just glued?

Title: Re: Waveshare e-paper displays with SPI
Post by: ZinggJM on Nov 01, 2017, 08:12 pm
Look at the Dalian Good Display website www.good-display.com (http://www.good-display.com) or www.buy-lcd.com (http://www.buy-lcd.com), they have special low temperature versions.

But I found only one low temperature version with partial update:

-25℃ Ultra-low temperature 2.13 inch104x212 partial update E-paper display (http://www.buy-lcd.com/index.php?route=product/product&path=2897_8366&product_id=57620)
Title: Re: Waveshare e-paper displays with SPI
Post by: vertigo72 on Nov 01, 2017, 11:07 pm
Well, there is the 2.9" too:
http://www.good-display.com/products_detail/productId=357.html

Interesting that it can work, but unfortunately, both are too big to fit in to my instrument :( The 1.54 fits with just millimeters to spare.

Its probably best I switch to the Sharp smart memory display. Which is a shame, as the e-ink has so much nicer contrast.
Title: Re: Waveshare e-paper displays with SPI
Post by: vertigo72 on Nov 01, 2017, 11:22 pm
BTW, its worth noting the normal temperature displays like the one I have, are rated for 0~50C. I have not tested this, but I have no reason to doubt that claim. At somewhere between 10-15C my display still worked fine doing full refreshes, but not doing partial refreshes, even though it was well above the rated temp.

So even the low temp displays will likely stop working when doing partial refresh at temperatures much higher than their rated -25C. How much higher is anyone's guess until someone tests it, but I wouldnt count on it working near freezing.
Title: Re: Waveshare e-paper displays with SPI
Post by: staberas on Nov 02, 2017, 07:08 pm
I have a Waveshare 1.54" (B,R,W) connected with a Teensy 3.2 is there any mod on the library that can boost the refresh speed? (i.e. spi speed?) and what about partial update ? it seems that there isnt any partial update library on the 1.54" one. thanks
Title: Re: Waveshare e-paper displays with SPI
Post by: ZinggJM on Nov 02, 2017, 08:18 pm
See Post #176 (https://forum.arduino.cc/index.php?topic=487007.msg3465157#msg3465157)
Title: Re: Waveshare e-paper displays with SPI
Post by: ZinggJM on Nov 02, 2017, 08:40 pm
I have a Waveshare 1.54" (B,R,W) connected with a Teensy 3.2 is there any mod on the library that can boost the refresh speed? (i.e. spi speed?) and what about partial update ? it seems that there isnt any partial update library on the 1.54" one. thanks
The update speed is given by the waveform table of the display. 3-color displays take much longer to update.

The 1.54" 3-color display has no partial update capabilities (not supported by the controller).

See also Post #176 (https://forum.arduino.cc/index.php?topic=487007.msg3465157#msg3465157)

(My Microsoft Edge browser currently does not allow me to enter text, maybe a Trend Micro bug, so I had to take Chrome instead).
Title: Re: Waveshare e-paper displays with SPI
Post by: roamingthings on Nov 02, 2017, 10:37 pm
Hi,

I'm trying to get a 1.54" display to work with the GxEPD library and a LOLIN32 V1.0.0 board. I've wired up the display and used the GxEPD_SPI_TestExample.ino sketch. The Demo starts showing the different screens. But after some time the Display either freezes, only updates parts, "fades" out or shows ghost images. The program is still running. Reset does not help. I have to unplug the power for some time before the display starts reacting again.
This doesn't seem to be related to the display since I have tried two different ones.

Any suggestions how I can solve this issue?

Alex
Title: Re: Waveshare e-paper displays with SPI
Post by: ZinggJM on Nov 03, 2017, 06:49 am
Most likely your BUSY line does not work correctly, e.g. is unconnected or stuck at inactive.

You can un-comment diagnostic output in the _waitWhileBusy method.
Title: Re: Waveshare e-paper displays with SPI
Post by: staberas on Nov 03, 2017, 04:47 pm
The update speed is given by the waveform table of the display. 3-color displays take much longer to update.

The 1.54" 3-color display has no partial update capabilities (not supported by the controller).

See also Post #176 (https://forum.arduino.cc/index.php?topic=487007.msg3465157#msg3465157)

(My Microsoft Edge browser currently does not allow me to enter text, maybe a Trend Micro bug, so I had to take Chrome instead).
Thanks ZinggJM, i think i've read that post but since this is a 13 page thread i wasnt sure if it was up to date
Since im making a game thingy that requires partial update & fast refresh speed which displays do you suggest?
Title: Re: Waveshare e-paper displays with SPI
Post by: ZinggJM on Nov 03, 2017, 05:45 pm
The 1.54" b/w e-paper display is the only e-paper display I would dare to call "relatively fast" on updates.

Waveshare provide a table with refresh times for their displays, e.g. here:

https://www.aliexpress.com/item/Universal-e-Paper-Raw-Panel-Driver-HAT-Used-to-drive-various-SPI-interface-e-Paper-from/32833050422.html (https://www.aliexpress.com/item/Universal-e-Paper-Raw-Panel-Driver-HAT-Used-to-drive-various-SPI-interface-e-Paper-from/32833050422.html)
Title: Re: Waveshare e-paper displays with SPI
Post by: roamingthings on Nov 04, 2017, 06:38 am
Quote
Most likely your BUSY line does not work correctly, e.g. is unconnected or stuck at inactive.

You un-comment diagnostic output in the _waitWhileBusy method.
This does not seem to be the reason also I have the feeling that the display eventually misses some data. The controller keeps reacting to commands even if the display is grayish or frozen. sometimes I can see the border flickering.
I wonder if some commands get lost and the display LUT and/or frame buffer become corrupted.
Title: Re: Waveshare e-paper displays with SPI
Post by: ZinggJM on Nov 04, 2017, 07:24 am
You could un-comment diagnostic output in the _waitWhileBusy method, and see and report output of Serial Monitor (115200bps).

Make sure your SPI connections are good, and your solder connections also; in several cases this was the cause of problems.
Title: Re: Waveshare e-paper displays with SPI
Post by: staberas on Nov 04, 2017, 08:34 am
It seems when i try to add images bigger than ~100x100 the images get 'corrupted'
is there a size limitation on bitmaps?
Title: Re: Waveshare e-paper displays with SPI
Post by: ZinggJM on Nov 04, 2017, 10:20 am
It seems when i try to add images bigger than ~100x100 the images get 'corrupted'
is there a size limitation on bitmaps?
From your picture I see you use a 1.54" b/w/r e-paper display.
From your previous post I can deduce you use a Teensy and so you may have enough RAM.

But you don't reveal if you use partial update, and which part is updated with partial update.

I am willing to analyze your issue, but you need to provide enough information.

Best is you provide a complete example with the bitmap that shows the issue, maybe shortened from your program, downloadable as zip-file.
Title: Re: Waveshare e-paper displays with SPI
Post by: staberas on Nov 04, 2017, 11:29 am
From your picture I see you use a 1.54" b/w/r e-paper display.
From your previous post I can deduce you use a Teensy and so you may have enough RAM.

But you don't reveal if you use partial update, and which part is updated with partial update.

I am willing to analyze your issue, but you need to provide enough information.

Best is you provide a complete example with the bitmap that shows the issue, maybe shortened from your program, downloadable as zip-file.
Im using the PagedDisplayExampleForSmallRam


Title: Re: Waveshare e-paper displays with SPI
Post by: ZinggJM on Nov 04, 2017, 11:32 am
Im using the PagedDisplayExampleForSmallRam



Good, but from your picture, with a different bitmap and modified code.
Title: Re: Waveshare e-paper displays with SPI
Post by: staberas on Nov 04, 2017, 11:39 am
I was about to upload but it got rejected before.
Anyway im using waveshare Img to lcd application and when i go over 100x97px the image become black but when i reupload in small resolution (under 90x90px) they display correctly
Title: Re: Waveshare e-paper displays with SPI
Post by: ZinggJM on Nov 04, 2017, 02:26 pm
I was about to upload but it got rejected before.
Anyway im using waveshare Img to lcd application and when i go over 100x97px the image become black but when i reupload in small resolution (under 90x90px) they display correctly
I do not really understand what you mean.

I compiled and run your program on Wemos D1 mini with the 1.54" b/w/r display.

I first got confused and did not understand what is happening.

Then I did the following changes:

Code: [Select]
  display.drawPaged(showFontCallback);
  delay(3000);
  display.drawPaged(showFontCall);
  delay(3000);
  showBitmapExample();
  delay(3000);


Code: [Select]
  //display.update(); // is no-op in callback
  //delay(100); // avoid delay, is called 20x!


Code: [Select]
  //display.update(); // is no-op in callback
  //delay(3000); // avoid delay, is called 20x!


Only drawing methods to buffer should be used in drawing callbacks!

I am not sure if the calendar icon looks like it should. Or if anything else is wrong.

I would need to know what board you use, is it an AVR Teensy? I don't know these.

Next I will run it on a Arduino Pro Mini.
Title: Re: Waveshare e-paper displays with SPI
Post by: staberas on Nov 04, 2017, 04:22 pm
Sorry for the confusion,
I was about to upload but it got rejected before.
I was talking about my last post (the one that i said i was using the the "PagedDisplayExampleForSmallRam "ect ) the forum rejected my code upload and told me to wait 5 min.

So yeah i actually found the reason,

IMG_20171104_170223_1509807770881
is what i see when i load an image 115x112 and using
Code: [Select]
display.drawBitmap(theimagename, 1, 1, 115, 112, GxEPD_WHITE); BUT
if i write
Code: [Select]
display.drawBitmap(theimagename, 1, 1, 110, 110, GxEPD_WHITE);
i can see the image normally

Im using a Teensy 3.2
 (https://www.pjrc.com/store/teensy32.html)

Title: Re: Waveshare e-paper displays with SPI
Post by: ZinggJM on Nov 04, 2017, 04:59 pm
Ok, this may be an error of img2lcd.

It looks as if it truncates w and h to multiples of 8.

The code to draw bitmaps to buffer is taken from Adafruit_GFX. It assumes width padded to multiple of 8.
My original code worked only with width of exact multiple of 8.

So it looks like you either need to take an other image converter, or use width of multiple of 8, or live with truncated value.

Maybe the Waveshare img2lcd is not up-to-date?

I did not play with bitmaps so far, because this is time-consuming.
Title: Re: Waveshare e-paper displays with SPI
Post by: staberas on Nov 04, 2017, 07:27 pm
Ok, this may be an error of img2lcd.

It looks as if it truncates w and h to multiples of 8.

The code to draw bitmaps to buffer is taken from Adafruit_GFX. It assumes width padded to multiple of 8.
My original code worked only with width of exact multiple of 8.

So it looks like you either need to take an other image converter, or use width of multiple of 8, or live with truncated value.

Maybe the Waveshare img2lcd is not up-to-date?

I did not play with bitmaps so far, because this is time-consuming.
The Img2lcd is the 'latest' one they have posted on the wiki but it could be some conversion problem which i can live with for now, What i care more is the possibility of a partial update on my b/w/r screen and if thats not possible i will buy a b/w one .
edit: or just use the 2.9 one i bought and forgot about
Title: Re: Waveshare e-paper displays with SPI
Post by: staberas on Nov 07, 2017, 08:57 am
Is it possible to run two 2.13" b/w displays at the same time using a Teensy?
Would it need 2 different SPI lines or is it possible to run it on a shared SPI cable?
 
Because looking at the higher size (4") displays i see a HUGE time delay (30 sec) and no partial update capability.


Title: Re: Waveshare e-paper displays with SPI
Post by: ZinggJM on Nov 07, 2017, 01:24 pm
Is it possible to run two 2.13" b/w displays at the same time using a Teensy?
Would it need 2 different SPI lines or is it possible to run it on a shared SPI cable?
 
Because looking at the higher size (4") displays i see a HUGE time delay (30 sec) and no partial update capability.



I posted answers to this here: Control multiple e-ink display with a single Arduino (https://forum.arduino.cc/index.php?topic=508963.0)
Title: Re: Waveshare e-paper displays with SPI
Post by: ZinggJM on Nov 08, 2017, 04:03 pm
Added Fast Partial Update variant GxGDEW042T2_FPU for 4.2 inch black/white display

- NOTE: This Fast Partial Update variant works with an experimental partial update waveform table

- Side effects and life expectancy with this LUT are unknown, as it is NOT from the manufacturer!
Title: Re: Waveshare e-paper displays with SPI
Post by: njitram on Nov 09, 2017, 11:38 pm
Hello ZinggJM,

Im using the ESP-WROOM-32 with the GDEW0154Z04 (DESTM32-S2). I connected the wiring as described:

//BUSY -> 4, RST -> 16, DC -> 17, CS -> SS(5),
//CLK -> SCK(18), DIN -> MOSI(23),
//GND -> GND, 3.3V -> 3.3V

I de-comment #include <GxGDEW0154Z04/GxGDEW0154Z04.cpp>  // 1.54" b/w/r and comment the other.

I uploaded the code, the monitor gives:
"
ets Jun  8 2016 00:22:57

rst:0x10 (RTCWDT_RTC_RESET),boot:0x13 (SPI_FAST_FLASH_BOOT)
flash read err, 1000
ets_main.c 371
ets Jun  8 2016 00:22:57

rst:0x10 (RTCWDT_RTC_RESET),boot:0x13 (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:956
load:0x40078000,len:0
load:0x40078000,len:11904
entry 0x40078a3c

setup
setup done
"

But the screen won't turn on, what could possibly be the problem?
Title: Re: Waveshare e-paper displays with SPI
Post by: ZinggJM on Nov 10, 2017, 06:59 am
Hi njitram,

There are many different ESP32 boards; I guess ESP-WROOM-32 is just a generic name for the encapsulated ESP32 part.

So to analyze issues with ESP32 I would need additional information:

- what is your actual ESP32 board? please provide a link
- what variant do you use to compile? the board you select in Tools
- do you use the "standard" Espressif ESP32 package for Arduino, is it actual?
- does your board work with other examples, e.g. blink, without and with e-paper connected?
- which e-paper example do you use to test?

From the error message there could be interference with the SPI connection of the flash memory.
I have not much experience with ESP32 yet; but with some ESP8266 boards there are pins available that are also used for flash, and connection to these could disturb the device.
Title: Re: Waveshare e-paper displays with SPI
Post by: njitram on Nov 10, 2017, 06:14 pm
Hello ZinggJM,

i didnt know there is a difference in ESP-WROOM-32

- what is your actual ESP32 board? please provide a link
https://nl.aliexpress.com/item/ESP-32S-ESP-WROOM-32-ESP32-ESP-32-Bluetooth-and-WIFI-Dual-Core-CPU-with-Low/32802438946.html?spm=a2g0s.9042311.0.0.MM7t73

- what variant do you use to compile? the board you select in Tools
Arduino IDE, i selected the board: "ESP32 Dev Module"

- do you use the "standard" Espressif ESP32 package for Arduino, is it actual?
https://github.com/espressif/esp-idf.git master branche last updated, today

- does your board work with other examples, e.g. blink, without and with e-paper connected?
It workz, i just tried it with Led Tutorial with and without epaper connected and disconnected

- which e-paper example do you use to test?
With this code (on pin 22 i have the led blinking):
Code: [Select]


// include library, include base class, make path known
#include <GxEPD.h>
#include <GxGDEW0154Z04/GxGDEW0154Z04.cpp>  // 1.54" b/w/r

// uncomment next line for drawBitmap() test
#include GxEPD_BitmapExamples

// FreeFonts from Adafruit_GFX
#include <Fonts/FreeMonoBold9pt7b.h>
#include <Fonts/FreeMonoBold12pt7b.h>
#include <Fonts/FreeMonoBold18pt7b.h>
#include <Fonts/FreeMonoBold24pt7b.h>


#include <GxIO/GxIO_SPI/GxIO_SPI.cpp>
#include <GxIO/GxIO.cpp>

// pins_arduino.h, e.g. LOLIN32
//static const uint8_t SS    = 5;
//static const uint8_t MOSI  = 23;
//static const uint8_t MISO  = 19;
//static const uint8_t SCK   = 18;

// GxIO_SPI(SPIClass& spi, int8_t cs, int8_t dc, int8_t rst = -1, int8_t bl = -1);
GxIO_Class io(SPI, SS, 17, 16); // arbitrary selection of 17, 16
// GxGDEP015OC1(GxIO& io, uint8_t rst = D4, uint8_t busy = D2);
GxEPD_Class display(io, 16, 4); // arbitrary selection of (16), 4

void setup()
{
  Serial.begin(115200);
  Serial.println();
  Serial.println("setup");

  display.init();

  // initialize digital pin LED_BUILTIN as an output.
  pinMode(22, OUTPUT);
 
  Serial.println("setup done");
}

void loop()
{
  digitalWrite(22, HIGH);   // turn the LED on (HIGH is the voltage level)
  delay(1000);                       // wait for a second
  digitalWrite(22, LOW);    // turn the LED off by making the voltage LOW
  delay(1000);                       // wait for a second

  showBitmapExample();
  drawCornerTest();

  showFont("FreeMonoBold9pt7b", &FreeMonoBold9pt7b);
  showFont("FreeMonoBold12pt7b", &FreeMonoBold12pt7b);
 
  delay(10000);
}

#if defined(_GxGDEP015OC1_H_) || defined(_GxGDE0213B1_H_) || defined(_GxGDEH029A1_H_)
#include "IMG_0001.h"
#endif

void showBitmapExample()
{
#ifdef _GxBitmapExamples_H_
#ifdef _GxGDEW027C44_H_
  // draw black and red bitmap
  display.drawExamplePicture(BitmapExample1, BitmapExample2, sizeof(BitmapExample1), sizeof(BitmapExample2));
  delay(2000);
  display.drawExampleBitmap(BitmapExample1, 0, 0, GxEPD_WIDTH, GxEPD_HEIGHT, GxEPD_BLACK);
  display.update();
#elif defined(_GxGDE0213B1_H_)
  display.drawBitmap(BitmapExample1, sizeof(BitmapExample1));
  delay(2000);
  display.drawBitmap(BitmapExample2, sizeof(BitmapExample2));
  delay(2000);
  display.drawBitmap(first, sizeof(first));
  delay(2000);
#if !defined(__AVR)
  display.drawBitmap(second, sizeof(second));
  delay(2000);
  display.drawBitmap(third, sizeof(third));
  delay(2000);
#endif
#elif defined(_GxGDEW042T2_H_) && defined(__AVR)
  display.drawBitmap(BitmapExample1, sizeof(BitmapExample1));
  delay(2000);
  display.fillScreen(GxEPD_WHITE);
  display.drawBitmap(0, 0, BitmapExample1, GxEPD_WIDTH, GxEPD_HEIGHT, GxEPD_BLACK);
  display.update();
  delay(10000);
#elif defined(_GxGDEW0154Z04_H_)
  display.drawPicture(BitmapWaveshare_black, BitmapWaveshare_red, sizeof(BitmapWaveshare_black), sizeof(BitmapWaveshare_red), GxEPD::bm_normal);
  delay(5000);
#if !defined(__AVR)
  display.drawExamplePicture(BitmapExample1, BitmapExample2, sizeof(BitmapExample1), sizeof(BitmapExample2));
  delay(5000);
#endif
#elif defined(_GxGDEW0213Z16_H_) || defined(_GxGDEW029Z10_H_)
  display.drawPicture(BitmapWaveshare_black, BitmapWaveshare_red, sizeof(BitmapWaveshare_black), sizeof(BitmapWaveshare_red));
  delay(5000);
#if !defined(__AVR)
  display.drawExamplePicture(BitmapExample1, BitmapExample2, sizeof(BitmapExample1), sizeof(BitmapExample2));
  delay(5000);
  display.drawExamplePicture(BitmapExample3, BitmapExample4, sizeof(BitmapExample3), sizeof(BitmapExample4));
  delay(5000);
#endif
  display.drawExampleBitmap(BitmapWaveshare_black, sizeof(BitmapWaveshare_black));
  delay(2000);
  // example bitmaps for b/w/r are normal on b/w, but inverted on red
  display.drawExampleBitmap(BitmapExample1, sizeof(BitmapExample1));
  delay(2000);
  display.drawExampleBitmap(BitmapExample2, sizeof(BitmapExample2), GxEPD::bm_invert);
  delay(2000);
  display.drawExampleBitmap(BitmapExample1, 0, 0, GxEPD_WIDTH, GxEPD_HEIGHT, GxEPD_BLACK);
  display.update();
#else
  display.drawExampleBitmap(BitmapExample1, sizeof(BitmapExample1));
  delay(2000);
  display.drawExampleBitmap(BitmapExample2, sizeof(BitmapExample2));
  delay(2000);
  display.setRotation(0);
  display.fillScreen(GxEPD_WHITE);
  display.drawExampleBitmap(BitmapExample1, 0, 0, GxEPD_WIDTH, GxEPD_HEIGHT, GxEPD_BLACK);
  display.update();
  delay(10000);
#if defined(_GxGDEP015OC1_H_) || defined(_GxGDE0213B1_H_) || defined(_GxGDEH029A1_H_)
  // thanks to bytecrusher: http://forum.arduino.cc/index.php?topic=487007.msg3367378#msg3367378
  uint16_t x = (display.width() - 64) / 2;
  uint16_t y = 5;
  display.fillScreen(GxEPD_WHITE);
  display.drawExampleBitmap(gImage_IMG_0001, x, y, 64, 180, GxEPD_BLACK);
  display.update();
  delay(500);
  uint16_t forward = GxEPD::bm_invert | GxEPD::bm_flip_x;
  uint16_t reverse = GxEPD::bm_invert | GxEPD::bm_flip_x | GxEPD::bm_flip_y;
  for (; y + 180 + 5 <= display.height(); y += 5)
  {
    display.fillScreen(GxEPD_WHITE);
    display.drawExampleBitmap(gImage_IMG_0001, x, y, 64, 180, GxEPD_BLACK, forward);
    display.updateWindow(0, 0, display.width(), display.height());
    delay(500);
  }
  delay(1000);
  for (; y >= 5; y -= 5)
  {
    display.fillScreen(GxEPD_WHITE);
    display.drawExampleBitmap(gImage_IMG_0001, x, y, 64, 180, GxEPD_BLACK, reverse);
    display.updateWindow(0, 0, display.width(), display.height());
    delay(1000);
  }
  display.update();
  delay(1000);
#endif
#endif
#endif
}

void showFont(const char name[], const GFXfont* f)
{
  display.fillScreen(GxEPD_WHITE);
  display.setTextColor(GxEPD_BLACK);
  display.setFont(f);
  display.setCursor(0, 0);
  display.println();
  display.println(name);
  display.println(" !\"#$%&'()*+,-./");
  display.println("0123456789:;<=>?");
  display.println("@ABCDEFGHIJKLMNO");
  display.println("PQRSTUVWXYZ[\\]^_");
#if defined(_GxGDEW0154Z04_H_) || defined(_GxGDEW0213Z16_H_) || defined(_GxGDEW029Z10_H_) || defined(_GxGDEW027C44_H_)
  display.setTextColor(GxEPD_RED);
#endif
  display.println("`abcdefghijklmno");
  display.println("pqrstuvwxyz{|}~ ");
  display.update();
  delay(5000);
}

void showFontCallback()
{
  const char* name = "FreeMonoBold9pt7b";
  const GFXfont* f = &FreeMonoBold9pt7b;
  display.fillScreen(GxEPD_WHITE);
  display.setTextColor(GxEPD_BLACK);
  display.setFont(f);
  display.setCursor(0, 0);
  display.println();
  display.println(name);
  display.println(" !\"#$%&'()*+,-./");
  display.println("0123456789:;<=>?");
  display.println("@ABCDEFGHIJKLMNO");
  display.println("PQRSTUVWXYZ[\\]^_");
#if defined(_GxGDEW0154Z04_H_) || defined(_GxGDEW0213Z16_H_) || defined(_GxGDEW029Z10_H_) || defined(_GxGDEW027C44_H_)
  display.setTextColor(GxEPD_RED);
#endif
  display.println("`abcdefghijklmno");
  display.println("pqrstuvwxyz{|}~ ");
}

void drawCornerTest()
{
#if defined(_GxGDEP015OC1_H_) || defined(_GxGDE0213B1_H_) || defined(_GxGDEH029A1_H_)
  display.drawCornerTest();
  delay(5000);
#endif
  uint8_t rotation = display.getRotation();
  for (uint16_t r = 0; r < 4; r++)
  {
    display.setRotation(r);
    display.fillScreen(GxEPD_WHITE);
    display.fillRect(0, 0, 8, 8, GxEPD_BLACK);
    display.fillRect(display.width() - 18, 0, 16, 16, GxEPD_BLACK);
    display.fillRect(display.width() - 25, display.height() - 25, 24, 24, GxEPD_BLACK);
    display.fillRect(0, display.height() - 33, 32, 32, GxEPD_BLACK);
    display.update();
    delay(5000);
  }
  display.setRotation(rotation); // restore
}
Title: Re: Waveshare e-paper displays with SPI
Post by: ZinggJM on Nov 10, 2017, 07:05 pm
ESP-WROOM-32 is the ESP32 device you have, the processor with flash encapsulated on a dense board.

Some ESP32 boards mount this board with additional components on an additional board, with easier to use pinhole spacing. Other devices mount the processor, flash and additional components directly on their board.

The variant you selected should be ok, it has the same pin mapping as the LOLIN32 I use.

Just make sure you use the correct pinholes for SPI: the holes marked with IOxx with the number of the mapping, e.g. IO23 for MOSI, IO18 for SCK. The pins CLK, SD1..SD3 are for the other SPI used for flash.

At least this is what I believe to know so far, it corresponds to ESP8266.
Title: Re: Waveshare e-paper displays with SPI
Post by: njitram on Nov 10, 2017, 07:23 pm
Well.. just to make sure, we have DESTM32-S2:
Code: [Select]

DESTM32-S2 pinout (top, component side view):
         |-------------------------------------------------
         |  VCC  |o o| VCC 5V  not needed
         |  GND  |o o| GND
         |  3.3  |o o| 3.3     3.3V
         |  nc   |o o| nc
         |  nc   |o o| nc
         |  nc   |o o| nc
   MOSI  |  DIN  |o o| CLK     SCK
   SS    |  CS   |o o| DC      e.g. D3
   D4    |  RST  |o o| BUSY    e.g. D2
         |  nc   |o o| BS      GND
         |-------------------------------------------------


What does "top, component side view" mean? Is that where i can see the jumpers or the resistors? and MOSI is on the end of the board or at long side? (just to make sure)

My pinout

IO23 : MOSI
IO18 : CLK
IO17 : DC
IO16 : RST
IO5 : SS
IO4 : BUSY


When i do filp it over, the monitor gives me "Busy Timeout!".
Title: Re: Waveshare e-paper displays with SPI
Post by: ZinggJM on Nov 10, 2017, 08:20 pm
I try to take every effort to make things clear, and to improve and make it clearer...

Component side is the side where the components are surface mount soldered to the board...

And I tried to show the outline of the board, and the pinholes/solder side of the connector...

Your connections correspond to the suggestion I made for ESP32.

At the other end there is the FCP connector to the display.
You could flip this connection too, but then the display would look downwards.
More likely the connection could be insufficient; you first need to loosen the black part, so the flexible connector goes in easily, and then push the black part back in, to fix the connection and get good connection.

Hope this helps.

You can download the schematics of the DESTM32-S2 from the good-display website.
Title: Re: Waveshare e-paper displays with SPI
Post by: njitram on Nov 10, 2017, 10:40 pm
Thank you for explaining, sorry if come on rude. Im really glad you're helping.

Anyhow im pretty sure it is now connected correctly i also measured the connections with the mulitmeter, they all transmit from JP1 connecter to the ESP.

Executing the code, gives me the following
Code: [Select]

rst:0x1 (POWERON_RESET),boot:0x13 (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:956
load:0x40078000,len:0
load:0x40078000,len:11904
entry 0x40078a3c

setup
setup done
Busy Timeout!
Busy Timeout!
Busy Timeout!
Busy Timeout!


"Busy Timeout!" Any idea how to solve the Busy Timeout? Also do you know how i can test the pins? which pin should turn on the screen that i can check if it really works?

little bit more debug info:
Code: [Select]

load:0x3fff0018,len:4
load:0x3fff001c,len:956
load:0x40078000,len:0
load:0x40078000,len:11904
entry 0x40078a3c
Busy Timeout!
Power On : 10000914
Busy Timeout!
update : 10000612
Busy Timeout!
Power On : 10000930
Busy Timeout!
update : 10000646
Busy Timeout!
Power On : 10000930
Title: Re: Waveshare e-paper displays with SPI
Post by: njitram on Nov 11, 2017, 01:37 am
Alright i found the problem, i changed the jumper on the board. J3 to the left and J1 was already to the left. Now it is working! Great, thank you. :)
Title: Re: Waveshare e-paper displays with SPI
Post by: pbwild on Nov 11, 2017, 04:21 pm
Hi,
thankyou everybody for all the great work that's been going on here - it's much appreciated.

I have been trying to use the  GxGDEW029Z10 to drive a Waveshare 2.9 b/w/r display via an Arduino Mega 2560.
Things have started looking much better since I followed the advice to put voltage dividers on all lines (to reduce signals from 5 to 3.3 volts.

My current mapping is:
BUSY -> 7, RST -> 9, DC -> 8, CS-> 53, CLK -> 52, DIN -> 51

I am experiencing a lot of flashing (i.e. fullscreen black-white six times in about 1.5 seconds) everytime I try an example (e.g. PagedDisplayExamplSmallRam) of code with display.init() or any sort of display.update().


Any tips on how to get rid of this?

Many thanks,

Peter

Title: Re: Waveshare e-paper displays with SPI
Post by: ZinggJM on Nov 11, 2017, 04:52 pm
Hi Peter,

So many flashes in such a short time is not normal. display.update() produces several flashes on a b/w/r e-paper display, but it takes several seconds.

Make sure you have the actual version of the GxEPD library. In an earlier version update() was not ignored inside a drawCallback function, which would produce flashes (not sure if this was the case for b/w/r).

You should not call update() inside a drawCallback, nor any method that directly draws to the display, only the methods that draw to buffer. refresh to display is done inside the drawPaged method at the end.

Make sure your BUSY line has good connection.

3-color displays produce several black/white and red/white transitions on update().

I run the PagedDisplayExampleSmallRam with the 2.9" b/w/r display with Arduino Pro Mini 3.3V to see the behavior once more.
The behavior is independent of the Arduino used with the actual display class.

The example first draws a picture with the direct drawExamplePicture method to the display.
There are several "big" short flashes with black white and red, and then a longer phase with several flashes of the red petals, in total ~16s.

Then text is shown with black and red parts, with the same behavior.

The whole refreshing of the display is controlled by the waveform table which is programmed by the manufacturer into the controllers OTP memory. This waveform is optimized for long term stability of the picture, for long power off periods, e.g. for shelf displays.
The display class could load a different waveform table into the "registers" part of the controller RAM.
But I do not have an example of the waveform tables for these 3-color displays to experiment with.
Title: Re: Waveshare e-paper displays with SPI
Post by: roamingthings on Nov 12, 2017, 07:45 am
Hi,

I'm still trying to get my 1.54" bw Waveshare (GxGDEP015OC1) to work with my ESP32 (or ESP8266) board.
As I wrote before the display freezes, displays garbage or parts of the image become "moved" or are overlapping with previous transmissions. It looks as if the controller memory becomes corrupted (eg some commands or data is not transmitted correctly). I've two displays and both behave the same.

As you suggested I checked all connections.
The very same display (1.54) works fine on an AVR Arduino with the original Waveshare Demo.
I connected a 2.13" display to the 1.54" breakout-board and ran GxEPD_SPI_TestExample (using the code for GxGDE0213B1). This demo runs without any problems.

So I assume:
* The 1.54 display is ok
* The connections between my ESP32 and display board are ok
* The controller board is ok
* The display board is ok

I wonder if anybody had the demo running for a longer time (let's say more than an hour).
Could the be some problem with the SPI timing?

Thank you very much for your help!
Alex
Title: Re: Waveshare e-paper displays with SPI
Post by: ZinggJM on Nov 12, 2017, 09:28 am
I have an endurance test running with promising result (PartialUpdateTest).
I usually don't run the GxEPD_SPI_TestExample for prolonged times.

Have you tried PagedDisplayExampleSmallRam with AVR Arduino?

I would still suspect SPI communication.

What I don't know is the damage the controller may take if it ever has been exposed to 5V signals.

Jean-Marc

PS: the actual test time is ~12 days more; I had switched off power to mount a new ceiling lamp.

(http://forum.arduino.cc/index.php?action=dlattach;topic=487007.0;attach=233167)
Title: Re: Waveshare e-paper displays with SPI
Post by: roamingthings on Nov 12, 2017, 09:34 am
Hi,

I finally got it working. I misunderstood how the SPI bus is working on the ESP32. I haven't been aware that the SPI busses are assigned to fixed pins. So I have been using a wrong pin for CS. After changing this to the correct bin everything works as expected.

Again thank you very much for your support!

Alex
Title: Re: Waveshare e-paper displays with SPI
Post by: ZinggJM on Nov 12, 2017, 09:57 am
Hi,

I finally got it working. I misunderstood how the SPI bus is working on the ESP32. I haven't been aware that the SPI busses are assigned to fixed pins. So I have been using a wrong pin for CS. After changing this to the correct bin everything works as expected.

Again thank you very much for your support!

Alex
Thank you for the feedback.

The SPI implementation for ESP32 and ESP8266 is unusual. The SS pin is used to somehow identify the SPI channel. You should be able to use any pin for CS, but you can't use the SS pin for anything else, afaik.
Title: Re: Waveshare e-paper displays with SPI
Post by: roamingthings on Nov 12, 2017, 11:24 am
How hard is it to use the library in an ESP-IDF (non-Arduino) Project?
Title: Re: Waveshare e-paper displays with SPI
Post by: ZinggJM on Nov 12, 2017, 03:05 pm
How hard is it to use the library in an ESP-IDF (non-Arduino) Project?
I have (nearly) no idea. No experience with ESP-IDF.

The GxEPD library is "standard" C++, include path could be an issue, as well as warning levels.

The examples are "Arduino C++", should be no major problem.

GxIO_SPI uses the SPI class of the espressif Arduino package; this may need more changes, as well as GPIO ports access.
Title: Re: Waveshare e-paper displays with SPI
Post by: roamingthings on Nov 12, 2017, 06:03 pm
Thanks!

I will take a look at it next weekend. How about dependency to Adafruit Gfx?
Title: Re: Waveshare e-paper displays with SPI
Post by: roamingthings on Nov 12, 2017, 06:40 pm
After doing more tests I still run into issues. Maybe it's not a good idea to refresh the display too often?

How often does your endurance test refresh the screen?
Title: Re: Waveshare e-paper displays with SPI
Post by: ZinggJM on Nov 12, 2017, 06:54 pm
Thanks!

I will take a look at it next weekend. How about dependency to Adafruit Gfx?

Yes, I forgot the dependency on Adafruit_GFX. But it might well be a standard C++ class, you could try.

Quote
How often does your endurance test refresh the screen?
You can look this up in the PartialUpdateTest example. It is 1/s for the 1.54".
Note that these are partial updates. Full updates may be more stress to the display.
I would avoid more full updates than one every 10 seconds, or even one every minute.
Title: Re: Waveshare e-paper displays with SPI
Post by: roamingthings on Nov 12, 2017, 07:06 pm
Maybe I really put too much stress on the display. I have no idea how often it is fine to do a full refresh.

This is how the display looks like after I had very short cycles before. I need to unplug the power and leave it there for some time before it will work again.

Display Content (https://www.dropbox.com/s/730i6n66j0cwbje/display.jpg?dl=0)
Title: Re: Waveshare e-paper displays with SPI
Post by: Fyery on Nov 16, 2017, 02:19 pm
Hi ZinggJM, I saw that you managed to connect the 4.2 inch EPD from waveshare to a Lolin32 Lite board here:

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

My Lolin 32 Lite just arrived, but I have trouble finding any information on which pins are used to drive the waveshare 4.2 inch EPD with your library. Do you remember the pin layout you used to connect it to your Lolin32 Lite? If so, could I ask you to post it here in case anyone else is interested?

Also, have you done any further testing on how your partial update LUT modifications affect the longevity of the 4.2" EPD display?

Thanks for your great work and best regards!

(https://i.imgur.com/HhDiIwP.jpg)
Title: Re: Waveshare e-paper displays with SPI
Post by: ZinggJM on Nov 16, 2017, 05:08 pm
Hi Fyery,

You can find the pin mapping for LOLIN32 in GxEPD_SPI_TestExample.ino:

// mapping suggestion for ESP32, e.g. LOLIN32, see .../variants/.../pins_arduino.h for your board
// NOTE: there are variants with different pins for SPI ! CHECK SPI PINS OF YOUR BOARD
// BUSY -> 4, RST -> 16, DC -> 17, CS -> SS(5), CLK -> SCK(18), DIN -> MOSI(23), GND -> GND, 3.3V -> 3.3V

No, I have no plan for endurance tests of GxGDEW042T2_FPU for now. I believe it should be safe. If PartialUpdateTest should show degradation after some one hour cycles, the test should be stopped.
Title: Re: Waveshare e-paper displays with SPI
Post by: ZinggJM on Nov 19, 2017, 10:02 am
I have updated the Arduino e-paper library GxEPD (https://github.com/ZinggJM/GxEPD) with support for multiple e-paper displays on one Arduino (with enough RAM, e.g. ESP32).

(https://forum.arduino.cc/index.php?action=dlattach;topic=487007.0;attach=233997)
Title: Re: Waveshare e-paper displays with SPI
Post by: ch4rly on Nov 21, 2017, 08:45 pm
Hi ZinggJM,

I'm interested in using the Waveshare 7.5" e-ink display for my smart home and found your library and this thread. Many thanks for your work, highly appreciated.

Is the 7.5" version of the display already supported or could it be easily added?


Best regards Charly
Title: Re: Waveshare e-paper displays with SPI
Post by: ZinggJM on Nov 21, 2017, 09:23 pm
Hi Charly,

The 7.5" black/white e-paper display is fully supported, except it has no fast partial update (yet).
This is the display I use for my IoT sensor values, for temperature and humidity.

The 7.5" black/white/red e-paper display has basic support. I had merged it from a contributor, but I don't have that display, so I can't test it.

These displays are best used with processors with enough RAM, e.g. ESP32 or ESP8266.
But they b/w works also with AVR Arduinos using paged drawing.

Jean-Marc
Title: Re: Waveshare e-paper displays with SPI
Post by: ch4rly on Nov 22, 2017, 07:30 am
Hi Jean-Marc,
many thanks for your fast reply!

It's working wit a Huzzah Feather and about to be connected via MQTT to my openHAB. If helpful I could share my code as well.

Best regards Charly!
Title: Re: Waveshare e-paper displays with SPI
Post by: Fyery on Nov 24, 2017, 10:26 pm
Hi ZinggJM,

thanks to your help a week ago, I got the Waveshare 4.2" e-paper display working with my Lolin32 Lite board and your GxEPD library.

Just wanted to give you some feedback and thank you again for your effort. It's greatly appreciated!

To add a little sugar on top, I've included a picture of the detailed forecast-view of the weather-dashboard app I've been working on. It displays the weather forecast (temperature and probability of rain) for the next 24 hours and for the next six days. Gotta love those displays, right?

Enjoy!

(https://i.imgur.com/z36N4st.jpg)
Title: Re: Waveshare e-paper displays with SPI
Post by: ch4rly on Nov 25, 2017, 07:51 am
To add a little sugar on top, I've included a picture of the detailed forecast-view of the weather-dashboard app I've been working on.
Hi Fyery,
looks amazing, thanks for sharing!
Did you use libraries for the bars and graphs or did you implement it from scratch? Could you share some code?

I found this interesting project: http://www.impulseadventure.com/elec/guislice-gui.html (http://www.impulseadventure.com/elec/guislice-gui.html)

Thanks in advance!
Title: Re: Waveshare e-paper displays with SPI
Post by: Fyery on Nov 25, 2017, 12:19 pm
Hi ch4rly,

Did you use libraries for the bars and graphs or did you implement it from scratch? Could you share some code?
Thanks in advance!
I drew the whole screen from scratch using the underlying Adafruit GFX library, since that is what GxEPD is built on. Pretty much all the lines, bars, and graphs are drawn pixel-perfect using the offered draw primitives. The degree sign ° is also drawn as a circle, since it is not a valid ASCII character.

For the dashed lines I copied out the related draw-functions from the library and modified them a bit. Since you seem to be interested in this particular part, I added the code for the horizontal dash lines below. The bars are basically dashed lines drawn layer by layer.

The icons and graphics were a little more tricky, but I found a neat free collection including a true-type font called Meteocons, which I converted into a font format that the Adafruit library can use. Whenever I need an icon, I simply move the cursor, change the font, and draw the corresponding character.

You can find the ttf font and other resources here: http://www.alessioatzeni.com/meteocons/

I can also share the converted font containing the icons, if people want to use it in their own projects. Just let me know :)

As for the gui-library you linked in the previous post, I believe it would not be a good fit for my project. The E-Paper display only supports black and white and has no touch support, so most of the functionality that the gui-library offered would end up being unused.


Below you can find the modified code for the dashed horizontal line and bars from the Adafruit GFX library. "display" is the GxEPD_Class instance for my display. You can find out how to initialize your display in the example sketches provided by GxEPD.

Code: [Select]

void drawDashedHLine(int16_t x, int16_t y,
int16_t w, uint16_t color) {
// Update in subclasses if desired!
display.startWrite();
writeDashedLine(x, y, x + w - 1, y, color);
display.endWrite();
}

#ifndef _swap_int16_t
#define _swap_int16_t(a, b) { int16_t t = a; a = b; b = t; }
#endif

void writeDashedLine(int16_t x0, int16_t y0, int16_t x1, int16_t y1,
uint16_t color) {
int16_t steep = abs(y1 - y0) > abs(x1 - x0);
bool hole = false; //make it dash by using a hole every second pixel
if (steep) {
_swap_int16_t(x0, y0);
_swap_int16_t(x1, y1);
}

if (x0 > x1) {
_swap_int16_t(x0, x1);
_swap_int16_t(y0, y1);
}

int16_t dx, dy;
dx = x1 - x0;
dy = abs(y1 - y0);

int16_t err = dx / 2;
int16_t ystep;

if (y0 < y1) {
ystep = 1;
}
else {
ystep = -1;
}

for (; x0 <= x1; x0++) {
if (steep) {
if (!hole) display.writePixel(y0, x0, color);
hole = !hole;
}
else {
if (!hole) display.writePixel(x0, y0, color);
hole = !hole;
}
err -= dy;
if (err < 0) {
y0 += ystep;
err += dx;
}
}
}

void dashedRect(int16_t x, int16_t y, int16_t w, int16_t h,
uint16_t color) {
// Update in subclasses if desired!
display.startWrite();
for (int16_t i = y; i<y + h; i++) {
drawDashedHLine(x, i, w, color);
}
display.endWrite();
}


Best regards,

Fyery
Title: Re: Waveshare e-paper displays with SPI
Post by: ch4rly on Nov 25, 2017, 12:49 pm
Thanks for sharing!
Title: Re: Waveshare e-paper displays with SPI
Post by: czAtlantis on Nov 27, 2017, 12:37 pm
Hello guys, I bought 2.9 E-ink display but it is not working properly with this library. Is it possible there is another batch with changed internal structure etc?

It looks only part of the display works when displaying text etc. But the display itself is OK - displaying whole screen graphic works fine. When I tried official Waveshare library and example it worked fine.

Here I made video showing the issue:
https://youtu.be/aWCin8yzNVI

I am using Arduino Pro mini, 2.9 Waveshare black-white display and I have loaded GxEPD_SPI_TestExample.

Could you please help me with the issue? I am newbie here and it is frustrating when even the example is not working.

Thanks a lot

PS: attached photo shows simple code where I tried to display "Hello world" but only "hello" "fits" the screen
Title: Re: Waveshare e-paper displays with SPI
Post by: ZinggJM on Nov 27, 2017, 02:02 pm
The Arduino Pro Mini (is an AVR Arduino) has not enough RAM to buffer the whole display.

You need to use the example "PagedDisplayExampleSmallRam" for buffered drawing.

PS: there are 3.3V Arduino Pro Mini versions - I use one for test - but with 5V Arduinos you should use level converters, voltage divisors or at least series resistors.
The controllers have anti-latch-up protection diodes on inputs, but these may be stressed with the full driving capability of a 5V AVR Arduino.
Title: Re: Waveshare e-paper displays with SPI
Post by: roamingthings on Nov 28, 2017, 06:39 am
Hi,

I'm still trying to figure out what the problem with the 1.54" displays (I've two of them) is.

I modified my application to do partly refresh every 40sec. Depending on the area the display will become corrupted and freezes usually after one hour or earlier.

When connecting a 2.13" display and using the exact same application (except the display dependent code from GxEPD) it works flawlessly. The display is still working after 48hrs.

Any idea why the 1.54" causes so much trouble?
Title: Re: Waveshare e-paper displays with SPI
Post by: ZinggJM on Nov 28, 2017, 06:56 am
No, my endurance test with 1.54" b/w with "PartialUpdateTest" now shows 30d 15:42:37 with no degradation.

Maybe you could provide more information; processor used, b/w or b/w/r e-paper?

Did you try with PartialUpdateTest?

Does your BUSY line work correctly (diagnostic output in Serial Monitor).
With the actual version of the GxEPD library, diagnostic output is enabled.

Have you ever exposed your 1.54" e-paper to 5V supply or 5V data signals?

Do all connections have good contact (e.g. connector on Waveshare display firmly pushed in)?
Title: Re: Waveshare e-paper displays with SPI
Post by: roamingthings on Nov 30, 2017, 06:32 am
Hi,

I've tried two different b/w displays. I used the adapter board that can mes with them. I even connected the displays by using the breakout module from my working 2.13" display. I used the wires and plugs that came with the display. I also soldered the breakout board to ensure that the problem is not produced by the plug.

The processor is an ESP32. I'm using a Lolin32 as well as a Lolin32 lite. I've also connected it to an Arduino Uno.

Busy line works fine.

The displays have been only exposed to 3.3V.

When only changing a small area of the display (e.g. one line of 9pt text) it works longer.

I've tried your sample Applications, a simple test application using "native" Arduino and an ESP-IDF application using the Arduino component.
Title: Re: Waveshare e-paper displays with SPI
Post by: ZinggJM on Nov 30, 2017, 06:59 am
It is difficult to diagnose your issue from distance. It looks like a hardware issue.

What do you mean by "adapter board" and "breakout module" ? You could provide a photo.

You could provide the diagnostic output; the values will tell me if BUSY works fine, and the sequence of full refresh and partial updates.

Have you tried with the Waveshare demo code also?
Title: Re: Waveshare e-paper displays with SPI
Post by: Q24H on Dec 01, 2017, 07:41 pm
Just wanted to say thanks for your awesome library, my project is coming along very nicely!!


I have both 1.54 B/W and 1.54 B/W/R from waveshare, and I'm trying to decide between the two of them, obviously having red makes things look awesome, but there is a downside in that it refreshes much slower.


I figured I could try using only black/white on some frames, but it turns out after displaying black elements, the ESP32 still waits many seconds until it can do the next line of code or accept some input, as if some red elements is also being worked on. I think the display, or perhaps a timer was still telling the code its working on refreshing the display but in fact all content are already there. Again I don't know if this is hardcoded into the hardware, and certainly not a priority by any means, but it would be nice to have the ability to tell a B/W/R display that it doesn't have any Red to display and thus ending the refresh cycle earlier. Cheers!


Pic of the datalogger I'm currently working on
(https://i.imgur.com/uVbnNP7.jpg)
Title: Re: Waveshare e-paper displays with SPI
Post by: ZinggJM on Dec 01, 2017, 08:23 pm
Hi Q24H,

thank you for your feedback. It's a pleasure to see the GxEPD library in use for such a nice project.

The refresh time is completely determined by the waveform table the controller uses for refreshing.
The waveform table contains timing, voltage levels and repetition counts for the physical process to move the particles that produce the display.

The waveform tables of the small b/w/r e-paper displays is contained in the controller. It could be loaded into registers by the display class SW, but I do not have the values (yet).

It would be possible to load different waveform tables dependent on picture content, or by call of a class method, so this may be a future enhancement.

I do have the waveform table for the 2.7" 3-color display and I am experimenting with it.
Speed improvement is tricky, because of the way the (slow) red particles need be handled; the particle size difference and thus speed difference is used to separate black and red particles, by timing and different voltage.

Jean-Marc
Title: Re: Waveshare e-paper displays with SPI
Post by: coticj on Dec 01, 2017, 09:39 pm
Hi!

First thank you ZinggJM for this great library, I'm alerady using it with my 4.2" module display. Now I'm interested in the 7.5" version, but are unsure which one to buy for use with ESP32. Something with the controller builtin would be great, but all I found were the HAT displays? Is this the best option?
Title: Re: Waveshare e-paper displays with SPI
Post by: czAtlantis on Dec 01, 2017, 11:18 pm
I love how everybody is keeping the protective foil on the displays (including me, but i just removed the green sticker from the protective foil :D)

Btw - have you noticed that the display is photosensitive during partial refresh?
I just shined powerful flashlight on the display and it turned the area grey - right top corner

(just running modified clock-example with black background and some icons :) )

(https://i.imgur.com/1SIuRfR.jpg)

It clears after full refresh without any permanent damage but still - I imagine bright summer sun will make the display really ugly (we have winter here so I can't try that :D )
Title: Re: Waveshare e-paper displays with SPI
Post by: ZinggJM on Dec 02, 2017, 08:18 am
Hi!

First thank you ZinggJM for this great library, I'm alerady using it with my 4.2" module display. Now I'm interested in the 7.5" version, but are unsure which one to buy for use with ESP32. Something with the controller builtin would be great, but all I found were the HAT displays? Is this the best option?
The controller is part of the display, but needs external components to produce the voltages for display refresh.

The "Universal e-Paper Raw Panel Driver HAT" is suitable. It has the advantage of the FCP cable extension.

The DESTM32-S2 is the other option. It takes more space near the display. I use it with flat cable and self cutting connector.
Title: Re: Waveshare e-paper displays with SPI
Post by: oleedee on Dec 03, 2017, 09:34 pm
Hi All,

I am having trouble getting my screen to work.

I have a 1.54 inch b/w/r display (raw pannel from waveshare), plugged into a e-paper hat (also waveshare https://www.waveshare.com/e-paper-driver-hat.htm (https://www.waveshare.com/e-paper-driver-hat.htm) ) then plugged into an Arduino Uno (from Elegoo)

(https://imgur.com/RS0iPX6)

Ive been trying to load you examples but it has no effect on the screen. it stays with the Waveshare logo it came flashed with.

I have selected
Code: [Select]
#include <GxGDEW0154Z04/GxGDEW0154Z04.cpp>  // 1.54" b/w/r

and I have been trying to change the pins to suit my Uno but have not found a sollution yet..

Im quite new, so if somone could offer a step by step to get this to work with my settup or point me in the right direction that would be great.



Title: Re: Waveshare e-paper displays with SPI
Post by: ZinggJM on Dec 03, 2017, 10:18 pm
You should not connect this 3.3V display to Arduino UNO 5V IO or supply pins directly.

The suggested pins to use with UNO is mentioned in several places.

You should see some output on the display with the GxEPD_SPI_TestExample, but only part of the text example output.

Use the example PagedDisplayExampleSmallRam for UNO or any other AVR Arduino.

Report the pin connections you use, and the diagnostic output from the Serial Monitor.
Title: Re: Waveshare e-paper displays with SPI
Post by: oleedee on Dec 04, 2017, 08:08 pm
Im using the 3.3v output on the Uno and using the pins you recomended for the UNO

BUSY -> 7, RST -> 9, DC -> 8, C S-> 10, CLK -> 13, DIN -> 11

is there somthing else I need to change in the code?
Title: Re: Waveshare e-paper displays with SPI
Post by: jzvolanek on Dec 06, 2017, 09:32 am
Hello,
I would like to try the ePaper 4.2 400x300,
  does anyone have pin mapping for
Adafruit Feather HUZZAH with ESP8266 WiFi
can anyone advise?
Mainly we are not clear pin RST?
When I want to sleep so I link with ESP ESP - RST + pin16.
And u ePaperu Pin RST ??
Thank you very much...
I apologize for my English.
Ps: I also thank you for the great library ZinggJM

Pepa
Title: Re: Waveshare e-paper displays with SPI
Post by: ZinggJM on Dec 06, 2017, 10:52 am
My mapping suggestions for ESP8266 is for Wemos D1 mini, which uses Dx names for pins:

// mapping suggestion from Waveshare 2.9inch e-Paper to Wemos D1 mini
// BUSY -> D2, RST -> D4, DC -> D3, CS -> D8, CLK -> D5, DIN -> D7, GND -> GND, 3.3V -> 3.3V

The general mapping suggestion for ESP8266 is still missing, so you need to translate back to GPIO numbers:

// mapping suggestion from Waveshare 2.9inch e-Paper to generic ESP8266
// BUSY -> 4, RST -> 2, DC -> 0, CS -> 15, CLK -> 14, DIN -> 13, GND -> GND, 3.3V -> 3.3V

This should be valid for Feather HUZZAH also, but you can check pins_arduino.h for this board.

Use a different RST pin for the display than for sleep reset of the processor.

Jean-Marc

Title: Re: Waveshare e-paper displays with SPI
Post by: jzvolanek on Dec 06, 2017, 11:18 am
@ZinggJM
Thank you for the information!!

Ps: My work with ePaper 4.3! :-)

URL=http://img.janforman.com/EPDver7u00k.JPG](http://img.janforman.com/th/EPDver7u00k.JPG)[/URL]
Title: Re: Waveshare e-paper displays with SPI
Post by: oleedee on Dec 06, 2017, 07:06 pm

BUSY -> 7, RST -> 9, DC -> 8, C S-> 10, CLK -> 13, DIN -> 11


The serial monitor reads:

⸮vxM@⸮⸮1⸮⸮⸮⸮⸮⸮M4x͉⸮M4⸮MR⸮<
Title: Re: Waveshare e-paper displays with SPI
Post by: ZinggJM on Dec 06, 2017, 08:17 pm
Quote
BUSY -> 7, RST -> 9, DC -> 8, C S-> 10, CLK -> 13, DIN -> 11


The serial monitor reads:

⸮vxM@⸮⸮1⸮⸮⸮⸮⸮⸮M4x͉⸮M4⸮MR⸮<
Hi,

Your post seems not be "quotable" by normal means.

One of my fellow Arduino developers told me the Gods have decided that Serial Communication should be 9600 baud. But even simple AVR Arduinos seem to be able to handle 115200 baud.

The bit rate used by my examples can be seen in the source: Serial.begin(115200).
(this was missing in an earlier version of PagedDisplayExampleSmallRam).
The Serial Monitor has  a drop down list to select the bit rate. With 115200 you should get a readable result.

Have you re-read my post and seen that you should not connect IO pins of 5V Arduinos directly?
See also post #240.
Title: Re: Waveshare e-paper displays with SPI
Post by: oleedee on Dec 06, 2017, 09:15 pm
Thankyou,

from serial monitor;

setup
setup done
_PowerOn : 8
_Update_Full : 4
_PowerOff : 8
_PowerOn : 8
_Update_Full : 8
_PowerOff : 8
_PowerOn : 8
_Update_Full : 8
_PowerOff : 8
_PowerOn : 8
_Update_Full : 8
_PowerOff : 8
_PowerOn : 8
_Update_Full : 8
_PowerOff : 8
Title: Re: Waveshare e-paper displays with SPI
Post by: ZinggJM on Dec 06, 2017, 09:37 pm
The near zero wait values mean that either the BUSY line does not work, or the the SPI communication (sending commands) does not work.

The e-paper HAT may be a bit tricky to use. The connecting cable to the uno needs be pushed in firmly to make good contact to the HAT, and the flexible cable connections need make good contact in the connectors. The black part needs be pushed in after the cable has been pushed in to get good contact.

The SPI pins should be the same number on any UNO (Atmega328P).

Make sure the switch is set to 4-line SPI, Interface Config on the HAT.
Title: Re: Waveshare e-paper displays with SPI
Post by: oleedee on Dec 07, 2017, 12:35 am
Thankyou! I think I had not pushed in the black parts on the connectors properly.

Now they are connected and I get different readings from the serial monitor,

Now it reads;

setup
setup done
Busy Timeout!
Power On : 10001016
Busy Timeout!
drawPicture : 10000968
Busy Timeout!
Power On : 10001072
Busy Timeout!
drawPaged : 10000228
Busy Timeout!
Power On : 10000196
Busy Timeout!
drawPicture : 10000140
Busy Timeout!
Power On : 10000336
Busy Timeout!
drawPaged : 10001040
Busy Timeout!
Power On : 10001028
Busy Timeout!
drawPicture : 10000140
Busy Timeout!
Power On : 10000144
Title: Re: Waveshare e-paper displays with SPI
Post by: ZinggJM on Dec 07, 2017, 06:50 am
... and you still get no update or reaction on the display?

This would mean your SPI communication still does not work.

You could also measure the BUSY signal at your UNO pin, to see if it is constantly zero or only as a reaction to command reception.

I do have the e-paper HAT, but did not use it so far. I will try with a b/w e-paper, my 1.54" b/w/r is mounted on its own board.

It works:

(http://forum.arduino.cc/index.php?action=dlattach;topic=487007.0;attach=236407)
Title: Re: Waveshare e-paper displays with SPI
Post by: Redinvader on Dec 10, 2017, 03:54 am
Does the 1.54" E-Paper Display work with the Arduino Due ?
Title: Re: Waveshare e-paper displays with SPI
Post by: ZinggJM on Dec 10, 2017, 08:46 am
Does the 1.54" E-Paper Display work with the Arduino Due ?
Yes, it does. But you need to connect CLK and DIN to the SPI pins on the 6 pin SPI connector.

See Waveshare E-ink and Arduino Due (http://forum.arduino.cc/index.php?topic=516216.msg3518353#msg3518353)
Title: Re: Waveshare e-paper displays with SPI
Post by: jzvolanek on Dec 18, 2017, 05:56 pm
@ZinggJM


ePaper 2.9 b/w/r

#include <GxGDEW029Z10/GxGDEW029Z10.cpp>    // 2.9" b/w/r

// mapping suggestion from Waveshare 2.9inch e-Paper to Wemos D1 mini
// BUSY -> D2, RST -> D4, DC -> D3, CS -> D8, CLK -> D5, DIN -> D7, GND -> GND, 3.3V -> 3.3V


Serial line:

setup
setup done
_wakeUp Power On : 5
drawPicture : 1
_sleep Power Off : 1
_wakeUp Power On : 1
drawPicture : 5
_sleep Power Off : 1
_wakeUp Power On : 2
drawPicture : 1
_sleep Power Off : 1
_wakeUp Power On : 5
drawBitmap : 1

Nothing shows where I'm making a mistake?
Thank you very much....

Josef
Title: Re: Waveshare e-paper displays with SPI
Post by: ZinggJM on Dec 18, 2017, 10:33 pm
The way too short values for BUSY active times  and missing update of the display make it most likely your SPI communication does not work. Check all connections and solder joints.

Tell us the processor board you use, and provide a photo if you need more help.

There is a reason for my base line that tells to provide links to the product in question.

It makes answering "Newbie"- questions easier by providing the needed background information.

You mentioned Adafruit Feather HUZZAH with ESP8266 WiFi in a previous post:

Adafruit Feather HUZZAH with ESP8266 WiFi (https://www.adafruit.com/product/2821)

This board uses pin numbers, GPIOx numbers, not the Dx names of Wemos D1 or D1 mini.
For this board you need to use the mapping I posted in my reply:

// mapping suggestion from Waveshare 2.9inch e-Paper to generic ESP8266
// BUSY -> 4, RST -> 2, DC -> 0, CS -> 15, CLK -> 14, DIN -> 13, GND -> GND, 3.3V -> 3.3V

After a closer look at the picture of the processor board it might also be:

CLK -> SCK
DIN -> MO aka  MOSI

but this might be the "other" SPI of the ESP8266, the one used internally, like the LoLin versions.

Maybe this helps.
Title: Re: Waveshare e-paper displays with SPI
Post by: ZinggJM on Dec 19, 2017, 08:40 am
For Adafruit Feather HUZZAH with ESP8266 WiFi (https://www.adafruit.com/product/2821) pins 13 and 14 are the SPI pins to use, see:

pinout Adafruit Feather HUZZAH with ESP8266 WiFi (https://learn.adafruit.com/assets/46249)
Title: Re: Waveshare e-paper displays with SPI
Post by: Domisol on Dec 19, 2017, 10:12 am
Hello,

I would like to use the Wavashare ePaper 2.9" Module B with an Arduino UNO. This configuration is the same as the one described on the Wiki page : https://www.waveshare.com/wiki/2.9inch_e-Paper_Module_(B)#Initialization_.28Init.29

After download and run the program from the Waveshare wiki page in the Arduino, nothing happens on the screen, the demo picture remains the same, no flickering, etc. and nothing is written on the Arduino IDE monitor.

I would like to use the library described in this topic. This wiring is correct for the Arduino UNO:


ePaper      Arduino UNO

3.3V           3V3
GND           GND
DIN           D11
CLK           D13
CS           D10
DC           D9
RST           D8
BUSY        D7

or need I use use an other one ?
What levels should be set on the RST, BUSY, CS, DC pins ?

Thanks for you help

Title: Re: Waveshare e-paper displays with SPI
Post by: jzvolanek on Dec 19, 2017, 10:47 am
@ ZinggJM
Hello,
so I'm testing EPD 2.9 with ESP D1
I checked the connections and contacts again ...
Everything OK
But the display does not show anything or flashes ..
Serial line:

_wakeUp Power On : 2
update : 1
_sleep Power Off : 1
_wakeUp Power On : 1
update : 1
_sleep Power Off : 2
_wakeUp Power On : 1
update : 2
_sleep Power Off : 2
_wakeUp Power On : 2
update : 1
_sleep Power Off : 1

Thank you in advance!!

Pepa
Title: Re: Waveshare e-paper displays with SPI
Post by: ZinggJM on Dec 19, 2017, 11:35 am
Hi Pepa,

your program looks ok, your wiring also (I did not check each connection), but your solder joints look not so good maybe.

I have seen DuPont connectors that did not make contact, and I have seen reports of bad breadboards.

So I would suggest to do continuity tests with ohm meter on every line from the display board on the board side of the connector to the ESP8266 itself, the 1mm spaced connections.

I don't expect a bad connection of the e-paper panel flat cable to the e-paper base plate, but you can also visually check that connection; the black fastener needs be pushed in.

Make sure the solder joints are good; the pins take some energy until the solder really flows and is sucked into the hole.

Jean-Marc

Title: Re: Waveshare e-paper displays with SPI
Post by: jzvolanek on Dec 19, 2017, 06:33 pm
Hello Jean.
with solder I have great long-term experience ..
It's my project.
Perhaps the last weather ESP + ePaper 4.3
Every link I checked ESP = ePaper 2.9 = OK

I took another board ESP8266 LoLin v0.1 (V3)
the same result.
// BUSY -> 4, RST -> 2, DC -> 0, CS -> 15, CLK -> 14, DIN -> 13, GND -> GND, 3.3V -> 3.3V
GxIO_Class io (SPI, 15, 13, 14);
GxEPD_Class display (io, 4, 2);

Serial:
update : 2
_sleep Power Off : 1


  if there is not bad error ePaper 2.9 !!

Regards

Pepa
Title: Re: Waveshare e-paper displays with SPI
Post by: ZinggJM on Dec 19, 2017, 07:13 pm
Hi Pepa,

looks like you need to get a replacement from Waveshare.

So you should first check with the Waveshare demo code; their Wiki is quite good, you can adapt the epd_if.h for any of your ESP8266.

I have indications that not only my 2.9" b/w/r Waveshare e-paper works with my library, but unfortunately in this topic we usually see only the problems, rarely the success cases, and seldom feedback after problem solution. The rare cases with resolution feedback were bad connections or bad solder joints.

Jean-Marc
Title: Re: Waveshare e-paper displays with SPI
Post by: ZinggJM on Dec 20, 2017, 05:09 am
Hello,

I would like to use the Wavashare ePaper 2.9" Module B with an Arduino UNO. This configuration is the same as the one described on the Wiki page : https://www.waveshare.com/wiki/2.9inch_e-Paper_Module_(B)#Initialization_.28Init.29

After download and run the program from the Waveshare wiki page in the Arduino, nothing happens on the screen, the demo picture remains the same, no flickering, etc. and nothing is written on the Arduino IDE monitor.

I would like to use the library described in this topic. This wiring is correct for the Arduino UNO:


ePaper      Arduino UNO

3.3V       3V3
GND       GND
DIN       D11
CLK       D13
CS       D10
DC       D9
RST       D8
BUSY        D7

or need I use use an other one ?
What levels should be set on the RST, BUSY, CS, DC pins ?

Thanks for you help


Hi Domisol,

I had not noticed your post, sorry for the delay.

The suggested wiring for GxEPD is different from the wiring for the Waveshare demo:

BUSY -> 7, RST -> 9, DC -> 8, C S-> 10, CLK -> 13, DIN -> 11

You can either use the suggested wiring, or change the values used in the constructors.
GxEPD is designed so that all wiring adaptations can be made in the application, by changing values in the constructors.

Note that for Arduino UNO you should start with the example "PagedDisplayExampleSmallRam".

And use level converters, voltage dividers or at least series resistors with 5V Arduinos!
Title: Re: Waveshare e-paper displays with SPI
Post by: Domisol on Dec 20, 2017, 10:14 am
Hi Domisol,

I had not noticed your post, sorry for the delay.

The suggested wiring for GxEPD is different from the wiring for the Waveshare demo:

BUSY -> 7, RST -> 9, DC -> 8, C S-> 10, CLK -> 13, DIN -> 11

You can either use the suggested wiring, or change the values used in the constructors.
GxEPD is designed so that all wiring adaptations can be made in the application, by changing values in the constructors.

Note that for Arduino UNO you should start with the example "PagedDisplayExampleSmallRam".

And use level converters, voltage dividers or at least series resistors with 5V Arduinos!
Hello ZinggJM,

Thank you for the answers. I use a voltage divider on the Arduino UNO in order to get 3.3V on the Digital outputs, and run the example code PagedDisplayExampleSmallRam, as you suggested. But the screen is still on the same demo picture, no reaction of the screen, no flickering, etc.

On the rear side of the ePaper, we can set le SPI interface on 3-wire or 4-wire. Which SPI version (3-wire o 4-wire) do you think is best for this ePaper module ?


For the Arduino UNO, the right declarations are this one:

// pins_arduino.h, e.g. AVR
#define PIN_SPI_SS    (10)
#define PIN_SPI_MOSI  (11)
#define PIN_SPI_MISO  (12)
#define PIN_SPI_SCK   (13)

GxIO_Class io(SPI, SS, 8, 9);
//GxIO_DESTM32L io;
//GxIO_GreenSTM32F103V io;
GxEPD_Class display(io);


is it right ?


And here is the Serial monitor trace of the program:


setup done
_wakeUp Power On : 4
drawPicture : 4
_sleep Power Off : 8
_wakeUp Power On : 8
drawPaged : 8
_sleep Power Off : 4
_wakeUp Power On : 4
drawPicture : 4
_sleep Power Off : 8
_wakeUp Power On : 8
drawPaged : 8
_sleep Power Off : 4
_wakeUp Power On : 8
drawPicture : 8
_sleep Power Off : 8
_wakeUp Power On : 8
...

Does this code look like the one expected on a correct execution of the program ?

Thanks in advance for your support.


Waveshare ePaper 2.9" - Arduino UNO (https://photos.app.goo.gl/3J13flk2b3etPMrk1)


(https://photos.app.goo.gl/3J13flk2b3etPMrk1)


Title: Re: Waveshare e-paper displays with SPI
Post by: ZinggJM on Dec 20, 2017, 11:41 am
Hi Domisol,

Both GxEPD and the Waveshare demo work only in 4-wire SPI mode. There should be a zero-ohm jumper soldered at the 0 side.

Please report, if the jumper is wrong on your display, as this would explain the issue in other posts.

The declarations are the correct ones for Arduino UNO (AVR).
I should clean up this part, the defines should be commented, they are for reference only.

Make sure you selected/uncommented the correct display class GxGDEW029Z10.

The diagnostic output shows that SPI communication does not work.

I have ~8 Waveshare e-paper displays with the cables with DuPont connectors on one side, and one of them caused connection problems; I had to remove the DuPont connectors and solder a female 8-pin connector to the wires instead.

The connector at the other side needs to be firmly pushed in.

Jean-Marc

Title: Re: Waveshare e-paper displays with SPI
Post by: Domisol on Dec 20, 2017, 02:22 pm
Hi Domisol,

Both GxEPD and the Waveshare demo work only in 4-wire SPI mode. There should be a zero-ohm jumper soldered at the 0 side.

Please report, if the jumper is wrong on your display, as this would explain the issue in other posts.

The declarations are the correct ones for Arduino UNO (AVR).
I should clean up this part, the defines should be commented, they are for reference only.

Make sure you selected/uncommented the correct display class GxGDEW029Z10.

The diagnostic output shows that SPI communication does not work.

I have ~8 Waveshare e-paper displays with the cables with DuPont connectors on one side, and one of them caused connection problems; I had to remove the DuPont connectors and solder a female 8-pin connector to the wires instead.

The connector at the other side needs to be firmly pushed in.

Jean-Marc


Hello Jean-Marc,

Thanks for all the support. The ePaper works perfectly after we set the SPI on 4-wire and check all connexions between the ePAper and the Arduino, all signals at 3.3V.

Best regards

Jerome
Title: Re: Waveshare e-paper displays with SPI
Post by: ZinggJM on Dec 20, 2017, 03:31 pm
Hello Jean-Marc,

Thanks for all the support. The ePaper works perfectly after we set the SPI on 4-wire and check all connexions between the ePAper and the Arduino, all signals at 3.3V.

Best regards

Jerome
Hi Jerome,

thank you for the feedback!

I would like to know if you have the 2.9" b/w/r e-paper mounted directly on the Waveshare board, and if so, if the BS jumper came set on the wrong side, or if you use a 2.9" e-paper panel with separate e-paper HAT.

Thank you & Best Regards

Jean-Marc
Title: Re: Waveshare e-paper displays with SPI
Post by: volatile666 on Dec 20, 2017, 06:09 pm
I'd like to use the lib in 3-wire SPI mode on an ESP8266. What would need to be done to enable this?
Title: Re: Waveshare e-paper displays with SPI
Post by: witchole on Dec 20, 2017, 06:29 pm
I'd like to use the lib in 3-wire SPI mode on an ESP8266. What would need to be done to enable this?
I presume you mean you need an extra input or output, like I did.

I've found that the library (and display) still works if you use the MISO wire for some other purpose.  For instance, I have a button going to that pin (GPIO12).

The only thing you have to do is set the pinMode for that pin *after* calling display.init(), because SPIClass::begin() sets the pinMode to SPECIAL.

i.e.:
display.init();
[...]
pinMode(12, INPUT);
Title: Re: Waveshare e-paper displays with SPI
Post by: volatile666 on Dec 20, 2017, 06:39 pm
I presume you mean you need an extra input or output, like I did.
Yes and no. I simply do not have a pin to spare for the DC pin (since ESP8266 doesnt have many pins).
Title: Re: Waveshare e-paper displays with SPI
Post by: ZinggJM on Dec 20, 2017, 07:29 pm
You can try to use GxIO_SPI_RS from my GxTFT library (copy it over), it supports ESP8266. Untested with GxEPD.

The better option is to switch to a ESP32 board, it has more IO pins and more memory.
Title: Re: Waveshare e-paper displays with SPI
Post by: volatile666 on Dec 20, 2017, 08:53 pm
You can try to use GxIO_SPI_RS from my GxTFT library (copy it over), it supports ESP8266. Untested with GxEPD.

The better option is to switch to a ESP32 board, it has more IO pins and more memory.
Thanks, I'll give that a try. In the worst case I'd have to implement 3 wire SPI mode myself...

Surely I could use an ESP32, but sometimes I like to have a challenge (the board is fully custom btw) ;)
Title: Re: Waveshare e-paper displays with SPI
Post by: Domisol on Dec 21, 2017, 10:00 am
Hi Jerome,

thank you for the feedback!

I would like to know if you have the 2.9" b/w/r e-paper mounted directly on the Waveshare board, and if so, if the BS jumper came set on the wrong side, or if you use a 2.9" e-paper panel with separate e-paper HAT.

Thank you & Best Regards

Jean-Marc

Hello Jean-Marc,

I get the b/w/r ePaper mounted directly on the WS board, and the BS jumper was correctly set on th 4-wire SPI option.

The ePaper execute the Waveshare example program right now. But the white color of the ePaper have a red hue. Maybe it is the level of the sgnal (not strictly 3.3V ?)

Title: Re: Waveshare e-paper displays with SPI
Post by: ZinggJM on Dec 21, 2017, 01:29 pm
I have seen a slight red hue on white screens also. Small supply voltage deviation should not make a difference, as the voltages to drive the panel are generated and controlled by the controller on the panel.
The vcom voltage has an influence, and the ambient temperature also. As far as I know the temperature is measured by the controller, and vcom adapted accordingly. There is also a parameter for vcom control, and the Waveshare Wiki may have additional information. In GxEPD I rely on the parameters taken from the Good Display demo code.
Title: Re: Waveshare e-paper displays with SPI
Post by: witchole on Dec 21, 2017, 03:22 pm
In the worst case I'd have to implement 3 wire SPI mode myself...

Surely I could use an ESP32, but sometimes I like to have a challenge (the board is fully custom btw) ;)
Are you already using GPIO10 on the ESP8266?
Title: Re: Waveshare e-paper displays with SPI
Post by: jzvolanek on Dec 21, 2017, 04:20 pm
@ZinggJM

Hello Jean.
That's how ePaper 2.9 works with three colors with ESP LoLin v1

I attach a photo and sample code ...

Now I will try to break in ESP D1.

Sincerely, thank you very much!


I have a stupid question, where can I get a different font?
I use: <Fonts / FreeMonoBold9pt7b.h>
Thank you

Pepa

(https://img15.hostingpics.net/thumbs/mini_843904EPD29OKLoLin.jpg) (https://www.hostingpics.net/viewer.php?id=843904EPD29OKLoLin.jpg)
Title: Re: Waveshare e-paper displays with SPI
Post by: ZinggJM on Dec 21, 2017, 04:31 pm
Hi Pepa,

glad to know that your 2.9" e-paper display now works!

The fonts are taken from the Adafruit_GFX library, and need to be in the format for this library, e.g. from:

C:\Users\xxx\Documents\Arduino\libraries\Adafruit_GFX_Library\Fonts

For methods to add other fonts you would need to search this forum; I have no experience.
Title: Re: Waveshare e-paper displays with SPI
Post by: volatile666 on Dec 21, 2017, 04:44 pm
Are you already using GPIO10 on the ESP8266?
Yes, and I do even use GPIO9. But its all good - Display is running on my PCB using 3 wire SPI, thank you and ZinggJM!

Now I need to investigate why the colors are a bit mushy, I guess its because of the lower supply voltage (3V)...
Title: Re: Waveshare e-paper displays with SPI
Post by: jzvolanek on Dec 22, 2017, 07:02 pm
@ZinggJM
HelloJean.
so today I am a lot of ESP D1 / clone + ePaper 2.9 three colors tested!

Then I thought I was uploading pin mapping
s with ESP LoLin v1!
And it's OK supe!

GxIO_Class io (SPI, 15, 0, 2);
GxEPD_Class display (io, 2, 4);


Then I wanted to try another font!
It is important to use a small display resolution
the correct font.
So we managed to find a method how
show two fonts in one project
by Adafruit_GFX.h !!
Super ...
I attach a photo and test code,
maybe it will throw somebody else ...


Regards

Pepa

(https://img15.hostingpics.net/thumbs/mini_199377EPD193ESPD1ok.jpg) (https://www.hostingpics.net/viewer.php?id=199377EPD193ESPD1ok.jpg)
Title: Re: Waveshare e-paper displays with SPI
Post by: ceptimus on Dec 24, 2017, 03:34 pm
I wrote a sketch that uses a serial RAM chip for holding a screen buffer and works pretty fast.  I blogged about it and posted the code here: http://ceptimus.co.uk/?p=336 (http://ceptimus.co.uk/?p=336)

I've only tested it on the 1.54 inch version so far, but it should work okay on the larger black and white ones.  I have a larger one on order and will test once it arrives.  So far, I've not considered the three colour black/white/red ones.
Title: Re: Waveshare e-paper displays with SPI
Post by: jzvolanek on Dec 27, 2017, 10:09 pm
@ZinggJM
HelloJean.

My work with epd 2.9 three colors.


(https://img15.hostingpics.net/thumbs/mini_670942Barometr29ESPD1.jpg) (https://www.hostingpics.net/viewer.php?id=670942Barometr29ESPD1.jpg)
Title: Re: Waveshare e-paper displays with SPI
Post by: lcocking on Dec 29, 2017, 07:03 pm
Hey folks,

Picked up a Waveshare 1.54" W/B/R a few days ago and have been trying to get it to work. I've attempted to use both Waveshare's test code for Arduino (using an Uno R3), as well as ZinggJM's library. Additionally tried porting Waveshare's library to the Particle Photon just in case my Uno was causing difficulties.

Basically I am unable to get the image to change. I instrumented the Waveshare code with debug statements and it appears that after sending the image and a DISPLAY_REFRESH command it then calls WaitUntilIdle(), which never returns. The digital read of the busy pin returns 0 (LOW) and the image is never updated.

The same thing happens with the GxEPD library. In the call to drawExamplePicture() it sends the data, calls for a display refresh (0x12) and enters a wait that never ends.

Has anyone else experienced this, or have any pointers on how to troubleshoot? I feel like either I'm doing something really stupid, or the display is a dud.

Thanks in advance,

Lee

Title: Re: Waveshare e-paper displays with SPI
Post by: ZinggJM on Dec 29, 2017, 08:17 pm
Quote
The same thing happens with the GxEPD library. In the call to drawExamplePicture() it sends the data, calls for a display refresh (0x12) and enters a wait that never ends.
This would mean you use an outdated version of GxEPD. The actual version has a timeout on _waitWhileBusy(), and diagnostic output.

Make sure you use voltage dividers or at least series resistors on data lines with 5V Arduino.

Most likely your SPI communication does not work correctly, wrong pins, bad connections or bad solder joints have shown up as the most likely cause. Scroll back through this topic.

Did you select the correct display class? 1.54" b/w and 1.54" b/w/r are different.
Title: Re: Waveshare e-paper displays with SPI
Post by: lcocking on Dec 30, 2017, 09:55 pm
This would mean you use an outdated version of GxEPD. The actual version has a timeout on _waitWhileBusy(), and diagnostic output.

Make sure you use voltage dividers or at least series resistors on data lines with 5V Arduino.

Most likely your SPI communication does not work correctly, wrong pins, bad connections or bad solder joints have shown up as the most likely cause. Scroll back through this topic.

Did you select the correct display class? 1.54" b/w and 1.54" b/w/r are different.
Thanks for the reply ZinggJM. I'm using the Arduino Uno and wiring into the 3.3V pin, so power is ok. I've double checked the SPI wiring and rewired a few times, I'm sure this is correct. I'm using your commented wiring suggestion of "BUSY -> 7, RST -> 9, DC -> 8, CS-> 10, CLK -> 13, DIN -> 11", though this is slightly different than Waveshare's code which suggested DC as 9 and RST as 8, but that wiring with their code doesn't work either.

I'm double checked and I'm using the latest version of your code. I'm uncommenting the below drive line for my display:

#include <GxGDEW0154Z04/GxGDEW0154Z04.cpp>  // 1.54" b/w/r

And the associated .h file indicates version 2.3 (though the SPI_TestExample indicates v2.0).

I may have misrepresented the busy status. Technically it's not stuck, the timeout occurs and the serial monitor reports the following, going on forever:

setup
setup done
Beginning Loop...
Busy Timeout!
Power On : 10000140
Busy Timeout!
drawPicture : 10000144
Busy Timeout!
Power On : 10000144
Busy Timeout!
drawCornerTest : 10000144
Busy Timeout!
Power On : 10000356
Busy Timeout!
drawPaged : 10000328
Beginning Loop...

I've had zero response from the screen no matter what I do. Open to any other suggestions.
Title: Re: Waveshare e-paper displays with SPI
Post by: ZinggJM on Dec 31, 2017, 07:05 am
I should never have added support for AVR Arduinos to my library!

I can repeat as many times as I do, with no persistent effect:

DO NOT connect the data lines of these e-paper displays directly to 5V IO pins!

For you it is time to measure:
- observe the voltage on the BUSY line with a voltmeter,
- observe the SPI signals with a scope or logic analyzer,

Measure the effective voltage on the VCC pin of the display; it may be above 3.3V, as the UNO has no load on 3.3V and the anti-latch-up diodes of the controller may feed it from 5V data signals.

No idea if this can cause malfunction of the SPI communication.
Title: Re: Waveshare e-paper displays with SPI
Post by: spigot on Jan 01, 2018, 08:39 pm
@ZinggJM: Thanks for the library. It's very helpful.
Title: Re: Waveshare e-paper displays with SPI - Update
Post by: tolkete on Jan 06, 2018, 03:07 pm
Hello,
I use NodeMCU with Waveshare e-ink. Everything works fine, but as I wanted to use ESP.deepSleep() in order to save battery time the display doesn't weak up.
If I remove the battery and insert it again the display is working, but after deep sleep only NodeMCU is up, there is no refresh on the display.

Has anyone an idea what the problem is? How to wake up the display?

For better understanding I add my code:

Code: [Select]

#include <GxEPD.h>

#include <GxGDEW042T2/GxGDEW042T2.cpp>      // 4.2" b/w
#include <ESP8266WiFi.h> // Enables the ESP8266 to connect to the local network (via WiFi)
#include <PubSubClient.h> // Allows us to connect to, and publish to the MQTT broker

// FreeFonts from Adafruit_GFX
#include <Fonts/FreeMonoBold9pt7b.h>
#include <Fonts/FreeSansBold9pt7b.h>

#include <GxIO/GxIO_SPI/GxIO_SPI.cpp>
#include <GxIO/GxIO.cpp>

// GxIO_SPI(SPIClass& spi, int8_t cs, int8_t dc, int8_t rst = -1, int8_t bl = -1);
GxIO_Class io(SPI, D8, D3, D4); // arbitrary selection of D3, D4 selected for default of GxEPD_Class
// GxGDEP015OC1(GxIO& io, uint8_t rst = D4, uint8_t busy = D2);
GxEPD_Class display(io, D4, D6); // default selection of D4, D2
#define RST_PIN D4

// WiFi
// Make sure to update this for your own WiFi network!
const char* ssid = "XYZ";
const char* wifi_password = "XXX";

// Nachrichten Variable
String nachricht ="";

// MQTT
// Make sure to update this for your own MQTT Broker!
const char* mqtt_server = "192.168.XXX.YYY";
const char* mqtt_topic = "nachrichten";
const char* mqtt_username = "XXX";
const char* mqtt_password = "XXX";
// The client id identifies the ESP8266 device. Think of it a bit like a hostname (Or just a name, like Greg).
const char* clientID = "ESP8266_1";

// Initialise the WiFi and MQTT Client objects
WiFiClient wifiClient;
PubSubClient client(mqtt_server, 1883, wifiClient); // 1883 is the listener port for the Broker

void ReceivedMessage(char* topic, byte* payload, unsigned int length) {
  // Output the first character of the message to serial (debug)
  Serial.print("Message:");
  nachricht = String((char*)payload);
  Serial.println(nachricht);
  display.drawPaged(showText);
  delay(3000);
  Serial.println("start deep sleep");
  ESP.deepSleep(36000000); //3600000000 go to sleep for 3600 second
  delay(100);
}

bool Connect() {
  // Connect to MQTT Server and subscribe to the topic
  if (client.connect(clientID, mqtt_username, mqtt_password)) {
      client.subscribe(mqtt_topic);
      return true;
    }
    else {
      return false;
  }
}



void setup()
{
  Serial.begin(115200);
  Serial.println();
  Serial.println("setup Display");
  pinMode(RST_PIN, OUTPUT);
  digitalWrite(RST_PIN, LOW);
  delay(20);
  digitalWrite(RST_PIN, HIGH);
  delay(20);
  display.init();
  Serial.println("setup done");

  Serial.print("Connecting to ");
  Serial.println(ssid);

  // Connect to the WiFi
  WiFi.begin(ssid, wifi_password);

  // Wait until the connection has been confirmed before continuing
  while (WiFi.status() != WL_CONNECTED) {
    delay(500);
    Serial.print(".");
  }

  // Debugging - Output the IP Address of the ESP8266
  Serial.println("WiFi connected");
  Serial.print("IP address: ");
  Serial.println(WiFi.localIP());

  // Connect to MQTT Broker
  // setCallback sets the function to be called when a message is received.
  client.setCallback(ReceivedMessage);
  if (Connect()) {
    Serial.println("Connected Successfully to MQTT Broker!"); 
  }
  else {
    Serial.println("Connection Failed!");
  }
}

void loop()
{
    if (!client.connected()) {
      Connect();
    }
  client.loop();// just tells the MQTT client code to do what it needs to do itself (i.e. check for messages, etc.)
  //Once it has done all it needs to do for this cycle, go back to checking if we are still connected.
 
}


void showText()
{
  const GFXfont* f = &FreeMonoBold9pt7b;
  display.fillScreen(GxEPD_WHITE);
  display.setTextColor(GxEPD_BLACK);
  display.setFont(f);
  display.setCursor(0, 0);
  display.println();
  display.println(nachricht);
}




Thanks in advane.
Tolkete
Title: Re: Waveshare e-paper displays with SPI
Post by: ZinggJM on Jan 06, 2018, 03:26 pm
Please use code tags for code - it makes code more pleasant to read - and provide complete code that reproduces the issue.

Otherwise I can only guess which e-paper you use, and which library.
Title: Re: Waveshare e-paper displays with SPI
Post by: tolkete on Jan 07, 2018, 04:14 pm
Hi ZinggJM,
Thanks for your comment. I update my first post.

Thanks, Tolkete
Title: Re: Waveshare e-paper displays with SPI
Post by: ZinggJM on Jan 07, 2018, 04:53 pm
Hi tolkete,

Thank you for the update and the complete code.
I have not yet used MQTT, and my display node does not need to sleep, as it is on a USB power supply.
But I can and will do this test with a WiFi client and the 4.2" e-paper display.
I am quite sure I once tried a WiFi node with 2.9" display and SHT21 sensor on 4 NiMH accu with deep sleep mode.

The e-paper display does not do any update or refresh by itself or by the display class on power up.
So with your code it will only update if you send a message.

So please report if you see your Serial output after deep sleep wakeup, but no display update after message reception (or you could produce an "initial" message on the display in setup for debug).

I assume you have connected the wakeup output pin to the reset input (I use a 100ohm resistor).

Jean-Marc

Looking closer at your code I have 2 remarks:
You do not need to use drawPaged() on a ESP8266, it has enough RAM, unless you have reduced the _buffer size (or prefer to use a drawCallback() function).
Calling deepSleep() inside a MQTT callback function may not be "clean", you could call deepSleep() in loop(), if MQTT has some isIdle() function.
Title: Re: Waveshare e-paper displays with SPI
Post by: tolkete on Jan 07, 2018, 07:39 pm
Thanks for your feedback.

I added deep sleep into the loop before, but than the NodeMCU was only sleeping without refreshing of the broker news.

Serial output:

Code: [Select]

⸮⸮0x2d
csum 0x2d
v09f0c112
~ld

setup Display
setup done
Connecting to Drxxx
....WiFi connected
IP address: 192.168.xxx.xx
Connected Successfully to MQTT Broker!
Message:2018-01-07 NASA-Legende John Young  gestorben                           ................................... Lange Jahre war kein Mensch oefter  im All als er: John Young.          Insgesamt sechs Mal flog der        Astronaut ins Weltall und           verbrachte dabei auch drei Tage auf dem Mond. Nun ist Young mit 87      Jahren gestorben. Die NASA nannte   ihn einen ihrer Pioniere. >>> 19:00                                                                                                                                                                                                             
start deep sleep
rd


There are some strange signs which I can't copy out of the serial monitor therefore I add a pic.

Thanks, tolkete
Title: Re: Waveshare e-paper displays with SPI
Post by: ZinggJM on Jan 07, 2018, 08:45 pm
Hi Tolkete,

I verified with my IoT_Display program, with added deep sleep.

I see the refresh update flashing and the actual values on the display.

I copied Serial output from Serial Monitor, without the garbled lines (ESP8266 output is 74880baud on start).

Code: [Select]
IoT Display
.6.6.6.6.6.6.6.3
WiFi connected
Server started
192.168.4.214
connected successfully
Balkon 21:27 4.3 94.6 3.5 4.6<br>
Waschen 21:25 15.4 80.8 12.1 4.0<br>
Keller 21:25 14.4 79.6 10.9 5.4<br>
Heizung 21:27 19.3 57.1 10.6 <br>
Hobby 21:25 13.0 81.4 9.9 5.0<br>
Eingang 21:28 21.5 51.5 11.1 5.0<br>
James 21:26 22.4 52.0 12.1 5.2<br>
Arbeit 21:28 22.4 51.3 11.9 4.9<br>
Schlafen 21:21 20.9 58.1 12.3 5.0<br>
Power On : 37658
update : 3316344
Power Off : 40706

IoT Display
.6.6.6.6.6.6.6.3
WiFi connected
Server started
192.168.4.214
connected successfully
Balkon 21:31 4.3 94.0 3.4 4.6<br>
Waschen 21:28 15.4 80.9 12.1 4.0<br>
Keller 21:28 14.4 79.6 10.9 5.4<br>
Heizung 21:30 19.3 57.1 10.6 <br>
Hobby 21:28 13.0 81.2 9.9 5.0<br>
Eingang 21:31 21.5 51.3 11.1 5.0<br>
James 21:29 22.5 52.0 12.1 5.2<br>
Arbeit 21:31 22.4 51.5 12.0 4.9<br>
Schlafen 21:21 20.9 58.1 12.3 5.0<br>
Power On : 38118
update : 3316218
Power Off : 40156


My IoT server has still DST.

Do you use the actual version of GxEPD? I don't see the diagnostic output of the display class.

Jean-Marc
Title: Re: Waveshare e-paper displays with SPI
Post by: tolkete on Jan 08, 2018, 10:07 pm
Dear Jean-Marc,
I updated the libaries, but still have the same problem.

Code: [Select]

setup Display
setup done
Connecting to Drxxx
..WiFi connected
IP address: 192.168.xxx.xxx
Connected Successfully to MQTT Broker!
Message:2018-01-08 AfD-Parteigericht lehnt  offenbar Ausschluss von Hoecke ab                                       ................................... Der AfD-Rechtsaussen Hoecke kann    wohl in der Partei bleiben. Das     Thueringer Landesschiedsgericht     lehnte laut dpa-Informationen einen Ausschlussantrag des                Bundesvorstands ab. Eine            Wiederaufnahme des Verfahrens gilt  als unwahrscheinlich. >>> 22:00                                                                                                                                                                             
Power On : 5
drawPaged : 2
Power Off : 1
start deep sleep


I think I made a silly mistake.

If I just call showText() nothing happens at start up only if I use display.drawPaged(showText)
Code: [Select]

void showText()
{
  const GFXfont* f = &FreeMonoBold9pt7b;
  display.fillScreen(GxEPD_WHITE);
  display.setTextColor(GxEPD_BLACK);
  display.setFont(f);
  display.setCursor(0, 0);
  display.println();
  display.println(nachricht);
}


Any idea?

Thanks, Tolkete
Title: Re: Waveshare e-paper displays with SPI
Post by: ZinggJM on Jan 08, 2018, 10:51 pm
You have two issues:

1. your BUSY line does not work. The low microseconds times show this.
    you reported that update worked, therefore your SPI communication works ok.

2. drawPaged does an automatic refresh of the screen at the end, which transfers the data from the controller internal memory to pixel states on the screen.
print() writes to the buffer in the display class. You need to call update() at the end, which writes the buffer to the controller internal memory and commands it to refresh the screen.
Take a look at the comments for the class methods in the header file.
Your showText() function needs display.update() at the end for normal buffered drawing,
no display.update() at the end when used as callback function for paged drawing, it is called multiple times in this case.

Jean-Marc
Title: Re: Waveshare e-paper displays with SPI
Post by: tolkete on Jan 09, 2018, 08:14 pm
Dear Jean-Marc,
Thank you very much!!!
Now it is running, wake up from deep sleep works well.

I checked the BUSY line and found that RST was on the wrong pin. Silly mistake, but now I have a deeper understanding for your libary. Thanks for sharing this libary.

Greetings, Tolkete
Title: Re: Waveshare e-paper displays with SPI
Post by: ZinggJM on Jan 09, 2018, 09:13 pm
Tolkete,


Thank you for the feedback. I wish you continuing success with your projects.

Jean-Marc
Title: Re: Waveshare e-paper displays with SPI
Post by: smawad on Jan 16, 2018, 09:44 pm
Hello,
Please forgive my ignorance.
I am using nodemcu ESP8266 board.
I have the waveshare 1.54 inch/3 color and I am using this class GxGDEW0154Z04, I am trying to use the display with two temperature sensors through Onewire library and Dallas Temperatures.
My connections  for the display are as follows
D2  => Busy
D3  => DC
D4  => RST
3V3 => 3.3V
GND => GND
D5  => CLK
D7  => DIN
D8  => CS
and I connect the sensors pin to D6.
My code works fine for the display but I am getting no reading from the sensors. Once I comment the display.init line in the setup function. The sensors start working properly.
I am don't know what is the problem with my code. Is it pin assignments or wrong use of the library or conflict between the two libraries
Code: [Select]

#include <OneWire.h>
#include <DallasTemperature.h>
// include library, include base class, make path known
#include <GxEPD.h>

// select the display class to use, only one
#include <GxGDEW0154Z04/GxGDEW0154Z04.cpp> // 1.54" b/w/r

#include GxEPD_BitmapExamples

// FreeFonts from Adafruit_GFX
#include <Fonts/FreeMonoBold9pt7b.h>
#include <Fonts/FreeMonoBold12pt7b.h>
#include <Fonts/FreeMonoBold18pt7b.h>
#include <Fonts/FreeMonoBold24pt7b.h>

#include <GxIO/GxIO_SPI/GxIO_SPI.cpp>
#include <GxIO/GxIO.cpp>
// Data wire is plugged into pin 2 on the Arduino
#define ONE_WIRE_BUS 12

// Setup a oneWire instance to communicate with any OneWire devices (not just Maxim/Dallas temperature ICs)
OneWire oneWire(ONE_WIRE_BUS);

// Pass our oneWire reference to Dallas Temperature.
DallasTemperature sensors(&oneWire);


#if defined(ESP8266)
//ESP8266
//static const uint8_t LED_BUILTIN = 16;
//static const uint8_t BUILTIN_LED = 16;

//static const uint8_t D0   = 16;
//static const uint8_t D1   = 5;
//static const uint8_t D2   = 4;
//static const uint8_t D3   = 0;
//static const uint8_t D4   = 2;
//static const uint8_t D5   = 14;
//static const uint8_t D6   = 12;
//static const uint8_t D7   = 13;
//static const uint8_t D8   = 15;
//static const uint8_t D9   = 3;
//static const uint8_t D10  = 1;
/////////

GxIO_Class io(SPI, 15, 0, 2);

GxEPD_Class display(io,2,4);
#endif


The above is my initialization code.
Thanks for your help.
Sameh
Title: Re: Waveshare e-paper displays with SPI
Post by: ZinggJM on Jan 17, 2018, 04:35 am
Hi Sameh,

Most likely the reason is simple, but to be sure I would need your setup() code.

D6 (12) is MISO of SPI on ESP8266. It is not needed with these e-paper displays, but initialized by SPIClass.
You can use D6 (12) for input without any restriction.
I think you can use it also for output, but it needs be initialized after display.init().

My suggestion would be to swap D2 and D6, as I do in the example IoT_SHT31LP_Example_1.54inchEPD.

Jean-Marc
Title: Re: Waveshare e-paper displays with SPI
Post by: smawad on Jan 17, 2018, 08:11 am
My setup function is as follows
Code: [Select]

void setup()
{
  Serial.begin(9600);
  Serial.println();
  Serial.println("setup");
  Serial.println("Setting up display");
  //display.init();

  Serial.println("Setting up sensors");

  // Start up the library
  sensors.begin();


}


I have tried to swapping the D2 and D6 pins and changing code to
Code: [Select]

#define ONE_WIRE_BUS 4
GxEPD_Class display(io, 2, 12);

But this time the display didn't work, it never got refreshed and the Busy line gave timeout but the sensors are working fine.
Thanks,
Sameh
Title: Re: Waveshare e-paper displays with SPI
Post by: ZinggJM on Jan 17, 2018, 09:00 am
@smawad

You would learn the most if you try to find out yourself; that is part of the fun with Arduino.

I am willing to help you, if you provide the complete, compilable part of your code that shows your issue.

I have some OneWire temperature sensor, so I can verify your issue.

Jean-Marc
Title: Re: Waveshare e-paper displays with SPI
Post by: smawad on Jan 17, 2018, 03:53 pm
Hi Jean-Marc,

Silly mistake from the above post. I forgot to un-comment the "display.init" line, this is why the screen was not working and the busy line kept on timing out.

Now everything is working after swapping D2 and D6 lines.

Thanks for your help

Sameh
Title: Re: Waveshare e-paper displays with SPI
Post by: pisker on Jan 18, 2018, 02:32 pm
Hi Fyery (refers to: post #235 (http://forum.arduino.cc/index.php?topic=487007.msg3499356#msg3499356))

I like your project, it looks really nice. I wonder, how did you calculate the probability for the weather and the weather forecast? It looks really sophisiticated. Could you share some links?

Thanks,

Ed
BTW: JMZingg, thanks for the hint regarding the link to the original post!
Title: Re: Waveshare e-paper displays with SPI
Post by: ZinggJM on Jan 18, 2018, 02:47 pm
Hi Fyery,

I like your project, it looks really nice. I wonder, how did you calculate the probability for the weather and the weather forecast? It looks really sophisiticated. Could you share some links?

Thanks,

Ed
The post refers to: post #235 (http://forum.arduino.cc/index.php?topic=487007.msg3499356#msg3499356) (make it easy for readers to follow, use link to big post, or quote for small)
Title: Re: Waveshare e-paper displays with SPI
Post by: jazzmax on Jan 18, 2018, 05:42 pm
Hello,, first off, Im beginner and total noob in MCU world ..
Couple days Im trying to understand in GxEPD examples, how to connect waveshare 1.54 inch display to STM32F103C8T6 (original Firmware) in Arduno IDE, but without any result.
Can someone show me /upload *.ino file with code to bring this display to life with STM32 and some Adafruid graphic example (for example circle/text, whatever) to see if it works please ?
(libraries GxEPD, Adafruid and STM32 support already installed .. )

I appreciate any help. thanks     
Title: Re: Waveshare e-paper displays with SPI
Post by: ZinggJM on Jan 18, 2018, 08:25 pm
Hi jazzmax,

It is just a question of selecting the correct pins for HW SPI.
You can find out yourself by locating pins_arduino.h of the board of the STM32 package you use.

The example GxEPD_SPI_TestExample is prepared for STM32, e.g. STM32F103C8T6 BluePill.

I will re-test this tomorrow; I use STM32 a lot with TFTs, but do not regularly re-test with GxEPD.

Jean-Marc
Title: Re: Waveshare e-paper displays with SPI
Post by: Fyery on Jan 18, 2018, 10:09 pm
Hi Fyery (refers to: post #235 (http://forum.arduino.cc/index.php?topic=487007.msg3499356#msg3499356))

I like your project, it looks really nice. I wonder, how did you calculate the probability for the weather and the weather forecast? It looks really sophisiticated. Could you share some links?
Hi pisker,

all the displayed information including the forecast originates from an online weather service. It is not calculated on the ESP32, since it couldn't possibly store enough data to forecast the weather, even locally. The JSON files containing hourly forecast values alone add up to around 70k in payload that need to be parsed every time I update.

Since this takes a couple seconds, I do compress the data to roughly 1kb in binary format to store them in the SPIFFS file system so they don't get lost when the microcontroller enters deep sleep - this makes switching between different info screens easier, i.e. switching between weather forecast and nearby gas station prices (which is really useful btw). I built a little capacitive touch array to tell the ESP32 to update the information from the web, or to switch between the available info screens.

Basically it just waits for a pad to be touched to wake up, then reads the data from the spiffs memory (without enabling WiFi to save power), and updates the screen with the requested info. Afterwards it goes back to deep sleep to save power. It updates its information once every hour via internet, or if I touch the update pad.

I installed a LiPo battery and fit everything inside an old CD case, then placed it in my kitchen. I had it running without any power connected for over a month now, so power consumption seems to be low enough for extended use.

I added two pictures of the project, one showing another weather screen (the other one can be found earlier in the thread), and another one of the underside of the project including the battery.

Keep up the good work,

-- Fyery

Simplified Weather Forecast Screen and hacked capacitive button array made out of aluminium foil:
(https://i.imgur.com/LjU7Iu9.jpg)

Underside of the project including the battery and an ESP32 Lite - fits inside an old CD case for protection (on the right):
(https://i.imgur.com/igGqP9V.jpg)
Title: Re: Waveshare e-paper displays with SPI
Post by: jazzmax on Jan 18, 2018, 10:58 pm
Hi jazzmax,

It is just a question of selecting the correct pins for HW SPI.
You can find out yourself by locating pins_arduino.h of the board of the STM32 package you use.

The example GxEPD_SPI_TestExample is prepared for STM32, e.g. STM32F103C8T6 BluePill.

I will re-test this tomorrow; I use STM32 a lot with TFTs, but do not regularly re-test with GxEPD.

Jean-Marc

Hello Zingg,,
yes you are right,, problems are pins .. on arduino nano (Atmel328) the GxEPD_SPI_TestExample works fine. For STM32F103C8T6 I cant find it,, but it looks like: Din - PA7 / CLK - PA5 / CS - PA4 / DC - PA6, but about RST and BUSY no idea ...   
Title: Re: Waveshare e-paper displays with SPI
Post by: ZinggJM on Jan 19, 2018, 07:00 am
@jazzmax

I will add a wiring suggestion for STM32F103C8T6, but there are just too many STM32 processors.

BUSY and RST need just general IO, so any GPIO pin can be used.

There is an implicit wiring suggestion contained here:

Code: [Select]
#elif defined(_BOARD_GENERIC_STM32F103C_H_)

// STM32 Boards (STM32duino.com)
// Generic STM32F103C series
// aka BluePill
// board.h
//#define BOARD_SPI1_NSS_PIN        PA4
//#define BOARD_SPI1_MOSI_PIN       PA7
//#define BOARD_SPI1_MISO_PIN       PA6
//#define BOARD_SPI1_SCK_PIN        PA5
//enum {
//    PA0, PA1, PA2, PA3, PA4, PA5, PA6, PA7, PA8, PA9, PA10, PA11, PA12, PA13,PA14,PA15,
//  PB0, PB1, PB2, PB3, PB4, PB5, PB6, PB7, PB8, PB9, PB10, PB11, PB12, PB13,PB14,PB15,
//  PC13, PC14,PC15
//};
// variant.h
//static const uint8_t SS   = BOARD_SPI1_NSS_PIN;
//static const uint8_t SS1  = BOARD_SPI2_NSS_PIN;
//static const uint8_t MOSI = BOARD_SPI1_MOSI_PIN;
//static const uint8_t MISO = BOARD_SPI1_MISO_PIN;
//static const uint8_t SCK  = BOARD_SPI1_SCK_PIN;

// GxIO_SPI(SPIClass& spi, int8_t cs, int8_t dc, int8_t rst = -1, int8_t bl = -1);
GxIO_Class io(SPI, SS, 8, 9);
// GxGDEP015OC1(GxIO& io, uint8_t rst = 9, uint8_t busy = 7);
GxEPD_Class display(io, 9, 3);


You can see that I used 9 for RST and 3 for BUSY, which corresponds to (enum value) PA9 and PA3.
(PA9 is not a good choice, as it is used for Serial IO).

If it does not work for you, then I would need to know which Arduino STM32 package you use;
the board you selected in the Arduino IDE with details, and the grey heading (package name).
The default SPI speed might be too high for the e-paper.

I need to wire an e-paper to a BluePill again, to re-test.

Jean-Marc

Check with original wiring is successful with package "STM32 Boards (STM32duino.com)", Board "Generic STM32F103C series"

Code: [Select]
// original mapping suggestion for STM32F1, e.g. STM32F103C8T6 "BluePill"
// BUSY -> A3, RST -> A9, DC -> A8, CS-> A4, CLK -> A5, DIN -> A7

// GxIO_SPI(SPIClass& spi, int8_t cs, int8_t dc, int8_t rst = -1, int8_t bl = -1);
GxIO_Class io(SPI, SS, 8, 9);
// GxGDEP015OC1(GxIO& io, uint8_t rst = 9, uint8_t busy = 7);
GxEPD_Class display(io, 9, 3);


(http://forum.arduino.cc/index.php?action=dlattach;topic=487007.0;attach=241863)

Check with new wiring is successful with package "STM32 Boards (STM32duino.com)", Board "Generic STM32F103C series"

Code: [Select]
// new mapping suggestion for STM32F1, e.g. STM32F103C8T6 "BluePill"
// BUSY -> A1, RST -> A2, DC -> A3, CS-> A4, CLK -> A5, DIN -> A7

// GxIO_SPI(SPIClass& spi, int8_t cs, int8_t dc, int8_t rst = -1, int8_t bl = -1);
GxIO_Class io(SPI, SS, 3, 2);
// GxGDEP015OC1(GxIO& io, uint8_t rst = 9, uint8_t busy = 7);
GxEPD_Class display(io, 2, 1);



(http://forum.arduino.cc/index.php?action=dlattach;topic=487007.0;attach=241875)
Title: Re: Waveshare e-paper displays with SPI
Post by: ARD334 on Jan 19, 2018, 11:40 am
My mapping suggestions for ESP8266 is for Wemos D1 mini, which uses Dx names for pins:

// mapping suggestion from Waveshare 2.9inch e-Paper to Wemos D1 mini
// BUSY -> D2, RST -> D4, DC -> D3, CS -> D8, CLK -> D5, DIN -> D7, GND -> GND, 3.3V -> 3.3V

The general mapping suggestion for ESP8266 is still missing, so you need to translate back to GPIO numbers:

// mapping suggestion from Waveshare 2.9inch e-Paper to generic ESP8266
// BUSY -> 4, RST -> 2, DC -> 0, CS -> 15, CLK -> 14, DIN -> 13, GND -> GND, 3.3V -> 3.3V

This should be valid for Feather HUZZAH also, but you can check pins_arduino.h for this board.

Use a different RST pin for the display than for sleep reset of the processor.

Jean-Marc





Hi ZinggJM!

Do you also have a tip on how to connect this e paper (1,54 inch from waveshare) to the NRF52 feather of adafruit?? This feather differs from the huzzah again in pins..


Kind regards!

Renate Hulst

Title: Re: Waveshare e-paper displays with SPI
Post by: ZinggJM on Jan 19, 2018, 12:30 pm
Hi Renate,

I have just updated README.md with more mapping suggestions.

I can't provide mapping suggestions for all boards, processors, and variants.

GxEPD uses HW SPI in general (you could also use a SW SPIClass instance reference to use other pins), so SCK and MOSI pins are given by the HW SPI. The other pins can be freely chosen, but restrictions of the processor need be taken into account, e.g. SS on ESP8266 and ESP32, boot selection pins, pins for serial communication etc.

My suggestion is to take a look at variant.h and pins_arduino.h of the variant of the Arduino package you use for your board.

Jean-Marc
Title: Re: Waveshare e-paper displays with SPI
Post by: kevinsidwar on Jan 19, 2018, 05:14 pm
Hey Zingg,

Really like your e-paper library and have been able to get it working successfully on a 1.54" display. I'm currently trying to write my own version from scratch going through the datasheet for the exercise of learning. I've made good progress but am hung up on the LUT (Full and Partial values). I see the section in the datasheet about VS and TP values in the LUT but I can't figure out how to calculate those values. Could you point me to some resources for understanding that piece better?

Thanks again for the awesome library and for supporting the community.

Kevin
Title: Re: Waveshare e-paper displays with SPI
Post by: jazzmax on Jan 19, 2018, 05:34 pm
Hello Zingg,,

Original mapping suggestion for STM32F1, e.g. STM32F103C8T6 "BluePill":
tested: BUSY -> A3, RST -> A9, DC -> A8, CS-> A4, CLK -> A5, DIN -> A7

New mapping suggestion for STM32F1, e.g. STM32F103C8T6 "BluePill":
tested: BUSY -> A1, RST -> A2, DC -> A3, CS-> A4, CLK -> A5, DIN -> A7

Both mappings work just PERFECT !

A9 as serial pin is not problem,, it can simultaneously work for upload and display run.

BIIIG thanks for help Zingg, now I can finaly start to learn arduino and I hope this mapping will help to
a lot of noobs like me, because STM32F103C8T6 is great price/performance mcu.
Title: Re: Waveshare e-paper displays with SPI
Post by: ZinggJM on Jan 19, 2018, 05:47 pm
Hi Kevin,

I don't know more about the waveform tables than is available in the datasheets.
I started some experiments with modified LUT for 4.2bw and 2.7bwr. You can find some information in posts in this topic.

Optimized LUT for full update for b/w seems possible as a compromise between the full and partial LUT.
But this may have an impact on long term stability and image retention.

Optimized LUT for full or partial update of b/w/r may be possible, but all my tries showed noticeable degradation compared to the manufacturers original LUT.

Even on Wikipedia I did not find much information concerning wavetables for e-papers; and this might be the private advanced knowledge of the manufacturers.

For us hobby users it may be the best solution to use the waveform tables provided by the manufacturer in the OTP storage of the display's controller, or in the available demo sources.

Jean-Marc
Title: Re: Waveshare e-paper displays with SPI
Post by: kevinsidwar on Jan 19, 2018, 08:49 pm
Thanks Jean-Marc. That's totally sufficient as an answer. Wasn't sure if I was just missing a doc somewhere. Thanks again and keep up the great work.

Kevin
Title: Re: Waveshare e-paper displays with SPI
Post by: jazzmax on Jan 21, 2018, 09:53 am
Hi, I have a noob question.
Is possibleto make with GxEPD library for example rectangle with running timer inside without full display refreshing ?
(display waveshare 1.54inch, IDE Arduino)
Title: Re: Waveshare e-paper displays with SPI
Post by: ZinggJM on Jan 21, 2018, 11:16 am
Yes, take a look at the examples PartialUpdateExample and PartialUpdateTest.

PartialUpdateTest is closer to what you intend to do.

Note that you should do a full update from time to time, but with 1.54" b/w this period can be long.
Title: Re: Waveshare e-paper displays with SPI
Post by: jazzmax on Jan 22, 2018, 04:52 pm
Yes, take a look at the examples PartialUpdateExample and PartialUpdateTest.

PartialUpdateTest is closer to what you intend to do.

Note that you should do a full update from time to time, but with 1.54" b/w this period can be long.
thanks you for answer.. please, one more question about waveshare 4.2inch b/w (GxGDEW042T2) display. how is progress with this display, you wrote "this display does not fully support partial update" what does it mean ?
Im just asking, because I would like ahead to this display in future..

thanks you
Title: Re: Waveshare e-paper displays with SPI
Post by: ZinggJM on Jan 22, 2018, 05:39 pm
For me "full partial update support" would mean partial update like the small b/w e-paper displays: fast update of the partial window without flashing effect.

For this, the controller needs to support update to a partial window, and a "partial update" waveform table must be available for fast refresh (difference optimised refresh), either stored in the controller OTP memory or available for loading to controller register space.

The partial update wavetable is only available for the 1.54", 2.13" and 2.9" b/w displays from the manufacturer.

I experimented with a partial update wavetable for the 4.2" b/w and made it available in GxGDEW042T2_FPU.
But I can't guarantee that this wavetable has no negative effect on the lifetime of the display.

Jean-Marc



Title: Re: Waveshare e-paper displays with SPI
Post by: jazzmax on Jan 22, 2018, 10:13 pm
For me "full partial update support" would mean partial update like the small b/w e-paper displays: fast update of the partial window without flashing effect.

For this, the controller needs to support update to a partial window, and a "partial update" waveform table must be available for fast refresh (difference optimised refresh), either stored in the controller OTP memory or available for loading to controller register space.

The partial update wavetable is only available for the 1.54", 2.13" and 2.9" b/w displays from the manufacturer.

I experimented with a partial update wavetable for the 4.2" b/w and made it available in GxGDEW042T2_FPU.
But I can't guarantee that this wavetable has no negative effect on the lifetime of the display.

Jean-Marc
I found this nice video about waveshare 4.2. if you didnot see it, please take a look at. Its very interesting video .. 

http://benkrasnow.blogspot.sk/2017/10/fast-partial-refresh-on-42-e-paper.html
Title: Re: Waveshare e-paper displays with SPI
Post by: ZinggJM on Jan 22, 2018, 10:26 pm
This video has been reported in an earlier post in this topic, and was the starting point for my FPU work.
But the version of Ben Krasnow did not work for me, and I got now answer if he re-tested.
Title: Re: Waveshare e-paper displays with SPI
Post by: jzvolanek on Jan 24, 2018, 07:23 pm
My almost completed WifI barometer project
ePaper 2.9 three colors + ESP Adafruit HUZZAH ESP8266 + DHT22
One station + EPD 4.3 sends data to http://zvolanek.tmep.cz/
A small ,, station, "ePaper 2.9 downloads weather data and displays on ePaper.

Thank you for supporting the author ZinggJM of this library !!

Video ePaper Update: https://www.youtube.com/watch?v=VNcb74keqBw

(http://img24.cz/images/76706443848806123812.jpg) (http://img24.cz/viewer.php?file=76706443848806123812.jpg)

(http://img24.cz/images/42627549640815229000.jpg) (http://img24.cz/viewer.php?file=42627549640815229000.jpg)

(http://img24.cz/images/10681290526168037553.jpg) (http://img24.cz/viewer.php?file=10681290526168037553.jpg)
Title: Re: Waveshare e-paper displays with SPI
Post by: Kastell on Jan 25, 2018, 12:10 pm
Hi,
I´ve a ESP8266 CP2102 and a 2.7" Waveshare EPD with HAT.

I would like to display a few dynamic texts and pictures on the display. These data are stored on FTP server and are updated once a day. The ESP and EDP should turn on once a day and show the new informations. Then it has to go in deepsleep.

Is is possbile to show dynamic pictures on the display? I think I´ve to convert the images from png to hex automatically. Or is there a better solution?

I´m still quite a newbie and would be glad about any help. Maybe there is already a similar project?
Title: Re: Waveshare e-paper displays with SPI
Post by: ZinggJM on Jan 25, 2018, 02:44 pm
Hi

"dynamic" text is no problem with my GxEPD (https://github.com/ZinggJM/GxEPD) library.
And you can load a picture to the buffer and write text onto it, and use partial update to change only the text or part of the display.

The examples use binary picture data (bitmaps) in code space, but you can feed bitmaps from data space.

I have no experience with png; maybe you could find converter for Arduino that would fit into ESP8266 or ESP32 code space.

I you tell us more clearly what your "dynamic" text and pictures mean, someone can give you a more detailed answer.
Title: Re: Waveshare e-paper displays with SPI
Post by: jzvolanek on Jan 25, 2018, 03:12 pm
All images displayed on ePaper must be in BMP format and then translated - convert to a code.

https://javl.github.io/image2cpp/

Then call in the code:
display.drawBitmap (x, y, Outside, 40, 40, GxEPD_BLACK);
(x, y, = position, image name, image size.)
Title: Re: Waveshare e-paper displays with SPI
Post by: Kastell on Jan 25, 2018, 03:50 pm
Thanks for your help!

The source is a little website with texts and pictures. The contents change from day to day. The simple html page should be displayed on the epaper.

Is it possible that the bmp is located on a ftp server and will automatically convert to code and then be displayed on the epaper?

And how do i get the text from the html page on the epaper?
Title: Re: Waveshare e-paper displays with SPI
Post by: ZinggJM on Jan 25, 2018, 05:09 pm
Is the website given, or can you change it?

If it is given, then display it in a browser on the PC and select "show source" or similar.
Find out if you can interpret the text by a simple program, if yes, you can do this on ESP8266.
Title: Re: Waveshare e-paper displays with SPI
Post by: Kastell on Jan 25, 2018, 05:38 pm
I can manage and change the website myself.
Title: Re: Waveshare e-paper displays with SPI
Post by: ZinggJM on Jan 25, 2018, 06:50 pm
I use simple text in a similar case (no pictures), with WebClient on the ESP8266 side.
Title: Re: Waveshare e-paper displays with SPI
Post by: Kastell on Jan 26, 2018, 02:10 pm
That would be enough for me, for the beginning. Do you have a code example?
Title: Re: Waveshare e-paper displays with SPI
Post by: ZinggJM on Jan 26, 2018, 02:33 pm
@Kastell

My example unfortunately is not in a state ready to be published.
I may later put a modified and simplified version on GitHub.

But there are examples with the ESP8266 and ESP32 Arduino packages.

Jean-Marc

Other posters to this topic may have examples.
Title: Re: Waveshare e-paper displays with SPI
Post by: ZinggJM on Jan 30, 2018, 06:26 am
Recipe for multiple partial update windows using paged drawing for AVR Arduinos:

1. take a sheet of paper and draw a rectangle on it representing the full screen.

2. draw in this rectangle what you would like to see on screen (screen snapshot).

3. draw rectangles (boxes) around the parts you want to update individually.

4. create a method to draw the background, e.g.

Code: [Select]
 
void drawBackground()
{
  display.drawExampleBitmap(BitmapExample1, sizeof(BitmapExample1));
  delay(2000);

  // partial update to full screen to preset for partial update of box window
  // (this avoids strange background effects)
  display.drawExampleBitmap(BitmapExample1, sizeof(BitmapExample1), GxEPD::bm_flip_x | GxEPD::bm_partial_update);
  delay(1000);
}


5. for each part create a draw callback function:

5a. decide if you want to use module global variables or function parameter(s) for variable content,

5b. use only drawing methods that draw to buffer (Adafruit_GFX methods). Coordinates are screen coordinates.

6. for each part create a method to draw that part

6a. for test, make it update to the full screen, e.g.
Code: [Select]

void drawPart1()
{
   display.drawPagedToWindow(showBox1Callback, 0, 0, display.width(), display.height());
}

6b. then use the coordinates of the partial window (box rectangle)
Code: [Select]

void drawPart1()
{
   display.drawPagedToWindow(showBox1Callback, box1_x, box1_y, box1_w, box1_h);
}

coordinates are screen coordinates.

For details take a look at PartialUpdateExample.ino or PartialUpdateTest.

For Arduinos with enough RAM (non-AVR) replace drawPagedToWindow() with updateToWindow().
And move the code from the callback function into the drawPart function.
Title: Re: Waveshare e-paper displays with SPI
Post by: PMB_NL on Jan 30, 2018, 10:14 pm
Thanks for the library!
I've used my 1.54" 3 color e-Paper display with a Sparkfun ESP32 Thing board.
As you mentioned the pins on ESP32 boards can differ.
Below the pin assignment for this board, perhaps useful for other users with similar board.

BUSY -> 19 (brown cable)
RST -> 5 (white cable)
DC -> 16 (green cable)
CS -> 2 (orange cable)
CLK -> 18 (SCK) (yellow cable)
DIN -> 23 (MOSI) (blue cable)
GND -> GND (black cable)
3.3V -> 3.3V (red cable)

Another tip, for the cable between display and board I've used a Dupont 8 pin connector and plugged in 8 small M-F cables. This is more breadboard friendly and you don't have to cut or extend the supplied cable with white connector.

Best regards,

Peter


Title: Re: Waveshare e-paper displays with SPI
Post by: AndreR241 on Jan 31, 2018, 12:03 pm
In the example, it says that partial update is not fully supported for the GxGDEW027C44. I've tried it and parts of the screen seem to stay static, but the partial refreshing takes around 15-16 seconds. During that, not only the updated area, but also the whole edge of the screen flicker.

Is this a hardware limitation of the three-color display. or is it just not fully implemented yet?
Title: Re: Waveshare e-paper displays with SPI
Post by: ZinggJM on Jan 31, 2018, 01:15 pm
Refresh speed of e-paper displays is a recurring question or issue. I have already responded with several posts.
The most recent one may be this (https://forum.arduino.cc/index.php?topic=487007.msg3571257#msg3571257).

You can scroll through this whole topic. Or use the search option (magnifying glass symbol).

And you can also look through my other topic (http://forum.arduino.cc/index.php?topic=436411.0) on e-papers.

Jean-Marc
Title: Re: Waveshare e-paper displays with SPI
Post by: Ben8785 on Feb 02, 2018, 10:44 pm
This video has been reported in an earlier post in this topic, and was the starting point for my FPU work.
But the version of Ben Krasnow did not work for me, and I got now answer if he re-tested.
Hi Jean-Marc
First thanks a lot for your library and this forum, it's of great help.

It's strange that Ben Kasnow does not work for you, it works relatively well with the 4.2 EPD I have bought one month ago from eckstein_komponente whereas your LUT does not work so great (poor display quality, slow refresh time).
I'm using your library with his LUT. I'm also trying Ben's LUT with a repetition to improve the contrast & quality (but slow down the refresh by a factor of 2). I must say that I'm not really understanding your LUT, whereas the principle of Ben's is simple to understand and is based on Waveshare LUT.

So I guess that there are different series of EPD which need different LUT.

I will now implement my program and see how the display renders. Not sure I will keep this 4.2, the quality does not look so great anyway when using fast partial updates.

I need also to add a touch panel on top of this screen but it's not so easy to find panels of the right size since the EPD is a 4:3 format.
Title: Re: Waveshare e-paper displays with SPI
Post by: ZinggJM on Feb 03, 2018, 08:48 am
I had downloaded the code from Ben Krasnow and it did not work on my display.

I may re-try this experiment, and try his waveform table with my code sometime.

Do you refer to the GxGDEW042T2_FPU version, or the original GxGDEW042T2 version?

Both versions work with the internal wavetable (OTP of the controller) for full update.

Maybe the quality of your display is inferior, maybe it is even not from Good Display.

Jean-Marc


Could you please post the LUT you use (with code tags)? this would make it easy for me to compare,
and for me and for others also to experiment with it.
Title: Re: Waveshare e-paper displays with SPI
Post by: Ben8785 on Feb 03, 2018, 09:31 am
I'm using the GxGDEW042T2_FPU version since I need fast refresh. I doubt mine is not from Good Display : it's a waveshare sold by a renowned german shop (else it is a really good fake), works pretty well.
The GxGDEW042T2 library works fine and I need to have a closer look.


The LUT I'm using:
Code: [Select]
const unsigned char GxGDEW042T2_FPU::lut_vcom0_partial[] =
{
0x00, 0x0E, 0x00, 0x00, 0x00, 0x01,       
0x00, 0x00, 0x00, 0x00, 0x00, 0x00,       
0x00, 0x00, 0x00, 0x00, 0x00, 0x00,       
0x00, 0x00, 0x00, 0x00, 0x00, 0x00,       
0x00, 0x00, 0x00, 0x00, 0x00, 0x00,       
0x00, 0x00, 0x00, 0x00, 0x00, 0x00,       
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
};

const unsigned char GxGDEW042T2_FPU::lut_ww_partial[] ={
0xA0, 0x0E, 0x00, 0x00, 0x00, 0x01,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
};

const unsigned char GxGDEW042T2_FPU::lut_bw_partial[] ={
0xA0, 0x0E, 0x00, 0x00, 0x00, 0x01,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00,     
};

const unsigned char GxGDEW042T2_FPU::lut_bb_partial[] ={
0x50, 0x0E, 0x00, 0x00, 0x00, 0x01,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00,     
};

const unsigned char GxGDEW042T2_FPU::lut_wb_partial[] ={
0x50, 0x0E, 0x00, 0x00, 0x00, 0x01,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00,         
};


I'm also using another modified LUT where I duplicate the first line to apply the changes twice.
Ben took the LUT from the Waveshare examples and he only kept the last line to make the update much faster (but losing some quality).
Title: Re: Waveshare e-paper displays with SPI
Post by: ZinggJM on Feb 03, 2018, 09:45 am
Thank you!

Yes, I believe your display is genuine.

I will need to dig a bit deeper, as I do not remember all details.
There may be different versions of the display, and they may have different optimized full update internal LUT.

Most likely I did my experiments with a ~ half year old panel from Good Display (where these panels come from).
As far as I remember, both Waveshare and Good Display demo codes use the OTP LUT, even if the code comes with full update LUT. And the LUTs are slightly different.

I will experiment again with all versions and all my 4.2" b/w displays, and report findings, some time soon.
Title: Re: Waveshare e-paper displays with SPI
Post by: Arduinonymus on Feb 04, 2018, 01:14 pm
Hi ZinggJM!

Great Library! I am working with Wemos D1 Mini, a Waveshare 1.45 inch e-paper display and a DS3231 RTC. I saw the demo code and the wiring recommendations:


// mapping suggestion from Waveshare 2.9inch e-Paper to Wemos D1 mini
// BUSY -> D2, RST -> D4, DC -> D3, CS -> D8, CLK -> D5, DIN -> D7, GND -> GND, 3.3V -> 3.3V.

The demo code works and I see updates on the screen but the problem is, if I connect the EPD acording to these instructions, how do I connect the RTC, since the Wemos pinout describes D2 and D1 as I2C pins. Please correct me if I'm wrong.
Title: Re: Waveshare e-paper displays with SPI
Post by: ZinggJM on Feb 04, 2018, 03:48 pm
The MISO pin can be used for BUSY input.

See example IoT_SHT31LP_Example_1.54inchEPD.ino

Jean-Marc
Title: Re: Waveshare e-paper displays with SPI
Post by: Arduinonymus on Feb 04, 2018, 04:11 pm
The MISO pin can be used for BUSY input.

See example IoT_SHT31LP_Example_1.54inchEPD.ino

Jean-Marc

This is just brilliant! I hope this is where the pins are defined : "GxEPD_Class display(io, D4, D6);" Unfortunately, I bricked my Wemos D1. I am awaiting a replacement and I'll update as soon as possible!

Thanks Man!
Title: Re: Waveshare e-paper displays with SPI
Post by: ZinggJM on Feb 04, 2018, 04:42 pm
Yes, that's correct.

Code: [Select]
GxIO_Class io(SPI, SS, D3, D4);
// D2 reserved for SDA, use D6 (MISO) instead
GxEPD_Class display(io, D4, D6);


You might also consider using ESP32, e.g. LOLIN32 lite, it has more pins and more RAM.
Title: Re: Waveshare e-paper displays with SPI
Post by: Arduinonymus on Feb 04, 2018, 06:17 pm
Yes, that's correct.

Code: [Select]
GxIO_Class io(SPI, SS, D3, D4);
// D2 reserved for SDA, use D6 (MISO) instead
GxEPD_Class display(io, D4, D6);


You might also consider using ESP32, e.g. LOLIN32 lite, it has more pins and more RAM.

Thanks man! My project will be battery powered. I was able to bring down the Wemos D1 to 20mA (with Wifi disabled). I see that ESP32 has Bluetooth+Wifi. I will have to disable both to be able to limit power consumption. Can I use STM32 as an alternate or ESP32 is a better option?
Title: Re: Waveshare e-paper displays with SPI
Post by: ZinggJM on Feb 04, 2018, 06:52 pm
It depends on your application. ESP8266 is well suited if you need WiFi, but can put it into deep sleep for periods of 1 minute or more. I use 3 minutes for my sensor network. Same should be true for ESP32, but I have not yet used it with deep sleep.

Small STM32 boards, e.g. STM32F103C8T6 "BluePill" should also be suited, it works with GxEPD, but I have not measured current nor tried deep sleep.

I am sure you can find more information in the Arduino Forum. Or get more answers here.
Title: Re: Waveshare e-paper displays with SPI
Post by: Arduinonymus on Feb 07, 2018, 03:28 am
Hey guys! Do we have support for Teensy boards like TeensyLC?
Title: Re: Waveshare e-paper displays with SPI
Post by: CrossRoads on Feb 07, 2018, 05:59 am
What is a TeensyLC? I don't see that here
https://www.pjrc.com/teensy/ (https://www.pjrc.com/teensy/)
Title: Re: Waveshare e-paper displays with SPI
Post by: Arduinonymus on Feb 07, 2018, 06:23 am
What is a TeensyLC? I don't see that here
https://www.pjrc.com/teensy/ (https://www.pjrc.com/teensy/)
Hi, It's the first from the left in the second row.
Title: Re: Waveshare e-paper displays with SPI
Post by: ZinggJM on Feb 07, 2018, 06:59 am
Hey guys! Do we have support for Teensy boards like TeensyLC?
Should work with GxEPD. This topic may help: how to connect waveshare 1.54" e paper screen with samd21 (https://forum.arduino.cc/index.php?topic=519583.0)
Title: Re: Waveshare e-paper displays with SPI
Post by: Arduinonymus on Feb 07, 2018, 12:53 pm
Thanks Man! I tried that, but the TeensyLC has little flsh memory. So back to Wemos D1 (I bricked the one I had so just recieved a replacement). Back to the drawing boards! I made this code to display date with a DS3231. I dunno whats wrong man, there's no change on the EPD  :smiley-confuse: .

Wiring Setup
Code: [Select]

 *  Wemos D1      Waveshare 1.54 Inch EPD
 * BUSY    ->     D2
 * RST     ->     D4
 * DC     ->      D3
 * CS     ->      D8
 * CLK    ->      D5
 * DIN      ->    D7
 * GND     ->     GND
 * 3.3V   ->      3.3V (From Wemos 3.3v out)
 *
 * Wemos D1     DS3231
 * D2             SDA
 * D1             SCL


This code is not working  :smiley-roll: :

Code: [Select]

#include <GxEPD.h>
#include <GxGDEP015OC1/GxGDEP015OC1.cpp>
#include <GxIO/GxIO_SPI/GxIO_SPI.cpp>
#include <GxIO/GxIO.cpp>
#include <Fonts/FreeMonoBold9pt7b.h>
#include <Fonts/FreeSans9pt7b.h>
#include "RTClib.h"
char daysOfTheWeek[7][12] = {"SUN", "MON", "TUE", "WED", "THU", "FRI", "SAT"};

RTC_DS3231 rtc;

GxIO_Class io(SPI, SS, 0, 2); // arbitrary selection of D3(=0), D4(=2), selected for default of GxEPD_Class
GxEPD_Class display(io, D4, D6); // default selection of D4(=2), D2(=4)

#define DEMO_DELAY 30

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

void loop()
{

  showPartialUpdate();

  delay(DEMO_DELAY * 1000);
}

void showPartialUpdate()

{
  DateTime now = rtc.now();
  display.setFont(&FreeMonoBold9pt7b);
  display.setCursor(18, 25);
  display.setTextColor(GxEPD_WHITE);
  display.setTextSize(0);
  display.print(now.day());
  display.updateWindow(2, 2, 50, 50, true);
  delay (2000);

}
Title: Re: Waveshare e-paper displays with SPI
Post by: ZinggJM on Feb 07, 2018, 01:51 pm
Hi Man,

I am short of time currently, so I try to give short answers, although I know this is not adequate for Newbies, sorry.

Partial update is a bit tricky, and the solution in GxEPD not optimal. I am working on a new and simpler version.

As you can see in the PatialUpdateExample, I first draw the background once with full update, then with partial update to the full screen, and only after this updates to partial window with updateWindow().

Update to full window with update(), and partial update to full screen window are also a good means to first check your output.

If this does not help I will check your code, just need to dig out one of my DS3231 from ? drawer.

Quote
* BUSY    ->     D2
I assume you have wired BUSY to D6.
Title: Re: Waveshare e-paper displays with SPI
Post by: Arduinonymus on Feb 07, 2018, 02:28 pm
Thanks a lot Zingg Man! Yeah I kinda learning, so yeah I'm making mistakes. Thanks to your support, real quick man!

Yeah I attached BUSY to D6 on Wemos D1.
Title: Re: Waveshare e-paper displays with SPI
Post by: Fritom on Feb 08, 2018, 09:46 pm
Hello,

I followed all the instruction how to install library. But still I can´t compile the file:
C:\Users\XXX\Documents\Arduino\libraries\GxEPD-master\examples\GxEPD_SPI_TestExample\GxEPD_SPI_TestExample.ino:50:19: fatal error: GxEPD.h: No such file or directory

GxEPD library downloaded as well Adafruit GFX library.
I´ve tried reinstalation but without sucess. Any tips how to solve it?

Thank you very much
best regards
Tomas
Title: Re: Waveshare e-paper displays with SPI
Post by: ZinggJM on Feb 08, 2018, 10:33 pm
Hi Tomas,

This comes rather as a surprise.

I would need to know which version of the Arduino IDE you use, and what your target system is.

I recommend to use the actual version of the Arduino IDE.

Copy the detailed error message and paste it into code tags </>-button top left.

I'll look for response tomorrow.

Jean-Marc
Title: Re: Waveshare e-paper displays with SPI
Post by: Fritom on Feb 10, 2018, 03:18 pm
Arduino IDE version 1.8.5.
Code: [Select]
<C:\Users\TomĂ­k  a Terezka\Documents\Arduino\libraries\GxEPD-master\examples\GxEPD_HD_TestExample\GxEPD_HD_TestExample.ino:17:19: fatal error: GxEPD.h: No such file or directory

compilation terminated.>
Title: Re: Waveshare e-paper displays with SPI
Post by: ZinggJM on Feb 10, 2018, 03:28 pm
Please check if the file is there.

Maybe you need to use a username with no blanks and only normal ASCII characters.

I have checked on Arduino 1.8.5 with username ZinggJ.
Title: Re: Waveshare e-paper displays with SPI
Post by: raz0rsedge on Feb 10, 2018, 07:54 pm
Hi there, I'm quite new to this forum. Just wanted to let you know that there is a nice ct article and github repository for a webbased Doorsign Loader.


Cheers
raz0r

Ed: oops, didn't provide the link ;) ==> https://github.com/jamct/DoorsignEPD
Title: Re: Waveshare e-paper displays with SPI
Post by: Arduinonymus on Feb 11, 2018, 07:09 pm
ZinggJM, please help me man! I'm trying the code below with the demo image background. I must be doing something wrong because there ain't no date on the screen. I changed "now.day()" with "Hello", but nada! The code seems just fine, compiles and loads on to the D1, but man its not really taking me anywhere :'(

Code: [Select]

/* WIring Setup:
   Wemos D1     Waveshare 1.54 Inch EPD
   BUSY  ->      D6
   RST    ->      D4
   DC     ->      D3
   CS      ->     D8
   CLK    ->     D5
   DIN    ->     D7
   GND   ->     GND
   3.3V   ->     3.3V (From Wemos 3.3v out)

   Wemos D1     DS3231
   D2             SDA
   D1             SCL
*/

#include <GxEPD.h>
#include <GxGDEP015OC1/GxGDEP015OC1.cpp>
#include <GxIO/GxIO_SPI/GxIO_SPI.cpp>
#include <GxIO/GxIO.cpp>
#include <Fonts/FreeMonoBold9pt7b.h>
#include GxEPD_BitmapExamples
#include "RTClib.h"

RTC_DS3231 rtc;
char daysOfTheWeek[7][12] = {"SUN", "MON", "TUE", "WED", "THU", "FRI", "SAT"};

GxIO_Class io(SPI, SS, 0, 2); // arbitrary selection of D3(=0), D4(=2), selected for default of GxEPD_Class
GxEPD_Class display(io, D4, D6); // default selection of D4(=2), D2(=4)

void setup(void)
{
  Serial.begin(115200);
  display.init();
  display.update();
  display.setRotation(1);
}

void loop()
{
  showPartialUpdate();
  delay(1000);
}

void showPartialUpdate()
{
  display.drawExampleBitmap(BitmapExample1, sizeof(BitmapExample1));
  delay(2000);
  display.drawExampleBitmap(BitmapExample1, sizeof(BitmapExample1), GxEPD::bm_flip_x | GxEPD::bm_partial_update);
  delay(1000);

  DateTime now = rtc.now();
  display.setFont(&FreeMonoBold9pt7b);
  display.setCursor(25, 25);
  display.setTextColor(GxEPD_BLACK);
  display.setTextSize(0);
  display.print(now.day());
  display.updateWindow(2, 2, 70, 70, true);
}
Title: Re: Waveshare e-paper displays with SPI
Post by: ZinggJM on Feb 11, 2018, 07:21 pm
I will reorder your code later, takes more than the 5min to the news on TV pending.

You should put drawing the background in the setup part, and updating time in the loop.
Title: Re: Waveshare e-paper displays with SPI
Post by: Arduinonymus on Feb 11, 2018, 07:56 pm
I will reorder your code later, takes more than the 5min to the news on TV pending.

You should put drawing the background in the setup part, and updating time in the loop.
I just tried as told, but I must be missing something crucial. Please take your time (althought i'm reeeally anxious here!).
Title: Re: Waveshare e-paper displays with SPI
Post by: ZinggJM on Feb 11, 2018, 08:59 pm
Changed code, checked without RTC. Check this, if it doesn't work I'll dig out DS3231.

Code: [Select]

/* WIring Setup:
   Wemos D1     Waveshare 1.54 Inch EPD
   BUSY  ->      D6
   RST    ->      D4
   DC     ->      D3
   CS      ->     D8
   CLK    ->     D5
   DIN    ->     D7
   GND   ->     GND
   3.3V   ->     3.3V (From Wemos 3.3v out)

   Wemos D1     DS3231
   D2             SDA
   D1             SCL
*/

#include <GxEPD.h>
#include <GxGDEP015OC1/GxGDEP015OC1.cpp>
#include <GxIO/GxIO_SPI/GxIO_SPI.cpp>
#include <GxIO/GxIO.cpp>
#include <Fonts/FreeMonoBold9pt7b.h>
#include GxEPD_BitmapExamples
#include "RTClib.h"

RTC_DS3231 rtc;
char daysOfTheWeek[7][12] = {"SUN", "MON", "TUE", "WED", "THU", "FRI", "SAT"};

GxIO_Class io(SPI, SS, 0, 2); // arbitrary selection of D3(=0), D4(=2), selected for default of GxEPD_Class
GxEPD_Class display(io, D4, D6); // default selection of D4(=2), D2(=4)

void setup(void)
{
  Serial.begin(115200);
  display.init();
  //display.update(); //****
  drawBackground(); //****
  display.setRotation(1);
}

void loop()
{
  showPartialUpdate();
  delay(1000);
}

void drawBackground() //**********
{
  display.drawExampleBitmap(BitmapExample1, sizeof(BitmapExample1));
  delay(2000);
  display.drawExampleBitmap(BitmapExample1, sizeof(BitmapExample1), GxEPD::bm_flip_x | GxEPD::bm_partial_update);
  delay(1000); //***********
}

void showPartialUpdate()
{

  // **** removed

  //DateTime now = rtc.now();
  display.setFont(&FreeMonoBold9pt7b);
  //display.fillScreen(GxEPD_WHITE); //**** clear background
  display.fillRect(2, 2, 70, 70, GxEPD_WHITE); //**** or rectangle
  display.setCursor(25, 25);
  display.setTextColor(GxEPD_BLACK);
  display.setTextSize(0);
  //display.print(now.day());
  static uint16_t n = 0;
  n++;
  display.print(n);
  display.updateWindow(2, 2, 70, 70, true);
  delay(1000); //****
}
Title: Re: Waveshare e-paper displays with SPI
Post by: Arduinonymus on Feb 11, 2018, 09:19 pm
Hey! I just tried the code and it displays two things, a "Good Display" logo and a counter at the top left corner! It works! Great! Finally I get to see some improvement! So is it the DS3231?
Title: Re: Waveshare e-paper displays with SPI
Post by: Arduinonymus on Feb 12, 2018, 03:56 pm
Hey ZinggJM, my friend what should I do? DS3231 is kinda important to this project. Actually, I'm making an organ clock, and time is very important part of it.
Title: Re: Waveshare e-paper displays with SPI
Post by: ZinggJM on Feb 12, 2018, 05:18 pm
You did not tell me if the modified code works if you enable RTC.
And you should tell me what library you use with your RTC.
And tell me if your code works without EPD, e.g. with output to Serial Monitor.
I don't mind if you call me friend, but I do not like your language.
I do not know if you are serious, or just joking and wasting my time.
Title: Re: Waveshare e-paper displays with SPI
Post by: Arduinonymus on Feb 12, 2018, 05:24 pm
You did not tell me if the modified code works if you enable RTC.
And you should tell me what library you use with your RTC.
And tell me if your code works without EPD, e.g. with output to Serial Monitor.
I don't mind if you call me friend, but I do not like your language.
I do not know if you are serious, or just joking and wasting my time.
Hey ZinggJM. I have nothing against man! I calld you "my friend" since you've been helping me. I'm sorry if I offended you in any way.  I don't mind meing too professional, but that kinda ruins the fun working with eachother.
Title: Re: Waveshare e-paper displays with SPI
Post by: Arduinonymus on Feb 12, 2018, 05:31 pm
The value of "now.day()" is not displayed if I replace "display.print(n);" with "display.print(now.day());". Though I was happy that at least display.print(n) works. If you see my previous post, that's what I meant. I'm using RTClib.h (it's declared in the code and I did not know If I had to explicitly mention that).

If I look at the code (with DS3231 enabled and try to print the value, say of the day), I get the following serial output:

Code: [Select]

_PowerOn : 2
_Update_Part : 2
165
_PowerOn : 1
_Update_Part : 1
165
_PowerOn : 1
_Update_Part : 1
165
_PowerOn : 2
_Update_Part : 2
165
_PowerOn : 1
_Update_Part : 1
165
_PowerOn : 2
_Update_Part : 2
165


That "165" seems to be the day from RTC code. However if I run the demo from RTClib.h, it displays the time and everything correctly with the same wiring.
Title: Re: Waveshare e-paper displays with SPI
Post by: ZinggJM on Feb 12, 2018, 05:49 pm
RTClib.h is a header file. It can come from different RTC libraries. Library Manager will tell you which RTCLibraries are installed on your system.

What happens if you use Serial.print(now.day());

Aha, now I see your serial output. The update times are way too short. Either your SPI connection does not work, or your BUSY line does not work.

Run the code once more with RTC disabled and post debug output again.
Title: Re: Waveshare e-paper displays with SPI
Post by: Arduinonymus on Feb 12, 2018, 06:01 pm
Ok, I ran the code without RTC I get the "Good Display" logo and a counter on the display and this is what I get on the serial:
Code: [Select]

_Update_Full : 1066230
_PowerOff : 67967
_PowerOn : 72031
_Update_Part : 278700
_PowerOff : 66874
_PowerOn : 72486
_Update_Part : 278687
_PowerOn : 11162
_Update_Part : 278242
_PowerOn : 10147
_Update_Part : 278174


I'm using the Adafruit version of RTClib, v1.2.0 (https://github.com/adafruit/RTClib).
Title: Re: Waveshare e-paper displays with SPI
Post by: ZinggJM on Feb 12, 2018, 06:30 pm
Ok, my wiring for EPD and RTC is nearly ready, I wanted something more durable than breadboard wiring, and I had installed the same library.

So you got the different behavior without any change to the wiring, I assume. RTC should not interfere with SPI or D6, I will check.
Title: Re: Waveshare e-paper displays with SPI
Post by: Arduinonymus on Feb 12, 2018, 06:42 pm
Thanks for helping me out! Yes as you suggested I ran the code with and without RTC code, and the output on both the display and serial is different.

Without RTC:
Good Display logo + Active running counter+ the following serial output:
Code: [Select]

_PowerOn : 10146
_Update_Part : 275757
_PowerOn : 10147
_Update_Part : 275718
_PowerOn : 11169
_Update_Part : 275711


With RCT
Good Display logo + Inactive counter (does not refresh) + following serial output:
Code: [Select]

_Update_Part : 2
165_PowerOn : 2
_Update_Part : 2
165_PowerOn : 2
_Update_Part : 2
165_PowerOn : 2
_Update_Part : 2
165_PowerOn : 2
_Update_Part : 1
165_PowerOn : 1
_Update_Part : 1
165_PowerOn : 2
_Update_Part : 2


The wiring setup remains same as:
Code: [Select]

Wemos D1     Waveshare 1.54 Inch EPD
BUSY  ->     D6
RST    ->     D4
DC     ->     D3
CS      ->     D8
CLK    ->     D5
DIN    ->     D7
GND   ->     GND
3.3V   ->     3.3V (From Wemos 3.3v out)

Wemos D1     DS3231
D2        ->     SDA
D1        ->     SCL


Following is the serial output for RTClib DS3231 demo code (wiring remains same):
Code: [Select]

2018/2/12 (Monday) 23:19:37
 since midnight 1/1/1970 = 1518477577s = 17574d
 now + 7d + 30s: 2018/2/20 11:49:43

2018/2/12 (Monday) 23:19:40
 since midnight 1/1/1970 = 1518477580s = 17574d
 now + 7d + 30s: 2018/2/20 11:49:46
Title: Re: Waveshare e-paper displays with SPI
Post by: ZinggJM on Feb 12, 2018, 06:46 pm
I confirm that RTC does interfere. I don't even need to connect the DS3231.

I will have to look what RTC library I used for my webserver (library installed on other PC), to see if this works. Or look into the RTC code.

I did not check this before, because all my connection boards (wired prototype boards) use D2 for BUSY.

Code: [Select]
  DateTime now = rtc.now();
  pinMode(D6, INPUT);


does not fix it.

I assume the RTC code is "clever" and tries to find DS3231 or alternative on both SPI and I2C.
Title: Re: Waveshare e-paper displays with SPI
Post by: Arduinonymus on Feb 12, 2018, 06:54 pm
Ok, thanks for making all the efforts! Is there anything that I could do?
Title: Re: Waveshare e-paper displays with SPI
Post by: ZinggJM on Feb 12, 2018, 07:00 pm
I want to create a clock example anyway, so I have this issue also, and start looking for a solution, and find it soon, hopefully.

You can try different RTC libraries, if you want, in the meantime.
Title: Re: Waveshare e-paper displays with SPI
Post by: Arduinonymus on Feb 12, 2018, 07:10 pm
I assume the RTC code is "clever" and tries to find DS3231 or alternative on both SPI and I2C.
This is my first foray into the territory of ESPs and EPDs. I have worked primarily on Arduino (Mini Pro in general). On Arduino, the SPI and I2C protocols work seamlessly with most of the libraries I have worked with. So I was perplexed when things looked skewed. There is a lot that's new to me, including these problems, but I'm glad there are people like you to offer help.

Yes, as for alternate RTC library. I already tried another DS3231 library by Eric Ayars (Link (https://github.com/NorthernWidget/DS3231)), unfortunately, the output remains the same for both display and serial. I'll keep tring some more and post the feedback.
Title: Re: Waveshare e-paper displays with SPI
Post by: Arduinonymus on Feb 12, 2018, 07:49 pm
ZinggJM,

Seems like this is the solution we've been looking for:

Code: [Select]

#include <Wire.h>

const int sclPin = D1;
const int sdaPin = D2;

void setup(void)
{
Wire.begin(sdaPin, sclPin);
}


Now things work as expected!
Title: Re: Waveshare e-paper displays with SPI
Post by: ZinggJM on Feb 12, 2018, 08:19 pm
Ok, if you look at my IoT_SHT31LP_Example_1.54inchEPD.ino, you see Wire.h included also.

I still have to look at the Adafruit RTCLib, to see what it does if Wire.h is not included.

Thanks for the feedback.
Title: Re: Waveshare e-paper displays with SPI
Post by: Arduinonymus on Feb 12, 2018, 08:32 pm
Yes, indeed its a part of your code. Seems like as your library evolved, the need for Wire library became less. I read somehwere that I2C and SPI wire are not hardwired on the Wemos as it is on Arduino. I'm uncertain if this valid or assumption. Waiting for your valuable inputs.

Thanks ZinggJM.
Title: Re: Waveshare e-paper displays with SPI
Post by: ZinggJM on Feb 12, 2018, 08:38 pm
This is my first foray into the territory of ESPs and EPDs. I have worked primarily on Arduino (Mini Pro in general). On Arduino, the SPI and I2C protocols work seamlessly with most of the libraries I have worked with. So I was perplexed when things looked skewed. There is a lot that's new to me, including these problems, but I'm glad there are people like you to offer help.

Yes, as for alternate RTC library. I already tried another DS3231 library by Eric Ayars (Link (https://github.com/NorthernWidget/DS3231)), unfortunately, the output remains the same for both display and serial. I'll keep tring some more and post the feedback.
As you tell us you have more experience with Arduino, it would be fair if you tell us your "real" Arduino Forum name, not only your new Newbie name "Arduinonimus"

Wire.h has nothing to do with GxEPD, I am quite sure this is an issue with RTCLib.
Title: Re: Waveshare e-paper displays with SPI
Post by: Arduinonymus on Feb 13, 2018, 04:49 am
Not my real arduino forum name ZingJM, It's Antrix, and that's my real name, and I'm a teacher by profession. I had to resort to disguise to avoid confrontation. This project will help new practitioners of Auriculotherapy, and your contribution is distinctly acknowledged.
Title: Re: Waveshare e-paper displays with SPI
Post by: ZinggJM on Feb 13, 2018, 06:03 am
@Arduinonymus, @Antrix,

You may take a look at GxEPD2_32 (https://github.com/ZinggJM/GxEPD2_32) and GxEPD2_AVR (http://GxEPD2_AVR). These are still "under construction", but may be easier for you to use, as you know U8G2.

I wish you all the best with your projects. I got the impression the forum displays get cluttered with strange posts for some time, and as a consequence I overreacted on your post in this forum and on U8G2.

You are welcome to post more questions, and I will try to answer.

Jean-Marc Zingg
Title: Re: Waveshare e-paper displays with SPI
Post by: Antrix on Feb 13, 2018, 08:13 am
Thank you Jean, I'm glad to have your support. I will surely consider the use of GxEPD2_32. But now that you've taught me in your original GxEPD library, I will further it's use for quiet some time. Moreover, it was my familiarity with U8G2 as I looked for its alternate for EPDs. Nonetheless,now I feel at home with the following as well.

Code: [Select]

 display.firstPage();
  do
  {
    display.fillScreen(GxEPD_WHITE);
    display.setCursor(x, y);
    display.println("Hello World!");
  }
  while (display.nextPage());


Regards,
Antrix.
Title: Re: Waveshare e-paper displays with SPI
Post by: PaulMathews on Feb 15, 2018, 10:44 pm
Hi ZinggJM,
Thank you for your fabulous GxEPD library. I am using the Waveshare 2.9 inch B&W EPD as a 3 digit instrument display with 128 pixel tall characters and partial update. I am using Arduino in Visual Studio Visual Micro with an Uno but I will move to a Mega2560 soon for more program space.

I am new to Arduino and C++ so I am struggling a bit. I have figured out some things but I have a maybe-silly but nagging question for you that I haven't been able to find the answer for: In your example code how does __AVR get evaluated? For example, as in:
Code: [Select]
#if defined(__AVR)
I'm used to looking for specific boards like this:
Code: [Select]
#if defined(ARDUINO_AVR_UNO)   
     //Uno specific code
#elif defined(ARDUINO_AVR_MEGA2560)   
     //Mega 2560 specific code
#else
#error "Unsupported hardware"
#endif


Is __AVR just a general catch-all for all AVR boards that would be true for the Uno, Mega, etc.? Are these evaluated from the build.board property in the ...\Arduino\hardware\arduino\avr\boards.txt file?

I'm sorry if my question is naive but I've put off asking it for a long time and just have to know.

Thanks again for all of your great work.

P.
Title: Re: Waveshare e-paper displays with SPI
Post by: ZinggJM on Feb 16, 2018, 08:11 am
Hi Paul,

Thank you for this question; I take note I should add MEGA2560 to the mapping suggestions, e.g. in ConnectingHardware.md.

Please use e.g. series resistors on data lines for 5V Arduinos.

The SPI connections on MEGA are on the ICSP and on the double row connector, afaik.

For target board dependent macros I look for -D in boards.txt of the platform files.

I had asked a similar question in this topic:

Target Preprocessor Macro List -- needs to be found easily! (AVR, SAM, STM32...) (http://forum.arduino.cc/index.php?topic=454617.0)

Jean-Marc
Title: Re: Waveshare e-paper displays with SPI
Post by: PaulMathews on Feb 16, 2018, 06:31 pm
Hi ZinggJM,
Thanks for your quick response and for your link (http://forum.arduino.cc/index.php?topic=454617.0 (http://forum.arduino.cc/index.php?topic=454617.0)) to your excellent question about the definition of __AVR. It definitely helped clear up some of my questions.

In the apparent continuing effort to keep this topic obscured pert's first link in his response to your question is broken. This is the broken link:
http://www.atmel.com/webdoc/AVRLibcReferenceManual/using_tools_1using_avr_gcc_mach_opt.html (http://www.atmel.com/webdoc/AVRLibcReferenceManual/using_tools_1using_avr_gcc_mach_opt.html)
Here is the new one:
http://www.microchip.com/webdoc/avrlibcreferencemanual/using_tools_1using_avr_gcc_mach_opt.html (http://www.microchip.com/webdoc/avrlibcreferencemanual/using_tools_1using_avr_gcc_mach_opt.html)

I found the source of my confusion about the value of __AVR. There is an error in how the Visual Studio or Visual Micro preprocessor interprets and displays the state of __AVR on the screen but when the compiler runs it interprets __AVR correctly. I've attached a screen shot demonstrating the errors. Values in purple are true/active. __AVR should be true/active and displayed in purple but it's not. And the "Active/Inactive Preprocessor Block" notes associated with __AVR are wrong, too.


Here is the pin mapping I'm using for the Mega. I tried this once, it didn't work, so I went back to the Uno, and I will try it again later.
Code: [Select]
// mapping example for AVR Mega 2560
//    Fixed: CLK -> 52, DIN -> 51 //SPI: SCLK -> 52, MOSI -> 51
//    User selectable:
//       BUSY -> 43, RST -> 45, DC -> 44
//       CS/SS-> 53 (pin 53 is Mega 2560 SPI default but SS can be changed to any digital pin in io(SPI, SS/CS, DC, RST), for example:
//           GxIO_Class io(SPI, 47, 44, 45);


Thank you for the continuous warnings about using the 3.3V EPD with a 5V Uno. I immediately put a logic converter on my EPD when I got it so I wouldn't forget.

You might also consider adding a note that your choice of pin assignments for DC and RST are swapped with respect to U8G2 and the Waveshare examples. It took me a while to figure that out. I found the Waveshare demos and U8G2 before I found GxEPD so I swapped your pin assignments in io() so I wouldn't have to remember to move pins around.

Thanks again for GxEPD!

P.
Title: Re: Waveshare e-paper displays with SPI
Post by: php4fan on Feb 17, 2018, 07:03 pm
Hi,

I am trying to get started with a WaveShare 7.5" three-color E-paper display and a Sparkfun ESP8266 Thing Dev board.

I have wired everything according to the mapping suggested in the examples and docs, that is:
Quote
mapping suggestion from Waveshare SPI e-Paper to generic ESP8266:
- BUSY -> GPIO4, RST -> GPIO2, DC -> GPIO0, CS -> GPIO15, CLK -> GPIO14, DIN -> GPIO13, GND -> GND, 3.3V -> 3.3V
and I'm trying to get the example "GxEPD_SPI_TestExample" to run.

I have uncommented the appropriate include line:
Code: [Select]
#include <GxGDEW075Z09/GxGDEW075Z09.cpp>    // 7.5" b/w/r


and I haven't modified anything else in the code, except for the bitrate in Serial.begin(9600).


The sketch compiles and uploads fine but it does nothing apart from printing "setup" and "setup done". The image on the screen doesn't update; it's still showing the image that was on it as it shipped.


By adding some Serial.println()s here and there I have verified that showBitmapExample() gets called and runs until the first call to display.drawExampleBitmap(), which never returns.

No error is thrown. There are some warnings at compile/upload time about low memory, I don't know if they are related to the issue.

I don't even know where to start to debug this.
I have verified that on the Waveshare Hat there is a 3.3V voltage between 3V3 and GND.


Any suggestions?
Title: Re: Waveshare e-paper displays with SPI
Post by: ZinggJM on Feb 17, 2018, 07:30 pm
Yes, try with the 7.5 b/w class. It is the same controller and may produce some output.
And it will produce diagnostic output about BUSY time.

I do not have this display, and the display class has been merged from a merge request.
I should not have merged something I can't test; its a waste of my time just to keep it compilable with my other changes.

Sponsors for this display are still welcome.

From your symptoms, I would have expected a watchdog timeout of the ESP8266. But you may not see its output with 9600, as the initial bitrate is 74800.

No, this class has no timeout on _waitWhileBuysy():

Code: [Select]
void GxGDEW075Z09::_waitWhileBusy(const char* comment)

{

  unsigned long start = micros();

  while (1)

  { //=0 BUSY

    if (digitalRead(_busy) == 1) break;

    delay(1);

  }

  //if (comment)

  {

//    unsigned long elapsed = micros() - start;

//    Serial.print(comment);

//    Serial.print(" : ");

//    Serial.println(elapsed);

  }

}



but also a delay(1) to avoid watchdog timeout, as in all my earlier versions.

you can change the code of this method with the code from GxGDW075T8.

Does your Sparkfun ESP8266 have pin numbers or Dx pin names like Wemos D1 mini?

A link to the devices in question is always helpful for responders.
Title: Re: Waveshare e-paper displays with SPI
Post by: php4fan on Feb 17, 2018, 09:53 pm
From your symptoms, I would have expected a watchdog timeout of the ESP8266. But you may not see its output with 9600, as the initial bitrate is 74800.
Just to clarify, what I changed to 9600 is just the argument to Serial.begin().
If I'm not mistaken, that should be just the speed of communication with the computer through the USB port. Or would you expect it to interfere in some way with the communication between the ESP8266 and the screen?


Does your Sparkfun ESP8266 have pin numbers or Dx pin names like Wemos D1 mini?

A link to the devices in question is always helpful for responders.
Here's the link, sorry:
https://learn.sparkfun.com/tutorials/esp8266-thing-development-board-hookup-guide/all (https://learn.sparkfun.com/tutorials/esp8266-thing-development-board-hookup-guide/all)

I guess the answer to your question is it has pin numbers.

Title: Re: Waveshare e-paper displays with SPI
Post by: php4fan on Feb 17, 2018, 10:33 pm
I switched to GxGDEW075T8 but the result is exactly the same.

I don't see any diagnostics (not in the serial monitor anyway)
Title: Re: Waveshare e-paper displays with SPI
Post by: php4fan on Feb 17, 2018, 10:50 pm
The bugs in this forum software are making it quite painful to follow up with this conversation. Every time I post a reply I won't be able to edit it (or any other of my posts, I think) for the next 5 minutes because of a bug in the mechanism that is supposed to prevent me from posting a new reply.

Anyway, in the meantime I tried the "library" provided by Waveshare at https://www.waveshare.com/wiki/7.5inch_e-Paper_HAT_(B) (https://www.waveshare.com/wiki/7.5inch_e-Paper_HAT_(B)) (I write "library" in quotes because it's quite pathetic, you need to change constants defined in library files in order to change the pin mappings - also it doesn't compile out of the box) and it doesn't work either.

I've found out that the problem, or one of the problems, seems to be that after sending the POWER_ON command (after having sent a few others succesfully), the BUSY line never gets back to idle.

There's this function in their code, which is called right after sending the POWER_ON command:
Code: [Select]
void Epd::WaitUntilIdle(void) {
    while(DigitalRead(busy_pin) == 0) {      //0: busy, 1: idle
        DelayMs(100);
    }     
}


and that never returns.

I have checked that indeed the voltage on the BUSY pin is 0. However, it seems to be always 0. (I'm measuring it on the HAT side, not the ESP8266's side).

Have you ever seen a similar issue?


Title: Re: Waveshare e-paper displays with SPI
Post by: php4fan on Feb 17, 2018, 11:38 pm
Now I have moved the "Interface Config" switch from 0 (4-line SPI), which is how it came, to 1 (3-line SPI). Is this correct?

Now I do see the output in the serial monitor:
Quote
setup
setup done
drawBitmap : 4
drawBitmap : 5
update : 1
drawCornerTest : 2
update : 1
update : 2
update : 1
update : 2
update : 1
update : 2
drawBitmap : 5
drawBitmap : 4
update : 1
drawCornerTest : 1
update : 2
However, it still doesn't draw anything.

Something has happened, though: a rectangular region of the screen (almost the entire screen except for a thin vertical band on the right) has become darker. You can still clearly see the image that was there before, but the white part is a pale, slightly pinkish, light grey rather than white. I attach a photo.
Title: Re: Waveshare e-paper displays with SPI
Post by: ZinggJM on Feb 18, 2018, 06:01 am
The results of your tests are confusing.

1. 3-wire SPI mode will not work, as GxIO_SPI works only with 4-wire (with DC line).

2. short BUSY time with 3-wire is a consequence of SPI commands not received by the controller.

3. endless loop with 4-wire SPI is a consequence of missing timeout handling in BOTH classes, sorry.
   I have updated GxEPD with timeout handling in _waitWhileBusy.

4. 1. - 3. seems to indicate 4-wire SPI works with your wiring, why BUSY stays active is a mistery.

Please update GxEPD and try again. Observe the BUSY signal with a Voltmeter.
BUSY should be active <1s for power up command, and ~16s on refresh command (update()).

Check your DC signal connection.

Looking at your picture:

The controller might have received some command from the wrong SPI data stream, maybe even a refresh command, started refresh, but got reset signal immediately on next _wakeup.

Check your FCP cable connections: pull out the black retainer slightly ~1mm, the black part, before pushing in the flexible cable, and then push in the retainer.
Title: Re: Waveshare e-paper displays with SPI
Post by: php4fan on Feb 18, 2018, 12:48 pm
Hi,
Thank you for your reply.

I have updated the library, and moved back the switch to 4-line. Now I do get the timeouts.


Observe the BUSY signal with a Voltmeter.
BUSY should be active <1s for power up command, and ~16s on refresh command (update()).
I never see it go high. It's constantly at 0.01V.

Quote
Check your FCP cable connections: pull out the black retainer slightly ~1mm, the black part, before pushing in the flexible cable, and then push in the retainer.
You mean here, right? (see attachment)

What's the retainer?
I tried pulling and pushing the little black squares on the sides but they don't seem to move.
Actually when I pushed the flexible cable in, it offered some resistance...
Title: Re: Waveshare e-paper displays with SPI
Post by: ZinggJM on Feb 18, 2018, 01:00 pm
Yes, its exactly these black squares or cubes. It may damage your finger nails, so you better take a watchmakers screwdriver.

I had the same problem with these connectors initially. The bridge between the cubes presses the cable to the contacts when pushed in, for the connectors with topside contacts. So I called it "retainer".

Good Luck!
Title: Re: Waveshare e-paper displays with SPI
Post by: php4fan on Feb 18, 2018, 01:10 pm
I see, thank you.

With the screwdriver, I was able to pull the retainer away, then to easily pull the cable out and push it back in with no resistance, and to push the retainer back so the cable is now "retained" again.

However, everything is now exactly like it was before, the cable looks perfectly connected (it already did), and when I pulled it off it didn't look damaged.

And I keep getting the same results.

The BUSY line stays constantly at about 9 mV
Title: Re: Waveshare e-paper displays with SPI
Post by: ZinggJM on Feb 18, 2018, 01:36 pm
Have you done this with all 3 connectors, if you use the extension FCP cable?

Make sure the FCP cable is aligned correctly; you can feel it when it sits in its "bed".

You can disconnect the cables from the processor and measure the resistance between the BUSY line and GND with power removed, on the side towards display. And you can check that the pin for BUSY is really input, if you use a ~10k resistor alternately to 3.3V or GND with display disconnected but program running, with a voltmeter, on the processor side.

That's about what comes to mind. I use a low-cost logic analyzer in such cases.
Title: Re: Waveshare e-paper displays with SPI
Post by: php4fan on Feb 18, 2018, 05:24 pm
Have you done this with all 3 connectors, if you use the extension FCP cable?
No, only the one that is attached directly to the display, which is the one that was not connected when I received it. The other two came already connected, so I haven't touched them.

Quote
Make sure the FCP cable is aligned correctly; you can feel it when it sits in its "bed".
Not entirely sure I get what you mean. There is no room for it to move either to the left or to the right, so it doesn't look like it can get misaligned, if that's what you mean.

I'll try your measuring suggestions, thanks.
Title: Re: Waveshare e-paper displays with SPI
Post by: php4fan on Feb 18, 2018, 06:09 pm
You can disconnect the cables from the processor and measure the resistance between the BUSY line and GND with power removed, on the side towards display.
It seems to be huge (more than 2M): is that what I should expect?

Quote
And you can check that the pin for BUSY is really input, if you use a ~10k resistor alternately to 3.3V or GND with display disconnected but program running, with a voltmeter, on the processor side.
This behaves as expected confirming it's input (same voltage as what it's connected to through the resistor).

I have looked at the FCP connector with a magnifying glass and it looks right.
Title: Re: Waveshare e-paper displays with SPI
Post by: ZinggJM on Feb 18, 2018, 06:56 pm
Ok, this all looks normal. I do have this e-paper HAT, and have tried it successfully. Normally I use the DESTM32-S2 connection boards with bare panels. I did not touch the 2 existing connections of the HAT.
These connectors look safe against misalignment, must have been a different connector where I was suspicious.

What I do not understand is the BUSY results you got with 3-wire, obviously then BUSY was not stuck at zero.

The other connection to the HAT can also produce problems, if not pushed in firmly. You can measure VCC and GND on the RasPi connector. I have even had a bad DuPont connector on the other side of one of these cables.

So the potential pitfalls are many; I expected to hear of problems from inexperienced users, and it has been reported in this topic already.
Title: Re: Waveshare e-paper displays with SPI
Post by: php4fan on Feb 18, 2018, 07:40 pm
What I do not understand is the BUSY results you got with 3-wire, obviously then BUSY was not stuck at zero.
To me that indicates that it's not "physically" stuck at zero because of a bad connection (otherwise, as you say, it would be at zero also when in 3-line mode).

Quote
The other connection to the HAT can also produce problems, if not pushed in firmly.
I have checked the continuity of each individual cable between the side connected to the ESP8266 and the side connected to the Hat.


Quote
You can measure VCC and GND on the RasPi connector.
If you mean here (see attachment, BTW why can't I embed it into the post??) I have already measured them, there are 3.3V between them as expected.

At this point I think either the display or the Hat must be broken and I'm going to request to return them :(
Title: Re: Waveshare e-paper displays with SPI
Post by: ZinggJM on Feb 18, 2018, 08:13 pm
Yes, you can measure there, or on the corresponding female pin of the black connector.
It may be easier to have a continuous connection for the voltmeter there, so you can observe the BUSY voltage during and after pushing reset on the processor, with switch set once to 3-wire and once to 4-wire.

Note every test you make on paper, and report the result afterwards.
Only this way you and I will get a clear picture.
You would not be the first reporter having found the error just after wanting to give up.
You should also observe the voltage on the DC pin, but this is hard with just a voltmeter. But you should see fluctuations.

Although I see mostly the cases with problems in this topic, real final hardware failures are rare or none.

A constantly active RST signal would result in a constantly active BUSY signal.
Title: Re: Waveshare e-paper displays with SPI
Post by: johnny2001 on Feb 19, 2018, 10:51 pm
Hi ZinggJM,

Thank you for your GxEPD library. I am using the Waveshare 2.9 inch B&W&RED EPD.

All is running with your demo code.

I wanted now to simply send some jpeg or Bitmap to the Waveshare. Is that possible with your library? The idea is to use httpd(curl) to download pictures from web.

Many thanks

jonathan
Title: Re: Waveshare e-paper displays with SPI
Post by: ZinggJM on Feb 20, 2018, 07:15 am
Hi ZinggJM,

Thank you for your GxEPD library. I am using the Waveshare 2.9 inch B&W&RED EPD.

All is running with your demo code.

I wanted now to simply send some jpeg or Bitmap to the Waveshare. Is that possible with your library? The idea is to use httpd(curl) to download pictures from web.

Many thanks

jonathan
Hi Jonathan,

I do not really know the answer, as I have never tried, and not yet searched for examples.

From your post I assume you want to use colors (b/w/r), and maybe a processor with WiFi.

The 3-color display classes of GxEPD have drawPicture() methods with parameters for separate b/w and r/w bitmaps. For AVR these bitmaps can be in PROGMEM only.

You can use any of the drawBitmap() methods provided by Adafruit_GFX, see Adafruit_GFX.h

For jpeg you would need a jpeg decoder, maybe this could be "taken" from some other display library or example.

I am interested in answers to this question also, so experts please contribute.

Jean-Marc

I assume examples for TFTs will use some sort of streaming to the display using setWindow() or setWindowAddress() and pushColor(). This is not available in GxEPD.
Title: Re: Waveshare e-paper displays with SPI
Post by: jzvolanek on Feb 20, 2018, 09:06 am
@johnny2001

All images displayed on ePaper must be in BMP format and then translated - convert to a code.

https://javl.github.io/image2cpp/

Then call in the code:
display.drawBitmap (x, y, Outside, 40, 40, GxEPD_BLACK);
(x, y, = position, image name, image size.)
Title: Re: Waveshare e-paper displays with SPI
Post by: ZinggJM on Feb 20, 2018, 09:31 am
@johnny2001, @jzvolanek,

The images can also be in RAM in BMP format, there are drawBitmap() methods in Adafruit_GFX that read BMP from RAM. It uses "signature matching" for the method to use to read from PROGMEM or RAM.

Note that PROGMEM is relevant for ESP8266 also, because of byte access workaround to flash memory.
Title: Re: Waveshare e-paper displays with SPI
Post by: PaulMathews on Feb 21, 2018, 10:25 pm
Hi ZinggJM,

I am having a problem with garbled characters on a Waveshare 2.9 inch B/W EPD (GxGDEH029A1). In about 1/3rd of the display updates a character gets split into two left/right pieces, for example, a 4 on the left and a 5 on the right as in the attached picture. The two characters are always consecutive, 0/1, 1/2, ..., 8/9, or 9/0. The split occurs anywhere along the long axis of the display but most often in the last digit because it's the one that's changing most often.

I am using an Uno with a 3.3V/5V logic level converter and a sketch derived from your PartialUpdateTest.ino to display elapsed time in seconds in large numerical characters. I created the numbers-only font using AdaFruit's GFX fonconvert.exe and have attached the font file.To eliminate hardware I reproduced the problem on two different Unos (a Sparkfun Redboard and an Uno clone), a Mega 2560, and a Pro Mini (3.3V, 8MHz, no logic level converter). I tried the Pro Mini to eliminate the possibility of the data getting garbled by the logic level converter.

Can you suggest where I could look for the problem in the code? It's almost like it's skipping ahead to the next character in the font file as it's writing the data to the display but I can't imagine how it could do that.

Thank you for your help!

P.
Title: Re: Waveshare e-paper displays with SPI
Post by: Matadormac on Feb 21, 2018, 11:38 pm
Hello ZiggyIM

I am using your library and the Waveshare 1.54 inch b/w/r epaper display.  I can get most of your examples to work with this display using:  Busy > D2, RST> D4, DC > D3, CS > D8, CLK > D5, DIN > D7, GND > GND, 3.3V > 3.3V

This is with an ESP8266 NodeMCU Amica microcontroller.  No other break out boards or sensors attached.

But between new or updated displays there are many flickers of the whole screen black to white to black to white, etc. perhaps 30 or more fast whole screen flickers.

If this isn't normal what suggestions do you have for me to try and fix this?

I am not able to get your partial update sketches to work either, an image mostly in black comes up and then stays.  But that is another issue.

Thank you for your wonderful library and any help you can provide.

Regards

Mark MacKenzie, Alcalde, New Mexico
Title: Re: Waveshare e-paper displays with SPI
Post by: ZinggJM on Feb 22, 2018, 06:41 am
@PaulMathews

Analyzing code without the code could be difficult, but the symptom is typical for a paged drawing issue.

The callback function is called multiple times per drawPaged() call.
It is important that the same data is drawn for each drawback call per drawPaged().

I recommend to use the new GxEPD2_AVR (https://github.com/ZinggJM/GxEPD2_AVR) library with AVR Arduinos, as the firstPage(), nextPage() mechanism may be easier to use and understand.

Jean-Marc
Title: Re: Waveshare e-paper displays with SPI
Post by: ZinggJM on Feb 22, 2018, 06:57 am
Hello ZinggJM

I am using your library and the Waveshare 1.54 inch b/w/r epaper display.  I can get most of your examples to work with this display using:  Busy > D2, RST> D4, DC > D3, CS > D8, CLK > D5, DIN > D7, GND > GND, 3.3V > 3.3V

This is with an ESP8266 NodeMCU Amica microcontroller.  No other break out boards or sensors attached.

But between new or updated displays there are many flickers of the whole screen black to white to black to white, etc. perhaps 30 or more fast whole screen flickers.

If this isn't normal what suggestions do you have for me to try and fix this?

I am not able to get your partial update sketches to work either, an image mostly in black comes up and then stays.  But that is another issue.

Thank you for your wonderful library and any help you can provide.

Regards

Mark MacKenzie, Alcalde, New Mexico
Hi,

The flashing effect is normal, especially for 3-color e-paper displays.

The controller of the 1.54 3-color e-paper display has no partial update capability.

see also this post (https://forum.arduino.cc/index.php?topic=487007.msg3465157#msg3465157).

Jean-Marc Zingg

Title: Re: Waveshare e-paper displays with SPI
Post by: Matadormac on Feb 22, 2018, 09:35 am
Ah, thank you very much.  But it does appear that the B/W 1.54 display does have partial update ability from what I can understand from the second post you point to?  I just wish to be sure as I will be purchasing one of those to work with next.

Thank you for all your hard work and for your very prompt help!

Regards

Mark MacKenzie
Title: Re: Waveshare e-paper displays with SPI
Post by: ZinggJM on Feb 22, 2018, 09:46 am
Yes, it does. It has a different controller. It is nice and fast.
It also flashes on full update, but you can use partial update to full screen.
See also example PartialUpdateTest.
Title: Re: Waveshare e-paper displays with SPI
Post by: samlewis02 on Feb 27, 2018, 01:51 pm
I have a 4.2in display connected to a Wemos D1 but I can't get any pictures. I am using the IconGrid example. I have checked BUSY with a voltmeter and it seems to go high for 10 seconds and then low for about 30. The serial monitor repeatedly shows the following (with variations in numbers). Nothing changes on the screen.

update : 10000958
Power On : 10001070
Busy Timeout!
Power Off : 40036

If I pull out the cable to the Waveshare then I get

update : 2
Power Off : 2
Power On : 9

Or similar.

Do I have a faulty screen?
Title: Re: Waveshare e-paper displays with SPI
Post by: ZinggJM on Feb 27, 2018, 04:40 pm
I assume you have uncommented this line:

Code: [Select]
#include <GxGDEW042T2/GxGDEW042T2.cpp>

and connected the display according to:

Code: [Select]
// mapping from Waveshare 2.9inch e-Paper to Wemos D1 mini
// BUSY -> D2, RST -> D4, DC -> D3, CS -> D8, CLK -> D5, DIN -> D7, GND -> GND, 3.3V -> 3.3


Then it should work.

You should also try the basic example: GxEPD_SPI_TestExample.ino

Busy Timeout is an indication of SPI not working correctly. The 4.2" has BUSY active HIGH.
1.54", 2.13" and 2.9" have BUSY active low.

If you disconnect the display the BUSY pin will have the default level, which I don't know.

Make sure the cable is firmly pushed in on the display side. Check continuity of the cable connection with ohm-meter, I have seen and heard of bad DuPont connectors.

For Newbies I recommend GxEPD2_AVR for AVR Arduinos, GxEPD2_32 for 32bit Arduinos.


Title: Re: Waveshare e-paper displays with SPI
Post by: MAcPIT69 on Mar 02, 2018, 09:31 pm
Hello.

i have also the BUSY TIMEOUT Problem.
I use a Waveshare 4.2 TriColor an so I use
   #include <GxGDEW042Z15/GxGDEW042Z15.cpp>

When display.update() is called the Display flickers for many Seconds before I got a clean output on it.

I use WEMOS D1 Mini Pro. My Wiring is okay but what about the BUSY-Line. It is connected to D2 is this correct?
I think the BUSY-Line from the Display should be connected to ESPs  MISO-Line. The D1 Mini Pro's MISO line is D6 (pin 12) but using this PIN does not solve the Problem.

Any Idea where my Problem could be find.

THX so much - especially  for this LIB

MacPIT69
Title: Re: Waveshare e-paper displays with SPI
Post by: ZinggJM on Mar 02, 2018, 09:49 pm
3-color e-paper displays have a long update/refresh time, >15 seconds.
Do you see Busy Timeout in Serial Monitor?

The default BUSY line suggestion is D2, but you can also use D6, but it must be same value as in the constructor.

Jean-Marc
Title: Re: Waveshare e-paper displays with SPI
Post by: jzvolanek on Mar 02, 2018, 10:51 pm
Here's one of my video takes a long time to update
Three-color ePaper 2.9

https://www.youtube.com/watch?v=VNcb74keqBw
Title: Re: Waveshare e-paper displays with SPI
Post by: beee on Mar 03, 2018, 08:50 am
Hello Jean-Marc.
From your previous posts, I understand that you are looking for LUT for color e-papers and you have only 2.7 inches.
I also have for 2.9 and 4.2 inches. If you want, I'll put them here.
Title: Re: Waveshare e-paper displays with SPI
Post by: ZinggJM on Mar 03, 2018, 09:29 am
Hello @beee,

Yes, please!

I should soon have time to experiment with waveform tables again.
And I am sure other e-paper users will be glad to try this also.
Thank you,

Jean-Marc
Title: Re: Waveshare e-paper displays with SPI
Post by: beee on Mar 03, 2018, 10:37 am
LUT for GDEW029Z10
Code: [Select]

const unsigned char lut_vcom0[] ={ 0x14 ,0x01 ,0x01 ,0x05 ,0x07 ,0x05 ,0x0C ,0x0C ,0x0A ,0x04 ,0x04 ,0x0A ,0x05 ,0x07 ,0x05 };
const unsigned char lut_w[] ={ 0x14 ,0x01 ,0x01 ,0x45 ,0x07 ,0x05 ,0x8C ,0x4C ,0x0A ,0x84 ,0x44 ,0x0A ,0x85 ,0x07 ,0x05 };
const unsigned char lut_b[] ={ 0x14 ,0x01 ,0x01 ,0x05 ,0x87 ,0x05 ,0x8C ,0x4C ,0x0A ,0x84 ,0x44 ,0x0A ,0x05 ,0x47 ,0x05 };
const unsigned char lut_g1[] ={ 0x94 ,0x81 ,0x01 ,0x05 ,0x87 ,0x05 ,0x8C ,0x4C ,0x0A ,0x84 ,0x44 ,0x0A ,0x05 ,0x07 ,0x05 };
const unsigned char lut_g2[] ={ 0x94 ,0x81 ,0x01 ,0x05 ,0x87 ,0x05 ,0x8C ,0x4C ,0x0A ,0x84 ,0x44 ,0x0A ,0x05 ,0x07 ,0x05 };
const unsigned char lut_vcom1[] ={ 0x01 ,0x09 ,0x23 ,0x06 ,0x04 ,0x01 ,0x00 ,0x00 ,0x00 ,0x00 ,0x00 ,0x00 ,0x00 ,0x00 ,0x00 };
const unsigned char lut_red0[] ={ 0x81 ,0x49 ,0x23 ,0x46 ,0x44 ,0x01 ,0x00 ,0x00 ,0x00 ,0x00 ,0x00 ,0x00 ,0x00 ,0x00 ,0x00 };
const unsigned char lut_red1[] ={ 0x01 ,0x09 ,0x23 ,0x06 ,0x04 ,0x01 ,0x00 ,0x00 ,0x00 ,0x00 ,0x00 ,0x00 ,0x00 ,0x00 ,0x00 };

void lut_bw(void)
{
unsigned int count;
EPD_W21_WriteCMD(0x20);
for(count=0;count<15;count++)      
{EPD_W21_WriteDATA(lut_vcom0[count]);}

EPD_W21_WriteCMD(0x21);
for(count=0;count<15;count++)      
{EPD_W21_WriteDATA(lut_w[count]);}   

EPD_W21_WriteCMD(0x22);
for(count=0;count<15;count++)      
{EPD_W21_WriteDATA(lut_b[count]);}   

EPD_W21_WriteCMD(0x23);
for(count=0;count<15;count++)      
{EPD_W21_WriteDATA(lut_g1[count]);}   

EPD_W21_WriteCMD(0x24);
for(count=0;count<15;count++)      
{EPD_W21_WriteDATA(lut_g2[count]);}         
}
void lut_red(void)
{
unsigned int count;
EPD_W21_WriteCMD(0x25);
for(count=0;count<15;count++)      
{EPD_W21_WriteDATA(lut_vcom1[count]);}

EPD_W21_WriteCMD(0x26);
for(count=0;count<15;count++)      
{EPD_W21_WriteDATA(lut_red0[count]); } 

EPD_W21_WriteCMD(0x27);
for(count=0;count<15;count++)      
{EPD_W21_WriteDATA(lut_red1[count]); }   
}


LUT for GDEW042Z15
Code: [Select]

const unsigned char lut_vcomDC[] =
{
0x00 ,0x1A ,0x1A ,0x00 ,0x00 ,0x01,
0x00 ,0x0A ,0x0A ,0x00 ,0x00 ,0x08,
0x00 ,0x0E ,0x01 ,0x0E ,0x01 ,0x10,
0x00 ,0x0A ,0x0A ,0x00 ,0x00 ,0x08,
0x00 ,0x04 ,0x10 ,0x00 ,0x00 ,0x05,
0x00 ,0x03 ,0x0E ,0x00 ,0x00 ,0x0A,
0x00 ,0x23 ,0x00 ,0x00 ,0x00 ,0x01 ,0x00 ,0x00
};


//R21H
const unsigned char lut_ww[] ={
0x90 ,0x1A ,0x1A ,0x00 ,0x00 ,0x01,
0x40 ,0x0A ,0x0A ,0x00 ,0x00 ,0x08,
0x84 ,0x0E ,0x01 ,0x0E ,0x01 ,0x10,
0x80 ,0x0A ,0x0A ,0x00 ,0x00 ,0x08,
0x00 ,0x04 ,0x10 ,0x00 ,0x00 ,0x05,
0x00 ,0x03 ,0x0E ,0x00 ,0x00 ,0x0A,
0x00 ,0x23 ,0x00 ,0x00 ,0x00 ,0x01
};
//R22H r
const unsigned char lut_r[] ={
0xA0 ,0x1A ,0x1A ,0x00 ,0x00 ,0x01,
0x00 ,0x0A ,0x0A ,0x00 ,0x00 ,0x08,
0x84 ,0x0E ,0x01 ,0x0E ,0x01 ,0x10,
0x90 ,0x0A ,0x0A ,0x00 ,0x00 ,0x08,
0xB0 ,0x04 ,0x10 ,0x00 ,0x00 ,0x05,
0xB0 ,0x03 ,0x0E ,0x00 ,0x00 ,0x0A,
0xC0 ,0x23 ,0x00 ,0x00 ,0x00 ,0x01
};
//R23H w
const unsigned char lut_w[] ={
0x90 ,0x1A ,0x1A ,0x00 ,0x00 ,0x01,
0x40 ,0x0A ,0x0A ,0x00 ,0x00 ,0x08,
0x84 ,0x0E ,0x01 ,0x0E ,0x01 ,0x10,
0x80 ,0x0A ,0x0A ,0x00 ,0x00 ,0x08,
0x00 ,0x04 ,0x10 ,0x00 ,0x00 ,0x05,
0x00 ,0x03 ,0x0E ,0x00 ,0x00 ,0x0A,
0x00 ,0x23 ,0x00 ,0x00 ,0x00 ,0x01
};
//R24H b
const unsigned char lut_b[] ={
0x90 ,0x1A ,0x1A ,0x00 ,0x00 ,0x01,
0x20 ,0x0A ,0x0A ,0x00 ,0x00 ,0x08,
0x84 ,0x0E ,0x01 ,0x0E ,0x01 ,0x10,
0x10 ,0x0A ,0x0A ,0x00 ,0x00 ,0x08,
0x00 ,0x04 ,0x10 ,0x00 ,0x00 ,0x05,
0x00 ,0x03 ,0x0E ,0x00 ,0x00 ,0x0A,
0x00 ,0x23 ,0x00 ,0x00 ,0x00 ,0x01
};

void lut(void)
{
unsigned int count;
SPI4W_WRITECOM(0x20);
for(count=0;count<44;count++)      
{SPI4W_WRITEDATA(lut_vcomDC[count]);}

// SPI4W_WRITECOM(0x21);
// for(count=0;count<42;count++)      
// {SPI4W_WRITEDATA(lut_ww[count]);}   

SPI4W_WRITECOM(0x22);
for(count=0;count<42;count++)      
{SPI4W_WRITEDATA(lut_r[count]);}

SPI4W_WRITECOM(0x23);
for(count=0;count<42;count++)      
{SPI4W_WRITEDATA(lut_w[count]);} 

SPI4W_WRITECOM(0x24);
for(count=0;count<42;count++)      
{SPI4W_WRITEDATA(lut_b[count]);}
}

I do not know why GOOD DISPLAY does not send "lut_ww" :-/
Title: Re: Waveshare e-paper displays with SPI
Post by: ZinggJM on Mar 03, 2018, 11:10 am
@beee

Thank you for your support!

lut_ww is not needed for 3-color displays (it is usually available and sent anyway), because these displays do not use differential update waveforms, like the b/w displays.

Jean-Marc

I just wondered where this information can be found. I checked if Good Display has updated their demo source.
Title: Re: Waveshare e-paper displays with SPI
Post by: programista25 on Mar 04, 2018, 12:06 pm
Hi all, has anyone get running e-paper display from Waveshare with Robotdyn Wifi NodeM board (https://robotdyn.com/what-s-new/wifi-nodem-esp8266-32m-flash-ch340g.html (https://robotdyn.com/what-s-new/wifi-nodem-esp8266-32m-flash-ch340g.html)) together with GxEPD library? I'm wondering how to properly connect SPI e-paper display to this board, and properly configure the connection on the core.

Nothign happen on the display when test application GxEPD_SPI_TestExample run.

On serial I'm getting something like that:
Code: [Select]
setup
setup done
Busy Timeout!
_wakeUp Power On : 20000262
Busy Timeout!
drawBitmap : 20000408
Busy Timeout!
_sleep Power Off : 20000741


Pin connections:
Code: [Select]

BUSY - D2
RST   - D4
DC    - D3
CS    - D8
CLK   - D5
DIN   - D7




My configuration section looks like:
Code: [Select]

// GxIO_SPI(SPIClass& spi, int8_t cs, int8_t dc, int8_t rst = -1, int8_t bl = -1);
GxIO_Class io(SPI, 15, 0, 2); // arbitrary selection of D3(=0), D4(=2), selected for default of GxEPD_Class
// GxGDEP015OC1(GxIO& io, uint8_t rst = 2, uint8_t busy = 4);
GxEPD_Class display(io); // default selection of D4(=2), D2(=4)


void setup()
{
  Serial.begin(115200);
  Serial.println();
  Serial.println("setup");

  display.init();

  Serial.println("setup done");
}





Pins are connected as on image below:
(https://forum.arduino.cc/index.php?action=dlattach;topic=487007.0;attach=247983)

Thanks in advance.
Title: Re: Waveshare e-paper displays with SPI
Post by: ZinggJM on Mar 04, 2018, 02:50 pm
I will answer when I am back home.
Title: Re: Waveshare e-paper displays with SPI
Post by: ZinggJM on Mar 04, 2018, 06:34 pm
Your picture is missing. To post a picture and show it directly, you add it as attachment, then post or save the post, then copy the link to the attachment, then open the post for modify, and add the picture with the picture icon and paste the link.

Your ESP8266 is a NodeMCU with the usual "Dx" inking and denomination, like the Wemos D1 mini.
As far as I see you use the pin mapping as suggested. So it should work.

The BUSY timeouts indicate that your SPI communication does not work.
Make sure that the connection is correct, and the connector to the display is firmly pushed in, and the DuPont connectors are good and make good contact.
Title: Re: Waveshare e-paper displays with SPI
Post by: programista25 on Mar 04, 2018, 08:26 pm
I've attached correctly the image. I've double checked the connection and nothing happened.
Title: Re: Waveshare e-paper displays with SPI
Post by: ZinggJM on Mar 04, 2018, 08:39 pm
Have you selected the correct display class for your 2.7" display?
From the picture I assume it is the 3-color display, but I am not sure.
I will try to follow the colored wires to the NodeMCU board tomorrow.
Title: Re: Waveshare e-paper displays with SPI
Post by: eschlenz on Mar 04, 2018, 11:59 pm
multiple of 8!!! That was it, it worked when I changed my image from 100px wide to 96px. Thank you!
So glad I decided to read through this forum topic. Multiples of 8 = *the magic sauce*. THANK YOU!
Title: Re: Waveshare e-paper displays with SPI
Post by: ZinggJM on Mar 05, 2018, 07:32 am
I've attached correctly the image. I've double checked the connection and nothing happened.
Your wiring looks correct, but the connector to the display may not be pushed in enough.
You may need to do continuity test on all connection with an ohm-meter.

Please tell which board you select in the Arduino IDE to compile for, and if you use a special package for RobotDyn ESP8266, so I can check for potential issues with the SPI definitions.
Title: Re: Waveshare e-paper displays with SPI
Post by: programista25 on Mar 05, 2018, 10:45 am
Please tell which board you select in the Arduino IDE to compile for, and if you use a special package for RobotDyn ESP8266, so I can check for potential issues with the SPI definitions.
I've tried NodeMCU 0.9 (ESP-12 Module) and Generic ESP 8266 Module boards.

I will check with the meter all of the pins and give you response later on today.
Title: Re: Waveshare e-paper displays with SPI
Post by: ZinggJM on Mar 05, 2018, 02:28 pm
Ok, both use the SPI pin definitions in common.h of generic:

Code: [Select]
#define PIN_SPI_SS   (15)
#define PIN_SPI_MOSI (13)
#define PIN_SPI_MISO (12)
#define PIN_SPI_SCK  (14)


So this should not be the cause, unless RobotDyn did something very strange.

Explanation:

From my experience, any output pin of ESP8266 can be used for CS, but the predefined SS pin can't be used for anything else, if SPI is used.

And there is one pin that shouldn't be used as input, because it determines boot mode. I do not know by heart which one.
Title: Re: Waveshare e-paper displays with SPI
Post by: ZinggJM on Mar 07, 2018, 10:49 am
I had downloaded the code from Ben Krasnow and it did not work on my display.

I may re-try this experiment, and try his waveform table with my code sometime.

Do you refer to the GxGDEW042T2_FPU version, or the original GxGDEW042T2 version?

Both versions work with the internal wavetable (OTP of the controller) for full update.

Maybe the quality of your display is inferior, maybe it is even not from Good Display.

Jean-Marc


Could you please post the LUT you use (with code tags)? this would make it easy for me to compare,
and for me and for others also to experiment with it.

I have started work on this.

The code from Ben Krasnow did not and still does not work for me, because my changes for Wemos D1 mini must be incomplete. Reason still to be analysed. Usually I had no problem adapting Waveshare demo code. But with this I still get unknown processor exceptions.

A 16k buffer on the stack was the reason. Ben Krasnow's example works ok.

PartialUpdateExample with GxGDEW042T2 on the Waveshare 4.2 b/w looks bad after some partial updates, it looks much better on my older GDEW042T2 panel from Good Display, re-verified.
The older display does not have two halves of the display with different degradation.

The full update wavetables of the demo code from Waveshare and Ben Krasnow produce better results with the actual display than the wavetable in OTP. As far as I remember there is one different value in lut_vcom0. On the older panel the results seem equal.

The fast partial update waveform from GxGDEW042T2_FPU gives better result than the one from Ben Kransnow in my opinion.

GxGDEW042T2 is now with fast partial update support and with waveform table from Waveshare demo for full update.

GxGDEW042T2_BK is available for comparison.


Jean-Marc

Title: Re: Waveshare e-paper displays with SPI
Post by: programista25 on Mar 07, 2018, 05:24 pm
From my experience, any output pin of ESP8266 can be used for CS, but the predefined SS pin can't be used for anything else, if SPI is used.

And there is one pin that shouldn't be used as input, because it determines boot mode. I do not know by heart which one.
Problem solved, thanks for the help!

It turned out, that the small SPI connector does not work. I've tried to use this Raspbery output pin and now everything is working with defauld configuration.
Title: Re: Waveshare e-paper displays with SPI
Post by: Fritom on Mar 07, 2018, 08:35 pm
Hello I am trying to make a small weather station. I have a small problem with partial update of the display. For now I was trying to display static image and then every 5sec display a temperature. For testing I am printing millis.

Well so I display static image and then I am trying to do a partial update. This where things goes wrong. See attached pictures. Before partial update and after. Image was made by image2lcd with vertical scan.
Can you please tell where am I making an mistake? And how to avoid it in the future?

Thanks
Tomas


Code: [Select]
#include <GxEPD.h>
#include <GxGDEH029A1/GxGDEH029A1.cpp>
#include <GxIO/GxIO_SPI/GxIO_SPI.cpp>
#include <GxIO/GxIO.cpp>
#include "teplomer.c"
#include "teplomer4.c"
#include "bezramecku.c"
#include <Fonts/FreeSansBold24pt7b.h>
#include <Fonts/FreeMonoBold9pt7b.h>


GxIO_Class io(SPI, SS, D3, D4);
GxEPD_Class display(io);


#include "DHT.h"



#define pinDHT            12         // Pin which is connected to the DHT sensor.
#define typDHT11           DHT21     // DHT 21 (AM2301)

DHT mojeDHT(pinDHT, typDHT11);


void setup() {
  Serial.begin(9600);
  display.init();
  display.fillRect(0, 0, 295, 295, GxEPD_BLACK);  
  display.update();
   delay(5000);

  display.drawExampleBitmap(gImage_teplomer4, 10, 0, 90, 80, GxEPD_BLACK);
  display.update();

   // display.drawExampleBitmap(gImage_teplomer4, sizeof(gImage_teplomer4), GxEPD::bm_flip_y | GxEPD::bm_partial_update);
   display.drawExampleBitmap(gImage_teplomer4, sizeof(gImage_teplomer4), GxEPD::bm_default | GxEPD::bm_partial_update);

}


void loop() {


  mojeDHT.begin();
  float tep = mojeDHT.readTemperature();
  float vlh = mojeDHT.readHumidity();
  showPartialUpdate(tep);

  delay(5000);
}

void showPartialUpdate(float teplota)
{
  unsigned long time;
  time = millis();

  const GFXfont* f = &FreeMonoBold9pt7b;
  uint16_t box_x = 90;
  uint16_t box_y = 20;
  uint16_t box_w = 120;
  uint16_t box_h = 50;
  uint16_t cursor_y = box_y + 16;
  display.setRotation(1);
  display.setFont(f);
  display.setTextColor(GxEPD_BLACK);
  display.fillRect(box_x, box_y, box_w, box_h, GxEPD_WHITE);
  display.setCursor(box_x, cursor_y);
   display.print(time);
  display.updateWindow(box_x, box_y, box_w, box_h, true);

}


Title: Re: Waveshare e-paper displays with SPI
Post by: ZinggJM on Mar 07, 2018, 09:07 pm
Hi Tomas,

To be able to analyze your program I would need the complete program, with all included files.
Except included libraries that are commonly used or can be commented out.
Or a shortened, compileable and runnable program that shows the effect.
I don't see where "temperature" is printed.

Check diagnostic output with serial monitor. Do you use the actual version of GxEPD?
The version is now in library.properties.

Does the PartialUpdateExample or PartialUpdateTest work correctly?
What processor do you use?

Jean-Marc
Title: Re: Waveshare e-paper displays with SPI
Post by: ZinggJM on Mar 08, 2018, 09:17 am
The GxEPD display class GxGDEW042T2 for the 4.2 inch b/w e-paper display panel from Dalian Good display and display panel or board from Waveshare now supports fast partial update.

Jean-Marc
Title: Re: Waveshare e-paper displays with SPI
Post by: Fritom on Mar 08, 2018, 06:09 pm
Hi Tomas,

To be able to analyze your program I would need the complete program, with all included files.
Except included libraries that are commonly used or can be commented out.
Or a shortened, compileable and runnable program that shows the effect.
I don't see where "temperature" is printed.

Check diagnostic output with serial monitor. Do you use the actual version of GxEPD?
The version is now in library.properties.

Does the PartialUpdateExample or PartialUpdateTest work correctly?
What processor do you use?

Jean-Marc

Hello, PartialUpdateTest works correctly.
I am using nodemcu.
Library version 2.3.1.
1st picture. Picture is printet correctly
2nd picture. Partialupdate data are ok - millis works, but original picture is smashed
3th picture. After 1st loop which where was picture smashed is now everything ok. With next loop picture gets smashed again and so on so on.
one.c is also attached. Picture size 90x90 pixels. Vertical scan
Reworked code bellow:

Code: [Select]
#include <GxEPD.h>
#include <GxGDEH029A1/GxGDEH029A1.cpp>
#include <GxIO/GxIO_SPI/GxIO_SPI.cpp>
#include <GxIO/GxIO.cpp>
#include "one.c"
#include <Fonts/FreeSansBold24pt7b.h>
#include <Fonts/FreeMonoBold9pt7b.h>


GxIO_Class io(SPI, SS, D3, D4);
GxEPD_Class display(io);


//#include "DHT.h"



//#define pinDHT            12         // Pin which is connected to the DHT sensor.
//#define typDHT11           DHT21     // DHT 21 (AM2301)

//DHT mojeDHT(pinDHT, typDHT11);


void setup() {
  Serial.begin(9600);
  display.init();
  display.fillRect(0, 0, 295, 295, GxEPD_WHITE);
  display.update();
  delay(2000);

  display.drawExampleBitmap(gImage_one, 0, 0, 90, 90, GxEPD_BLACK);
  display.update();
  delay(2000);
  //   display.drawExampleBitmap(gImage_teplomer4, sizeof(gImage_teplomer4), GxEPD::bm_flip_y | GxEPD::bm_partial_update);
  display.drawExampleBitmap(gImage_one, sizeof(gImage_one), GxEPD::bm_default | GxEPD::bm_partial_update);
  display.update();

}


void loop() {


  // mojeDHT.begin();
  //  float tep = mojeDHT.readTemperature();
  // float vlh = mojeDHT.readHumidity();
  showPartialUpdate();

  delay(5000);
}

void showPartialUpdate()
{
  unsigned long time;
  time = millis();

  const GFXfont* f = &FreeMonoBold9pt7b;
  uint16_t box_x = 90;
  uint16_t box_y = 20;
  uint16_t box_w = 120;
  uint16_t box_h = 50;
  uint16_t cursor_y = box_y + 16;
  display.setRotation(1);
  display.setFont(f);
  display.setTextColor(GxEPD_BLACK);
  display.fillRect(box_x, box_y, box_w, box_h, GxEPD_WHITE);
  display.setCursor(box_x, cursor_y);
  display.print(time);
  display.updateWindow(box_x, box_y, box_w, box_h, true);

}


THanks

Tomas
Title: Re: Waveshare e-paper displays with SPI
Post by: ZinggJM on Mar 08, 2018, 07:32 pm
Hi Tomas,

It is obvious, but I didn't see it.

GxEPD has two kinds of bitmap drawing methods:

methods that draw a bitmap to buffer; these have w and h parameter, for any size bitmaps.

methods that draw directly to (full) screen; these have only a length parameter as limit, but w and h are implicit the screen dimension.

If you try do draw a bitmap directly to screen that does not fit, it gets distorted.

I hope this helps

Jean-Marc
Title: Re: Waveshare e-paper displays with SPI
Post by: Fritom on Mar 11, 2018, 03:11 pm
Well, picture got size 90x90 pixels so this should be ok. So what am I doing wrong?
Title: Re: Waveshare e-paper displays with SPI
Post by: ZinggJM on Mar 11, 2018, 03:52 pm
Well, picture got size 90x90 pixels so this should be ok. So what am I doing wrong?
Well, I was in a hurry when answering your post, so I did not use appropriate explanation for a Newbie.

If you try to draw a picture of size 90x90 directly to screen, the size does not match and the picture gets distorted. It would need to be 128x296 for your display.

With the actual version of GxEPD it should no longer be needed to draw the background a second time using partial update; I will need to do more extensive tests.

With the older versions, as you may not have a bitmap for the whole background, you may either call update() a second time (with unmodified buffer content), or call updateWindow(0,0,display.width(),display.height()) for partial update of full screen.

This call tells me this image is 90x90:
Code: [Select]
  display.drawExampleBitmap(gImage_one, 0, 0, 90, 90, GxEPD_BLACK);

This call produces distorted background:
Code: [Select]
  display.drawExampleBitmap(gImage_one, sizeof(gImage_one), GxEPD::bm_default | GxEPD::bm_partial_update);

This call then produces good background again:
Code: [Select]
  display.update();

But the other controller internal buffer has the distorted image, which show up on next partial update.
Title: Re: Waveshare e-paper displays with SPI
Post by: ykolly on Mar 12, 2018, 06:36 pm
HI,

I have a problem with your library and a Waveshare 4.2 display.

I want to display menu pages.

For the 2 first pages, it work.

When i want to dsiplay the third one, nothing append.

Do you have an idea ?

See code attached.

Thanks in advance.

Title: Re: Waveshare e-paper displays with SPI
Post by: ZinggJM on Mar 12, 2018, 08:25 pm
Hi,

I have a problem with your post.

You do not provide enough information to analyze your problem.

And if you provide a program to check, the program should be reduced to the minimum that shows your problem, and not rely on additional libraries and hardware.

From the program it looks like you use an AVR processor, but the code size is too big (107%).

Please state which Arduino board or processor you use.

I have successfully run your code on Wemos D1 mini.

I just needed to comment out 2 lines of Keypad, and use modified pins for D1 mini.

Your code may fail because of memory allocation error or exception.

The String class uses dynamic allocated memory; this may fail on low RAM processors.

Try to replace your Strings with character arrays.
Title: Re: Waveshare e-paper displays with SPI
Post by: johnny2001 on Mar 13, 2018, 01:35 pm
Hello,

Quick Question

I trx to display äüöèàé on then eink with display.println("äöü"),

How can i do that?

Tahnks in advanced

jonathan
Title: Re: Waveshare e-paper displays with SPI
Post by: ZinggJM on Mar 13, 2018, 01:54 pm
Hi,

Quick Answer: you can't!

Umlauts are not part of the fonts available with Adafruit_GFX, afaik.

I would like to add support for additional fonts, e.g. from other libraries like U8G2, but had no time to investigate for now.

Jean-Marc
Title: Re: Waveshare e-paper displays with SPI
Post by: samlewis02 on Mar 14, 2018, 05:59 am
I have checked my wiring and the dupont connections with ohmmeter. I have uncommented the correct waveshare module (4.2in). Still no change in display from the original running GxEPD_SPI_TestExample. Still BUSY timeout.

The BS link is set to 4-line - is that correct?
Title: Re: Waveshare e-paper displays with SPI
Post by: ZinggJM on Mar 14, 2018, 07:05 am
Yes, 4-line is correct. 3-line can't be used with the standard SPI class.

Your problem is hard to diagnose from distance. At this point I usually connect a logic analyzer.

More than once with TFTs I discovered with the logic analyzer that I had a constant active reset line to the display. Or some other line stuck at zero or high.

And then there was one user that left out the GND connection, because I had not marked it for the DESTM32-S2 adapter.


Just to make sure: do you have the 4.2" b/w or the 4.2" 3-color display?
Title: Re: Waveshare e-paper displays with SPI
Post by: samlewis02 on Mar 14, 2018, 01:00 pm
i have 4.2in BW
Title: Re: Waveshare e-paper displays with SPI
Post by: ZinggJM on Mar 14, 2018, 01:09 pm
You could post some photo(s) with connection details, especially FCP cable connections.
Title: Re: Waveshare e-paper displays with SPI
Post by: ZinggJM on Mar 14, 2018, 02:56 pm
I started looking for how to add additional fonts to GxEPD and GxEPD2.

This post from Mr. Bodmer (https://forum.arduino.cc/index.php?topic=535040.msg3647398#msg3647398) contains information how users can add fonts to Adafruit_GFX, and a link to an extended Adafruit_GFX library that could be used (I will look at this).

Jean-Marc
Title: Re: Waveshare e-paper displays with SPI
Post by: Kastell on Mar 15, 2018, 08:08 pm
Hi,
i want to add some european letters to the font. I would be very happy about a little guide. Thanks!

Another problem is the line break. How can I prevent a word from being interrupted at the end of the line and display the remaining letters in the next line? If the word does not fit in the line, it should be printed completely in the next row.

(The text is read from a json file.)
Title: Re: Waveshare e-paper displays with SPI
Post by: ZinggJM on Mar 15, 2018, 08:42 pm
Hi,

GxEPD and GxEPD2 rely on font support from Adafruit_GFX. For graphics and fonts I am a complete Newbie. My only chance is to add font support from a Adafruit_GFX alternative, or extract code from some other library. I am looking at these options.

I could not use Adafruit_ftGFX (https://github.com/pljakobs/Adafruit_ftGFX) directly, but I will modify my forked clone and make it accessible from GxEPD, hopefully soon. And I see a good chance to extract code from a known library (not U8G2, unfortunately, too complicated for me).

From Bodmer's post I understand that Adafruit_GFX will be updated; fonts is the most likely enhancement.

Jean-Marc


Title: Re: Waveshare e-paper displays with SPI
Post by: Kastell on Mar 15, 2018, 09:06 pm
Hi, sounds good! Do you have a idea for the line break problem?

How can I prevent a word from being interrupted at the end of the line and display the remaining letters in the next line?
Title: Re: Waveshare e-paper displays with SPI
Post by: ZinggJM on Mar 15, 2018, 09:35 pm
Adafruit_GFX has a method getTextBounds, you would need to check every word.

But even better, it has a method setTextWrap(Boolean w). Oops, TextWrap is not WordWrap.
Title: Re: Waveshare e-paper displays with SPI
Post by: Kastell on Mar 17, 2018, 08:58 am
The setTextWrap ist no solution because i need a wordwrap solution.
But first i want to solve the font problem. I found this interesting tool:

https://tchapi.github.io/Adafruit-GFX-Font-Customiser/

I have inserted the font "FreeSansBold24pt7b" and added some characters. Then I overwrote the font .h file. However, the font does not change. Did I forget a step or isn´t it that easy?
Title: Re: Waveshare e-paper displays with SPI
Post by: ZinggJM on Mar 17, 2018, 09:40 am
I have no experience with this, so I hope someone else can answer your question.

See e.g. this post (http://forum.arduino.cc/index.php?topic=535040.msg3651552#msg3651552).
Title: Re: Waveshare e-paper displays with SPI
Post by: ykolly on Mar 17, 2018, 04:19 pm
Hello J-M and thanks for your reply,

I forgot to specify my board... I use an Arduino Due.

I remove Strings from my code and use arrays.

I got the same trouble (still 2 page diplayed only), my goal is to have some different menu and result pages to display (about 10).


Is there a solution to clear the memory after each page displayed ?

Thanks in advance

Yann

P.S i attached a new "clean" code



Title: Re: Waveshare e-paper displays with SPI
Post by: ZinggJM on Mar 17, 2018, 06:58 pm
Hi Yann,

I quickly ran your example on a Wemos D1 mini with Waveshare 4.2 b/w display, as I have this configuration at hand. I just had to change the pins used. It runs ok, all 3 pages were shown.

I will test with Arduino Due later, need to wire this first.

Jean-Marc

Not yet tested, but I bet I know the reason!

You force the compiler to make local copies of your char arrays in stack space.

You should pay attention to compiler warnings; a simple const before char* should help.

And if you had declared the char arrays outside the functions the compiler could allocate the space for the copy globally, and warn if ram is not sufficient.

Now going to check this, I just need to add BUSY and DC on a proto board for Due.

My bet was wrong. The points are valid, but not the reason.

The reason is still unknown, but when I tried to analyze it, the (d)effect went away. I added this for diagnostic output:

Code: [Select]
void setup() {
  Serial.begin(115200);


Maybe the "Serial.print"s in the _waitWhileBusy() method fill a buffer and the Due misbehaves if Serial.begin() was never called. Who knows.
Title: Re: Waveshare e-paper displays with SPI
Post by: witchole on Mar 17, 2018, 07:12 pm
I have inserted the font "FreeSansBold24pt7b" and added some characters. Then I overwrote the font .h file. However, the font does not change. Did I forget a step or isn´t it that easy?
You might get a better response if you show your source code.
Title: Re: Waveshare e-paper displays with SPI
Post by: ZinggJM on Mar 18, 2018, 07:20 am
Warning: GxEPD will hang on some platforms if Serial.begin() is omitted!

Per default, GxEPD produces debug output in the _waitWhileBusy() method, to help analyzing wiring problems. On some platforms (AVR, SAM, ...) this will fill the buffer for transmit and then hang if Serial.begin() has not been called. There is no easy platform independent solution to this issue.

You can disable diagnostic output in the .cpp file of each display class if needed by un-commenting:

Code: [Select]
//#define DISABLE_DIAGNOSTIC_OUTPUT


To be fixed, sometime soon.

Jean-Marc
Title: Re: Waveshare e-paper displays with SPI
Post by: ykolly on Mar 18, 2018, 01:35 pm
Thanks for your help J-M,

It look like the buffer is never flushed if serial is not enabled.

Good luck for your futur developpment from the far west side of Switzerland


Title: Re: Waveshare e-paper displays with SPI
Post by: samlewis02 on Mar 20, 2018, 05:16 am
After re-installing ESP8266 libraries the Waveshare 4.2in display now works fine! Thanks for your time.
Title: Re: Waveshare e-paper displays with SPI
Post by: nemiro on Mar 21, 2018, 05:39 am
Just now starting to work with these.  I appreciate all of the work ZinggJM has put into this library!  I have read nearly every post, and am implementing this on a homebrewed DUE system.  I am using the 2.13" 3 color display, with a charge pump circuit built from the data sheet.  I have verified that it is wired up correctly.

Link to display: https://www.buydisplay.com/default/2-13-inch-color-e-paper-display-module-manufacturers-104x212-ssd1675a

 

I am wired up using the following (use of the official SS is not an option, unfortunately, but CS does toggle):
BUSY -> 51, RST -> 50, DC -> 6, CS -> 49, CLK -> SCK, DIN -> MOSI, GND -> GND, 3.3V -> 3.3V

In my code:
#include <GxEPD.h>
#include <GxGDEW0213Z16/GxGDEW0213Z16.cpp>  // 2.13" b/w/r
#include <GxIO/GxIO_SPI/GxIO_SPI.cpp>
#include <GxIO/GxIO.cpp>

GxIO_Class io(SPI, 49, 6, 50); // arbitrary selection of 8, 9 selected for default of GxEPD_Class
GxEPD_Class display(io, 50, 51);


Nothing appears on the display. 

When I look via an oscilloscope, all of the control signals seem to be in place.  I can see BUSY toggling from time to time, and output signals to the display looks normal.  Looking in the Serial Monitor, it behaves as if it should be drawing on the display. 

What does not look right to me are any of the voltages or signals to the charge pump section of the display.  I never see any signal at all from GDR (and hence nothing to show at RESE).  My observations as follows:

Pin 2 GDR 0v (no signal, shouldn't I see some drive there?)
Pin 3 RESE 0v
Pin 5 VSH2 0v
Pin 18 VDD 1.84v  <- Should this read +3.3v?  Do I need to tie it in to VDDIO (does not call for this in datasheet)?
Pin 20 VSH1 -0.125v
Pin 21 VGH 3.26v
Pin 22 VSL -0.015v
Pin 23 VGL 0v
Pin 24 VCOM 0.010v

I have a small box full of these displays, and swapping out a display results in the same thing.  I feel that I am missing something obvious.  Any help that can be offered would be most welcome!  Thanks!
Title: Re: Waveshare e-paper displays with SPI
Post by: ZinggJM on Mar 21, 2018, 06:54 am
Hi nemiro,

I do not know these details. Voltage levels should be in the display specs.

You could buy the DESTM32-S2 or the Waveshare e-paper HAT for comparison.

And consult the schematics of the DESTM32-S2 (http://www.good-display.com/download_detail/downloadsId=558.html), it may have more details than the reference circuit.

For more help and information contact Dalian Good Display.

Good Luck!
Title: Re: Waveshare e-paper displays with SPI
Post by: imran445 on Mar 21, 2018, 10:14 am
Hi @ZinggJM,

I have bought new 1.54 inch epaper dispaly from waveshare. I have used your libary for the Arduino and I got the output successfully. But When I want to use the display with the Particle photon, am facing library issues and pinning. If you don't mind can you provide a library and an example related to Particle Photon which will help so many people. Sorry to disturb you. Thank you so much.
Title: Re: Waveshare e-paper displays with SPI
Post by: ZinggJM on Mar 21, 2018, 10:28 am
I don't know Particle Photon, and don't know if it is supported by Arduino IDE.

For these kinds of questions I expect a clickable link to the product, so I can quickly check without needing to search myself and waste time.

If it is not supported by the Arduino IDE (if no package is available for it), I do not have the capacity to support it. But you can try to adapt e.g. GxEPD2_32_BW or GxEPD2_32_3C to this board. GxEPD is too complicated for this.

Jean-Marc

Title: Re: Waveshare e-paper displays with SPI
Post by: imran445 on Mar 21, 2018, 10:35 am
this is the waveshare display that i'm using "https://www.waveshare.com/wiki/1.54inch_e-Paper_Module"
and particle photon datasheet "https://docs.particle.io/datasheets/photon-(wifi)/photon-datasheet/#pinout-diagrams"
Title: Re: Waveshare e-paper displays with SPI
Post by: ZinggJM on Mar 21, 2018, 11:41 am
this is the waveshare display that i'm using "https://www.waveshare.com/wiki/1.54inch_e-Paper_Module"
and particle photon datasheet "https://docs.particle.io/datasheets/photon-(wifi)/photon-datasheet/#pinout-diagrams"

You definitely want me go searching. Please make links clickable. Icon next to picture icon.

I found on the pinout sheet "Broadcom Wi-FI + STM32F205RGY6 MCU".

There might be an Arduino package with support for STM32F205RGY6, but with support for WI-FI?

Find out yourself, or ask in the Processors Section. Or tell us how you use it with the Arduino IDE.
Title: Re: Waveshare e-paper displays with SPI
Post by: fr on Mar 21, 2018, 02:47 pm
Hello JM,

A big thank you for the GxEPD library
I discover the example PartialUpdateTest with #include <GxGDEH029A1/GxGDEH029A1.cpp> (2.9 inch 128 x 296 pixels black/white waveshare + Wemos D1 R1)

And in the serial console there are displays

_PowerOn: nnnnnn
_Update_Part: nnnnn
and so on...

How to delete them?
Thanks in advance
Title: Re: Waveshare e-paper displays with SPI
Post by: ZinggJM on Mar 21, 2018, 03:03 pm
See in this post (https://forum.arduino.cc/index.php?topic=487007.msg3652557#msg3652557).
Title: Re: Waveshare e-paper displays with SPI
Post by: nemiro on Mar 21, 2018, 03:09 pm
Hi nemiro,

I do not know these details. Voltage levels should be in the display specs.

You could buy the DESTM32-S2 or the Waveshare e-paper HAT for comparison.

And consult the schematics of the DESTM32-S2 (http://www.good-display.com/download_detail/downloadsId=558.html), it may have more details than the reference circuit.

For more help and information contact Dalian Good Display.

Good Luck!
Thank you!
Title: Re: Waveshare e-paper displays with SPI
Post by: fr on Mar 21, 2018, 03:17 pm
Thank you !

Read 31 pages and miss the end of a post in the penultimate page ... :smiley-confuse:
Title: Re: Waveshare e-paper displays with SPI
Post by: fabianbambam on Mar 22, 2018, 06:07 am
Hello People!


I'm working with an Epaper Display 2.9Inch from Waveshare using Arduino UNO.

I play the demo successfully from waveshare demo code and I found an interesting video about how to hack the refresh rate:

Epaper Hacking 3Hz refresh rate (https://www.youtube.com/watch?v=MsbiO8EAsGw&t=782s)

I was wondering if you know some implementation that somebody did with 2.9 inch display that could be available online, I'm interested on hack the current library like the video to get the fastest refresh rate from the display.

I'm also interested to know if GxEPD could draw bigger letters than the waveshare library and to know if the refresh rate is possible to be faster with this implementation than the waveshare library.

I will be working on this so any help could be helpful to get some progress.

Thank you so much for time!

Good day.
Title: Re: Waveshare e-paper displays with SPI
Post by: ZinggJM on Mar 22, 2018, 06:42 am
You can find more information about wavetables and refresh speed if your read through this topic.

GxEPD uses Adafruit_GFX for graphics and text rendering. Adafruit_GFX comes with FreeFonts up to 24pt, and you can setTextSize() for size multiplication.

And just now all the fonts of U8G2 come available for GxEPD and all Adafruit_GFX deriving display libraries.

See U8g2_for_Adafruit_GFX (https://github.com/olikraus/U8g2_for_Adafruit_GFX)

Jean-Marc
Title: Re: Waveshare e-paper displays with SPI
Post by: fabianbambam on Mar 22, 2018, 07:51 am
Thanks for your quick reply.


I saw the GxEPD library and I want to give it a try to see how it works.

The example for small ram processors works great.

I want to make a quick question. Is it totally required to dropdown voltage from data lines to 3.3v? I mean, according with the Waveshare page this is not required to use. This could damage the epaper display in long term of usage?

Did you have any bad experience around this?

Thanks!
Title: Re: Waveshare e-paper displays with SPI
Post by: ZinggJM on Mar 22, 2018, 08:04 am
No bad experience, as I am cautious. You should look at the controller specs section Maximum Ratings.
I saw maximum VCC 3.6V somewhere and maximum input signal VCC + 0.7V.
The +0.7V is because of the input protection diodes.

If you hard feed input lines from a 5V AVR Arduino with 20mA drive capability you will feed the display through the protection diodes! This doesn't seem healthy in the long term and it can cause SPI communication distortions!

There are not so many data lines to a SPI e-paper; use at least series resistors!
Title: Re: Waveshare e-paper displays with SPI
Post by: fabianbambam on Mar 22, 2018, 08:16 am
I will take your advice, I will need to use some resistors but it's better than get future issues.

Thank you very much, you've made a great piece of work here.

Demo it looks a little bit faster than the waveshare library.

I hope to get more info according how to get faster refresh rates. Maybe someone on this thread was looking the same thing like me.

Datasheet from Epaper 2.9Inch says that the refresh rate is about 600ms if I'm not wrong. I would need less than that if I plan to show an stopwatch with this.
Title: Re: Waveshare e-paper displays with SPI
Post by: ZinggJM on Mar 22, 2018, 09:06 am
I used the 1.54" b/w in a long-time test successfully with 1s update period. It stops after 49 days because of uint32_t overflow, but shows no degradation.

The 2.9" b/w should not be used with less than 2s update period in my opinion. No long-time test done.

For stopwatch I would recommend a sunlight readable monochrome LCD, e.g.

128x64 128*64 COG 12864 LCD Module UC1701X (https://www.aliexpress.com/item/12864-LCD-screen-module-20PIN-KS0108-Oor-KS0107-controller-Red-word-on-the-black-background/32215047945.html)

but I have not yet tried to use it outside, or without backlight.

Without backlight it power consumption is low; there is a topic on this.
Title: Re: Waveshare e-paper displays with SPI
Post by: ZinggJM on Mar 22, 2018, 02:22 pm
I just discovered this nice gadget (https://www.aliexpress.com/item/TTGO-T5-v1-0-wifi-bluetooth-basis-ESP-32-esp32-1-54-2-13-2-9/32843165848.html).
Title: Re: Waveshare e-paper displays with SPI
Post by: Kastell on Mar 22, 2018, 10:23 pm
Font Question:

I need a ISO 8859-1 (Latin-1) font. After long search I found this libary with 255 different letters and some nice Google fonts like Open Sans:
https://github.com/pljakobs/Adafruit_ftGFX

Is it possible to use this on the epaper?
Title: Re: Waveshare e-paper displays with SPI
Post by: ZinggJM on Mar 23, 2018, 05:36 am
Font Question:

I need a ISO 8859-1 (Latin-1) font. After long search I found this libary with 255 different letters and some nice Google fonts like Open Sans:
https://github.com/pljakobs/Adafruit_ftGFX

Is it possible to use this on the epaper?
Yes, you can. It is still "experimental" in the actual version of GxEPD.

See GxFont_GFX_Example (https://github.com/ZinggJM/GxEPD/tree/master/examples/GxFont_GFX_Example)

Code: [Select]
// for use of additional fonts you need to enable these in file GxFont_GFX.h
// and install the library
//
// selection of the additional fonts is done by the following methods:
//
// void setFont(const uint8_t *font); // selects rendering and fonts from library U8G2_FOR_ADAFRUIT_GFX
//
// void setFreeFont(const GFXfont *f = NULL); // selects rendering and fonts from library GxFont_GFX_TFT_eSPI
// void void setTextFont(uint8_t font); // selects rendering and fonts from library GxFont_GFX_TFT_eSPI
//
// void setFont(uint8_t f); // selects rendering and fonts from library Adafruit_tfGFX
// (no additional fonts, as all are now part of Adafruit_GFX)
//
// void setFont(const GFXfont *f = NULL); // reverts back to Adafruit_GFX FreeFonts
// use setFont((void*)NULL); // to select Adafruit_GFX classic font
//
// these additions may not work with AVR Arduinos
//
// these additions are only partially tested; more tests and additions may follow


Code: [Select]
// class GxFont_GFX : Font Rendering Graphics Switch and Bridge Class
//
// This class allows to connect GxEPD to additional font rendering classes.
//
// U8G2_FOR_ADAFRUIT_GFX: Arduino Library that makes all U8G2 fonts available (Oliver Kraus)
// avaliable from: https://github.com/olikraus/U8g2_for_Adafruit_GFX
//
// GxFont_GFX_TFT_eSPI: fonts and font rendering of TFT_eSPI library (Bodmer)
// available here: https://github.com/ZinggJM/GxFont_GFX_TFT_eSPI
//
// Adafruit_ftGFX: a Adafruit_GFX variant with different fonts.
// need to use modified clone from: https://github.com/ZinggJM/Adafruit_ftGFX
// (no additional fonts, as all are now part of Adafruit_GFX)


You need to install the modified Adafruit_tfGFX from here https://github.com/ZinggJM/Adafruit_ftGFX (https://github.com/ZinggJM/Adafruit_ftGFX)

But Peter Jakobs told me these fonts are now part of Adafruit_GFX.
See here: https://github.com/adafruit/Adafruit-GFX-Library/issues/154 (https://github.com/adafruit/Adafruit-GFX-Library/issues/154)

Jean-Marc

I just had to fix the classname to Adafruit_ftGFX.
Title: Re: Waveshare e-paper displays with SPI
Post by: Matadormac on Mar 24, 2018, 06:50 am
Dear Jean-Marc.

I often work with Teensy 3.2 micro-controllers (https://www.pjrc.com/teensy/index.html  and https://www.pjrc.com/teensy/teensy31.html#specs )

I have got my 1.54 epaper displays to work with your library and the  nano and esp8266 controllers but now I need to work with the Teensy 3.2.  Normally you use the same pins as for AVR which I have done following the suggestions in your library.

// mapping suggestion for AVR, UNO, NANO etc.
// BUSY -> 7, RST -> 9, DC -> 8, CS-> 10, CLK -> 13, DIN -> 11

But, I cannot get the display to work with this wiring, the Teensy 3.2 and the current Arduino version software as well as the current Teensyduino software add on for Arduino.

Do you have any suggestions how I might proceed?

Regards

Mark MacKenzie
Title: Re: Waveshare e-paper displays with SPI
Post by: ZinggJM on Mar 24, 2018, 08:29 am
Hi Mark,

I do not have any Teensy, and don't know enough to help directly. I will try.

You can help me by telling me the Arduino package you use; Boards Manager and/or additional package in preferences.

Then I or you can check pins_arduino.h of this board in this package.

Jean-Marc

A reason could be SPI speed; setting SPI speed in GxIO_SPI might not work with Teensy and the default speed might be too high for the e-paper controller. The usual default speed of 4MHz works.

Ok, I found Teensyduino. I do not intend to load another package to my already cluttered Arduino installation. It is not part of the unofficial list of 3rd party boards support urls.

I have a rarely used notebook where I could try to install Teensyduino.
But it does not install to Arduino 1.8.5; the location to install can't be selected.
Title: Re: Waveshare e-paper displays with SPI
Post by: php4fan on Mar 24, 2018, 04:21 pm
At this point I think either the display or the Hat must be broken and I'm going to request to return them :(
Just to let you know how my story ended:
I did return the display and its hat (and got a refund) and bought a new one, this time directly from WaveShare's website, and it worked out of the box with your library and example.

Same sketch, same ESP, same connections, new display&hat.

So my humble piece of advice learning from this experience is: nevery buy stuff from DealExtreme  >:(  (this was my second time, the first I just never got the package).

Thanks a lot ZinggJM for your time, your help, and of course your library in the first place, and sorry for the waste of time.
Title: Re: Waveshare e-paper displays with SPI
Post by: php4fan on Mar 24, 2018, 05:02 pm
One thing I'm not entirely sure is if the output I'm seeing from ESP_TestExample is exactly the expected one.
The bottom half of the screen is always all black, red, or white, while images, text and stuff always shows up only on the top half.

I attach some photos. Is this expected?

Title: Re: Waveshare e-paper displays with SPI
Post by: php4fan on Mar 24, 2018, 05:11 pm
Now trying the "IconGrid" example. I selected GxGDEW075T8 as the b/w/r is not available here.

I get this error:

> 'D3' was not declared in this scope

at this line:

> GxIO_Class io(SPI, SS, D3, D4);

I guess I can replace the constants with the actual integer values, but I don't think this is expected, is it?

Again I'm using this controller:
https://learn.sparkfun.com/tutorials/esp8266-thing-development-board-hookup-guide/all
Title: Re: Waveshare e-paper displays with SPI
Post by: php4fan on Mar 24, 2018, 05:24 pm
One thing I'm not entirely sure is if the output I'm seeing from ESP_TestExample is exactly the expected one.
The bottom half of the screen is always all black, red, or white, while images, text and stuff always shows up only on the top half.

I see, if I select the black&white display, the output does fill the whole screen and looks a lot more like expected output.

I guess the b/w/r class, which I seem to remember you said you got from somebody else, is completely broken.

Do you have any plans to add proper support for that model?
Title: Re: Waveshare e-paper displays with SPI
Post by: ZinggJM on Mar 24, 2018, 07:14 pm
Yes, I support it in a test-version in GxEPD2_32_3C_X. As I do not have this display, I can't test it.
Sponsors are still welcome, but this display needs too much RAM for buffer to properly support it in GxEPD.

So far I left it in GxEPD, because nobody complained yet, and you can at least see if the display works.

I will remove it in the next version, unless requested otherwise by more than one person (there are enough forks around that will still have it).
Title: Re: Waveshare e-paper displays with SPI
Post by: bmishra4 on Mar 25, 2018, 03:49 pm
Hello Genius people,

First of all, i would like to say Thanks to ZinggJM for this library. Its truly amazing and works like charm.

I am very new to this Arduino and ESP world but wanted to make few things for my 3 year old daughter.

I need help in driving 2.9inch waveshare epaper module (https://www.waveshare.com/wiki/2.9inch_e-Paper_Module ) by a M5Stack board (http://www.m5stack.com/), which already have an TFT connected to SPI bus. I tried many times with different pins but unable to get that working with M5Stack.

I think, i need to change the controls pins like Busy, RST, CS, and DC in the library to work with M5Stack (https://github.com/m5stack/M5Stack).

Declaration part of the code, which is not working:

#include <WiFi.h>
#include <HTTPClient.h>
#include <ArduinoJson.h>
#include <M5Stack.h>
#include "Free_Fonts.h"
#include <GxEPD.h>
#include <GxGDEH029A1/GxGDEH029A1.cpp>      // 2.9" b/w
#include <GxIO/GxIO_SPI/GxIO_SPI.cpp>
#include <GxIO/GxIO.cpp>

#define DEMO_DELAY 30
// BUSY -> 4, RST -> 16, DC -> 17, CS -> SS(5), CLK -> SCK(18), DIN -> MOSI(23), GND -> GND, 3.3V -> 3.3V
GxIO_Class io(SPI, SS, 17, 16);
GxEPD_Class display(io, 16, 3);


I would appreciate if someone can explain me the way to achieve this, it will be a gr8 help. I will share my code once m done with my project.

Thanks and Regards
Brijesh

Title: Re: Waveshare e-paper displays with SPI
Post by: ZinggJM on Mar 25, 2018, 04:35 pm
Hi Brijesh, Hi All, Hi users of uncommon processor boards,

you can help me and all potential responders, if you

- provide clickable links: symbol in the middle of the symbols bar; makes it easy to get to information,

- provide information about the processor and the Arduino package used (Boards Manager).

- information about the display used (as done in above post).

@Brijesh

do you need to share the HW SPI with other devices?

have you tried the GxEPD_SPI_TestExample.ino without additions and additional devices?

The first thing to find out is the HW SPI pins used by the SPIClass of your board (SCK, MOSI).
Use the defined SS pin for CS if possible, but this can be changed. Use any other available pins for the remaining signals.

In some recent post I showed where pins_arduino.h usually can be found for your board.

I may add more here, after I have followed your links.

Ok, time to go digging in my drawers; I think I bought one of these, but not yet used.
Neither found it in a drawer, nor in my excel sheet, so maybe I didn't really buy it.

Processor is ESP32, so there are suggestions for pins to use. Does it work with the  TFT removed?
Most likely you can use shared SPI (SCK, (MISO), MOSI, DC) with separate CS pins.

Jean-Marc
Title: Re: Waveshare e-paper displays with SPI
Post by: bmishra4 on Mar 25, 2018, 05:32 pm
Thanks a lot for your Prompt Attention.

do you need to share the HW SPI with other devices?

Yes, i want to share the SPI bus with E-Paper display

have you tried the GxEPD_SPI_TestExample.ino without additions and additional devices?

Yes, its working when i disable the TFT LCD of M5Stack

Here is the pin assignment (https://github.com/m5stack/M5Stack) of M5Stack and its Schematic (https://github.com/m5stack/M5-hardware/blob/master/M5_Core_SCH(20171206).pdf https://github.com/m5stack/M5Stack).

 
Also, the PartialUpdateExample.ino is working perfectly fine if, i don't declare the M5 LCD.

M a newbee not at all expert in manipulating the libraries but i thing it has to do something with //static const uint8_t SS    = 5;. If i change the pin assignments of  BUSY , RST , DC , CS, probably it will work.


I am very thankful for your efforts and help in this, really appreciated.

Thanks and Regards
Brijesh

Title: Re: Waveshare e-paper displays with SPI
Post by: ZinggJM on Mar 25, 2018, 06:04 pm
Quote
If I change the pin assignments of  BUSY , RST , DC , CS, probably it will work.
Yes, I thinks so. I would propose you try step by step.

Start with the version with TFT removed and all pins used as suggested. Make sure it works.
Then change the pin used for CS to the e-paper, change in HW connection and in SW value to the io constructor in GxIO_Class io(SPI, SS, 17, 16); replace SS with the pin number. Make sure it works.
Check if pins for RST and BUSY conflict with pins for TFT, change if needed. Make sure it works.
Connect the TFT, without enabling TFT, check if this works.
Enable the TFT, check if this works.

This should work if the TFT behaves as it should; it should release all signal lines as long as its CS line is inactive.

Conflicting signal lines should not be the issue, as the e-paper does not use MISO.

But conflicting SPI speeds could be a reason, as the e-paper does not support the high SPI speeds TFTs can use. In this case I would need to provide a GxIO_SPI class that uses transactions, to have its own SPI speed. This might slow down the TFT, if its driver doesn't use SPI transactions (transactions use their own set of SPI settings, but usually don't restore previous settings).

The TFT most likely does not use transactions. Then it may be enough to call init() for the e-paper after begin() for the TFT.

Jean-Marc
Title: Re: Waveshare e-paper displays with SPI
Post by: bmishra4 on Mar 25, 2018, 06:10 pm
Thanks a lot ZinggJM, Going to try that ASAP.

Will update you about the progress by tomorrow.

Thanks and Regards
Brijesh
Title: Re: Waveshare e-paper displays with SPI
Post by: korstiaan on Mar 26, 2018, 03:58 pm
Hi,

I'm currently testing some ESP8266/ESP32 together with some Waveshare displays.
It all works fine only the 7.5" gives me some problems. (<GxGDEW075T8/GxGDEW075T8.cpp>).
Even with an almost empty sketch I get an low memory warning during compile. (77% used)
If I then want to draw a line (from 0,0 to 640,384) I only see the top half. The bottom half of the display shows a filled rectangle.
I suppose the memory gets in trouble...
On a ESP32 it is no problem.
Do you think an ESP8266 can control an 7.5"?

Title: Re: Waveshare e-paper displays with SPI
Post by: ZinggJM on Mar 26, 2018, 04:30 pm
Hi,

77% is no problem on ESP8266, as long as you do not use large dynamic allocated RAM (heap), e.g. Strings. Your line should get correctly cropped to (0, 0, 639, 383).

I have a 7.5" b/w in constant use for text output.

Post an example that shows the error, try to reduce it to the minimum, then I will check.

Do you use the actual version from https://github.com/ZinggJM/GxEPD (https://github.com/ZinggJM/GxEPD) ?

Title: Re: Waveshare e-paper displays with SPI
Post by: ZinggJM on Mar 27, 2018, 01:46 pm
Additional Fonts are now available with GxEPD, GxEPD2_32 and GxEPD2_AVR, see examples

Jean-Marc Zingg
Title: Re: Waveshare e-paper displays with SPI
Post by: korstiaan on Mar 27, 2018, 05:05 pm
Hi,

This is the only code thats in the ESP8266:

Code: [Select]
#include <GxEPD.h>
#include <GxGDEW075T8/GxGDEW075T8.cpp>
#include <GxIO/GxIO_SPI/GxIO_SPI.cpp>
#include <GxIO/GxIO.cpp>

GxIO_Class io(SPI, SS, 16, 2); // io(SPI, SS, 16, 2) ESP8266 // io(SPI, SS, 16, 19) ESP32 Thing, // GxEPD_Class display(io, 16, 4);

void setup() {
    int retry=0;
    // put your setup code here, to run once:
    Serial.begin(115200);
    display.init();
    display.eraseDisplay(false);
    display.fillScreen(GxEPD_WHITE);
    display.drawLine(0, 0, 640, 384, GxEPD_BLACK);
    display.update();
}

void loop() {
  // put your main code here, to run repeatedly:
    delay(1000);
}
Title: Re: Waveshare e-paper displays with SPI
Post by: ZinggJM on Mar 27, 2018, 05:44 pm
Your code draws nothing; it doesn't even compile (no display instance).

My modified code draws a perfect diagonal line; I use my "standard" ESP8266 wiring with Wemos D1 mini.

Code: [Select]
#include <GxEPD.h>
#include <GxGDEW075T8/GxGDEW075T8.cpp>
#include <GxIO/GxIO_SPI/GxIO_SPI.cpp>
#include <GxIO/GxIO.cpp>

//GxIO_Class io(SPI, SS, 16, 2); // io(SPI, SS, 16, 2) ESP8266 // io(SPI, SS, 16, 19) ESP32 Thing, // GxEPD_Class display(io, 16, 4);

GxIO_Class io(SPI, SS, 0, 2); // arbitrary selection of D3(=0), D4(=2), selected for default of GxEPD_Class
GxEPD_Class display(io); // default selection of D4(=2), D2(=4)

void setup() {
    int retry=0;
    // put your setup code here, to run once:
    Serial.begin(115200);
    display.init();
    display.eraseDisplay(false);
    display.fillScreen(GxEPD_WHITE);
    display.drawLine(0, 0, 640, 384, GxEPD_BLACK);
    display.update();
}

void loop() {
  // put your main code here, to run repeatedly:
    delay(1000);
}


From the symptoms you described the RAM of your ESP8266 might be bad.

Did you check diagnostic output in the Serial Monitor?
Title: Re: Waveshare e-paper displays with SPI
Post by: korstiaan on Mar 27, 2018, 07:15 pm
Hi Jean-Marc,

Oeps, sorry I delete a line too much.
And YES, it also works now! Thanks.

And it seems like it is just that line that makes the difference:
This works:
Code: [Select]
GxEPD_Class display(io);

This doesn't:
I used
Code: [Select]
GxEPD_Class display(io, 16, 4);

What does this 16,4 means?
Title: Re: Waveshare e-paper displays with SPI
Post by: ZinggJM on Mar 27, 2018, 07:29 pm
Code: [Select]
// GxIO_SPI(SPIClass& spi, int8_t cs, int8_t dc, int8_t rst = -1, int8_t bl = -1);
GxIO_Class io(SPI, SS, 0, 2); // arbitrary selection of D3(=0), D4(=2), selected for default of GxEPD_Class
// GxGDEP015OC1(GxIO& io, uint8_t rst = 2, uint8_t busy = 4);
GxEPD_Class display(io); // default selection of D4(=2), D2(=4)


The line in comment tells you the name of the parameter. And I provide pin mapping suggestions.
Title: Re: Waveshare e-paper displays with SPI
Post by: korstiaan on Mar 27, 2018, 08:00 pm
Hi,

Ok.
But now I tried, since it is a 7.5" b/w/r display, the <GxGDEW075Z09/GxGDEW075Z09.cpp> instead of the <GxGDEW075T8/GxGDEW075T8.cpp>and now the output is corrupt (upper half of the screen is ok, the lower half is a red rectangle.

Korstiaan
Title: Re: Waveshare e-paper displays with SPI
Post by: ZinggJM on Mar 27, 2018, 08:22 pm
Hi korstiaan,

See also post #492 (https://forum.arduino.cc/index.php?topic=487007.msg3661971#msg3661971)

The 7.5" b/w/r is no longer supported in GxEPD for now, I have removed it from the actual version.

It is now supported in GxEPD2_32 in class GxEPD2_32_3C.

I thank you for your offer; if I receive this display I will add a new version to GxEPD, that will compile only for processors with enough RAM, e.g. ESP32, and maybe for AVR for paged display.

I do not recommend the 7.5" 3-color display because of its long screen refresh time.
Except for applications with infrequent updates like shelf labels.

And I recommend to use the GxEPD2 libraries, with the more general automatic use of paged display,
and the more intuitive constructors used, with inline parameter name comments in the examples.

Jean-Marc

(https://forum.arduino.cc/index.php?action=dlattach;topic=487007.0;attach=253006)
Title: Re: Waveshare e-paper displays with SPI
Post by: korstiaan on Mar 27, 2018, 09:56 pm
Hi,

Quote
And I recommend to use the GxEPD2 libraries
Can these be used on ESP8266/Arduino and/or ESP32/Arduino?
(I'm using Arduino on ESP8266 and Arduino on ESP32.)
Title: Re: Waveshare e-paper displays with SPI
Post by: ZinggJM on Mar 27, 2018, 10:32 pm
Yes, these libraries are for the Arduino IDE, and can be used with many Arduino supported boards.
I mostly use ESP8266 (Wemos D1 mini) and ESP32, because of WiFi.

One advantage of the GxEPD2 libraries is the option to modify the buffer space to use (in the header files).
Title: Re: Waveshare e-paper displays with SPI
Post by: Cybias on Mar 28, 2018, 11:37 am
Hi Jean Marc,

first of all thank you very much for your efforts to create these libraries.
I have used GxEPD for the 7.5" bw version so far and it work like a charm.

Now I tried to get the 7.5" bwr version running. As I learned in the discussion here it does not work with GxEPD, but just with GxEPD2_32:

It is now supported in GxEPD2_32 in class GxEPD2_32_3C.

So I tried to get the example in the library running. Compiling and uploading works fine, with
GxEPD2_32_3C display(GxEPD2::GDEW075Z09,  /*CS=5*/ SS, /*DC=*/ 17, /*RST=*/ 16, /*BUSY=*/ 4);
activated, but unfortunately nothing happens on the display.

The Busy-Pin is constantly at 0.0V.

My serial output is the following:

setup
Busy Timeout!
POWER : 40000864
Busy Timeout!
_PowerOn : 40000742
Busy Timeout!
_Update_Full : 40000744
_PowerOff : 40993
Busy Timeout!
POWER : 40000940
Busy Timeout!
_PowerOn : 40000768
Busy Timeout!
_Update_Part : 40000812
Busy Timeout!
POWER : 40000935
Busy Timeout!
_Update_Part : 40000617
Busy Timeout!
POWER : 40000934
Busy Timeout!
_Update_Full : 40000565
_PowerOff : 40993
Busy Timeout!
POWER : 40000941
.
.
.


If I attach my 7.5" bw Display to the same hardware (controller and wemos lolin32) even with the software for the bwr Display above, it works perfectly and shows "Hello World" and all the other test-pictures.

Also I checked the officially correct setting for bw:
GxEPD2_32_BW display(GxEPD2::GDEW075T8, /*CS=5*/ SS, /*DC=*/ 17, /*RST=*/ 16, /*BUSY=*/ 4)
It also works perfectly.


With the bw-Software and the bwr-Panel attached, I get the following output:

setup
Busy Timeout!
_PowerOn : 10000663
Busy Timeout!
_Update_Full : 10000350
Busy Timeout!
_PowerOff : 10001006
Busy Timeout!
_PowerOn : 10000742
Busy Timeout!
_Update_Part : 10000688
Busy Timeout!
_Update_Part : 10000468
Busy Timeout!
_Update_Full : 10000066
_PowerOff : 39993
Busy Timeout!
_PowerOn : 10000746
Busy Timeout!
_Update_Full : 10000100
Busy Timeout!
_PowerOff : 10001002
Busy Timeout!
_PowerOn : 10000731
Busy Timeout!
_Update_Full : 10000563
.
.
.


Also the display seems to be slightly more red shaded, but still no picture.


Do you have an idea what I could try else? If you need any further information / setup try-outs, just tell me, then I can try to realize / measure / evaluate it.

Cheers

Tobias
Title: Re: Waveshare e-paper displays with SPI
Post by: ZinggJM on Mar 28, 2018, 01:27 pm
Hi Tobias,

I tried to understand your post, and I think I found all relevant information:

- your processor is ESP32, board Wemos LOLIN32

- your 7.5" b/w display works fine with GxEPD2::GDEW075T8

- your 7.5" b/w/r causes Busy Timeout with GxEPD2::GDEW075T8 and with GxEPD2::GDEW075Z09

- you use the suggested wiring / pin mapping for ESP32

- you get Busy Timeout and no display update

The "remote doctor" diagnoses SPI communication not working with the 7.5" b/w/r.

The reason could be wrong connections of the SPI lines SS, SCK, MOSI (CS, CLK, DIN), or DC, or bad connection.

Do you use the Waveshare E-paper HAT? The same in both cases?

The connector needs be firmly pushed in, the DuPont connectors can be bad, the FCP connections need be good (loosen the black retainer before pushing the flexible connector in, then push the retainer in).

Jean-Marc
Title: Re: Waveshare e-paper displays with SPI
Post by: ZinggJM on Mar 28, 2018, 05:26 pm
Hi All,

An issue has been raised about the update behavior of 3-color displays. This is my answer:

Quote
Quote
please use the Arduino Forum Displays for questions or enhancement suggestions
Please observe the guide in the issue_template.md.

This is not an issue of the library, but physical behavior of the e-paper display.
Black / white e-paper displays can support fast update for partial update, applying only the difference.
For this the controller internally has 2 buffers and uses a waveform table for partial update that handles only the differences. For 3-color e-paper displays this is not possible because of the physical process; the movement speed difference of the smaller black particles and the larger colored particles is used, which does not work using only differences, and the 2 buffers are used for black and colored.
Title: Re: Waveshare e-paper displays with SPI
Post by: Cybias on Mar 28, 2018, 10:43 pm
Hi Jean-Marc,

thanks for the quick reply. I put my answers in green below.

Cheers

Tobias

Hi Tobias,

I tried to understand your post, and I think I found all relevant information:

- your processor is ESP32, board Wemos LOLIN32 yes

- your 7.5" b/w display works fine with GxEPD2::GDEW075T8  yes, and even with GDEW075Z09

- your 7.5" b/w/r causes Busy Timeout with GxEPD2::GDEW075T8 and with GxEPD2::GDEW075Z09  yes

- you use the suggested wiring / pin mapping for ESP32  yes

- you get Busy Timeout and no display update  yes

The "remote doctor" diagnoses SPI communication not working with the 7.5" b/w/r. What is this? A test tool?

The reason could be wrong connections of the SPI lines SS, SCK, MOSI (CS, CLK, DIN), or DC, or bad connection. Since I did not disconnect the E-paper HAT from the ESP (see below) and it works fine with bw, there should not be any wrong connections

Do you use the Waveshare E-paper HAT? The same in both cases?  yes, even physically the same. I even did not disconnect the E-paper HAT from the ESP when changing the displays, but just exchanged the displays directly at the DuPont Connectors.

The connector needs be firmly pushed in, the DuPont connectors can be bad, the FCP connections need be good (loosen the black retainer before pushing the flexible connector in, then push the retainer in).

I connected it very carefully and took care that the flexible connector was well inserted and that the retainer was fully pushed in again. I did the exchange at least twice and always got the same result. Also the bw-Display worked again after the reconnection. 


Jean-Marc

Title: Re: Waveshare e-paper displays with SPI
Post by: Cybias on Mar 29, 2018, 12:13 am
Small, but probably relevant update:

After letting the test program run a little longer, and a closer look to the bwr-Display I saw that obviously the data connection seems to work fine.

Apart from turning more and more red as described before, in the mittle of the screen the "Hello World!" message of the Test-Program can be recognized.

I attached a picture of it to this post.

So in principle the display tries to display the right things, but is not able to complete the display update process completely.
Just a thought: Is it maybe somehow liked to the different timing of the update process you mentioned in the last post between red and black particles? Is this controlled by the E-HAT-controller, of can it be influenced manually?

Update: It's a little hard to see, because the change process is not very well visible, but I have the strong feeling, that the display just changes when the driver for the bw-Display is loaded. The driver for the bwr-Display does not seem to update the screen at all.
Title: Re: Waveshare e-paper displays with SPI
Post by: ZinggJM on Mar 29, 2018, 06:25 am
Good Morning,

Could it be that the "Display Config" switch is set wrong on your e-Paper HAT?

The b/w displays are less susceptible to wrong setting than the b/w/r.
This setting controls the voltages generated by the circuit on the HAT.
The timing is controlled by the waveform table stored in the controller.

Did you still have Busy Timeout?

with Kind Regards from your

"remote doctor".
Title: Re: Waveshare e-paper displays with SPI
Post by: Cybias on Mar 29, 2018, 10:32 am
Hello remote doctor :-D,

- Display Config is set to "B" (Other)
- Interface Config is set to "0" (4-line SPI)

I also tried to switch to "1", but this did not help and also an exchange of the controller did not change anything.

The busy timeouts are still exactly the same.

I'm a little running out of ideas for the ESP32, but I thought I could give a try to get it running attached to an raspberry to find out if this changes something in the behaviour.

Might take some days because I'll be busy with other stuff.

Cheers

Tobias
Title: Re: Waveshare e-paper displays with SPI
Post by: ZinggJM on Mar 29, 2018, 10:51 am
And of course you can try the demo example from Waveshare. Note that they use different pin connections.

Where did you buy your display? There was a post reporting bad e-paper displays available:

post #488 (https://forum.arduino.cc/index.php?topic=487007.msg3661738#msg3661738)
Title: Re: Waveshare e-paper displays with SPI
Post by: fr on Mar 29, 2018, 03:42 pm
Hello Jean Marc,

I have two problems in progress:
1) Make a countdown timer with the 2.9 inch screen ( sunlight !) The partial refresh time is between 1.1s and 1.6sec depending on the size of the part to be updated. So for now I update every 2 seconds and in the last 10 sec, I chained ... Low acceptable error. You spoke about transflective screen, in the size around 200 x300 pixels do you have a tip to use with the ESP8266 ?
2 I want to add an SD card and a GPS .... and some push buttons. Outputs are running out for CS pins and pushers. On the "busy pin" waveshare screen is it necessary? Is there a small circuit that would be able to recover at least 4 pushers through an SPI management that it would take a CS?
3) Can we use AC0, Tx and Rx from ESP for GPIO from CS?

Can you help me (or an other reader) ?
Title: Re: Waveshare e-paper displays with SPI
Post by: ZinggJM on Mar 29, 2018, 04:08 pm
The link to the transflective display I have is in this post (https://forum.arduino.cc/index.php?topic=487007.msg3658504#msg3658504), don't yet know if it is usable outside.
I have it connected to a Wemos D1 mini ESP8266.

You get more pins with ESP32, e.g. Wemos LOLIN32, at a similar price.

BUSY is needed with GxEPD and GxEPD2, to avoid a fixed delay.

SPI can be shared, but each device needs its own CS. Call init() of e-paper display last, to make sure SPI speed is low enough.

There are chips and small boards that can be used to report pushed buttons or keyboard through I2C, search for keyboard multiplexer.
Title: Re: Waveshare e-paper displays with SPI
Post by: nemiro on Mar 30, 2018, 07:06 am
I wrote earlier about having problems with the 2.13" 3 color display.  After checking, and I know this sounds dumb, I realized that the 2.13" color display I have is not the same one as the Waveshare.  Mine instead is based on the SSD1675 controller.  After much frustration, I am happy to say that I have a driver working for it, and the display is up.  I have little problems, like definitions for black and white are reversed.  Those are easy to work through.  However, I am having trouble with it on the orientation.  If you look at the first pic, you can see that doing a font test with it will draw the font, but the orientation is in portrait mode.  I would like to rotate the display 90° so that it is in landscape mode.  I have played with manually setting rotation, and found that "2" seems to give the best results.  Other settings will only fill half of the screen, print the text mirrored, but keep the same portrait orientation. 

The driver file, based very largely on your existing GxGDEW0213Z16.h driver (since displays are same dimensions/colors), (GxGXEPD0213.h, as I have called my driver) has the following definition up at the top:
Code: [Select]

[code]#ifndef _GxGXEPD0213_H_
#define _GxGXEPD0213_H_

#include "../GxEPD.h"

#define GxGXEPD0213_WIDTH 104
#define GxGXEPD0213_HEIGHT 212

#define GxGXEPD0213_BUFFER_SIZE (uint32_t(GxGXEPD0213_WIDTH) * uint32_t(GxGXEPD0213_HEIGHT) / 8)

// divisor for AVR, should be factor of GxGXEPD0213_HEIGHT
#define GxGXEPD0213_PAGES 8

#define GxGXEPD0213_PAGE_HEIGHT (GxGXEPD0213_HEIGHT / (GxGXEPD0213_PAGES - 1))
#define GxGXEPD0213_PAGE_SIZE (GxGXEPD0213_BUFFER_SIZE / (GxGXEPD0213_PAGES - 1))

[/code]



Manually setting the rotation value in the drawPixel section gives varying results, but none that approach what I want.  If I go into the driver file (GxGXEPD0213.h, as I have called my driver), and go to the display _HEIGHT and _WIDTH definitions, and just swap those two values, I get the garbage display you see here. 

Code: [Select]
#ifndef _GxGXEPD0213_H_
#define _GxGXEPD0213_H_

#include "../GxEPD.h"

#define GxGXEPD0213_WIDTH 212
#define GxGXEPD0213_HEIGHT 104

#define GxGXEPD0213_BUFFER_SIZE (uint32_t(GxGXEPD0213_WIDTH) * uint32_t(GxGXEPD0213_HEIGHT) / 8)

// divisor for AVR, should be factor of GxGXEPD0213_HEIGHT
#define GxGXEPD0213_PAGES 8

#define GxGXEPD0213_PAGE_HEIGHT (GxGXEPD0213_HEIGHT / (GxGXEPD0213_PAGES - 1))
#define GxGXEPD0213_PAGE_SIZE (GxGXEPD0213_BUFFER_SIZE / (GxGXEPD0213_PAGES - 1))




I not sure what I am doing wrong.  Obviously, I can write to the whole display, but rotating that view is just not working for me.  Aside from needing to invert the fill color values, I am at least getting a picture on the display.  Any ideas on how to rotate the whole orientation of the screen? 

Title: Re: Waveshare e-paper displays with SPI
Post by: ZinggJM on Mar 30, 2018, 07:36 am
A sensible approach would be to first compare the specs of the two controllers. My guess is they are very much the same, otherwise you wouldn't have got any acceptable result.

The color inversion is most likely caused by a different waveform table used.

Next you need to find out what the native orientation of the display is, especially in which direction bits in a byte written to the controller are oriented. You need to keep this orientation in the WIDTH and HEIGHT definitions. Rotation then is handled easily in the drawPixel method.

My approach would be to start with the demo code from the vendor or producer of the display. I then convert such code to a GxEPD display class.

As usual, if you post such a question, you should provide a (clickable) link to the device in question.

Jean-Marc
Title: Re: Waveshare e-paper displays with SPI
Post by: nemiro on Mar 30, 2018, 07:40 am
Jean-Marc, Thank you!  The display I am using is this one:

https://www.buydisplay.com/default/2-13-inch-color-e-paper-display-module-manufacturers-104x212-ssd1675a (https://www.buydisplay.com/default/2-13-inch-color-e-paper-display-module-manufacturers-104x212-ssd1675a)



SSD1675 Data Sheet (http://www.buydisplay.com/download/ic/SSD1675A.pdf)
Title: Re: Waveshare e-paper displays with SPI
Post by: nemiro on Mar 30, 2018, 07:46 am
I did start with the demo code, which I will post below.  Be aware, that I have this running on an Arduino DUE, and it is indeed in 3-Wire SPI mode (9-bit).  The demo code, converted to Arduino is attached.  
Title: Re: Waveshare e-paper displays with SPI
Post by: bmishra4 on Mar 30, 2018, 07:46 am
Thank you, ZinggJM,

As you suggested, i changed the pin mappings and SS pin. it worked like charm.

I am very thankful for your prompt attention and help, i will post my working code soon.

U r a true Genius :).

Thanks and Regards
Brijesh
Title: Re: Waveshare e-paper displays with SPI
Post by: ZinggJM on Mar 30, 2018, 08:55 am
I did start with the demo code, which I will post below.  Be aware, that I have this running on an Arduino DUE, and it is indeed in 3-Wire SPI mode (9-bit).  The demo code, converted to Arduino is attached.  
Thank you for the information. I do not have time to look at the details for now.

The important information for users of my GxEPD library is that there are similar displays that are not directly compatible.

@nemiro, rotation is best handled by calling setRotation(). Color inversion can be easily changed by inverting the bytes written to the controller (as you can see by comparing different display classes of GxEPD).

If anyone needs help for EastRising e-papers that are similar to the ones from Dalian Good Display, send me such a display complete with adapter board, and I will try to help.

GxEPD is intended for e-paper displays from Dalian Good Displays and SPI display boards from Waveshare.

Jean-Marc
Title: Re: Waveshare e-paper displays with SPI
Post by: nemiro on Mar 30, 2018, 01:38 pm
Thank you for the information. I do not have time to look at the details for now.

The important information for users of my GxEPD library is that there are similar displays that are not directly compatible.

@nemiro, rotation is best handled by calling setRotation(). Color inversion can be easily changed by inverting the bytes written to the controller (as you can see by comparing different display classes of GxEPD).

If anyone needs help for EastRising e-papers that are similar to the ones from Dalian Good Display, send me such a display complete with adapter board, and I will try to help.

GxEPD is intended for e-paper displays from Dalian Good Displays and SPI display boards from Waveshare.

Jean-Marc
I will look to see if they have one. If they do, I will get one and send it.  Thanks!
Title: Re: Waveshare e-paper displays with SPI
Post by: bmishra4 on Mar 31, 2018, 12:20 pm
Thank you, ZinggJM,

As you suggested, i changed the pin mappings and SS pin. it worked like charm.

I am very thankful for your prompt attention and help, i will post my working code soon.

U r a true Genius :).

Thanks and Regards
Brijesh
Hello Jean-Marc,

I am stuck in a weird situation, getting these errors while setting the fonts for 2.9" E-paper display code is below.


Code: [Select]
******************Sketch***************
#include <WiFi.h>
#include <M5Stack.h>
#include <GxEPD.h>
#include <GxGDEH029A1/GxGDEH029A1.cpp>
#include <GxIO/GxIO_SPI/GxIO_SPI.cpp>
#include <GxIO/GxIO.cpp>

#include GxEPD_BitmapExamples
GxIO_Class io(SPI, SS, 17, 16);
GxEPD_Class display(io, 16, 3);
//BUSY -> 3, RST -> 16, DC -> 17, CS -> SS(5), CLK -> SCK(18), DIN -> MOSI(23), GND -> GND, 3.3V -> 3.3V
#define DEMO_DELAY 30
const char* ssid = "***************";
const char* password = "****************";



void setup() {
// put your setup code here, to run once:
Serial.begin(115200);
M5.begin();
display.init();
Serial.println();
Serial.println("setup");
Serial.println("setup done");
WiFi.mode(WIFI_STA);
WiFi.begin(ssid, password);

while (WiFi.status() != WL_CONNECTED) {
  delay(500);
  Serial.print(".");
}

Serial.println("");
Serial.println("WiFi connected");  
Serial.println("IP address: ");
Serial.println(WiFi.localIP());
}

void loop() {
// put your main code here, to run repeatedly:
 M5.Lcd.setTextColor(TFT_WHITE);
 M5.Lcd.setCursor(10, 20);
 M5.Lcd.setFreeFont(&FreeSans18pt7b);
 M5.Lcd.print("Success");
 showPartialUpdate();
}

void showPartialUpdate()
{
// use asymmetric values for test
uint16_t box_x = 10;
uint16_t box_y = 15;
uint16_t box_w = 70;
uint16_t box_h = 20;
uint16_t cursor_y = box_y + box_h - 6;
float value = 13.95;

display.setFont(&FreeSans18pt7b); // This is the TROUBLEMAKER. Code runs fine, if i comment this one.//

display.setTextColor(GxEPD_BLACK);
display.setRotation(0);
// draw background
display.update();
delay(1000);

// partial update to full screen to preset for partial update of box window
// (this avoids strange background effects)
display.updateWindow(0, 0, GxEPD_WIDTH, GxEPD_HEIGHT, false);

// show where the update box is
for (uint16_t r = 0; r < 4; r++)
{
  display.setRotation(r);
  display.fillRect(box_x, box_y, box_w, box_h, GxEPD_BLACK);
  display.updateWindow(box_x, box_y, box_w, box_h, true);
  delay(1000);
  display.fillRect(box_x, box_y, box_w, box_h, GxEPD_WHITE);
  display.updateWindow(box_x, box_y, box_w, box_h, true);
}
// show updates in the update box
for (uint16_t r = 0; r < 4; r++)
{
  // reset the background
  display.setRotation(0);
  display.drawExampleBitmap(BitmapExample1, 0, 0, GxEPD_WIDTH, GxEPD_HEIGHT, GxEPD_BLACK);
  display.updateWindow(0, 0, GxEPD_WIDTH, GxEPD_HEIGHT, false);
  display.setRotation(r);
  for (uint16_t i = 1; i <= 10; i++)
  {
    display.fillRect(box_x, box_y, box_w, box_h, GxEPD_WHITE);
    display.setCursor(box_x, cursor_y);
    display.print(value * i, 2);
    display.updateWindow(box_x, box_y, box_w, box_h, true);
    delay(2000);
  }
  delay(2000);
  display.fillRect(box_x, box_y, box_w, box_h, GxEPD_WHITE);
  display.updateWindow(box_x, box_y, box_w, box_h, true);
}
// should have checked this, too
box_x = GxEPD_HEIGHT - box_x - box_w - 1; // not valid for all corners
// should show on right side of long side
// reset the background
display.setRotation(0);
display.drawExampleBitmap(BitmapExample1, 0, 0, GxEPD_WIDTH, GxEPD_HEIGHT, GxEPD_BLACK);
display.updateWindow(0, 0, GxEPD_WIDTH, GxEPD_HEIGHT, false);
// show where the update box is
for (uint16_t r = 0; r < 4; r++)
{
  display.setRotation(r);
  display.fillRect(box_x, box_y, box_w, box_h, GxEPD_BLACK);
  display.updateWindow(box_x, box_y, box_w, box_h, true);
  delay(1000);
  display.fillRect(box_x, box_y, box_w, box_h, GxEPD_WHITE);
  display.updateWindow(box_x, box_y, box_w, box_h, true);
}
// show updates in the update box
for (uint16_t r = 0; r < 4; r++) // avoid
{
  // reset the background
  display.setRotation(0);
  display.drawExampleBitmap(BitmapExample1, 0, 0, GxEPD_WIDTH, GxEPD_HEIGHT, GxEPD_BLACK);
  display.updateWindow(0, 0, GxEPD_WIDTH, GxEPD_HEIGHT, false);
  display.setRotation(r);
  if (box_x >= display.width()) continue; // avoid delay
  for (uint16_t i = 1; i <= 10; i++)
  {
    display.fillRect(box_x, box_y, box_w, box_h, GxEPD_WHITE);
    display.setCursor(box_x, cursor_y);
    display.print(value * i, 2);
    display.updateWindow(box_x, box_y, box_w, box_h, true);
    delay(2000);
  }
  delay(2000);
  display.fillRect(box_x, box_y, box_w, box_h, GxEPD_WHITE);
  display.updateWindow(box_x, box_y, box_w, box_h, true);
}
}



******************Error***************
C:\Users\Brijesh\AppData\Local\Temp\arduino_build_630820\sketch\app_v0.0002.ino.cpp.o:(.literal._Z17showPartialUpdatev+0xc): undefined reference to `GxFont_GFX::setFreeFont(GFXfont const*)'

C:\Users\Brijesh\AppData\Local\Temp\arduino_build_630820\sketch\app_v0.0002.ino.cpp.o: In function `setup()':

C:\Users\Brijesh\M5Stack\app_v0.0002/app_v0.0002.ino:212: undefined reference to `GxFont_GFX::setFreeFont(GFXfont const*)'

collect2.exe: error: ld returned 1 exit status
*********************************

*****************GxFont_GFX_H declaration**************
#ifndef _GxFont_GFX_H_
#define _GxFont_GFX_H_

#include <Adafruit_GFX.h>

// select the library/libraries to add, none to preserve code space
//#include <U8g2_for_Adafruit_GFX.h>
//#include <Adafruit_ftGFX.h>
//#include <GxFont_GFX_TFT_eSPI.h>

*****************Error**************
Code: [Select]
Title: Re: Waveshare e-paper displays with SPI
Post by: ZinggJM on Mar 31, 2018, 01:25 pm
@bmishra4

Please put code into code tags, the "</>"-symbol top left. If you started with Quote, you can click Preview to get the window with the symbol bar.

Please apply code tags to your previous post by clicking More on down right and modify.

Please check the version of the library in file library.properties, actual is "version=2.3.8".

I have check-compiled the actual version just now for ESP8266 and ESP32 on my notebook used for tests, and it compiled without errors. My Arduino Version is 1.8.5.

The compiler should automatically include code from GxFont_GFX.cpp, as it is in the top directory.

Jean-Marc

SetFreeFont() should be unknown when //#include <GxFont_GFX_TFT_eSPI.h> is commented out.
Title: Re: Waveshare e-paper displays with SPI
Post by: bmishra4 on Mar 31, 2018, 02:00 pm
Thanks for your quick reply Jean-Marc,

library.properties, actual is "version=2.3.8". = OK

My Arduino Version is 1.8.5. = OK

I am still lost, whenever i comment the below line it runs fine but the e-paper prints in very small fonts.

Code: [Select]
display.setFont(&FreeSans18pt7b); // This is the TROUBLEMAKER. Code runs fine, if i comment this one.//

If i uncomment the above line, i get the following error.

Code: [Select]
C:\Users\Brijesh\AppData\Local\Temp\arduino_build_703308\sketch\app_v0.0001.ino.cpp.o:(.literal._Z17showPartialUpdatev+0xc): undefined reference to `GxFont_GFX::setFreeFont(GFXfont const*)'

C:\Users\Brijesh\AppData\Local\Temp\arduino_build_703308\sketch\app_v0.0001.ino.cpp.o: In function `setup()':

C:\Users\Brijesh\Documents\Arduino\libraries\GxEPD/GxIO/GxIO_SPI/GxIO_SPI.cpp:523: undefined reference to `GxFont_GFX::setFreeFont(GFXfont const*)'

collect2.exe: error: ld returned 1 exit status


Thanks for your efforts and help.

Regards
Brijesh
Title: Re: Waveshare e-paper displays with SPI
Post by: ZinggJM on Mar 31, 2018, 02:45 pm
I don't understand what happens. try to comment out the following lines:

Code: [Select]
M5.Lcd.setTextColor(TFT_WHITE);
 M5.Lcd.setCursor(10, 20);
 M5.Lcd.setFreeFont(&FreeSans18pt7b);
 M5.Lcd.print("Success");
Title: Re: Waveshare e-paper displays with SPI
Post by: bmishra4 on Mar 31, 2018, 03:03 pm
Getting error now, i reinstalled your lib again for "version=2.3.8". Now its not working at all.

Earlier i was using Version=2.3.6, it worked when i comment 
Code: [Select]
display.setFont(&FreeSans18pt7b); // This is the TROUBLEMAKER. Code runs fine, if i comment this one.//

It seems some kind of issue with M5Stack fonts, may be declaration or anything (sorry about my bad writting, m not sure actually)

Code: [Select]
In file included from C:\Users\Brijesh\Documents\Arduino\libraries\M5Stack\src/Fonts/Font16.h:1:0,

                 from C:\Users\Brijesh\Documents\Arduino\libraries\GxFont_GFX_TFT_eSPI/GxFont_GFX_TFT_eSPI.h:33,

                 from C:\Users\Brijesh\Documents\Arduino\libraries\GxEPD/GxFont_GFX.h:31,

                 from C:\Users\Brijesh\Documents\Arduino\libraries\GxEPD/GxEPD.h:20,

                 from C:\Users\Brijesh\app_v0.0001\app_v0.0001.ino:7:

:\Users\Brijesh\Documents\Arduino\libraries\M5Stack\src/Fonts/Font16.c:8:42: error: redefinition of 'const unsigned char widtbl_f16 [96]'

 PROGMEM const unsigned char widtbl_f16[96] =         // character width table

                                          ^

In file included from C:\Users\Brijesh\Documents\Arduino\libraries\M5Stack\src/Fonts/Font16.h:1:0,

                 from C:\Users\Brijesh\Documents\Arduino\libraries\M5Stack\src/utility/Display.h:221,

                 from C:\Users\Brijesh\Documents\Arduino\libraries\M5Stack\src/M5Stack.h:97,

                 from C:\Users\Brijesh\app_v0.0001\app_v0.0001.ino:4:

C:\Users\Brijesh\Documents\Arduino\libraries\M5Stack\src/Fonts/Font16.c:8:29: note: 'const unsigned char widtbl_f16 [96]' previously defined here

 PROGMEM const unsigned char widtbl_f16[96] =         // character width table

                             ^

In file included from C:\Users\Brijesh\Documents\Arduino\libraries\M5Stack\src/M5Stack.h:97:0,

                 from C:\Users\Brijesh\app_v0.0001\app_v0.0001.ino:4:

C:\Users\Brijesh\Documents\Arduino\libraries\M5Stack\src/utility/Display.h:398:24: note: 'const fontinfo fontdata [9]' previously defined here

Title: Re: Waveshare e-paper displays with SPI
Post by: ZinggJM on Mar 31, 2018, 03:41 pm
Try just with unmodified example GxEPD_SPI_TestExample.
Title: Re: Waveshare e-paper displays with SPI
Post by: bmishra4 on Mar 31, 2018, 03:51 pm
Thanks ZinggJM,

Its working fine, with *unmodified* skctch.

I identified that the Issue occurs when i try to add M5Stack in to the sketch.

Looks some kind of font declaration in M5Stack library is causing the issue.

Attached is the screenshot of the board information and the M5Stack library installation folder.

M5Stack also has a folder Font in its library and it is also using Adafruit GFX lib. The problem starts when i try to marge both M5Stack.h and GxEPD display.setfont function.

Thanks and Regards
Brijesh

Title: Re: Waveshare e-paper displays with SPI
Post by: heynsheyns on Apr 01, 2018, 07:37 pm
Hi there,

I'd like to push to 4 of the 7.5" e-paper displays from waveshare. They don't need to refresh in parallel, though that would be nice. Can the ESP32 handle this with the GxEPD library? I haven't actually purchased anything yet, so if there's something else I should get I'd love to know.

Thank you!

Title: Re: Waveshare e-paper displays with SPI
Post by: ZinggJM on Apr 01, 2018, 08:18 pm
For 7.5" b/w : 640 * 384 / 8 bytes per display buffer, size is 30'730 bytes, * 4 displays is 122'880 bytes.

For 7.5" b/w/r : 4 displays is double, 245'760 bytes.

ESP32 has 294'912 bytes maximum.

So this should be possible with GxEPD. No support for parallel refresh.

GxEPD2 uses less RAM thanks to paged drawing / picture loop, and buffer space can be adapted.
Also no support for parallel refresh. Experienced programmer might achieve this.
Code: [Select]

// this should work
bool b1, b2, b3, b4 = true;
display1.firstPage();
display2.firstPage();
display3.firstPage();
display4.firstPage();
do
{
  if (b1) display1.drawXXX();
  if (b2) display2.drawXXX();
  if (b3) display3.drawXXX();
  if (b4) display4.drawXXX();
  if (b1) b1 = display1.nextPage();
  if (b2) b2 = display2.nextPage();
  if (b3) b3 = display3.nextPage();
  if (b4) b4 = display4.nextPage();
}
while (b1 || b2 || b3 || b4);


Ok, looks nice, but refresh is not parallel. I seem to be tired.

No guarantee that I calculated correctly.

I have posted a picture for this with ESP8266 and ESP32, and for GxEPD there is an example GxEPD_SPI_MultiExample showing shared RST and BUSY lines. Search for multiple displays, maybe.

Jean-Marc

Title: Re: Waveshare e-paper displays with SPI
Post by: ZinggJM on Apr 02, 2018, 06:45 am
Missing parallel refresh for multiple displays with GxEPD and GxEPD2.

Screen refresh followed by _waitWhileBusy() is not at the end of update() in GxEPD or nextPage() in GxEPD2. Therefore parallel refresh can't be achieved easily.

Both libraries currently are not multithread-safe, because they don't use true SPI transactions.
I consider making GxEPD2 multithread-safe in a future version.
This would allow using threading in the application to achieve parallel refresh for multiple displays, but would require separate BUSY pin for each display.

Feedback on the need for this enhancement is welcome.

Jean-Marc

Title: Re: Waveshare e-paper displays with SPI
Post by: bmishra4 on Apr 02, 2018, 07:26 am
Hello Jean-Marc,

Any help or suggestion to make the GxEPD work with M5Stack, will be highly appreciated.

I am trying my level best not to bother you again and again but unfortunately, have no choice.

Thanks and Regards
Brijesh
Title: Re: Waveshare e-paper displays with SPI
Post by: ZinggJM on Apr 02, 2018, 08:37 am
Hello Jean-Marc,

Any help or suggestion to make the GxEPD work with M5Stack, will be highly appreciated.

I am trying my level best not to bother you again and again but unfortunately, have no choice.

Thanks and Regards
Brijesh
Hi Brijesh,

I had not noticed your addition to your last post.

Your previous posts were confusing and inconsistent. It looks like you had 2 variants of GxFont_GFX.h, one with fonts additions un-commented and one original.

Make sure you have only one GxEPD library installed, with original GxFont_GFX.h, and post the error message again.

The issue most likely arises from the Adafruit_GFX font files not having the multiple #include protection like in gfxfont.h :


Code: [Select]
#ifndef _GFXFONT_H_
#define _GFXFONT_H_


Maybe you just need to comment-out the fontfile include for GxEPD in your code.

Compare the two gxfont.h files; maybe you just need to copy the actual one from Adafruit_GFX over.

Jean-Marc
Title: Re: Waveshare e-paper displays with SPI
Post by: ZinggJM on Apr 02, 2018, 09:16 am
Using one library that uses Adafruit_GFX and another library that uses a copy of Adafruit_GFX will not work.

Even after resolving multiple #include most likely the linker will complain.

You need to find out the controller used by your TFT and the physical connection. Then you need to find a library that either does not use Adafruit_GFX code or uses standard Adafruit_GFX by inclusion and inheritance.
Title: Re: Waveshare e-paper displays with SPI
Post by: snoopy1492 on Apr 02, 2018, 05:40 pm
Hi!

First of all, huge thanks to you for this library.
I have been using it for my project with a waveshare 1.54" and it's been a breeze to work with.

As i said, I've been using the GDEP015OC1, and my program relies on the partial update this display supports.

Unfortunately, as I'm switching gears in my project and going a bit bigger, such a small display will not do.

The 4.2" seems great, you've implemented a partial update on you own (kudos !), but how fast is it and is it reliable ?

Or is there another display you'd recommend around this size that support partial update ?

Thanks very much for any hindsight you could give !

Also, quick question not related to your library, does any of you have any link or idea to install a front light system to one of those displays ?
Title: Re: Waveshare e-paper displays with SPI
Post by: ZinggJM on Apr 02, 2018, 06:38 pm
Hi snoopy,

The 4.2" b/w is the only mid-size e-paper display I have a partial update waveform table for so far.
It seems reliable; the current library from Waveshare now uses a similar waveform table.
I have not measured the speed; it might be around half as fast as the 1.54.
But e-paper displays are rather for static displays, there may be a tradeoff between update frequency and life expectancy. The 1.54" b/w is amazing, it passed several 49 days periods with 1 s update frequency and still works fine.

Dalian Good Display now has e-paper panels with front-light. www.good-display.com (http://www.good-display.com). Some of them are also available on their shop on AliExpress:
https://goodisplay.aliexpress.com/store/600281 (https://goodisplay.aliexpress.com/store/600281)

Jean-Marc
Title: Re: Waveshare e-paper displays with SPI
Post by: snoopy1492 on Apr 02, 2018, 07:02 pm
Merci Jean-Marc !

Didn't know waveshare added partial update to the 4.2" now.

As for the display from Good Display with front lightning, I saw them but the biggest one compatible is the 2.13 inch which is a bit too small.

I think I'll try something my way on the 4.2"

Thanks !
Title: Re: Waveshare e-paper displays with SPI
Post by: flyingbaloon on Apr 03, 2018, 04:50 pm
Hello !

Many thanks for the library !

I have a 7.5 inch b/w/r display with me , and I am able to  run the sample provided on the https://www.waveshare.com/wiki/7.5inch_e-Paper_HAT_(B) page  ,  the sample runs fine  on esp32 .

now i want to display my own image using that code ,  I took a 640 * 384  image  and tried to break it into two and used Image2lcd  v 3.2  to convert the two parts  into arrays . and then i replaced the array data in the original code in the place of IMAGE_DATA_1 and IMAGE_DATA_2 .  but  nothing is getting displayed .


The options used in Image2Lcd   are  scan mode : vertical  ,  Bits pixel : 4 color  , (could not find 4 level gray scale option as pointed in the wiki page)  ,  maxWidth * height : 640 * 384


could you please  help me display a 640 * 384 image on this display .  Thanks



Title: Re: Waveshare e-paper displays with SPI
Post by: ZinggJM on Apr 03, 2018, 05:37 pm
GxEPD2_32 (https://github.com/ZinggJM/GxEPD2_32) supports this display with class GxEPD2_32_3C, but without bitmap example so far.

3-color pictures can be drawn by drawing a b/w bitmap and a r/w bitmap, see GxEPD2_32_Example.ino

I do not know the bitmap format Waveshare uses, but the Dalian Good Display demo example uses 2 bits per pixel, one for b/w and one for r/w. The native format for the display panel is 2 bits for each color.

Jean-Marc
Title: Re: Waveshare e-paper displays with SPI
Post by: flyingbaloon on Apr 03, 2018, 08:19 pm
Thanks , I will check it out
Title: Re: Waveshare e-paper displays with SPI
Post by: djmusic on Apr 07, 2018, 11:13 pm
Hello ZinggJM,

Thanks to the library.

You've helped me once, so I'm counting on your help. I have two esp-12e. The first esp-12e is as AP and sends data from sensors after UDP. The second esp-12e receives data and displays it on the 2.9 "b / w display. Everything works very well, I just do not know why there is a delay of 5s between the transmitter and the receiver.

Changing the value in #define GxGDEH029A1_PU_DELAY from 300 to 30 a little improves but about 1-2s. But then there is an ugly picture.

I connected the OLED display and this problem was not there. As there was a change in the value in the transmitter it immediately appeared on the display in the receiver.

The UDP transmission between the transmitter and the receiver without displays was also very fast.

Maybe you have an idea what can cause such a delay?

library.properties, "version=2.3.8"
My Arduino Version is 1.8.1

Thanks and Regards
David
Title: Re: Waveshare e-paper displays with SPI
Post by: ZinggJM on Apr 08, 2018, 06:54 am
Hi djmusic,

My IoT_Display uses TCP and updates every 3 minutes temperature and humidity values.

The PartialUpdateTest example updates every 2 seconds with 2.9" b/w display; this is the maximum I would use with this display.

I have not used e-paper with UDP on any processor so far, so I have no experience to answer your question.

The _waitWhileBusy() method does not just "wait busy", but repeatedly calls delay(1), which does yield() on ESP8266. This should allow the processor to handle asynchronous reception.

You can try with different delay times, up to e.g. 100; please report if this helps. Or you can replace delay(1) with yield() for ESP8266.

If your issue persists, I will do some test myself, some time soon.

Jean-Marc
Title: Re: Waveshare e-paper displays with SPI
Post by: vmz on Apr 15, 2018, 09:32 pm
But e-paper displays are rather for static displays, there may be a tradeoff between update frequency and life expectancy. The 1.54" b/w is amazing, it passed several 49 days periods with 1 s update frequency and still works fine.
So, considering ~1000000 refresh limit from the display spec, how long could it actually last in this mode with your partial update algorithm? 49*3*24*60*60 is already close to 13 million updates for three 49-days periods, at least for some pixels/cells. Could it be that your algorithm actually negates degradation so that the display can be used forever in this mode? Okay, not forever, but for many years

I have a use case in which I need to gradually increase a filled circle sector which represents a progress of a 1-hour interval (like in this picture: https://i.stack.imgur.com/jwZ9k.png (https://i.stack.imgur.com/jwZ9k.png)). So for 200x200 display resolution I will have 4*200 = 800 possible increments, which gives minimal refresh interval = 60*60/800 = 4.5 seconds, though I can increase it even further to about 10 seconds. I will run this continuously for about 16 hours/day, and I want a display to last as long as possible (10 years will be good). I wonder if this 1.54" e-paper display can fit my need
Title: Re: Waveshare e-paper displays with SPI
Post by: ZinggJM on Apr 15, 2018, 10:11 pm
This is a question I can't answer, and I think nobody really can.
From my experience I can only say that the different e-paper displays have different degradation behavior with partial update. The 1.54" b/w works well with 1s partial update period and one full update every 6 hours to "clean" degradation. The 2.9" works with 2s and full update once every hour.

The COG TFT kind panel should have similar life expectancy as a normal TFT, but uses higher voltages.
But the life expectancy of the "ink" fluid may be less well known.

Asking for 10 years life may be a bit optimistic in this short lived electronic world.
Title: Re: Waveshare e-paper displays with SPI
Post by: ZinggJM on Apr 18, 2018, 10:22 am
A new version of GxGDEW075Z09 for 7.5" 3-color e-paper display is available in GxEPD, thanks to sponsors Korstiaan (@korstiaan) and Christian (@opendocumentary).

This display class needs more RAM for full buffer display than ESP8266 has available.
Full buffer is available e.g. on ESP32, STM32F4, Arduino Due.
Paged drawing is available on AVR, ESP8266, STM32F1.

Buffered drawing using update() method with AVR, ESP8266, STM32F1 will show stripes of buffer content.

Jean-Marc
Title: Re: Waveshare e-paper displays with SPI
Post by: ZinggJM on Apr 18, 2018, 02:50 pm
Added Support for Bitmaps (Sprites) to Controller Buffer and to Screen to library GxEPD2_32.

the bitmaps can reside in RAM or ROM, parameter pgm, default RAM
origin x and width should be multiple of 8, are rounded down
cropping to screen dimensions is handled
allows tiled drawing for bitmaps from SD, SPIFFS or WiFi download
use e.g. writeImage(...) for each tile, followed by refresh() for all

Code: [Select]
    //  Support for Bitmaps (Sprites) to Controller Buffer and to Screen
    void clearScreen(uint8_t value = 0xFF); // init controller memory and screen (default white)
    void writeScreenBuffer(uint8_t value = 0xFF); // init controller memory (default white)
    // write to controller memory, without screen refresh; x and w should be multiple of 8
    void writeImage(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);
    void writeImage(const uint8_t* black, const uint8_t* red, int16_t x, int16_t y, int16_t w, int16_t h, bool invert = false, bool mirror_y = false, bool pgm = false);
    // 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);
    void drawImage(const uint8_t* black, const uint8_t* red, int16_t x, int16_t y, int16_t w, int16_t h, bool invert = false, bool mirror_y = false, bool pgm = false);
    void refresh(); // screen refresh from controller memory to full screen
    void refresh(int16_t x, int16_t y, int16_t w, int16_t h); // screen refresh from controller memory, partial screen


GxEPD2_32_Example shows use with bitmaps in program space, with 200x200 example bitmaps.
I intend to add more examples using this feature.

Jean-Marc
Title: Re: Waveshare e-paper displays with SPI
Post by: kvik86 on Apr 18, 2018, 10:57 pm
Hi,

I'm having problems with getting a Waveshare 2.13" working.
I have a custom pcb with the "hat" functionality and an STM32. I'm using the demo code from waveshare.
The most obvious problem is that it looks like the busy signal is not driven by the display. It does not respond to any of the spi commands. VCI is okay, reset, dc, cs, mosi are all fine.
I checked the signals with a logic analyzer, the spi from the stm32 looks fine, but nothing happens: no busy, gdr etc driven. (checked busy by setting pullup or downs: the display does not drive it)
This was my second day trying to get it work, but completely lost.
I have two displays, both "behave" the same way.

Please help, how can I find the root cause of the problem..?
Title: Re: Waveshare e-paper displays with SPI
Post by: ZinggJM on Apr 19, 2018, 06:19 am
Hi kvik86,

Does your pcb tie the BS signal to the display to ground? BS 0 selects 4-line SPI, with DC line, BS high selects 3-line SPI with DC in 9bit data.

What SPI speed did you measure with the logic analyzer. 4MHz is normal, 10MHz is maximum according to specs.

Good Luck!

Jean-Marc
Title: Re: Waveshare e-paper displays with SPI
Post by: kvik86 on Apr 19, 2018, 12:01 pm
Hi Jean-Marc,

BS1 is on GND (4-wire SPI), SPI clock is 4MHz (measured it).
Title: Re: Waveshare e-paper displays with SPI
Post by: ZinggJM on Apr 19, 2018, 01:19 pm
I assume your pin-mapping corresponds to the pin definitions in epdif.h, and you use the correct library for your display; you didn't tell if it is a b/w or 3-color e-paper.

You could also make sure that all connections make good contact; remove power and measure resistance between pins on the backside of the connector of the display board to the pin on the processor. And take a look at the flexible flat cable connection of the e-paper panel.

And of course check VCC and GND connections.
Title: Re: Waveshare e-paper displays with SPI
Post by: kvik86 on Apr 19, 2018, 03:30 pm
Oh no...
Silly me, this was my first time with an FPC connector. It looks like I selected a bottom type instead of a top connector type. By looking at it, it seemed like there is connection at the top. I wasn't aware it was bottom only type. Also after closing the copper on the display cable is completely hidden by the door mechanism.
Title: Re: Waveshare e-paper displays with SPI
Post by: ssozonoff on Apr 19, 2018, 03:37 pm
Hi Guys,

Just started experimenting with the GxGDEW0154Z04

I have seen this video Video (https://youtu.be/UBEhod2wxvE) where the seconds count is changing smoothly every second. Given the refresh issues of the 1.54" r/b/w display, can someone confirm that this is simply not possible with the 3 couler version.

I am simply writing text to the display using the display.println() method but it seems impossible to do so without going through the painfully slow screen flickering stage.

Thanks,
Serge
Title: Re: Waveshare e-paper displays with SPI
Post by: ZinggJM on Apr 19, 2018, 03:45 pm
@kvik86,

Good, this would have been hard to diagnose from distance, especially if I forgot in between that you made your own board.

Could you share with us a picture of your board, or even more details? Maybe someone else would like to reproduce it. How difficult was it to solder the 0.5mm spaced connections?

Jean-Marc

Title: Re: Waveshare e-paper displays with SPI
Post by: ZinggJM on Apr 19, 2018, 03:57 pm
@ssonozonoff,

Yes, I can confirm that this is not possible with 3-color e-paper displays.
Black / white e-paper displays can do the screen refresh based on the difference to the previous display; this is used for partial update. 3-color displays don't use difference because of the physical method to move black and red particles based on speed difference, the red particles are bigger. Red particles move slower, but are moved by a lower voltage. Even with lower voltage, the black ones move also, and need be torn back with short pulses. This "requires" the fast flashes towards the end of the refresh.

Black / white e-paper displays usually also use flashing for full update, to "clear" the image from ghosting from previous images.

Jean-Marc
Title: Re: Waveshare e-paper displays with SPI
Post by: kvik86 on Apr 19, 2018, 05:26 pm
@ZinggJM

I'll get back in a few days after I got the fixed pcb.
The soldering was pretty easy. Having no contact at all explains everything.
Title: Re: Waveshare e-paper displays with SPI
Post by: isenberg on Apr 26, 2018, 11:12 pm
I am using the Waveshare 2.7'' b/w/r e-Paper HAT (B) together with an ESP32, yet the red comes out very washed out toward the edges and by far not as strong as, for example, on a 4.2" b/w/r Waveshare module (black and white works fine). I am using the GxGDEW027C44 resp. GxGDEW042Z15 libraries, both with the same setup for the e-ink modules. I tried both my own code and the GxEPD_SPI_TestExample.ino example. Any suggestion on what to do? It seems that the GxGDEW027C44 and GxGDEW042Z15 libraries implement the communication somewhat differently, yet should the only difference not be the size of the display?

Anyway, any help would be much appreciated!
Title: Re: Waveshare e-paper displays with SPI
Post by: ZinggJM on Apr 27, 2018, 07:47 am
Hi Isenberg,

Make sure the Display Config switch on the e-Paper HAT is set to the correct position.

The GDEW027C44 has the IL91874 controller, the GDEW042Z15 has the IL0398 controller, as you can see in the corresponding header files or on the good-display.com web page.

The different controllers have different commands and setup parameters, so the "communication" is different. And my display classes for GxEPD are derived from the different demo codes from Good Display.

My GDEW027C44 display is rather "old", and the display class is based on an older version of the demo code, most likely. I can check if the actual demo code uses different parameter values.

You should check your display with the actual demo code from Waveshare, so you can communicate and "complain" with Waveshare. Report back if the Waveshare code gives better results.

Jean-Marc

Title: Re: Waveshare e-paper displays with SPI
Post by: E_Paper_User on May 01, 2018, 08:50 am
Little off topic but i did not know where to put this information. I use these following components:

https://www.waveshare.com/product/7.5inch-e-paper-b.htm (https://www.waveshare.com/product/7.5inch-e-paper-b.htm)

https://www.waveshare.com/e-paper-esp8266-driver-board.htm (https://www.waveshare.com/e-paper-esp8266-driver-board.htm)


I got the "GxEPD_SPI_TestExample" from ZinggJM runnig. Thank you for that! I want to share the right configuration for getting started:



Code: [Select]


// First you have to uncommand:

include <GxGDEW075Z09/GxGDEW075Z09.cpp>

// Second configure the right SPI Ports (under "if defined ESP8266"):

GxIO_Class io(SPI, /*CS=D8*/ SS, /*DC=D3*/ 4, /*RST=D4*/ 5); // selected after Waveshare "Loader" example-code. There is the epd.h file with defines the right SPI ports on the wvaeshare e-paper driver board
GxEPD_Class display(io, /*RST=D4*/ 5, /*BUSY=D0*/ 16); // selected after Waveshare "Loader" example-code

 


That´s all. After flashing, the example should run. Nice an easy way to use the 7.5" E-Ink Display because all the wiring is already done!

Title: Re: Waveshare e-paper displays with SPI
Post by: ZinggJM on May 01, 2018, 12:07 pm
Thank you very much for this helpful link and information!

I should visit the Waveshare web shop more often!

Unfortunately they chose D0 for BUSY. D0 should be left free for deep sleep wakeup, to connect to RST.

So I can't use this for a wall mounted battery operated sensor display.

Jean-Marc

Title: Re: Waveshare e-paper displays with SPI
Post by: E_Paper_User on May 03, 2018, 06:00 am
Right!

Using the D0 is also not my best compromise!

As you said, the display is predestinated for some weather station including battery use. But without deep sleep?.....

I´ll think about it. When it got some idea, i will share!

Michael
Title: Re: Waveshare e-paper displays with SPI
Post by: georg77cz on May 03, 2018, 10:30 am
Hi, I'd like to ask you for help as I wasn't able to make it work with 4.2" waveshare/good display black/white/red e-ink.

I have Sparkfun ESP32 Thing with e-Paper HAT and I from GxEPD_SPI_TestExample I included <GxGDEW042Z15/GxGDEW042Z15.cpp> in my platformIO setup.

I can't see any updates on the e-ink (waveshare logo is shown) and this is the output from console:
Code: [Select]

Power On : 161901
drawPicture : 1
Power Off : 1
Power On : 1102952
drawPicture : 9
Power Off : 1
Power On : 216948
drawPicture : 462903
Power Off : 1
Power On : 1204948
drawBitmap : 5942
Power Off : 1
Power On : 1305952
update : 2
Power Off : 1
Power On : 1539960
drawCornerTest : 8461
Power Off : 1


e-Paper HAT configuration:
Display Config: B (Other)
Interface Config: 0 (4-line SPI)

Thank you
Title: Re: Waveshare e-paper displays with SPI
Post by: ZinggJM on May 03, 2018, 01:49 pm
Hi georg77cz,

Your diagnostic output looks completely strange.
If SPI does not work, or if BUSY is not connected ok, then either the values should all be low, e.g. <1000 microseconds, or all high and Busy Timeout.

Maybe your BUSY input acts as an antenna?

Have you connected GND and VCC? Do the FCP connections make good contact on the right side?

Do you call display.init() or display.init(115200)? I assume so, as you get diagnostic output.

Do your first test with GxEPD_SPI_TestExample. If it works, try your code.

Jean-Marc
Title: Re: Waveshare e-paper displays with SPI
Post by: georg77cz on May 04, 2018, 08:19 pm
Hi Jean-Marc,

thank you for your help.

It's true that I don't have soldered header pins to ESP32 board so there might be loose contact somewhere, I will check it again.

Both GND and VCC are properly connected, I posted a picture of the pinout to my previous post and I double checked everything but still, I might have done an error :)

I call display.init(115200), the output seems to be fine and I actually use GxEPD_SPI_TestExample (at first I tried a different one but then realized this is the best one for the first check).

Thanks
Jiri
Title: Re: Waveshare e-paper displays with SPI
Post by: AndersenJ on May 04, 2018, 10:04 pm
ZinggJM,

Thanks for all you've done with this driver; it's been a pleasure to use so far. I was wondering if you were aware of Waveshare's new 5.83" screens (https://www.waveshare.com/product/modules/oleds-lcds/e-paper/5.83inch-e-paper-hat.htm), and if you had plans to add support for them.

Thanks,
Johnathan
Title: Re: Waveshare e-paper displays with SPI
Post by: ZinggJM on May 04, 2018, 10:37 pm
Hi Johnathan,

I didn't know that Waveshare now has this display on offer, but I have already bought the 5.83" b/w from Good Display. I have prepared a display class for it for test, but have decided to not add it to the library for now.

The 5.83" b/w e-paper I have has a refresh time of ~30 15 seconds.

The Waveshare demo takes ~31 seconds, it uses a different PLL setting.

I do not know if the controller in my display has the waveform table for a 3-color display, or if all 5.83" have this long refresh time. I did not ask for more information yet.

See also my remark here (https://forum.arduino.cc/index.php?topic=436411.msg3712202#msg3712202)

Jean-Marc
Title: Re: Waveshare e-paper displays with SPI
Post by: AndersenJ on May 04, 2018, 10:53 pm
Well, the good news is that Waveshare's website lists the refresh rate of their 5.83" screen as being only 3.5 seconds. I don't know how accurate those numbers usually are. It's odd that you're having that issue with yours; that just doesn't seem right. Thanks for letting me know though, because we're aiming at a battery life of > 3 months for our current project, and needing to keep the ESP8266 on for that long each time we refresh the screen would shatter our dreams.
Title: Re: Waveshare e-paper displays with SPI
Post by: isenberg on May 06, 2018, 04:22 pm
Make sure the Display Config switch on the e-Paper HAT is set to the correct position.

The GDEW027C44 has the IL91874 controller, the GDEW042Z15 has the IL0398 controller, as you can see in the corresponding header files or on the good-display.com web page.

The different controllers have different commands and setup parameters, so the "communication" is different. And my display classes for GxEPD are derived from the different demo codes from Good Display.

My GDEW027C44 display is rather "old", and the display class is based on an older version of the demo code, most likely. I can check if the actual demo code uses different parameter values.

You should check your display with the actual demo code from Waveshare, so you can communicate and "complain" with Waveshare. Report back if the Waveshare code gives better results.

Jean-Marc
Thanks a lot for the explanation, Jean-Marc! (Sorry for the long silence, I was traveling.) The config switch is correct and I did get the Arduino version of the demo code to run on the ESP32, and it seems that the results are not fundamentally different. In fact, it seems that the quality of the red is improving over time, after I have done several switches between black and red. The sides are still fading a bit, but the overall intensity of the red is improving. For red it still also needs a few cycles to make ghost images from previous images disappear, but I can work with that. Anyway, thanks again for the help, the explanations, and the pointers.
Title: Re: Waveshare e-paper displays with SPI
Post by: ZinggJM on May 07, 2018, 01:37 pm
Well, the good news is that Waveshare's website lists the refresh rate of their 5.83" screen as being only 3.5 seconds. I don't know how accurate those numbers usually are. It's odd that you're having that issue with yours; that just doesn't seem right. Thanks for letting me know though, because we're aiming at a battery life of > 3 months for our current project, and needing to keep the ESP8266 on for that long each time we refresh the screen would shatter our dreams.
I got an answer from Good Display:

Quote
The type refresh time of 5.83'' B/W e-paper display is 3s, the maximum time is 6s. Waveshare is our distributors, so the controller is the same as our e-paper display's.
So there seems to be something wrong with the panel I received.

I would appreciate if someone could verify the refresh time with the Waveshare demo code; if it is low as claimed, I will add the display class to GxEPD anyway.

It has become obvious that I have a b/w panel with a controller with waveform table for 3-color display. If I use it with a display class for 3-color display (the 7.5" 3-color has the same controller), the red part becomes grey, and gets its final refresh at the end, as with real 3-color displays. Let's see if I get a panel with correct wavetable from Good Display.

Quote
I'm sorry that I didn't explain clearly in the last letter.

As I explained in previous mail, generally the initaliaztion refresh time is a little bit longer at 15s, after first picture refreshing, the continuous refresh time is 3.5s(typ)/6s(max).

If this reply could't answer your question, could you please explain your question again to me? Maybe I did't get your meaning clearly.  
So I need to check with their demo example, and maybe put the result on YouTube.

This is what I get with the demo program from Good Display, with some diagnostic output added:

Code: [Select]
setup() (original main())
pic_display
pic_display done
refresh done
lcd_chkstatus done in 14690871 microseconds
pic_display
pic_display done
refresh done
lcd_chkstatus done in 14692819 microseconds
setup() (original main()) done


Jean-Marc
Title: Re: Waveshare e-paper displays with SPI
Post by: Kastell on May 07, 2018, 11:10 pm
Dear Jean-Marc,
I'm trying for weeks to get the font demo to work.

1. I installed your modified "Adafruit_tfGFX libary" and "U8g2_for_Adafruit_GFX" from Olikraus.

2. Change the "GxFont_GFX.h" and activate "#include <U8g2_for_Adafruit_GFX.h>" and "#include <Adafruit_ftGFX.h>". Is it nessesary to activate "//#include <GxFont_GFX_TFT_eSPI.h>" too?

3. Uploaded the "GxFont_GFX_Example.ino" on my ESP8266 NodeMCU. The demo content is displayed, but unfortunately in the umlaut line the characters "ÄöÜäööü" are not displayed. But that's why I'm doing the whole thing ...

Maybe you have an idea what it could be?

best regards
Title: Re: Waveshare e-paper displays with SPI
Post by: ZinggJM on May 08, 2018, 07:58 am
Hi Kastell,

You are welcome to ask for help, no need to try for weeks first.

The GxFont_GFX_Example should show 2 different fonts of Adafruit_ftGFX.h, if this is enabled, one of it has Umlauts. For U8g2_for_Adafruit_GFX.h I have not looked for which fonts provide Umlauts; U8G2 has many fonts and a list of these fonts with example representation. You don't need GxFont_GFX_TFT_eSPI.h, this is just the first source of external fonts I had tried to add.

I am actually short of time, but will check this later today.

Jean-Marc

Which panel do you use? Maybe the line with the Umlauts at the end does not fit on the panel.

Sorry, I also don't see the Umlauts testing on my test-notebook. So I need to find out. It did work on my development notebook, next test is does it still, and what is the difference. I think u8g2_fontHelvR14_tf had Umlauts.
Title: Re: Waveshare e-paper displays with SPI
Post by: kvik86 on May 08, 2018, 09:44 am
@ZinggJM

I'll get back in a few days after I got the fixed pcb.
The soldering was pretty easy. Having no contact at all explains everything.
Forgot to reply :(
After "fixing the connector" (it was bottom only and the e-paper contacts were on the top) ie new pcb was designed and manufactured with reversed pins of the connector, everything worked like charm right away.
Yeey!
Title: Re: Waveshare e-paper displays with SPI
Post by: Kastell on May 08, 2018, 07:57 pm
Thanks for you answer Jean-Marc,
it´s the largest 7,5 inch display. There is very much space. And the Umlauts should be next to the word "Umlauts" but there is only the word. And no special characters next to that.

It´s the google open sans font font. That should also have special characters.

I hope this information will help you.

best regards
Title: Re: Waveshare e-paper displays with SPI
Post by: ZinggJM on May 08, 2018, 08:08 pm
This seems to be a very strange effect. It doesn't work on my test-notebook. It still worked on my development notebook, with, by comparison, the same version of GxEPD and U8g2_for_Adafruit_GFX.

But after having re-installed both, using zip download and zip install by library manager, it also works no longer. I have no idea yet why.
Title: Re: Waveshare e-paper displays with SPI
Post by: Kastell on May 08, 2018, 08:59 pm
That sounds really strange! I hope you find the problem. Thanks for your help
Title: Re: Waveshare e-paper displays with SPI
Post by: ZinggJM on May 09, 2018, 08:38 am
I will need to find out if this issue is caused by GxEPD or U8g2_for_Adafruit_GFX. It may relate with late changes for newline handling. I need to handle other things too, so this analysis may take some days.
Title: Re: Waveshare e-paper displays with SPI
Post by: nimio on May 09, 2018, 08:29 pm
Hello, i'm a total newbie with low programming skills, i can connect my 2.13" b/w e-paper Waveshare to an Arduino Mega and i can run the Waveshare libraries with examples and the GxEPD and GxEPD2_AVR libraries and run the programs but... i have not idea how to handle the code for my own ideas. Please, can someone tell me the basics for just write some text in the display? the elemental instructions or some GxEPD tutorial?

Thanks in advance.

Regards.
Title: Re: Waveshare e-paper displays with SPI
Post by: ZinggJM on May 10, 2018, 02:01 pm
I will need to find out if this issue is caused by GxEPD or U8g2_for_Adafruit_GFX. It may relate with late changes for newline handling. I need to handle other things too, so this analysis may take some days.
I did not find out. I tried with earlier versions of font support of GxEPD and all versions of U8g2_for_Adafruit_GFX. It happened to work once, but not reproducible. I give up for now, as it eats my time and my nerves.

GxEPD2_32 seems to work with U8g2_for_Adafruit_GFX with Umlauts.

Jean-Marc
Title: Re: Waveshare e-paper displays with SPI
Post by: Kastell on May 10, 2018, 02:06 pm
Hi, thanks for your efforts! Maybe I ask in a few weeks again? It's very strange :/
Title: Re: Waveshare e-paper displays with SPI
Post by: ZinggJM on May 12, 2018, 06:37 pm
Yes, its even more strange: I just tested with the 5.83" b/w display, and got the Umlauts shown.

From my experience, such strange behavior occurs with un-initialized variables. I will have to go searching and digging.
Title: Re: Waveshare e-paper displays with SPI
Post by: Kastell on May 12, 2018, 06:42 pm
Thank you for your efforts! I'm sitting right now and have a little question. Is it possible to draw horizon lines? I tried "drawFastHLine" but it did not work.
Title: Re: Waveshare e-paper displays with SPI
Post by: ZinggJM on May 12, 2018, 06:53 pm
drawFastHLine should work. It is a method of Adafruit_GFX and should draw to the display class buffer, and should show up after call to update() in GxEPD.

Btw: if drawFastHLine does not work reliably, U8g2_for_Adafruit_GFX could not work reliably, as it mostly uses this method as far as I know.
Title: Re: Waveshare e-paper displays with SPI
Post by: ZinggJM on May 12, 2018, 06:58 pm
I have added GxGDEW0583T7 for the 5.83" b/w 600x448 display.

My GDEW0583T7 panel has a refresh time of ~15 seconds.

Please report if you got this display with faster refresh time, or got a faster driver or demo.

Good Display is analyzing this long refresh time for a b/w e-paper display issue.

Jean-Marc
Title: Re: Waveshare e-paper displays with SPI
Post by: Kastell on May 12, 2018, 07:08 pm
I have a 7.5 inch waveshare epaper:
https://www.waveshare.com/7.5inch-e-paper-hat.htm

with HAT and a esp8266 nodemcu.
It is the black and white version.
Title: Re: Waveshare e-paper displays with SPI
Post by: fr on May 16, 2018, 10:55 pm
I used the 1.54" b/w in a long-time test successfully with 1s update period. It stops after 49 days because of uint32_t overflow, but shows no degradation.

The 2.9" b/w should not be used with less than 2s update period in my opinion. No long-time test done.

For stopwatch I would recommend a sunlight readable monochrome LCD, e.g.

128x64 128*64 COG 12864 LCD Module UC1701X (https://www.aliexpress.com/item/12864-LCD-screen-module-20PIN-KS0108-Oor-KS0107-controller-Red-word-on-the-black-background/32215047945.html)

but I have not yet tried to use it outside, or without backlight.

Without backlight it power consumption is low; there is a topic on this.
I am desperately looking for an example of an ino file and the schematic diagram that goes well
Title: Re: Waveshare e-paper displays with SPI
Post by: ZinggJM on May 17, 2018, 06:23 am
That goes well with what? The device the above link points to? As my post refers to three different displays you need to be specific.
Title: Re: Waveshare e-paper displays with SPI
Post by: fr on May 18, 2018, 12:36 pm
Thanks
I want test with sunlight
https://fr.aliexpress.com/item/12864-LCD-screen-module-20PIN-KS0108-Oor-KS0107-controller-Red-word-on-the-black-background/32215047945.html (https://fr.aliexpress.com/item/12864-LCD-screen-module-20PIN-KS0108-Oor-KS0107-controller-Red-word-on-the-black-background/32215047945.html)
on ESP32

Title: Re: Waveshare e-paper displays with SPI
Post by: ZinggJM on May 18, 2018, 03:58 pm
Aha, they now have a simplified board. But the panel is the same, most likely. I got mine from the same shop.

You connect it to the standard SPI pins of your ESP32 board, SCK to SCK, SDA to MOSI, CS usually to SS, RS and RST to what you choose, but needs to correspond to the constructor. As you did not specify your ESP32 board, you may need to look in pins_arduino.h, or pinout schematic of your board for the pin numbers. A picture of my wiring will not help, as I use it with Wemos D1 mini ESP8266.
Title: Re: Waveshare e-paper displays with SPI
Post by: tudro on May 18, 2018, 04:11 pm
Hello,

Sorry if this is not the right place to post, but i couldn't find any other place where people talk about the waveshare epaper.

I have a 7.5 inch b/w waveshare epaper. I connected it to a RPi zero w and implemented a weather station. Everything is similar to this https://f.ruuvi.com/t/weatherpaper/908 (https://f.ruuvi.com/t/weatherpaper/908)

The screen will refresh once per hour to update the info. Everything will be fine the first couple of hours, but then slowly the image displayed starts to lose contrast. Here are some examples:
(https://imgur.com/k3ZwFfx)
https://imgur.com/k3ZwFfx (https://imgur.com/k3ZwFfx)

(https://imgur.com/OBrsaSD)
https://imgur.com/OBrsaSD (https://imgur.com/OBrsaSD)

(https://imgur.com/B8TsQjc)
https://imgur.com/B8TsQjc (https://imgur.com/B8TsQjc)

If i leave the epaper to 'rest' for a few days, then it starts working fine again.

I am using waveshare libs to display stuff. The guy with the project on the ruuvi forum seems to have the same problem.

Did anybody experience such problems? Any advice? I looked through all the 40 pages, but i couldn't find anything. Sorry if i missed it or didn't understand it.

Thank you
Title: Re: Waveshare e-paper displays with SPI
Post by: fr on May 18, 2018, 07:08 pm
Aha, they now have a simplified board. But the panel is the same, most likely. I got mine from the same shop.

You connect it to the standard SPI pins of your ESP32 board, SCK to SCK, SDA to MOSI, CS usually to SS, RS and RST to what you choose, but needs to correspond to the constructor. As you did not specify your ESP32 board, you may need to look in pins_arduino.h, or pinout schematic of your board for the pin numbers. A picture of my wiring will not help, as I use it with Wemos D1 mini ESP8266.
An image of your wiring will help, because I could test the right way with Wemos D1 mini ESP8266.
I like to start from something that works
Title: Re: Waveshare e-paper displays with SPI
Post by: ZinggJM on May 18, 2018, 08:31 pm
@tudro,

This topic is about Waveshare e-paper displays, so you are welcome with your question.

The 7.5" b/w uses the same waveform table for full and for partial refresh, so this should not be the reason for your issue.

I assume you use the E-Paper HAT with Raspi; make sure the Display Config switch is set correctly.

I have a 7.5" b/w display in constant use with update every 3 minutes with no problems (connected through Good Display DESTM32-S2 to Wemos D1 mini ESP8266).

If you have a suitable Arduino (3.3V or series resistors on data lines) you could do a long term test with GxEPD examples.

I have never looked at the Waveshare library for Raspi, it should be similar to the Arduino version. It is important that the BUSY signal is handled correctly; commands sent while BUSY is active cause bad display.

Check that all connections make good contact.


Display refresh time should be ~4 seconds for the b/w 7.5", with noticeable flashing.

That's about what comes to my mind.

Jean-Marc

Title: Re: Waveshare e-paper displays with SPI
Post by: ZinggJM on May 18, 2018, 08:40 pm
@fr,

hope this helps.

Jean-Marc

(https://forum.arduino.cc/index.php?action=dlattach;topic=487007.0;attach=258331)
Title: Re: Waveshare e-paper displays with SPI
Post by: ZinggJM on May 19, 2018, 07:19 am
@XOIIO

Hi, I hope you don't mind getting quoted here; as this might interest other readers as well.

Quote
Hi zingg, I came across your post/library for the waveshare epaper displays and it was incredibly helpful, the waveshare wiki was useless when trying to get this to work as well as several other posts/libraries I found.

I'm going through the thread now, however that will take some time and it's been a long day lol, I was wondering if you had a list of the commands and what they do, and also a quick guide on how I convert images and add them in to the script, as it's different from some other methods I saw while researching, I'm guessing you did it using img2lcd but beyond that this is all new to me.

I also noticed on my 2.9 inch unit the first two images display properly but then whatever the third one is that starts to scroll only shows on the left third, hopefully that's just a bug having to do with using a pro mini with this as the sketch takes up 90% of the memory.

If there's a way to store the image information externally like on an sd card that would be pretty cool as well.

cheers.
The list of commands the controller(s) have can be found in the controller specs, there is a link in the header of every display class of GxEPD.

The methods of the display classes can be found in the header files of the classes, with only minimal description as comment.

I used image2lcd once with my first e-paper, a LinkSprite 4.3" e-paper on a pcDuino.

All bitmap examples in GxEPD are taken from demo source code from Good Display and Waveshare, and a few from contributors.

image2lcd seems to be the widest used image converter; you can find others in this forum.

I just started to learn how to use SD cards and present bitmaps from SD cards on displays.
The first lesson I just learned is to start with a well known example, not surprisingly one coming from Adafruit. Once this works with GxEPD instead of Adafruit_ST7735_Library, I can look at other examples and optimize for GxEPD and GxEPD2.

A preliminary version is available; only works with full buffer, not AVR.

Other examples I will look at are in MCUFRIEND_kbv and TFT_eSPI-master, also for SPIFFS.

And of course downloading bitmaps over WiFi with ESP8266 or ESP32 will be a further step; one example I know of is from Waveshare for their ESP8266 e-paper board (Loader.zip).

I would need to know more about your issue with the 2.9" with Arduino Pro Mini, to try to help.

Jean-Marc
Title: Re: Waveshare e-paper displays with SPI
Post by: fr on May 19, 2018, 07:32 am
Thanks !
Title: Re: Waveshare e-paper displays with SPI
Post by: tudro on May 19, 2018, 01:17 pm
@tudro,

This topic is about Waveshare e-paper displays, so you are welcome with your question.

The 7.5" b/w uses the same waveform table for full and for partial refresh, so this should not be the reason for your issue.

I assume you use the E-Paper HAT with Raspi; make sure the Display Config switch is set correctly.

I have a 7.5" b/w display in constant use with update every 3 minutes with no problems (connected through Good Display DESTM32-S2 to Wemos D1 mini ESP8266).

If you have a suitable Arduino (3.3V or series resistors on data lines) you could do a long term test with GxEPD examples.

I have never looked at the Waveshare library for Raspi, it should be similar to the Arduino version. It is important that the BUSY signal is handled correctly; commands sent while BUSY is active cause bad display.

Check that all connections make good contact.


Display refresh time should be ~4 seconds for the b/w 7.5", with noticeable flashing.

That's about what comes to my mind.

Jean-Marc


Thank you for your help.

Yes, i'm using the HAT and the Display Config is set correctly. I checked it so many times :) I also checked the connections many times.

What you say about the refresh is correct, ~4 seconds with noticeable flashing.

Unfortunately i don't have an Arduino to test your lib, too. I don't have the skills to check the stuff you said about the BUSY signal, but i think that it is handled correctly because sometimes it works great for many refreshes.

When i got the epaper i played with it for 4-5 days. I refreshed the screen at much smaller intervals than 1 hour and it worked great. It started having problems after i put it inside the picture frame. Could the fact that it's between the picture frame's glass and the cardboard on the back influence it somehow? Like here front (https://f.ruuvi.com/uploads/default/original/1X/dcf610299ede5654f39228a7f726247fbfc72eee.JPG)

Or maybe the fact that the connector is bent at the botton like here back (https://f.ruuvi.com/uploads/default/original/1X/192eed76211be3fbeb87717116671ff8a49575ee.JPG) is a problem?

After the first picture frame attempt i took it out and left it for a few days and then made it run the same code for hours and it worked ok. So i put it again back in the picture frame and after about 2-3 refreshes (2-3 hours) it started losing contrast again.

Now i have taken it out of the picture frame again and waiting a few days to see if it starts working properly again.

Thank you
Title: Re: Waveshare e-paper displays with SPI
Post by: ZinggJM on May 19, 2018, 02:40 pm
There could be an issue with static charge on your glass or picture frame. E-paper panels are susceptible to static charge. Temperature could also be an issue; someone posted that a strong flashlight is enough to get a "stained" picture.

If the display is refreshed with long intervals, it is important that the driver powers off the display, turns off the voltages used to drive the refresh (+-15V). I don't know if the Waveshare code does this. The controller even supports a deep sleep mode, where it can only be woken up by the RST signal.

Consider buying an ESP2866 or ESP32 board, e.g. Wemos D1 mini or Wemos LOLIN32 Lite, they are inexpensive, and it is worth to discover the Arduino world. For me it seems easier to have full control with Arduino boards than I would have with Raspi.

Btw: I also use a picture frame with my 7.5" b/w display.
Title: Re: Waveshare e-paper displays with SPI
Post by: XOIIO on May 19, 2018, 03:46 pm
Thanks jean, I was able to figure out some of my issues, and refined it slightly more now that I've slept, though sadly that didn't reduce the usage of global variables, my issue currently seems to be with the display class/resolution.

I found out about display.rotate which did work, however setting the cursor to 0.0 sets text too far up the screen, and when I try to fill the display with black, or print text, only the leftmost 1/3 (connector to the left) side of the display can update with text or the black color.

When I used the demo sketch, as I had mentioned in my pm the first two images did load across the whole display however which is quite odd. I'll have to look through the command list for the controller and see if there is a way to define the resolution, it should be handled by your library I would think though by setting the display class.

edit: oh yes, and I am using the spi demo as a base for this project.
edit 2: found the link you mentioned in the header, I guess what I'm looking for is a list of commands available in the library itself, when I sent the pm I was just working on the issue of it not filling the whole screen, which is why I was hoping a list of commands would have options to set the resolution or something like that.
Title: Re: Waveshare e-paper displays with SPI
Post by: ZinggJM on May 19, 2018, 05:28 pm
@XOIIO,

Now that I read your actual post and your original post more in detail, I understand your issue.

You use an Arduino Pro Mini, which is an AVR Arduino and has not enough RAM to buffer the whole display content. The GxEPD_SPI_TestExample first uses methods to draw bitmaps directly to the controller buffer with subsequent refresh to the screen. Then it draws one bitmap to the buffer in the display class and calls update() to update to the screen. With AVR Arduino this buffer is only the size of a part of the screen, that's the effect you see. I did in on purpose so in the example, so users can see what happens. Maybe I should have added more explanation.


Use the example PagedDisplayExampleSmallRam.ino to see how you can draw or print to the whole screen with GxEPD on AVR Arduinos.

Jean-Marc
Title: Re: Waveshare e-paper displays with SPI
Post by: XOIIO on May 19, 2018, 05:38 pm
@ZinggJM I see, that makes sense, I'm also unable to even include the sd card library without maxing out the dynamic memory available.

I'll have to find another product I can use instead of the pro mini, however I want to keep form factor as small as possible, unfortunately this means another delay waiting on parts to arrive.
Title: Re: Waveshare e-paper displays with SPI
Post by: ZinggJM on May 19, 2018, 07:01 pm
Take a look at GxGDEH029A1.h (https://github.com/ZinggJM/GxEPD/blob/master/GxGDEH029A1/GxGDEH029A1.h)

There you find all the "commands" you were looking for, the methods of this display class.

And on line 30 you see the number of pages used for AVR Arduinos. You can increase that number to have more RAM available for your application. Using paged display with SD cards is possible but not straightforward; I am working on that example.
Title: Re: Waveshare e-paper displays with SPI
Post by: tudro on May 19, 2018, 08:19 pm
What you say about static charge could make sense, considering both me and the guy from the ruuvi forum have the same problem.

I saw the post with the flashlight, but i never kept it in direct sunlight and the temperature was never more than 30 degrees.

I'll test some more when the epaper gets back from dead and if it still doesn't work i'll buy one of the boards you've mentioned.

Do you also have the epaper between a glass and a cardboard in your picture frame?

Thank you very much for your help. Neither waveshare, nor the shop cared to give my any real help.
Title: Re: Waveshare e-paper displays with SPI
Post by: ZinggJM on May 19, 2018, 08:43 pm
@tudro,

Yes, it looks quite the same, I just have the display upside down, because I used the DESTM32-S2 connection board originally, now also the e-paper HAT. Make sure no component (capacitor) on the flex cable gets damaged or squeezed.

The temperature effect (or is it photons causing it) should soon go away when the flashlight is turned off.

From your picture of the backside I can't see clearly if the flex connector is pushed in enough; you first loosen the black retainer (pull out the black cubes ~1mm) before pushing in the flex, then push the cubes back in.
Title: Re: Waveshare e-paper displays with SPI
Post by: ZinggJM on May 19, 2018, 08:48 pm
@XOIIO,

I have updated the GxEPD_SD_BitmapExample with support for AVR using paged drawing, tested on ESP8266 with AVR simulated, but not yet tested with Arduino Pro Mini 3.3V.
Title: Re: Waveshare e-paper displays with SPI
Post by: XOIIO on May 19, 2018, 11:06 pm
@ZinggJM I'm actually using the 5v pro mini with an lm317 to provide the 3.3v though grabbing a 3.3v unit would probably good for the sake of simplicity.

I'm looking at the 1284 mini from Cross Roads Electronics, it has 128k of flash and 16k ram which should be plenty for what I want to do even without loading from an SD card, I think I have about 15 or 16 images I want to store.
Title: Re: Waveshare e-paper displays with SPI
Post by: msrparts on May 20, 2018, 11:10 pm
hey guys,

I have a little problem with the standart pinout of the GxEPD_SPI_TestExample.

My hardware:

-NodeMCU Lua Lolin V3 Module ESP8266
-Waveshare 7.5 Inch E-Paper Display

When I am connecting the Waveshare Module by standart pin configuration:

// mapping suggestion from Waveshare SPI e-Paper to generic ESP8266
// BUSY -> GPIO4, RST -> GPIO2, DC -> GPIO0, CS -> GPIO15, CLK -> GPIO14, DIN -> GPIO13, GND -> GND, 3.3V -> 3.3V

I canot flash the esp chip (error: "flash memory failed". I found out that the CS PIN on GPIO15 ist responsable for that problem. If the CS PIN of the e-Paper HAT is disconnected of the ESP-module it works. So I have
remapped the CS pin to D1 instead of to D8 and it works fine. I can flash the esp and the display works.

Did you have similiar problems?
Title: Re: Waveshare e-paper displays with SPI
Post by: Kastell on May 20, 2018, 11:13 pm
Hi msrparts, try the small ram example.
Title: Re: Waveshare e-paper displays with SPI
Post by: ZinggJM on May 21, 2018, 08:09 am
@msrparts

Hi,

I do not have this board, so I can't check. NodeMCU boards use the GENERIC pin mapping, I assume this is true for V3 also (which board do you select to compile for?).

I do get sporadic upload failures with Wemos D1 mini, maybe only with e-paper connected, but usually it works on the second try.

Maybe adding a pullup resistor for the CS line could help.

Paged drawing (small ram example) is only needed for 7.5" 3-color e-paper on ESP8266.

Jean-Marc
Title: Re: Waveshare e-paper displays with SPI
Post by: XOIIO on May 21, 2018, 10:34 am
@ZinggJM I'm messing around with the small ram example for the heck of it as I see that the bitmapexample file is actually holding all the images, whereas I've seen the c code in the sketch itself on some other videos.

Now, it displayed the waveshare image just fine on my setup as well as the text but I'm having trouble getting a custom image to work, it's tending to just leave a strip of random black/white bars on one segment of the screen, perhaps it's something I missed while simplifying the code to the bare minimum from the example, or perhaps it's something I messed up making the image.

I've reversed color and mirrored left-right, as well as unticked head data which added the progmem part which I was missing with that option ticked in img2lcd, anything else in that software I need to do?

Here's my sketch to just try and display something.

Code: [Select]


#include <GxEPD.h>
#include <GxGDEH029A1/GxGDEH029A1.cpp>      // 2.9" b/w

#include <GxIO/GxIO_SPI/GxIO_SPI.cpp>
#include <GxIO/GxIO.cpp>

// FreeFonts from Adafruit_GFX
#include <Fonts/FreeMonoBold9pt7b.h>

#include <GxGDEH029A1/customimages.h>



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");

}

void loop()
{
  display.drawExampleBitmap(testpic, sizeof(testpic));
  delay(10000);
  display.fillScreen(GxEPD_WHITE);
  display.update();
  delay(10000);
 
}


and here is the test picture file, I made the original image at the correct resolution in photoshop to be sure it would fit correctly.

edit: that exceeds the character limit, so here it is https://pastebin.com/pSUCNBa8

It seems I was too hasty to order those other boards, I might be able to do it using the low ram example after all, oh well, too late and maybe I will need then anyways, if not for this for a more substantial project.
Title: Re: Waveshare e-paper displays with SPI
Post by: ZinggJM on May 21, 2018, 04:15 pm
@XOIIO,

As I wrote, I have no experience with image2lcd. I see the same effect with your bitmap on my display.
I think the scan direction is wrong. Both Waveshare in their Wiki and Good Display have documented how to convert images with image2lcd for their e-papers.

The header part of the image code, the part in comment, should be the same as the examples, I think, but the first value is different. Maybe you need to select vertical scan.
Title: Re: Waveshare e-paper displays with SPI
Post by: msrparts on May 21, 2018, 07:32 pm
Hi @ZinggJM

I do not have this board, so I can't check. NodeMCU boards use the GENERIC pin mapping, I assume this is true for V3 also (which board do you select to compile for?).

I compile to a NODEMcu 1.0 (ESP12E-Module), 80 MHz, 4M(1M SPIFFS), v2 Prebuilt (MSS=536), DISABLED, None, 115200 COM5,


Maybe adding a pullup resistor for the CS line could help.

I tried out, to flash the esp I need low (GND) at the cs-pin. If I connect a pull-up, it doesnt work.


Paged drawing (small ram example) is only needed for 7.5" 3-color e-paper on ESP8266.

At this example I have the same problem.
Title: Re: Waveshare e-paper displays with SPI
Post by: Deous on May 22, 2018, 02:57 am
I just wonder if it is really worth buying larger e-paper now. They are very expensive and delicate.
Will they be popular in the future?
Title: Re: Waveshare e-paper displays with SPI
Post by: Afanget on May 22, 2018, 12:06 pm
I love how everybody is keeping the protective foil on the displays (including me, but i just removed the green sticker from the protective foil :D)

Btw - have you noticed that the display is photosensitive during partial refresh?
I just shined powerful flashlight on the display and it turned the area grey - right top corner

(just running modified clock-example with black background and some icons :) )

(https://i.imgur.com/1SIuRfR.jpg)

It clears after full refresh without any permanent damage but still - I imagine bright summer sun will make the display really ugly (we have winter here so I can't try that :D )
Hi there,

I was wondering if anybody had encountered this problem and even more if a workaround has been found?
I'm using a B&W 2.9 display and while I just need to do a full refresh every hour or so when using it indoor, it turns instantaneoulsy grey when exposed to direct sun light.

edit: a video found on the tube, not mine:
http://www.youtube.com/watch?v=FK-ohH9O2vA (http://www.youtube.com/watch?v=FK-ohH9O2vA)
Title: Re: Waveshare e-paper displays with SPI
Post by: Deous on May 22, 2018, 02:00 pm
That is quite ridiculous. I was thinking maybe it is the poor quality of the e-paper because I saw few e-papers on industrial devices and exposing to sun didn't do any visible effects.

Maybe it is doomed technology and we should wait for some better displays
Title: Re: Waveshare e-paper displays with SPI
Post by: tudro on May 25, 2018, 04:04 pm
No luck yet. I left it for several days, like last time, but it didn't recover. I checked the flex and the connectors multiple times. Everything seems ok. Oh well, i'll try with one of the boards you mentioned.

Thank you :)
Title: Re: Waveshare e-paper displays with SPI
Post by: XOIIO on Jun 02, 2018, 01:07 pm
Hey @ZinggJM, bit of an update, I got the 1284 mini in and it's working great with bitmaps, however I am having the same issue when I try to set the display rotation to 1 (landscape) and print text, with this setup I only get the leftmost third of the display still, a little bit less actually, it only shows "This is" and the s is actually cut off a little bit.

I'm well under the memory and program space limits, I've also tried dropping the baud rate to 9600 to no affect.

Any ideas? I would really like to be able to print text out in landscape mode.

Code: [Select]
  Serial.begin(115200);
  Serial.println("setup");
  display.init(115200); // enable diagnostic output on Serial
  display.setTextColor(GxEPD_BLACK);
  display.setFont(&FreeMonoBold9pt7b);
  display.fillScreen(GxEPD_WHITE);
  display.update();
  delay(500);
  Serial.println("setup done");
  display.setRotation(1);
  display.setCursor(0,50);
  display.println("This is test line 1");
  display.update();


Edit: crap, actually I'm getting that using it in portrait mode as well. It works well in that small ram example you gave however, I'm just trying to figure out the bare minimum to display text.

Plan is to use this in a menu with a clicky joystick to move a cursor from line to line.
Title: Re: Waveshare e-paper displays with SPI
Post by: ZinggJM on Jun 02, 2018, 02:47 pm
@XOIIO,

This is the kind of question I am not happy with trying to answer.

I know that I can click the poster, and then click show posts, but still this takes some effort to get the context.

If your previous post is some while ago, please state shortly the necessary information:
- library used
- display used
- processor / board used
- example program used.

You state that you use a 1284 mini. I would need go searching for information about this processor, but I think it is an AVR kind with even less program space than an Atmega 328, but about the same RAM.

So you need paged drawing for buffered drawing (e.g. text).

GxEPD will provide buffer for one page, which is for one fourth of the 2.9" e-paper size, if __AVR is defined.


Btw: the library has a README.MD file, you should at least have taken a look at it.
Title: Re: Waveshare e-paper displays with SPI
Post by: ZinggJM on Jun 03, 2018, 03:57 pm
Support for downloading bitmaps through Wifi to Spiffs or to display is now available in GxEPD2_32 examples for ESP8266, as well as displaying bitmaps from SD or Spiffs.

Jean-Marc
Title: Re: Waveshare e-paper displays with SPI
Post by: epicface2304 on Jun 06, 2018, 01:41 am
Hello, I am having some issues with my display.

I bought a 4.2-inch waveshare e-paper display off of Amazon, which has been working for me until I tried soldering the display to my ESP8266. I have checked the connections, but it just doesn't update when I call an update function. Below I have some of my code and pictures of the connections to the display.

Code: [Select]

#include <ArduinoJson.h>

#include <ESP8266WiFi.h>
#include <DebugMacros.h>
#include <HTTPSRedirect.h>

#include <GxEPD.h>
#include <GxFont_GFX.h>

#include <GxIO/GxIO_SPI/GxIO_SPI.cpp>
#include <GxIO/GxIO.cpp>

#include <GxGDEW042T2/GxGDEW042T2.cpp>      // 4.2" b/w

// Fonts

#include <Fonts/FreeSansBoldOblique12pt7b.h>
#include <Fonts/FreeMonoBold12pt7b.h>

int sleepTime = 10;

bool reboot = false;

const char* ssid = "****";
const char* password = "****";

const char* host = "script.google.com";
String url = "";
String GScriptId = "****";

GxIO_Class io(SPI, SS, 0, 2);
GxEPD_Class display(io);

HTTPSRedirect* client = nullptr;

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

  while (!Serial) continue;
  
  display.init(115200);
  
  display.setTextColor(GxEPD_BLACK);
  display.fillScreen(GxEPD_WHITE);
  display.setCursor(0, 0);
  display.setRotation(3);
  
  Serial.println();
  Serial.print("connecting to ");
  Serial.println(ssid);
  WiFi.begin(ssid, password);
  while (WiFi.status() != WL_CONNECTED) {
    delay(500);
    Serial.print(".");
  }
  Serial.println("");
  Serial.println("WiFi connected");
  Serial.println("IP address  ");
  Serial.println(WiFi.localIP());

  refresh();

  Serial.println("sleeping for: ");
  Serial.print(sleepTime * 10e6);

  ESP.deepSleep(sleepTime * 10e6);
}

void refresh() {
  
  url = "/macros/s/" + GScriptId + "/exec";

  client = new HTTPSRedirect();
  
  client->setPrintResponseBody(true);

  Serial.print("Connecting to ");
  Serial.println(host);

  bool flag = false;
  
  for (int i=0; i<5; i++){
    int retval = client->connect(host, 443);
    if (retval == 1) {
       flag = true;
       break;
    }
    else
      Serial.println("Connection failed. Retrying...");
  }

  if (!flag){
    Serial.print("Could not connect to server: ");
    Serial.println(host);
    Serial.println("Exiting...");
    return;
  }
  
  client->GET(url, host);

  DynamicJsonBuffer jsonBuffer(4096);

  JsonObject& root = jsonBuffer.parseObject(client->getResponseBody());

  if (!root.success()) {
    Serial.println("Parsing Failed!");
  } else {
  
    String title[root["events"].size()];
    String verbStart[root["events"].size()];
    String verbEnd[root["events"].size()];

    
    long startTime[root["events"].size()];
    long endTime[root["events"].size()];

    int hrs[root["times"].size()];
    
    String hrsTimes[root["times"].size()];
    
    uint32_t t = root["time"];
  
    String verboseTime = root["verbTime"];
  
    for (int i = 0; i < root["events"].size(); i++) {
      startTime[i] = root["events"][i]["start"];
      endTime[i] = root["events"][i]["end"];
      
      verbStart[i] = root["events"][i]["verbStart"].asString();
      verbEnd[i] = root["events"][i]["verbEnd"].asString();
      title[i] = root["events"][i]["title"].asString();
    }

    for (int i = 0; i < root["times"].size(); i++) {
      hrs[i] = root["times"][i];
      hrsTimes[i] = root["verbTimes"][i].asString();
    }
  
    display.setTextColor(GxEPD_BLACK);
    display.fillScreen(GxEPD_WHITE);

    drawDither(0, 0, display.width(), display.height());
    
    for (int i = 0; i < root["events"].size(); i++) {

      display.fillRoundRect(1, round(startTime[i] / 36) + 1, display.width() - 50, round((endTime[i] - startTime[i]) / 36) + 2, 10, GxEPD_WHITE);
      display.drawRoundRect(1, round(startTime[i] / 36) + 1, display.width() - 50, round((endTime[i] - startTime[i]) / 36) + 2, 10, GxEPD_BLACK);
      if (round(endTime[i] / 36) > 46) {
        if (round(startTime[i] / 36) + 22 > 0) {
          display.setCursor(5, round(startTime[i] / 36) + 22);
        } else {
          display.setCursor(5, 22);
        }
        display.setTextColor(GxEPD_BLACK);
        display.setFont(&FreeSansBoldOblique12pt7b);
        display.print(title[i]);
        if (round(startTime[i] / 36) + 46 > 46) {
          display.setCursor(5, round(startTime[i] / 36) + 46);
        } else {
          display.setCursor(5, 46);
        }
        display.setFont(&FreeMonoBold12pt7b);
        display.print(verbStart[i]);
        display.print("-");
        display.print(verbEnd[i]);
      }
    }
    
    for (int i = 0; i < root["times"].size(); i++) {
      display.fillRect(254, hrs[i] - 1, 47, 3, GxEPD_WHITE);
      display.drawFastHLine(255, hrs[i], 45, GxEPD_BLACK);
      
      if (hrsTimes[i].length() == 1) {
        display.fillRect(270, hrs[i] + 5, 15, 20, GxEPD_WHITE);
        display.drawRect(270, hrs[i] + 5, 15, 20, GxEPD_BLACK);
        display.setCursor(270, hrs[i] + 22);
        display.print(hrsTimes[i]);
      } else {
        display.fillRect(270, hrs[i] + 5, 24, 20, GxEPD_WHITE);
        display.drawRect(270, hrs[i] + 5, 24, 20, GxEPD_BLACK);
        display.setCursor(270, hrs[i] + 22);
        display.print(hrsTimes[i]);
      }
    }
    
    display.update();
    display.powerDown();
  }
  
  delete client;
  client = nullptr;
}

void drawDither(uint16_t x, uint16_t y, uint16_t w, uint16_t h) {
  for (int x1 = x; x1 < x + w; x1 += 2) {
    for (int y1 = y; y1 < y + h; y1 += 2) {
      display.drawPixel(x1, y1, GxEPD_BLACK);
    }
  }
}

void loop() {}


(https://lh3.googleusercontent.com/whmQBc0oP2CId5MGjB7Rg80Yf_27-dtkzeJ-0WTAlZ_x2yed9-L38KR56HIlGbI1s8gmnsE6Y99xP_7ntSlK0JlX2bOAy_NEC7iyW8iSDYjYneApmw5AiDuEoVgEGatJsbPibSZZvVal5mXO2o_MFQMwFjphDtObKp_-b9pPxDqTqappBVychPE-WA57a-wO9USwi0mpy12wdAG-tvUdKKtbWJX2jtZie2FS6pvcdIu_0ilEZAeJcU3XMiRkgO9BeFUsw890Dv6YYTzKqlY1-4afiL9Yv3NO9rgvqmoTB0F5aylnnxnNokFe8_axKptXvaYBEhiY-m0r4QiX5EXpyY5oEEftKg1NwxWSUKy6h15qGJkKm2_XvI1zK1GtOyAgEcXmaRHq6Ei1A_4QON_gQcooJUMwMJVScdZifanSCRUBfGqiaMhx7EHQ7JVZeTR0UJK-PgQyfu92uRlKesVfYq0KisGSzHfqCjcb3VUPcDfu9apmqV_xU5MiSWwInCS68KucCvjp5gQ2Ks497CUGIS-g602oZe5txQ1vutlDeh6vPA-2c4bcXESS7YKtDEmuUBfZx6QYZIMwfqFv4H16zyMqojISrg79kk_4eEE9=w667-h888-no)

(https://lh3.googleusercontent.com/n28WyZ4CJRbCLwixJMgRYB3s09hQqvxzx7FSrJh3PEVicvbR9dvDYFFaQWsL6SiFEfs2hav82xuVV8qli_AbwMDWorkScs94FI9zegEbo71jHUWIJ8_8vuta9-Jle6RTbMRUDnWpQwoSd6Rn9VyHEV1NZHTamUp1PSExjybfngFSLzZNhH_6E01eJdY3AucDMxzbFS0oHBAXMWRvivhf3zMzkKO7v2cyFPJs5kIxddPOjHX7ll2qXJ-fhpRiiCVkYf5tI21MnqAId9Mg17RPPw2KsQnma0c6B2_Gm5C1lqJopBm8zWLYEFaWDpqhnFyLSMlboJ5vMEm6zs8NFhXLpeJ-vgkai9lPWK_CfOyb0TVuxmuuyP1-tuJBNapvcHieRll4u35BEhq7dvPNvUaMQNiWBNw4lrAEg56lt-RT0N-q9ZKNTWxOAbooJ03hB7PyhtFcxzK-dX-koEemZ8W4Mwzr3opDJ06ttVA6IV00gQu5UOyrn_m8v24PDBIr_0KmcHb_iSYrpaW0jZG8B-MtzszI0LHH8fp9ZzRh57oH1Z8yNVnkG2JJqAczy6nYrpPT1qZ4yxg2MQJapcRquBmhybB6SwyTu-th8gLiZI8J=w667-h888-no)
Title: Re: Waveshare e-paper displays with SPI
Post by: ZinggJM on Jun 06, 2018, 07:28 am
@epicface2304

Quote
I bought a 4.2-inch waveshare e-paper display off of Amazon, which has been working for me until I tried soldering the display to my ESP8266.
What has been working? What is the difference? Do you use the same wiring? Did the GxEPD_SPI_TestExample work before? Does it still work?

You could post diagnostic output of GxEPD_SPI_TestExample.

And fix your picture links.
Title: Re: Waveshare e-paper displays with SPI
Post by: epicface2304 on Jun 07, 2018, 08:39 pm
I just realized my mistake.

It appears I have fried it... I by mistake soldered the 3.3v of the display to the 5v of the ESP8266 board and now the display is not working. I've ordered a new display, which has been working well for me. I have verified that my code is working well with the new display.

Sorry for wasting your time... :'(



Just in case...

Here is the diagnostic information of the GxEPD_SPI_TestExample:

Code: [Select]


setup done
Power On : 9
drawBitmap : 1
drawBitmap : 1
Power Off : 2
Power On : 9
drawBitmap : 1
Power Off : 2
Power On : 10
update : 2
Power Off : 2
Power On : 6
drawCornerTest : 2
Power Off : 1
Power On : 6
update : 1
Power Off : 2
Power On : 5
update : 1
Power Off : 2
Power On : 5
update : 1
Power Off : 1
Power On : 5
update : 2
Power Off : 2
Power On : 5
update : 2
Power Off : 2
Power On : 2
update : 1
Power Off : 2
Power On : 5
drawBitmap : 5
Power Off : 1
Power On : 5
drawBitmap : 6
Power Off : 2
Power On : 9
update : 2
Power Off : 2
Power On : 2
drawCornerTest : 2
Power Off : 2
Power On : 5
update : 1
Power Off : 2
Power On : 6
update : 1
Power Off : 2
Power On : 5
update : 2
Power Off : 2
Title: Re: Waveshare e-paper displays with SPI
Post by: johweb on Jun 07, 2018, 09:39 pm
Hello everyone,

I bought a Lolin Nodemcu V3 with a Waveshare 4.2 (black & white) e-paper screen.

I uploaded a test sketch with arduino ide and Lolin is working fine (thanks to the serial print ! ;) )
Now, I try to have my screen updated with strings, but I can't.

Can anyone give me the good wiring between Lolin Nodemcu and Waveshare ? (I've seen multiple possibilities in this thread...) With a ino sketch example (just one line written on screen) would be really great !

Thanks a lot for help !
Title: Re: Waveshare e-paper displays with SPI
Post by: johweb on Jun 08, 2018, 01:40 pm
Hello everyone,

To be more precise on my last message.
This is my configuration :
- GxEPD-master library-properties : 2.3.14
- arduino IDE : 1.8.5
- 4.2inch (Black and White) Waveshare e-Paper Module
- Lolin NodeMcu V3

My wiring pinout :
Busy -> D2
RST -> D4
DC -> D3
CS -> D8
CLK -> D5
DIN -> D7
GND -> G
VCC -> 3V

Code used (from GxFont_GFX_Example.ino) :
Code: [Select]

// include library, include base class, make path known
#include <GxEPD.h>
#include <GxGDEW042T2/GxGDEW042T2.cpp>      // 4.2" b/w

#if !defined(_GxFont_GFX_TFT_eSPI_H_)
// FreeFonts from Adafruit_GFX
#include <Fonts/FreeMonoBold9pt7b.h>
#include <Fonts/FreeMonoBold12pt7b.h>
#endif
#if defined(_ADAFRUIT_TF_GFX_H_)
#include <Fonts/Open_Sans_Bold_12pt.h>
#endif


#include <GxIO/GxIO_SPI/GxIO_SPI.cpp>
#include <GxIO/GxIO.cpp>

// generic/common.h
//static const uint8_t SS    = 15; // D8
//static const uint8_t MOSI  = 13; // D7
//static const uint8_t MISO  = 12; // D6
//static const uint8_t SCK   = 14; // D5
GxIO_Class io(SPI, /*CS=D8*/ SS, /*DC=D3*/ 0, /*RST=D4*/ 2); // arbitrary selection of D3(=0), D4(=2), selected for default of GxEPD_Class
GxEPD_Class display(io /*RST=D4*/ /*BUSY=D2*/); // default selection of D4(=2), D2(=4)

void setup()
{
  Serial.begin(9600);
  Serial.println();
  Serial.println("setup");

  display.init(9600); // enable diagnostic output on Serial

  Serial.println("setup done");
}

void loop()
{
#if !defined(_ADAFRUIT_TF_GFX_H_) && !defined(_GxFont_GFX_TFT_eSPI_H_) && !defined(U8g2_for_Adafruit_GFX_h)
  showFont("FreeMonoBold12pt7b", &FreeMonoBold12pt7b);
#endif
#if defined(U8g2_for_Adafruit_GFX_h)
  showFont("u8g2_font_helvR14_tf", u8g2_font_helvR14_tf); // select u8g2 font from here: https://github.com/olikraus/u8g2/wiki/fntlistall
  delay(2000);
  showFont("u8g2_font_profont22_mr", u8g2_font_profont22_mr); // select u8g2 font from here: https://github.com/olikraus/u8g2/wiki/fntlistall
  delay(2000);
#endif
#if defined(_GxFont_GFX_TFT_eSPI_H_)
  showFreeFont("FreeMonoBold12pt7b", &FreeMonoBold12pt7b);
  delay(2000);
  //showFreeFont("NULL", NULL);
  showTextFont("Font 1", 1, 1);
  delay(2000);
  showTextFont("Font 1", 1, 2);
  delay(2000);
  showTextFont("Font 1", 1, 3);
  delay(2000);
  showTextFont("Font 2", 2, 1);
  delay(2000);
  showTextFont("Font 2", 2, 2);
  delay(2000);
  showTextFont("Font 2", 2, 3);
  delay(2000);
  showTextFont("Font 4", 4, 1);
  delay(2000);
  showTextFont("Font 4", 4, 2);
  delay(2000);
  showTextFont("Font 4", 4, 3);
#endif
#if defined(_ADAFRUIT_TF_GFX_H_)
  showFont("Open_Sans_Bold_12pt", OPENSANSBOLD_12);
#endif
  delay(10000);
}

void showFont(const char name[], const GFXfont* f)
{
  display.fillScreen(GxEPD_WHITE);
  display.setTextColor(GxEPD_BLACK);
  display.setFont(f);
  display.setCursor(0, 0);
  display.println();
  display.println(name);
  display.println(" !\"#$%&'()*+,-./");
  display.println("0123456789:;<=>?");
  display.println("@ABCDEFGHIJKLMNO");
  display.println("PQRSTUVWXYZ[\\]^_");
#if defined(HAS_RED_COLOR)
  display.setTextColor(GxEPD_RED);
#endif
  display.println("`abcdefghijklmno");
  display.println("pqrstuvwxyz{|}~ ");
  display.update();
  delay(5000);
}

#if defined(U8g2_for_Adafruit_GFX_h)
void showFont(const char name[], const uint8_t *f)
{
  display.setRotation(0);
  display.fillScreen(GxEPD_WHITE);
  display.setFontMode(1);                   // use u8g2 transparent mode (this is default)
  display.setFontDirection(0);              // left to right (this is default)
  display.setForegroundColor(GxEPD_BLACK);  // apply Adafruit GFX color
  display.setBackgroundColor(GxEPD_WHITE);  // apply Adafruit GFX color
  display.setFont(f); // select u8g2 font from here: https://github.com/olikraus/u8g2/wiki/fntlistall
  display.setCursor(0, 0);
  display.println();
  display.println(name);
  display.println(" !\"#$%&'()*+,-./");
  display.println("0123456789:;<=>?");
  display.println("@ABCDEFGHIJKLMNO");
  display.println("PQRSTUVWXYZ[\\]^_");
  display.println("`abcdefghijklmno");
  display.println("pqrstuvwxyz{|}~ ");
  display.println("Umlaut ÄÖÜäéöü");
  display.update();
}
#endif

#if defined(_ADAFRUIT_TF_GFX_H_)
void showFont(const char name[], uint8_t f)
{
  display.setRotation(0);
  display.fillScreen(GxEPD_WHITE);
  display.setTextColor(GxEPD_BLACK);
  display.setFont(f);
  display.setCursor(0, 0);
  display.println();
  display.println(name);
  display.println(" !\"#$%&'()*+,-./");
  display.println("0123456789:;<=>?");
  display.println("@ABCDEFGHIJKLMNO");
  display.println("PQRSTUVWXYZ[\\]^_");
  display.println("`abcdefghijklmno");
  display.println("pqrstuvwxyz{|}~ ");
  display.update();
}
#endif

#if defined(_GxFont_GFX_TFT_eSPI_H_)
void showFreeFont(const char name[], const GFXfont* f)
{
  display.setRotation(0);
  display.fillScreen(GxEPD_WHITE);
  display.setTextColor(GxEPD_BLACK);
  display.setFreeFont(f);
  display.setCursor(0, 0);
  display.println();
  display.println(name);
  display.println(" !\"#$%&'()*+,-./");
  display.println("0123456789:;<=>?");
  display.println("@ABCDEFGHIJKLMNO");
  display.println("PQRSTUVWXYZ[\\]^_");
  display.println("`abcdefghijklmno");
  display.println("pqrstuvwxyz{|}~ ");
  display.update();
}
void showTextFont(const char name[], uint8_t f, uint8_t size)
{
  display.setRotation(0);
  display.fillScreen(GxEPD_WHITE);
  display.setTextColor(GxEPD_BLACK, GxEPD_WHITE);
  display.setTextFont(f);
  display.setTextSize(size);
  display.setCursor(0, 0);
  display.println();
  display.println(name);
  display.println(" !\"#$%&'()*+,-./");
  display.println("0123456789:;<=>?");
  display.println("@ABCDEFGHIJKLMNO");
  display.println("PQRSTUVWXYZ[\\]^_");
  display.println("`abcdefghijklmno");
  display.println("pqrstuvwxyz{|}~ ");
  display.update();
}
#endif


No move on e-paper. No display on serial output : just boot's junk characters and then it hangs.

I tested the Lolin Nodemcu with another project code, it runs well, so it is'nt guilty.
I made a try with a Wemos D1, I've got exactly the same result...

I don't know what I'm doing wrong...
Title: Re: Waveshare e-paper displays with SPI
Post by: ZinggJM on Jun 08, 2018, 03:48 pm
@johweb,

Your wiring looks correct for use with GxEPD on Lolin NodeMcu. I assume V3 uses same pin configuration as V1.

There are also different versions of Wemos D1, but it uses the same pin names Dn as Wemos D1 mini and Lolin NodeMcu 1.0.

You should at least see "setup" in Serial Monitor. Do you see it with display disconnected?

Some ESP8266 pins determine startup mode; I avoided using these as inputs.

You can set bitrate at 74880 baud to see the "boot's junk characters".

You could test with unmodified GxEPD_SPI_TestExample.
Title: Re: Waveshare e-paper displays with SPI
Post by: johweb on Jun 09, 2018, 02:40 pm
Thanks for your answer !

I made another test : I plugged the module on a Raspberry GPIO and I tried the waveshare demo code. It's working fine, so my e-paper module is OK.

I tested original GxEPD_SPI_TestExample (with just 4.2B&W line uncommented). It remains the same : I don't even see junk boot characters.
If I remove the wires between screen and Lolin, serial print give me these messages :
Power On : 1
drawBitmap : 2
Power Off : 1
Power On : 2
update : 1
Power Off : 2
Power On : 2
drawCornerTest : 2
Power Off : 2
Power On : 1
update : 2
Power Off : 2
Title: Re: Waveshare e-paper displays with SPI
Post by: ZinggJM on Jun 09, 2018, 06:03 pm
@johweb,

I did a quick search for "Lolin NodeMcu V3" in the Arduino Forum. I didn't find an obvious reason for your issue - there are many results - but you can do this yourself.

I tried to give you a hint how to find out what might be wrong. But you need to do some testing and thinking yourself, as I have no Lolin NodeMcu V3.

The obvious next step would be to find out which line/pin causes the boot failure, so disconnect the wires one by one. BUSY is the only input to the processor, so this would be the first candidate.

ESP8266 has two different SPI connections; if you use the wrong one, flash communication can get disturbed.

Of course you get the short BUSY times of your diagnostic output with display disconnected (or long timeouts if the processor sees the opposite value on the pin used for BUSY).

Title: Re: Waveshare e-paper displays with SPI
Post by: johweb on Jun 09, 2018, 06:58 pm
Thanks for the hints.
I'll tell you if I success... ;)
Title: Re: Waveshare e-paper displays with SPI
Post by: johweb on Jun 10, 2018, 08:02 am
One important step for me...
Setting serial to 74880 give me translation of junk characters at boot. With e-paper module connected on spi, Nodemcu hangs saying "Bootmode (7,7) Waiting for host"  :o
Title: Re: Waveshare e-paper displays with SPI
Post by: johweb on Jun 10, 2018, 11:30 am
My screen is working !!!  :)
What I found on others forums :
Quote
Ok, after debugging for a while: the problem is with the CSN pin on GPIO pin 15. Pin 15 is also used in the ESP8266 to define boot from SD card.
This user had the same problem : bootmode 7 7 with a spi sensor connected. So I did the same as him : I moved the CS wire from GPIO 15 to GPIO 5 (D1) and changed this line in the demo code :
Code: [Select]
//GxIO_Class io(SPI, /*CS=D8*/ SS, /*DC=D3*/ 0, /*RST=D4*/ 2); // arbitrary selection of D3(=0), D4(=2), selected for default of GxEPD_Class
GxIO_Class io(SPI, /*CS=D1*/ 5, /*DC=D3*/ 0, /*RST=D4*/ 2); // arbitrary selection of D3(=0), D4(=2), selected for default of GxEPD_Class


And now, everything is working fine ! I'm so happy !!
Thanks for your hints, have a nice day.
Title: Re: Waveshare e-paper displays with SPI
Post by: Khayanna on Jun 10, 2018, 01:51 pm
Hi ZinggJM,

I want to use a Waveshare 2.9 inch B&W EPD with a MEGA 2560 R3.
The display works with a arduino nano pretty well, but the small memory is the problem, so I want to port this to an mega R3.

A few month ago (https://forum.arduino.cc/index.php?topic=487007.390) the was already a thread concerning this, but he never posted a whole code example how he got the display working with the mega.

First Im not clear about the pin allocation. Then, a small code expamle would be great.

Hope you can help me with this,

Khay.
Title: Re: Waveshare e-paper displays with SPI
Post by: ZinggJM on Jun 10, 2018, 03:50 pm
Hi Khay,

I hope you can be helped with a quick answer; come back if you need more detailed help.

You can use the suggested pin mapping for AVR Arduino (SCK, MOSI, SS, …), just note that the SPI pins are at the ISCP header (6 pin block), not at pin 13, 11, 10.

And although you have slightly more RAM, you still need paged drawing for buffered drawing.

Start with example PagedDisplayExampleSmallRam.ino, if you use GxEPD.

GxEPD2_AVR has a "smaller" example GxEPD2_AVR_Example.ino

Don't forget the series resistors on the data lines.

Jean-Marc
Title: Re: Waveshare e-paper displays with SPI
Post by: Khayanna on Jun 10, 2018, 04:47 pm
Hello Jean-Marc,

thank you for the quick reply.

Now my  Nano is connected like this...

GxEPD2_AVR_BW display(GxEPD2::GDEH029A1, /*CS=*/ SS, /*DC=*/ 9, /*RST=*/ 8, /*BUSY=*/ 7);
D13=CLK
D11=DIN
D10=CS
D09=DC
D08=RST
D07=BUSY
and of course 3V3,GND (RST and DC are swapped, I started with the waveshare example)

...without any serial resistors (?) I didn't get what value to put in here. Seems to work directely with the nano.

Now, how do I need to connect the MEGA in detail?
SS=Digital 53
MOSI=Digital 51
MISO=Digital 52
SCLK=Digital 53
...
(also connected to the ISP header, as you mentioned), see my attachnemt of the MEGA-Pins

what about busy, rst, DC?
Dont have any clue, what has to be connected how to the MEGA
Then, how do I need to change then display(GxEPD2::....) parameters then?

Sorry for those "basic" questions". I already read the complete thread without getting out this info clearly.

Ok, I know that it will be still a paged drawing. Maybe the page size can be increased somehow?

Thanks for your help in advance,
Khay.
Title: Re: Waveshare e-paper displays with SPI
Post by: ZinggJM on Jun 10, 2018, 05:48 pm
I am short of time today, sorry.

connect MOSI to DIN, use e.g. 4.7k,
SCLK to CLK
SS to CS
eigher from the pins you mentioned, or from the ISCP header.

The other pins just need to correspond to the values in the constructor.
Title: Re: Waveshare e-paper displays with SPI
Post by: Khayanna on Jun 13, 2018, 04:46 pm
Hi Jean-Marc,

after tinkering around, I've found out a setup which works for the MEGA 2560 with the 2.9inch waveshare.

Here's my pin-allocation.

D52=CLK/SCLK
D51=DIN/MOSI
D53=CS/SS
D44=DC
D45=RST
D43=BUSY

and 3v3,GND.

The display-init should look like this:
GxEPD2_AVR_BW display(GxEPD2::GDEH029A1,53, 44, 45, 43);

Probably it's possible to connect them to any other free digital pin.
All data lines have also a 3k9 resistor in series to the Mega-digital pin.

Didn't realize, that the display init-function handles also pin-numbers like '45'.
Where in the lib are the pins assigned? How does the lib know, that there is a MEGA-CPU and  not a AT328?

Khay.
Title: Re: Waveshare e-paper displays with SPI
Post by: ZinggJM on Jun 13, 2018, 05:48 pm
Hi Khay,

I prefer to not give lessons on C++ programming here, I am not a teacher and not good at teaching or explaining.

Quote
The display-init should look like this:
GxEPD2_AVR_BW display(GxEPD2::GDEH029A1,53, 44, 45, 43);
This is not a display-init; it is the construction of an object instance named "display" of type (aka class) named "GxEPD2_AVR_BW".

The constructor of the class GxEPD2_AVR_BW can be found in the corresponding header file GxEPD2_AVR_BW.h : GxEPD2_AVR_BW.h (https://github.com/ZinggJM/GxEPD2_AVR/blob/master/GxEPD2_AVR_BW.h)


as you can see it uses no default parameter values, so you have to specify them, e.g. as you did.

Code: [Select]
    GxEPD2_AVR_BW(GxEPD2::Panel panel, int8_t cs, int8_t dc, int8_t rst, int8_t busy);



The code of the GxEPD2_AVR_BW class does not distinguish between MEGA and 328.
You could make the buffer size dependent on the processor, but this will not make a noticeable performance difference. The value chosen is a "good compromise" for AVR processors.

Code: [Select]
  private:

    static const uint16_t buffer_size = 800;



Jean-Marc
Title: Re: Waveshare e-paper displays with SPI
Post by: opendocumentary on Jun 13, 2018, 10:00 pm
Hi everybody :)

Just playing around with the GxEPD2_32_SD_BitmapExample and it is working great :)
Thanks Jean-Marc for your work.

Does anybody has a tip on how I can create a 3 color bitmap for the 3 color dispays?
I tryed a few programms but could not find any programm that can do it :)

Cheers,
Christian
Title: Re: Waveshare e-paper displays with SPI
Post by: ZinggJM on Jun 13, 2018, 10:28 pm
Hi Christian,

I am still working on this topic, on enhancements and bugfixes, and on problems with WiFi download of big bitmaps on ESP8266.

You can create a normal bitmap with 24bit per pixel containing e.g. black, white and red (or yellow) parts. Support for bitmaps with 2bpp, 4bpp, 8bpp with palette will follow.

Jean-Marc
Title: Re: Waveshare e-paper displays with SPI
Post by: opendocumentary on Jun 14, 2018, 09:38 am
Hi Jean-Marc,

how do I get the third color (yellow/red) to work with bitmap?
I always get just black/white images.

Right now i'm working on finishing my bike for the "climate change tour" :)

It would be perfect if I could run 3 screens with 3 color bitmaps from one ESP32. Right now working with the TTGO T8 V1.3 and the LOLIN32 Pro V1 (both have SD Card reader onboard).

As an Attacement you can see the e-paper displays installed in the back, right now 6 on each side.

Cheers,
Christian
Title: Re: Waveshare e-paper displays with SPI
Post by: ZinggJM on Jun 14, 2018, 10:43 am
Hi Christian,

Great, looks good! Hope you pass through Luzerne on your tour.

I have just updated GxEPD2_32 with enhanced version of GxEPD2_32_SD_Example (renamed).
It handles colored bitmaps, e.g. 24bit or 4bit (color depth).

I just discovered that the large WiFi download issue of ESP8266 seems ok on ESP32.
So I need to check with the actual ESP8266 package from Espressif, or check if it is a known issue.

Jean-Marc
Title: cpp vs header includes
Post by: kid1000000000 on Jun 14, 2018, 04:48 pm
Hi ZinggJM, first a note that your library is awesome and thank you for supporting it for as long and as much as you have.

To get started with your library, I must initialize using this code:

Code: [Select]
#include <GxEPD.h>
#include <GxGDEH029A1/GxGDEH029A1.h>//cpp //specify the correct 2.9" screen                                                                                                                   
#include <GxIO/GxIO_SPI/GxIO_SPI.cpp>//cpp
#include <GxIO/GxIO.cpp>//cpp
#include <Fonts/FreeMonoBold9pt7b.h>
GxIO_SPI io = GxIO_SPI(SPI, /*CS=*/ SS, /*DC=*/ 8, /*RST=*/ 14);
GxEPD_Class display = GxEPD_Class(io, /*RST=*/ 14, /*BUSY=*/ 12);


I'm interested in passing `display` to other classes in other files, but because *cpp files get included, my compiler complains of duplication errors. If it were possible to follow the regular standard and only include header files, that would allow your package to intercalate with the language better. Do you know if it would be possible to do with your library?

Thanks again for what you have already given us.
Title: Re: Waveshare e-paper displays with SPI
Post by: ZinggJM on Jun 14, 2018, 05:33 pm
Hi kid,

thanks for the feedback!

I invite you to try to change the structure of the GxEPD source tree to your needs.
I know this source structure does not fit well with the capabilities of the Arduino IDE; it didn't with 1.6.x and still doesn't with 1.8.x.

The .cpp source file needs be included where the instance of the display class is created, because it is not automatically included in the build from a second level subdirectory.

However there should be no problem to pass a reference or pointer to the display instance to classes or methods in other files; in these only the header file needs be included to make the type/class of the instance known.

You could also consider to use one of the libraries GxEPD2_32, GxEPD2_AVR or GxEPD2, which have a simpler source structure.

Btw: why do you use the old-fashioned style of instance creation with copy assign operator?

I know the compiler optimizes this sequence of two creations, one assignment and one destruction, but C++ fans don't like to see this.
Title: Re: Waveshare e-paper displays with SPI
Post by: Davste on Jun 17, 2018, 08:22 pm
Hi, first of all, thank you for the amazing library!

I'm trying to get updateWindow to work, but so far have been unsuccesful.
I've been able to get display.update() and pagedUpdate() to work however.
If it helps, I'm using the 1.54(B) Waveshare screen.

Example:
Code: [Select]
  display.setCursor(0, 0);
  display.setTextColor(GxEPD_BLACK);
  display.print("TEST");
  display.updateWindow(0, 0, 50, 50, true);


I've also tried:
Code: [Select]
display.updateWindow(0, 0, GxEPD_WIDTH, GxEPD_HEIGHT, false);

My objective actually - but I do not know if this is possible from the reading so far - is to just update a single pixel at a time to make some sort of animation without refreshing the whole display.
Title: Re: Waveshare e-paper displays with SPI
Post by: ZinggJM on Jun 17, 2018, 09:21 pm
Hi Davste,

The 1.54" 3-color 200x200 e-paper does not have partial update (class GxGDEW0154Z04).
The 1.54" 3-color 152x152 e-paper has partial update (class GxGDEW0154Z17).
updateWindow() requires partial update support.

You would need to specify which one you have.

For the e-paper displays with partial update support only byte-granularity is available for update to screen. Without partial update support only the full screen can be updated.
Title: Re: Waveshare e-paper displays with SPI
Post by: Davste on Jun 18, 2018, 08:07 am
That explains it. I have the GxGDEW0154Z04, 200x200 but I also have the 2.9" B/W 296 x 128 on the way, does this support partial update?
In addition, I'm also curious how fast it is to send one pixel at a time to the display if you have any idea, but I guess I will test it out when the other display arrives
Title: Re: Waveshare e-paper displays with SPI
Post by: ZinggJM on Jun 18, 2018, 09:58 am
You can't send single pixels to the display; the minimum is 8 pixel that belong to the same byte, are one a 8 pixel boundary in x direction. That is why GxEPD uses a display buffer in the display class to allow drawing individual pixels through the graphics and text methods of Adafruit_GFX.

Sending the (multiple) pixels to the buffer of the controller is quite fast, but updating the screen with the buffer content of the controller takes time. Waveshare provides a list with update times.
Only few b/w e-paper displays have "fast" update times for partial update. 3-color is slow by physical nature.
Title: Re: Waveshare e-paper displays with SPI
Post by: Davste on Jun 18, 2018, 10:15 am
The 1.54" 3-color 200x200 e-paper does not have partial update (class GxGDEW0154Z04).
...
updateWindow() requires partial update support.

Could you clarify if it's not supported by the device, or by the library?  Because I found this code for the z04 at the manufacturer's site with a partialUpdate function, here: http://www.good-display.com/download_detail/downloadsId=528.html


Code: [Select]
/***********************************************************
Copyright(C), Good Display
FileName : main.c
Author : Yukewantong, Zhongxiaodong
Date   : 2012/3/13
Description :
Version : V1.0
History :
--------------------------------
2012/3/13: created
2012/9/21: Visionpeak MP test version
***********************************************************/
#include "Display_EPD_W21_spi.h"
#include "Display_EPD_W21.h"

extern const unsigned char pic[4736];
extern const unsigned char pic5[5600];
extern const unsigned char pic0[224];
extern const unsigned char pic1[224];
extern const unsigned char pic2[224];
extern const unsigned char pic3[224];
extern const unsigned char pic4[224];

const unsigned char LUTDefault_part[31] = {
 0x32, // command

/* 0x00,0x00,0x00,0x18,
 0x18,0x18,0x18,0x00,
 0x00,0x00,0x00,0x00,
 0x00,0x00,0x00,0x00,
 0x00,0x00,0x00,0x00,
 0x40,0x14,0x34,0x01,
 0x00,0x00,0x00,0x00,
 0x00,0x00,
*/
 0x10 //C221 25C partial update waveform
,0x18
,0x18
,0x08
,0x18
,0x18
,0x08
,0x00
,0x00
,0x00
,0x00
,0x00
,0x00
,0x00
,0x00
,0x00
,0x00
,0x00
,0x00
,0x00
,0x13
,0x14
,0x44
,0x12
,0x00
,0x00
,0x00
,0x00
,0x00
,0x00

 };

const unsigned char LUTDefault_full[31] = {
 0x32, // command
/* 0x11,0x11,0x10,0x02, // full
 0x02,0x22,0x22,0x22,
 0x22,0x22,0x51,0x51,
 0x55,0x88,0x08,0x08,
     0x88,0x88,0x00,0x00,
 0x34,0x23,0x12,0x21,
 0x24,0x28,0x22,0x21,
 0xA1,0x01
*/
 0x02 //C221 25C Full update waveform
,0x02
,0x01
,0x11
,0x12
,0x12
,0x22
,0x22
,0x66
,0x69
,0x69
,0x59
,0x58
,0x99
,0x99
,0x88
,0x00
,0x00
,0x00
,0x00
,0xF8
,0xB4
,0x13
,0x51
,0x35
,0x51
,0x51
,0x19
,0x01
,0x00
 };


void driver_delay_xms(unsigned long xms)
{
    unsigned int i = 0;

    while(xms)
    {
        for(; i<2100; i++);
        xms--;
    }   
}

void fulltest()
{
 EPD_W21_Init();
 EPD_W21_WirteLUT((unsigned char *)LUTDefault_full);
   EPD_W21_POWERON();
   
     EPD_W21_SetRamPointer(0x00,0xC7,0x00); // set ram
 EPD_W21_WriteDispRamMono(200, 200, 0xFF); // black
 driver_delay_xms(1000);

     EPD_W21_SetRamPointer(0x00,0xC7,0x00); // set ram
 EPD_W21_WriteDispRamMono(200, 200, 0xFF); // black
 EPD_W21_Update();
 driver_delay_xms(400000);
 driver_delay_xms(1000);
}

void fullparttest(void)
{
// EPD_W21_Init();
        EPD_W21_BS_0;
 EPD_W21_WirteLUT((unsigned char *)LUTDefault_part);
   EPD_W21_POWERON();
 //EPD_W21_SetRamArea(0x00,0x18,0xc7,0x00,0x00,0x00); 
 EPD_W21_SetRamPointer(0x00,0xC7,0x00); // set ram
 EPD_W21_WriteDispRamMono(200, 200, 0xFF); // white
 //EPD_W21_Update1();
 //driver_delay_xms(400000);
 driver_delay_xms(10000);

 EPD_W21_WriteDispRamMono(200, 200, 0xFF); // white
 EPD_W21_Update1();
 driver_delay_xms(400000);
 driver_delay_xms(10000);

 //EPD_W21_SetRamArea(0x00,0x18,0xc7,0x00,0x00,0x00); 
 EPD_W21_SetRamPointer(0x00,0xC7,0x00); // set ram
 EPD_W21_WriteDispRamMono(200, 200, 0x00); // white
 EPD_W21_Update1();
 driver_delay_xms(10000);
 driver_delay_xms(400000);

 EPD_W21_WriteDispRamMono(200, 200, 0x00); // white
 //EPD_W21_Update1();
 //driver_delay_xms(400000);
 driver_delay_xms(10000);


}

void parttest()
{
 //EPD_W21_Init();
 EPD_W21_WirteLUT((unsigned char *)LUTDefault_part);
   EPD_W21_POWERON();
 EPD_W21_SetRamArea(0x00,0x18,0xc7,0x00,0x00,0x00); 
 EPD_W21_SetRamPointer(0x00,0xC7,0x00); // set ram
 EPD_W21_WriteDispRamMono(200, 200, 0x00); // white
 driver_delay_xms(10000);

 EPD_W21_WriteDispRamMono(200, 200, 0x00); // white
 EPD_W21_Update1();
 driver_delay_xms(400000);
 driver_delay_xms(10000);


        part_display(0x00,0x03,0xc7,0x00,0x8f,0x00); // set ram
   
 EPD_W21_UpdataDisplay((unsigned char *)pic0,32,56);
 EPD_W21_Update1();
 driver_delay_xms(100000);
 part_display(0x00,0x03,0xc7,0x00,0x8f,0x00); // set ram
 EPD_W21_UpdataDisplay((unsigned char *)pic0,32,56);
 driver_delay_xms(10000);
 
   
 part_display(0x04,0x07,0xc7,0x00,0x8f,0x00); // set ram
 EPD_W21_UpdataDisplay((unsigned char *)pic1,32,56);
 EPD_W21_Update1();
 driver_delay_xms(100000);
 part_display(0x04,0x07,0xc7,0x00,0x8f,0x00); // set ram
 EPD_W21_UpdataDisplay((unsigned char *)pic1,32,56);
 driver_delay_xms(10000);

 
 part_display(0x09,0x0c,0xc7,0x00,0x8f,0x00); // set ram
 EPD_W21_UpdataDisplay((unsigned char *)pic2,32,56);
 EPD_W21_Update1();
 driver_delay_xms(100000);
 part_display(0x09,0x0c,0xc7,0x00,0x8f,0x00); // set ram
 EPD_W21_UpdataDisplay((unsigned char *)pic2,32,56);
 driver_delay_xms(10000);

   
 part_display(0x0e,0x11,0xc7,0x00,0x8f,0x00); // set ram
 EPD_W21_UpdataDisplay((unsigned char *)pic3,32,56);
 EPD_W21_Update1();
 driver_delay_xms(100000);
 part_display(0x0e,0x11,0xc7,0x00,0x8f,0x00); // set ram
 EPD_W21_UpdataDisplay((unsigned char *)pic3,32,56);
 driver_delay_xms(10000);

   
 part_display(0x13,0x16,0xc7,0x00,0x8f,0x00); // set ram
 EPD_W21_UpdataDisplay((unsigned char *)pic4,32,56);
 EPD_W21_Update1();
 driver_delay_xms(100000);
 part_display(0x13,0x16,0xc7,0x00,0x8f,0x00); // set ram
 EPD_W21_UpdataDisplay((unsigned char *)pic4,32,56);
 driver_delay_xms(10000);

   
}

void EPD_W29_init(void)
{
 EPD_W21_Init(); // display
 EPD_W21_WirteLUT((unsigned char *)LUTDefault_full);
    EPD_W21_POWERON();
   
     EPD_W21_SetRamPointer(0x00,0xC7,0x00); // set ram
 EPD_W21_WriteDispRamMono(200, 200, 0xFF); // black
 driver_delay_xms(1000);

     EPD_W21_SetRamPointer(0x00,0xC7,0x00); // set ram
 EPD_W21_WriteDispRamMono(200, 200, 0xFF); // black
 EPD_W21_Update();
 driver_delay_xms(400000);
 driver_delay_xms(1000);


 
 EPD_W21_SetRamPointer(0x00,0xC7,0x00); // set ram
 EPD_W21_WriteDispRamMono(200, 200, 0x00); // white
 EPD_W21_Update();

 driver_delay_xms(400000);
 driver_delay_xms(1000);
 EPD_W21_SetRamPointer(0x00,0xC7,0x00); // set ram
 EPD_W21_WriteDispRamMono(200, 200, 0x00); // white
 driver_delay_xms(1000);
 parttest();
 //fullparttest();
 fulltest();
}


/***********************************************************
 end file
***********************************************************/


Would it also help for speed if I only need to update one colour? Or do I have to send data for both black, and red? I tried modifying the code for the library to send only black, but I didn't have success.
Title: Re: Waveshare e-paper displays with SPI
Post by: ZinggJM on Jun 18, 2018, 10:43 am
There were no 3-color e-paper displays in 2012 afaik.

Good display publishes the controller specs for each of their e-paper displays. I invite you to check yourself.

Btw: the file you posted the code of is named "application_main.c" and is not used for this display. It looks like a leftover example for a b/w e-paper display.
Title: Re: Waveshare e-paper displays with SPI
Post by: johweb on Jun 22, 2018, 06:33 am
Hello everyone. Just a little question : how can I learn to convert bitmaps to "const unsigned char" ? I'd like to make my own icons to show on waveshare screen...
Thanks a lot !
Title: Re: Waveshare e-paper displays with SPI
Post by: jzvolanek on Jun 22, 2018, 02:11 pm
@johweb

Convert BMP using this www page!

https://javl.github.io/image2cpp/

http://wiki.tmep.cz/lib/exe/detail.php?id=ruzne%3Abarometr_wifi_epaper_2.9&media=zarizeni:esp:baromet_wifi_epaper_29.jpg



Code: [Select]

const unsigned char Slunicko2 [] PROGMEM = {
  // 'Slunicko2, 32x32px
  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x80, 0x00,
  0x00, 0x01, 0x80, 0x00, 0x00, 0x01, 0x80, 0x00, 0x01, 0x01, 0x80, 0xc0, 0x01, 0x81, 0x81, 0xc0,
  0x01, 0xc0, 0x03, 0x80, 0x00, 0xe0, 0x07, 0x00, 0x00, 0x63, 0xc2, 0x00, 0x00, 0x07, 0xf0, 0x00,
  0x00, 0x0f, 0xf8, 0x00, 0x00, 0x1f, 0xf8, 0x00, 0x00, 0x1f, 0xfc, 0x00, 0x1f, 0x1f, 0xfc, 0xf8,
  0x1f, 0x1f, 0xfc, 0xf8, 0x00, 0x1f, 0xfc, 0x00, 0x00, 0x1f, 0xf8, 0x00, 0x00, 0x0f, 0xf8, 0x00,
  0x00, 0x07, 0xf0, 0x00, 0x00, 0x60, 0x82, 0x00, 0x00, 0xe0, 0x03, 0x00, 0x01, 0xc0, 0x03, 0xc0,
  0x01, 0x81, 0x81, 0xc0, 0x01, 0x01, 0x80, 0x80, 0x00, 0x01, 0x80, 0x00, 0x00, 0x01, 0x80, 0x00,
  0x00, 0x01, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
};

display.drawBitmap(160, 15, Slunicko2, 32, 32, GxEPD_BLACK);//Doma ikona

Title: Re: Waveshare e-paper displays with SPI
Post by: ZinggJM on Jun 22, 2018, 05:06 pm
@johweb

You told us you have the 2.4" b/w e-paper from Waveshare. It is available e.g. on AliExpress:

400x300-4-2inch-E-Ink-display-module-SPI (https://www.aliexpress.com/store/product/400x300-4-2inch-E-Ink-display-module-SPI-Without-backlight-Compatible-with-variuous-board-Ultra-low/407494_32827172081.html)

On this page you find a link to their Wiki page for this display:

https://www.waveshare.com/wiki/4.2inch_e-Paper_Module (https://www.waveshare.com/wiki/4.2inch_e-Paper_Module)

On that page you find a chapter How to display an image with a download link to image2lcd.exe,
and the settings for the image conversion.

@jzvolanek

Thank you for this information about an alternative source and method.

@All

I would appreciate to get additional information about bitmap conversion and creation.
I have started a topic to collect this information:

Bitmap Creation and Conversion Know How (https://forum.arduino.cc/index.php?topic=553285.0)

Jean-Marc
Title: Re: Waveshare e-paper displays with SPI
Post by: johweb on Jun 22, 2018, 07:58 pm
Thanks to both of you !
Title: Re: Waveshare e-paper displays with SPI
Post by: SVanoli on Jun 26, 2018, 07:32 pm
Hi ZinggJM,

I'm having some trouble getting my 2.9 epaper to work. I've tried not only your library, but also the example provided by waveshare and some code written by myself looking at the datasheet.

Since your code example was de nearest I got to making it work i've decided to bother you by asking for help.

The problem I'm having is: most of the screen is frozen and just a part (like 2mm) flickers like if it were updating.

I'm using arduino nano, and running your GxEPD_SPI_TestExample and PagedDisplayExampleSmallRam both with the same results.

My wiring is the same as suggested BUSY -> 7, RST -> 9, DC -> 8, CS-> 10, CLK -> 13, DIN -> 11. Also, SPI connection seems to work fine (i've checked with a scope).

The serial otput from GxEPD_SPI_TestExample is:
Code: [Select]

setup
setup done
_PowerOn : 92456
_Update_Full : 106664
_PowerOff : 173740
_PowerOn : 92500
_Update_Full : 105664
_PowerOff : 173828
_PowerOn : 92472
_Update_Full : 105716
_PowerOff : 173848
_PowerOn : 92416
_Update_Full : 105720
_PowerOff : 173744
_PowerOn : 92476
_Update_Part : 14224
_PowerOn : 92500
_Update_Part : 14224
_PowerOn : 92456
_Update_Part : 14224
_PowerOn : 92468
_Update_Part : 14228
_PowerOn : 92472
_Update_Part : 14236
_PowerOn : 92460
_Update_Part : 14224
_PowerOn : 92512
_Update_Part : 14224
_PowerOn : 92456
_Update_Part : 14236
_PowerOn : 92500
_Update_Part : 14224
_PowerOn : 92444
.
.
.


Any clue on where direction to look will be appreciated.

If i'm missing any information, please tell me.
(Please forgive me, my english is not the best).

Thanks in advance
Title: Re: Waveshare e-paper displays with SPI
Post by: ZinggJM on Jun 26, 2018, 08:23 pm
Hi SVanoli,

You use a Waveshare 2.9" b/w e-paper display on an Arduino Nano if I read your post correctly.

Did you select the GxGDEH029A1 display class of library GxEPD in your example?

Do you use level converters on the data lines, or at least series resistors? And 3.3V supply to the display?

From the symptoms you describe only the boarder of the display flickers; this could be if the wrong display class is selected, or if the controller is not initialized correctly, e.g. because of SPI disturbance because of missing series resistors.

The refresh times (_Update..) are way too low for any of these displays, so the controller internal clock does not work correctly, or got a wrong PLL setting value.

But this is just a guess.
Title: Re: Waveshare e-paper displays with SPI
Post by: j0k3r187 on Jun 28, 2018, 10:40 pm
Hello from Germany

First of all thank you for this Library ;).

But when i try to test your Bitmap Example, i always get "File not found" on Serial Monitor.
Display works fine in your "GxEPD_SPI_TestExample" so my wiring is correct.

When i try a Test Scetch from SD Library that only looks for the file on Sd Card, the Serial Monitor output
looks like this:

Initializing SD card...initialization done.
betty_1.BMP exists.


Im using a Pro Micro as Controller, the Waveshare 4.2 and SD Card Module.

Hope somebody can Help me here. I also posted that issue on github

Regards
Title: Re: Waveshare e-paper displays with SPI
Post by: pngpng on Jun 29, 2018, 03:27 am
Hi ZinggJM,

I'm using a Waveshare 4.2" 3-color e-paper display with Arduino UNO. Does your library support this display? I've tried GxGDEW042T2 and GxGDEW042Z15, and couldn't get the display to work.

If not, do you have plan to support it in near future?


Thanks!
Title: Re: Waveshare e-paper displays with SPI
Post by: j0k3r187 on Jun 29, 2018, 05:04 am
Hi ZinggJM,

I'm using a Waveshare 4.2" 3-color e-paper display with Arduino UNO. Does your library support this display? I've tried GxGDEW042T2 and GxGDEW042Z15, and couldn't get the display to work.

If not, do you have plan to support it in near future?


Thanks!
On the github site for this Library it says:

"Added GxGDEW042Z15 display class for 4.2inch 400 x 300 black / white / red e-Paper

    The display class supports partial update, but display update is full screen (controller issue)"

Maybe ur wiring is not correct or ur Display is broken. My Waveshare 4.2 400x300 b/w works fine with the
GxGDEW042T2 Class.

And the GxGDEW042Z15 should work with your Dispalay.

Do you use the 3.3v Output from the Arduino UNO to power the Display and just connected the other Pins directly to ur Arduino UNO?
Or do you use Level shifter for your Display?
If not using Level Shifter connect the Display to ur Arduino 5V Pin and it should work.

!!! But better use Level Shifter for the Display for a Long time use !!!

Waveshare Wiki says:

https://www.waveshare.com/wiki/4.2inch_e-Paper_Module_(B)

FAQ

Question:
1. Why the e-Paper cant work with Arduino?
Answer:

The I/O level of Arduino is 5V, and the e-Paper should be driven with 3V3. If your Arduino cant drive the e-Paper successfully, please try to convert the level to 3.3V

You can also try to connect the Vcc pin to the 5V of Arduino to see whether the e-Paper works, but we recommend you not to use 5V for a long time. "


Title: Re: Waveshare e-paper displays with SPI
Post by: j0k3r187 on Jun 29, 2018, 05:22 am
I tested my 4.2 b/w Display with my arduino UNO (only UNO and Display witout Level Shifting) and it works with the GxEPD_SPI_TestExample.
Sometimes the Display Update was not correct but i think its because the Uno has not enough RAM.
Title: Re: Waveshare e-paper displays with SPI
Post by: ZinggJM on Jun 29, 2018, 05:59 am
@j0k3r187

Quote
But when i try to test your Bitmap Example, i always get "File not found" on Serial Monitor.
Display works fine in your "GxEPD_SPI_TestExample" so my wiring is correct.
I will look at this issue. I think I tested only with ESP8266 (Wemos D1 mini), as I had no SD module, and I stopped trying with the SD part of a TFT as soon I got the RobotDyn SD shield for D1 mini. Now I have separate SD modules; need to wire one to my 3.3V Arduino Pro Mini.
Maybe SD use with hardware SPI together with GxEPD will require SPI transaction support in GxEPD.

Please do not suggest to use these e-papers with 5V data lines without series resistors. It will ultimately kill the display. And malfunction and disturbance has been reported, and I explained the reason before.
Title: Re: Waveshare e-paper displays with SPI
Post by: ZinggJM on Jun 29, 2018, 06:27 am
Hi ZinggJM,

I'm using a Waveshare 4.2" 3-color e-paper display with Arduino UNO. Does your library support this display? I've tried GxGDEW042T2 and GxGDEW042Z15, and couldn't get the display to work.

If not, do you have plan to support it in near future?


Thanks!
Your Waveshare 4.2" 3-color e-paper display should work with GxGDEW042Z15.

To use it with Arduino UNO you need level shifters or at least series resistors (e.g. 4.7k) on data lines, and 3.3V Vcc supply.

You need paged drawing for buffered drawing with AVR Arduinos because of limited RAM; use example PagedDisplayExampleSmallRam.ino; GxEPD_SPI_TestExample.ino will show only a small stripe with buffered drawing, e.g. text output.

Jean-Marc

Title: Re: Waveshare e-paper displays with SPI
Post by: pngpng on Jun 29, 2018, 07:22 am
Thanks j0k3r187 for your answers!

I'm certain the display is fine as I can run the demo provided by Waveshare on this wiki page: https://www.waveshare.com/wiki/4.2inch_e-Paper_Module_(B)

I'm using the 3.3v output from UNO to power the display. As for the PIN connection, I followed what Waveshare says on the above wiki page.

E-PAPER      UNO PLUS
3.3V         >  3V3
GND         >  GND
DIN         >  D11
CLK         >  D13
CS         >  D10
DC         >  D9
RST         >  D8
BUSY      >  D7


What's not very clear to me from reading the github page is that when it says "Added GxGDEW042Z15 display class for 4.2inch 400 x 300 black / white / red e-Paper" it didn't specify the manufacturer, whereas for the GxGDEW042T2 class it did say "The GxGDEW042T2 class can be used with Waveshare 4.2inch e-Paper SPI display."
Title: Re: Waveshare e-paper displays with SPI
Post by: pngpng on Jun 29, 2018, 07:38 am
Your Waveshare 4.2" 3-color e-paper display should work with GxGDEW042Z15.

To use it with Arduino UNO you need level shifters or at least series resistors (e.g. 4.7k) on data lines, and 3.3V Vcc supply.

You need paged drawing for buffered drawing with AVR Arduinos because of limited RAM; use example PagedDisplayExampleSmallRam.ino; GxEPD_SPI_TestExample.ino will show only a small stripe with buffered drawing, e.g. text output.

Jean-Marc


Thanks for your answer and a great library!

I'm using the 3.3v output from UNO to power the display. Do I still need to level shift?

For context, the demo code provided by Waveshare for this display works with my current wiring and pin setup. And this is the display I'm using: https://www.waveshare.com/4.2inch-e-Paper-C.htm

Thanks!

Title: Re: Waveshare e-paper displays with SPI
Post by: ZinggJM on Jun 29, 2018, 08:09 am
@pngpng

Please note that the suggested wiring for GxEPD is different from the Waveshare example, RST and DC are swapped. For GxEPD the wiring needs to correspond to the values in the constructors, so you either adapt the wiring or use the values of your wiring in the constructors.

Yes, at least series resistors are needed. It may work or not without, but without you feed the display through the data lines with fluctuating voltages, which will cause disturbance. If you supply with 5V this is not the case, but 5V supply is clearly out of specs for the controller on the display.

I don't have the yellow Waveshare 4.2" 3-color display and my 4.2" red 3-color display is a bare panel from Good Display. But the controller is the same afaik, only the wavetable and thus the behavior and refresh time seems to be different, as has been reported.
Title: Re: Waveshare e-paper displays with SPI
Post by: j0k3r187 on Jun 29, 2018, 08:18 am
@j0k3r187

I will look at this issue. I think I tested only with ESP8266 (Wemos D1 mini), as I had no SD module, and I stopped trying with the SD part of a TFT as soon I got the RobotDyn SD shield for D1 mini. Now I have separate SD modules; need to wire one to my 3.3V Arduino Pro Mini.
Maybe SD use with hardware SPI together with GxEPD will require SPI transaction support in GxEPD.

Please do not suggest to use these e-papers with 5V data lines without series resistors. It will ultimately kill the display. And malfunction and disturbance has been reported, and I explained the reason before.
Thanks ZinggJM, i hope u find the problem ;)


@pngpng  Glad to Help you, im not a professional Programmer but i try my best :)
Title: Re: Waveshare e-paper displays with SPI
Post by: ZinggJM on Jun 29, 2018, 11:34 am
@pngpng

Congratulations for testing with Arduino Pro Micro, it allows at least to compile GxEPD_SD_BitmapExample.ino for it, as it has more RAM than an ordinary AVR Arduino.

Not only did I not test GxEPD_SD_BitmapExample.ino on AVR Arduino, I didn't even test-compile for it.

GxEPD_SD_BitmapExample.ino may never be available for standard AVR Arduino because of insufficient RAM. It looks like the file system support eats too much RAM. I think one block on SD is 512 bytes.

My solder board for SD card with Arduino Pro Mini thus was a waste of time.
I do have one Pro Micro, maybe I use a breadboard this time, or dig for a Leonardo I didn't use so far.

So this may get postponed for some time.

Jean-Marc
Title: Re: Waveshare e-paper displays with SPI
Post by: j0k3r187 on Jun 29, 2018, 12:32 pm
Hey ZinggJM

Thanks for your fast Support :).

I thought it is a RAM problem but atm i have no board with more RAM. I ordered one but this take some time until i get it ;)

But if u get it running on a "small" RAM AVR let me know.
Title: Re: Waveshare e-paper displays with SPI
Post by: Kastell on Jul 03, 2018, 11:49 am
I have a question about the power supply:

I have an ESP8266 with a 18650 Lipo Battery. When I plug in my little 2.7" waveshare display everything works fine but when I plug in the big 7.5" epaper the ESP8266 does not start. The blue LED flashes only a moment and the display remains off. I connected the battery directly to VIN and GND. Do I need a 3.3v regulator in between?
Title: Re: Waveshare e-paper displays with SPI
Post by: ZinggJM on Jul 03, 2018, 01:40 pm
@Kastell,

Yes, I think so. The series regulator on an ESP8266 is rather weak, and the ESP8266 already uses over 100mA on startup if WiFi is not turned off. The big e-paper display use quite some power during refresh, you can hear the switching regulator of a DESTM32-S2, but I have never measured current drawn.

So you might feed the e-paper Vcc through a separate series regulator off your LiPo battery.
Title: Re: Waveshare e-paper displays with SPI
Post by: j0k3r187 on Jul 04, 2018, 05:49 am
Hello all

Today my NodeMcu V3 arrived and now the GxEPD_SD_BitmapExample works fine.
So i guess the Problem was just not enough RAM on the Pro Micro.

But i have another question:

Can i use the Waveshare 4.2 b/w ePaper without BUSY and RST?

I need some free Pins on my NodeMcu V3  ;)
Title: Re: Waveshare e-paper displays with SPI
Post by: ZinggJM on Jul 04, 2018, 06:30 am
@j0k3r187

Quote
Can i use the Waveshare 4.2 b/w ePaper without BUSY and RST?
No, not with GxEPD, this is only implemented for GxGDEP015OC1.

I recommend planning your pin budget before buying a new processor board.
Consider ESP32 or STM32F1 boards.

I do not recommend using these e-papers without BUSY or RST, but support for this is implemented in the new library GxEPD2 (https://github.com/ZinggJM/GxEPD2).

In GxEPD2 you find an example GxEPD2_SD_AVR_Example.ino that should work with your Arduino Pro Micro.

Quote
This issue is caused by insufficient RAM available for SD support. It does not compile for 2k AVR. It compiles for 2.5k AVR but has not enough free RAM for SD use (stack or heap size).
Library GxEPD2 now has an example GxEPD2_SD_AVR_Example.ino that uses the base display class without graphics buffer to work on AVR Arduino.
For your NodeMCU you would use the example GxEPD2_SD_Example.ino with GxEPD2.
Title: Re: Waveshare e-paper displays with SPI
Post by: j0k3r187 on Jul 04, 2018, 09:09 am
Hey ZinggJM,
you are my new Hero :). I tested ur GxEPD2_SD_AVR_Example with my Pro Micro and it works fine.
The Waveshare 4.2 b/w can display all bitmaps from ur GxEPD2 Library, of course the colered bitmaps will be recolored in b/w but it looks great.



I ordered the NodeMcu v3 not for this Project but it was helpfull to test your GxEPD_SD_BitmapExample.
But i think i will use some other Board for my Project with 3.3v support and more RAM.

Very much thanks from Germany for your Support
Title: Re: Waveshare e-paper displays with SPI
Post by: ZinggJM on Jul 09, 2018, 10:26 am
GxEPD2 (https://github.com/ZinggJM/GxEPD2) initial release 1.0.2 is now ready.

The Arduino Library GxEPD2 has (all) the features of GxEPD, GxEPD2_AVR and GxEPD2_32 in a simpler structure and with smaller code. No inclusion of .cpp files needed, more Arduino Library like structure.

All configuration parameters are set in the application code as constructor parameters and as template parameter for buffer size; no need to configure changes in the library code.

The driver classes can be used directly for drawing bitmap data; buffered graphics is implemented in template classes, one for black/white, one for 3-color e-papers.

Paged drawing for limited buffer space is available in both ways, as picture loop or using draw callbacks.

Full buffered drawing is available using update method display() and full height template parameter.

The waveform tables for e-paper displays with waveform tables in the driver class are accessed from program space (4.2" b/w can be used with GxEPD2_SD_AVR_Example on 2k RAM Arduino).

Jean-Marc Zingg
Title: Re: Waveshare e-paper displays with SPI
Post by: noelportugal on Jul 16, 2018, 02:12 am
Hello Jean-Marc, love your work with the GxEPD and now with GxEPD2! I have added the first github issue :( When you get a chance to look at let me know. Also if you believe I miss something truly obvious and it doesn't belong in github, I can close it.

It is related to displaying remote bitmaps on esp8266. I tried to be as clear as possible: https://github.com/ZinggJM/GxEPD2/issues/1

I hope this can work soon! Thanks!

Noel
Title: Re: Waveshare e-paper displays with SPI
Post by: ZinggJM on Jul 16, 2018, 08:02 am
Hi Noel,

The 1.54" 200x200 3-color e-paper display has no partial update capability; the controller has no capability to address parts of the internal RAM.
The bitmap file drawing examples use the partial update capability to write to the controller RAM.
For the example GxEPD2_SD_Example I put a comment that it can't be used with GxEPD2_154c, but I forgot to add this comment to the other examples.
I will later add support for file bitmap drawing through buffered drawing, except for AVR Arduino.

Soon will be a little later, sorry.

Jean-Marc
Title: Re: Waveshare e-paper displays with SPI
Post by: h3ndrik on Jul 16, 2018, 03:55 pm
Hey @ZinggJM:

are you open to supporting different e-paper displays in GxEPD2?
That would be adding support for the Pimoroni inky pHAT (SSD1675A)

I've implemented a working driver:
https://github.com/h3ndrik/GxEPD2/tree/test

based on Pimoroni's library: https://github.com/pimoroni/inky-phat/
and https://github.com/drewler/epd/
datasheet: https://www.buydisplay.com/download/ic/SSD1675A.pdf

i'd like to squash all of this into a single commit and then open a pull request in GxEPD2 If you're okay with this.

Any preferred naming scheme for the files? GxEPD2_inkyphat and calling the panel INKYPHAT ?
Also: i hope the code quality is okay. There are a few "ToDo"s left to test on my side.
While testing this, I just wanted to make sure you're open to supporting other display modules and if my naming scheme is correct.
Title: Re: Waveshare e-paper displays with SPI
Post by: ZinggJM on Jul 16, 2018, 04:53 pm
@h3ndrik

for SPI e-paper displays from Dalian Good Display

My e-paper libraries are dedicated to the e-paper displays from Good Display.

And in CONTRIBUTING.md you can see that I do not merge pull request in general.

You are free and welcome to copy any of my libraries, or create a fork. I would suggest you use a different library name however, to avoid confusion for users.

For new SPI e-paper displays from Good Display, or e-paper displays that are based on the same controllers, I am willing to add support, if I get sponsored with such a display.

I might be interested to add support for e-paper displays from other provenience, if I get sponsored with such a display, and a demo program is available, to a new library in my GitHub Repository.

Jean-Marc
Title: Re: Waveshare e-paper displays with SPI
Post by: h3ndrik on Jul 16, 2018, 10:00 pm
@ZinggJM: Alright. That was not what i hoped for... but that's fair.
Thank you very much for writing the library and releasing it under the GPL. I'll have to decide if i want to maintain a fork for this. I'll remember to not confuse people by not renaming it.

(I read your contributing guidelines, just wasn't sure if "in general" meant: pull requests not in general, but in special cases... or no pull requests at all;) In case there will be a SSD1675A-based Dalian Good Display in the future, you're welcome to use this. No need for attribution)

Lastly: if anybody knows a generic arduino e-paper library to submit things like this to, let me know. I didn't find one.
Title: Re: Waveshare e-paper displays with SPI
Post by: Cocorico on Jul 18, 2018, 01:47 pm
Hello Jean-Marc.

I am really interested in buying the 4.2" E-ink screen 3-color B/W/Y ( https://www.waveshare.com/wiki/4.2inch_e-Paper_Module_(B) ) but I have some question.

Does your lib/screen can do a partial refresh of this screen in paricular (<5s) ? At least for black ?


Corentin
Title: Re: Waveshare e-paper displays with SPI
Post by: ZinggJM on Jul 18, 2018, 05:56 pm
Hi Corentin,

No, it can't. The refresh time is controlled by the waveform table of the display controller.
Waveshare has published a table with the refresh times of the SPI e-paper displays they sell.

Jean-Marc

PS: In the library GxEPD2 you can find measured refresh times (BUSY signal active times) used for displays without BUSY line, e.g. in:

GxEPD2_420c.h (https://github.com/ZinggJM/GxEPD2/blob/master/src/epd3c/GxEPD2_420c.h)

Code: [Select]
   static const uint16_t power_on_time = 40; // ms, e.g. 38006us
    static const uint16_t power_off_time = 30; // ms, e.g. 20292us
    static const uint16_t full_refresh_time = 16000; // ms, e.g. 15771891us
    static const uint16_t partial_refresh_time = 16000; // ms, e.g. 15771891us
Title: Re: Waveshare e-paper displays with SPI
Post by: Cocorico on Jul 19, 2018, 09:30 am
Jean-Marc,

Ok, thank you.

So I look at your code for B/W 4.2 screen (waveshare) and I see the partial refresh const is 1000 (ms), but in the documentation provided by waveshare, they say this screen is capable of doing partial refresh.
Moreover, according to waveshare, only B/W screen below 2.9" seems to be able to do a partial refresh.
I study the pb for a while now, and can't find the answer.

What is the good answer ?

I am very interested in such screen but I need a screen at least 4.2" (I think about 5"8 or 7 too) but I really need partial refresh to display the clock (one refresh every minute) with an ESP8266-12E.
You seem to have tested many many screens. Which one will be the best for my case ?

Thx for your answer and your work.
Title: Re: Waveshare e-paper displays with SPI
Post by: ZinggJM on Jul 19, 2018, 10:22 am
@Cocorico,

You could scroll through this topic, to find answers for your questions. There are posts about partial refresh aspects and prerequisites. Search for "Ben Krasnow" e.g.

The 4.2" b/w is supported by a modified waveform table to have fast partial refresh.
All these e-paper displays have controllers that support partial refresh (controller RAM addressing), exept the 1.54" 200x200 3-color e-paper display. Fast partial refresh is only possible for monochrome, and only if a wavetable for fast partial refresh is available.

So the 4.2" b/w is your only choice above 2.9" b/w. Note that the 5.83" b/w is very slow.
Title: Re: Waveshare e-paper displays with SPI
Post by: Hungerburg on Jul 20, 2018, 02:14 pm
Both waveshare and good display have 7.5 inch e-papers. The resolutions are different, both offer raspberry PI interfaces, at least waveshare offers SPI.

Any one of those suitable for partial updates?

My use case would be, to make an animated bitmap appear like handwriting (ghostwriting), that using an esp32 controller.
Title: Re: Waveshare e-paper displays with SPI
Post by: ZinggJM on Jul 20, 2018, 02:59 pm
Partial update is possible, but not fast partial update; there is no waveform table available for fast partial update. Both are the same panel from Good Display, both are SPI.
Title: Re: Waveshare e-paper displays with SPI
Post by: Hungerburg on Jul 20, 2018, 05:32 pm
Thank you, reading through the thread I wonder, what is the difference between fast and ordinary partial update - is it about #define PU_DELAY 300 - something like a limit on framerate?

In my use case, I'd start with a white slate and only add black, 5fps was nice, but even 1fps should be good; after some time, fully wipe to white and repeat; Can ordinary pu do this?
Title: Re: Waveshare e-paper displays with SPI
Post by: ZinggJM on Jul 20, 2018, 07:09 pm
The 1.54" b/w is the only one that can achieve 1fps. Waveshare has published a list of update/refresh times for the different e-papers.
Title: Re: Waveshare e-paper displays with SPI
Post by: Semme on Jul 23, 2018, 10:42 pm
Hey, is there any way that I can use 5 instead of 6 wires to the ESP8266? On the waveshare website there ist something about 3pin SPI.

I really need an extra pin on my ESP8266 :/
Title: Re: Waveshare e-paper displays with SPI
Post by: ZinggJM on Jul 24, 2018, 07:36 am
@Semme

You provide very little information in your post. You get faster and better response with more information.

You could simply search for "3-wire SPI" in this forum, and look through the results. You would see this post: #280 (https://forum.arduino.cc/index.php?topic=487007.msg3530935#msg3530935).

You can also use the library GxEPD2 (https://github.com/ZinggJM/GxEPD2) which also supports e-paper displays without RST and BUSY that use the panels from Good Display (same panels as the Waveshare SPI e-paper displays use).
Title: Re: Waveshare e-paper displays with SPI
Post by: doctormord on Jul 24, 2018, 01:22 pm
Hi Jean-Marc and all other contributors,

thanks to GxEPD im actually driving a "Wuxi Vision Peak Technology" 4.2" EPD, WF0402T8DCF1300E4, which can be found in Samsungs electronic shelf labels from the E2X-ST-GM42001 series. The panel is connected to an ESP8266 (Wemos D1 mini)


These panels are directly pincompatible with the 4.2" panels from Waveshare and/or Dalian Good Display beside the fact, that the FFC connector is "pad-down" rather than "pad-up" found on Waveshare panels and adapters. To connect this panel to the Waveshare HAT, i reflowed the FFC connector to make it fit.

The S-Tag pcb is showed on the attached picture, where the FFC is already resoldered to the Waveshare pcb.

The only informations i can find about this panel are these:

ST-GM42001 ESL Graphic TAG User Manual (https://fccid.io/E2X-ST-GM42001/User-Manual/User-Manual-2551386)

The auxially components are both the same for Waveshare and Samsung, i've checked this against the schematics found here:

E-Paper-Driver-HAT-Schematic.pdf (https://www.waveshare.com/wiki/File:E-Paper-Driver-HAT-Schematic.pdf)

Almost everything works like expected, i also use partial refresh without any issues. I've made a short flic to see the panel in action.

4.2" EPD E-Ink Display Weather + Google Calendar by ESP8266 (Weifeng Wuxi Vision Samsung WaveShare) (https://www.youtube.com/watch?v=6d8e1NNJUvw)

My issue now is, that im hunting down some quiescent current in the range of 400uA at the panels side.
I've isolated the current issue to the panel, as the whole board (Wemos D1 mini) is only drawing about 71uA when only the Waveshare with its components is connected. The 71uA current draw is archievable when patching the VCC side of the CH340C right before the diode, so, that it isn't up when the board is powered by the 5V pin. (But works, when USB is connected)

Anyway, what im doing in code to have everything powered down? I finally going into deep sleep for the EPS8266 and the display:

Code: [Select]

  DisplayData(); // includes display.update(); at last line

  WiFi.forceSleepBegin(); // power down WiFi
  delay(2000); // wait some time to have EPD settled
  display.powerDown(); // power down EPD
 
  unsigned long updateMinutes = updateInterval / (1000000L * 60L); // debug
  DPRINT(F("Next update in: ")); DPRINT(updateMinutes);  DPRINTLN(F(" minutes."));

  //Good Bye

  ESP.deepSleep(updateInterval, WAKE_RF_DEFAULT); // DeepSleep then restart - Connect RST to GPIO16


As i don't have a "genuine" Waveshare panel, i can't tell if this 450uA is to be expected but i guess not, at the Waveshare datasheets state about 50uA max in deepsleep.

Any hint on this?

Thanks in advance, keep it up.

Regards,

Christian

Edit:

From what i can see at this datasheet for a 7.5" EPD by Weifeng (Wuxi Vision):

https://vdocuments.com.br/wf0750t8pcz09230hu59.html

I'd guess the Waveshare displays are made by them, so the Good Display ones will be as well. (By comparing the datasheets layout, tables and text)

You can directly compare to:

http://www.good-display.com/download_detail/downloadsId=457.html
Title: Re: Waveshare e-paper displays with SPI
Post by: ZinggJM on Jul 24, 2018, 03:25 pm
Hi Christian,

as far as I know, and got confirmed by Dalian Good Display, the e-paper display panels Waveshare uses are from Dalian Good Display. But with OEM producers selling to other OEMs, you are never sure.
These e-paper display panels are mainly produced for electronic shelf labels.

Dalian Good Display provides specifications for their e-paper panels, and the controllers used by the panels.

Some controllers have commands for "deep sleep", e.g. the 7.5", that requires reset active for wake-up.
The GxEPD display classes only partly use the deep sleep command, dependent of its presence in the original demo code from Good Display.

Jean-Marc
Title: Re: Waveshare e-paper displays with SPI
Post by: doctormord on Jul 24, 2018, 04:10 pm
Hi Jean-Marc,

thanks for the reply. Actually i don't need to wake-up the display from deep-sleep as the Arduino inits the display from start when WDT sleep time is over. I also suspect the display not going into deepsleep at all the moment.

I rely on the "GxGDEW042T2" class for the actual 4.2" display used which does have proper deepsleep (sw-wise) implemented.

From the user manual here:

https://fccid.io/2AFWN-ST-GR42003N/User-Manual/15-ST-GR42003N-UserMan-3578129.html

which is for a similar/same ESL (electronic store label), they state 5 years runtime with 2 updates a day. These ESL are powered by 2xCR2450 which have a usual usable capacity of 600mAh/each, so totally 1800mAh.

Reverse calculating that into an avg. quiscent current relates to:

24hours*365days*5years=43800hours

1.8Ah/43800h=41uA avg. which includes 2 updates per day.

If i power down the display, it dangles at about 500uA. Once i cycle the displays FFC connection, the display rests at 36uA then.

Regards,

Christian

Edit:

I suspect there's some interference with the Wemos Reset logic (CH340 + Q1/Q2 NPN).
Title: Re: Waveshare e-paper displays with SPI
Post by: doctormord on Jul 24, 2018, 05:53 pm
Okay, i fixed it.

Inital code was:
Code: [Select]


  DisplayData(); // includes display.update(); at last line

  WiFi.forceSleepBegin(); // power down WiFi
  delay(2000); // wait some time to have EPD settled
  display.powerDown(); // power down EPD
 
  unsigned long updateMinutes = updateInterval / (1000000L * 60L); // debug
  DPRINT(F("Next update in: ")); DPRINT(updateMinutes);  DPRINTLN(F(" minutes."));

  //Good Bye

  ESP.deepSleep(updateInterval, WAKE_RF_DEFAULT); // DeepSleep then restart - Connect RST to GPIO16


Magic code is:
Code: [Select]

[code]

  DisplayData(); // includes display.update(); at last line

  WiFi.forceSleepBegin(); // power down WiFi
 
  unsigned long updateMinutes = updateInterval / (1000000L * 60L); // debug
  DPRINT(F("Next update in: ")); DPRINT(updateMinutes);  DPRINTLN(F(" minutes."));

  //Good Bye

  // Get display into ULP mode
  int rstDelay = 3500;
  DPRINT(F("Pulling RST low in ")); DPRINT(rstDelay); DPRINTLN(F("us.."));
  delay(rstDelay);
  DPRINTLN(F("Pulling RST low now!"));
  pinMode(2, OUTPUT); // RST
  digitalWrite(2, LOW);
  delay(50);
  digitalWrite(2, HIGH); // force RST high again to save power - Wemos has 10/12k ext. pullup here.

  ESP.deepSleep(updateInterval, WAKE_RF_DEFAULT); // DeepSleep then restart - Connect RST to GPIO16


So the point is to toogle RST after entering sleep mode. Now the display settles at 22uA which is fine for me. :)

Regards,

Christian
Title: Re: Waveshare e-paper displays with SPI
Post by: Semme on Jul 25, 2018, 09:26 am
@Semme

You provide very little information in your post. You get faster and better response with more information.

You could simply search for "3-wire SPI" in this forum, and look through the results. You would see this post: #280 (https://forum.arduino.cc/index.php?topic=487007.msg3530935#msg3530935).

You can also use the library GxEPD2 (https://github.com/ZinggJM/GxEPD2) which also supports e-paper displays without RST and BUSY that use the panels from Good Display (same panels as the Waveshare SPI e-paper displays use).
I'm planing a project with an esp2866 (12E or 12F), the 1,54" Waveshare display, an BME280 sensor on the i2c bus. Also Deep Sleep is a thing, so i have to use D0 for that. That leaves me without any remaining GPIO pins of the ESP. But I really need a pin for a button or better, more pins for an rotary encoder. Yes there are I2C rotary encoders out there, but i'm designing my own PCB and don't have the knowledge to design an I2C bus myself.

Hope these info helped. :)
Title: Re: Waveshare e-paper displays with SPI
Post by: ZinggJM on Jul 25, 2018, 09:44 am
@Semme

I hope you noticed that I recommend the use of ESP32 in this case, e.g. Wemos LOLIN32 Lite or similar; these are available about nearly the same price as ESP8266 and have more pins, more RAM and more code flash.
Title: Re: Waveshare e-paper displays with SPI
Post by: Semme on Jul 25, 2018, 10:47 am
@Semme

I hope you noticed that I recommend the use of ESP32 in this case, e.g. Wemos LOLIN32 Lite or similar; these are available about nearly the same price as ESP8266 and have more pins, more RAM and more code flash.
Yes I did. Unfortunately the ESP32 is a bit too expensive for this project. But I will probably give it a try. Thanks!
Title: Re: Waveshare e-paper displays with SPI
Post by: kuzmanzs on Aug 10, 2018, 03:09 pm
Hi,

I have memory issues with Wemos D1 and 7.5" eink display. Therefore I use it in paged mode.

I would like to read few bmp icons from SD card. The "GxEPD_SD_Example.ino" was a good starting point, but the problem is if I put several images to the display from SD the previous icons will be deleted.

I would like to use "drawPagedToWindow" function but I do not know how can I use it with SD card bmp.

Have anyone any hint?
Title: Re: Waveshare e-paper displays with SPI
Post by: ZinggJM on Aug 10, 2018, 04:04 pm
Hi kuzmanzs,

This is a quick answer, not verified! You could try to comment out line 380:

Code: [Select]
    display.fillScreen(GxEPD_WHITE);



and add that line before calling drawBitmapFromSD() the multiple times.

Oops, thats not enough. All bitmaps would need been drawn in the same drawCallback method. Gets complicated.

But drawBitmapFrom_SD_ToBuffer_Callback() is a callback function, and drawPagedToWindow() takes a callback function; I leave this exercise to the user (an example is just an example, to be adapted to the users need). Good Luck!

drawPagedToWindow() may be the best option with GxEPD, especially if you want to add text or graphics. Post some example bitmaps with coordinates if you encounter problems, so I can test and maybe add such an example.

Library GxEPD2 supports drawing multiple bitmaps from SD, you find the method in its example.
Title: Re: Waveshare e-paper displays with SPI
Post by: catccaatt on Aug 14, 2018, 08:31 am
Hi,

I am trying to use Arduino Mega on the 2.9 inch module. I downloaded the demo program and uploaded to arduino, but nothing happens. No error of initialization failed. I checked the wired, they are connected correctly. Can anyone suggest what should I do for troubleshooting? Is the 3.3V very very sensitive?

Thanks.

Title: Re: Waveshare e-paper displays with SPI
Post by: ZinggJM on Aug 14, 2018, 10:14 am
Yes, 3.3V supply and 3.3V data lines signal is important. Use at least series resistors on data lines with 5V Arduino.

Check that your SPI pins correspond to the definitions in the demo. HW SPI is on different pins on MEGA than on UNO.
Title: Re: Waveshare e-paper displays with SPI
Post by: DonovanG on Aug 14, 2018, 12:15 pm
Hi, could anyone possibly assist with a Arduino Due connected to a 2.13 inch Waveshare e-paper HAT.

I've tried following the waveshare schematics etc, but can't seem to get the display working.

I'm really new at this so it's a learning process for me!

Could someone assist with firstly the connection side of things and then the possibly  code?
 
Title: Re: Waveshare e-paper displays with SPI
Post by: AWOL on Aug 14, 2018, 12:27 pm
Have you tried U8g2 library?
Title: Re: Waveshare e-paper displays with SPI
Post by: ZinggJM on Aug 14, 2018, 01:19 pm
@DonovanG,

… or you could try with GxEPD (https://github.com/ZinggJM/GxEPD) or GxEPD2 (https://github.com/ZinggJM/GxEPD2).

These libraries use HW SPI, so SCK -> CLK and MOSI - DIN are fix. Note that these are on the 6 pin connector marked SPI on Due. The other pins can be chosen freely, but SS is usually used for CS, and the pins chosen must correspond to the constructor parameters used.

Jean-Marc
Title: Re: Waveshare e-paper displays with SPI
Post by: j0k3r187 on Aug 15, 2018, 06:08 pm
Hello again :)

Maybe someone can help me with the GxEPD2_SD_AVR_Example on an STM32F103C8T6.
When i try to copmpile the Scetch with an Pro Micro no Problems, but when i switch to the STM32
i get an Error -> 'display' was not declared in this scope.


I tried the AVR Example to test the RAM usage, because when i upload the GxEPD_SD_BitmapExample the RAM is @ 94% with the 4.2" b/w Display.
Title: Re: Waveshare e-paper displays with SPI
Post by: ZinggJM on Aug 15, 2018, 06:38 pm
Hi j0k3r187,

The answer is simple: as the GxEPD2_SD_AVR_Example is made for use with AVR processors, it does not have the definitions or declarations for the display instance for other processors.

You just need to compare GxEPD2_SD_AVR_Example with GxEPD2_SD_Example to add the part for STM32F1. You can't just copy this part, you need to edit the copied part to make it similar to the AVR part.

Report back if you get difficulties, then I will create a new version. I'll do that anyway later, for whoever has the same need.

I think I will do that tomorrow morning, if you can wait. But try to do it anyway, you can always learn something by doing.

Your other option is to reduce the page_height parameter for your display in GxEPD2_SD_Example to use less RAM for the graphics buffer.

Jean-Marc

Added GxEPD2_SD_AVR_boards_added.h to GxEPD2_SD_AVR_Example for use with non-AVR boards.
Title: Re: Waveshare e-paper displays with SPI
Post by: j0k3r187 on Aug 16, 2018, 04:39 pm
Ok thanks ZinggJM

.... But try to do it anyway, you can always learn something by doing.

thats what i do  8)
Title: Re: Waveshare e-paper displays with SPI
Post by: Bjack795 on Aug 16, 2018, 11:19 pm
Hello!
I'm very interested in the development of the partial update support for the 7.5" display.
I would use it with a lolin32, in a sort of typewriter where the text is organized in pages.
So a full refresh will happen on page changing and the partial refresh will be only in modifying the current page. So the endurance tests of days of updating shouldn't be the master problem.
Is there any chance of partial refresh implementation for 7.5" display?
Title: Re: Waveshare e-paper displays with SPI
Post by: ZinggJM on Aug 17, 2018, 06:15 am
Hi,

Quote
Is there any chance of partial refresh implementation for 7.5" display?
Not without the help from the manufacturer of these e-paper displays, as far as I have tried to find out.

Added: For "fast partial update" of parts of the display.

The format of the wavetable for the controller used isn't documented, I think intentionally.
And there is no example for a wavetable available to start with.
And the wavetable of this controller is bigger and more complicated for this controller, because of color and gray level capability. That may be the reason the manufacturer doesn't want to publish it.

There might be the possibility to read the content of the flash memory where the raw wavetable is stored, the controller has this option, but I don't know how to do it, and it wouldn't help, as the format is unknown. And this data is only the input for the final wavetable created in the controllers RAM, see the schema in the controller specs.

Added: GxEPD and GxEPD2 support "slow partial update" on this display; update of part of the display, but with the same flashing effect in that part as for full update.

Added: The controller may not have the capability for fast partial update (applying deltas), as it supports b/w and 3-color, but has no configuration bit for b/w or color.

Jean-Marc
Title: Re: Waveshare e-paper displays with SPI
Post by: Bjack795 on Aug 17, 2018, 10:20 am
How fast is the "slow partial update" for a typing workflow for example?

I have also written to the manufacturer that had confirmed the impossibility of fast partial refresh.

On e-ink there is like an incredible slow improvement in technology with respect to other fields.

Anyway the Kindle screen works pretty well and it is big.

Is there anyone who tried the exploit of using it for an Arduino board, not with a software hack like kindleberry?





Hi,

Not without the help from the manufacturer of these e-paper displays, as far as I have tried to find out.

For "fast partial update" of parts of the display.

The format of the wavetable for the controller used isn't documented, I think intentionally.
And there is no example for a wavetable available to start with.
And the wavetable of this controller is bigger and more complicated for this controller, because of color and gray level capability. That may be the reason the manufacturer doesn't want to publish it.

There might be the possibility to read the content of the flash memory where the raw wavetable is stored, the controller has this option, but I don't know how to do it, and it wouldn't help, as the format is unknown. And this data is only the input for the final wavetable created in the controllers RAM, see the schema in the controller specs.

GxEPD and GxEPD2 support "slow partial update" on this display; update of part of the display, but with the same flashing effect in that part as for full update.

The controller may not have the capability for fast partial update (applying deltas), as it supports b/w and 3-color, but has no configuration bit for b/w or color.

Jean-Marc

Title: Re: Waveshare e-paper displays with SPI
Post by: ZinggJM on Aug 17, 2018, 10:47 am
Quote
How fast is the "slow partial update" for a typing workflow for example?
The answer for the 7.5" b/w can be found here: GxEPD2_750.h (https://github.com/ZinggJM/GxEPD2/blob/master/src/epd/GxEPD2_750.h)

Code: [Select]

    static const uint16_t full_refresh_time = 4500; // ms, e.g. 4273474us
    static const uint16_t partial_refresh_time = 4500; // ms, e.g. 4273474us


Quote
On e-ink there is like an incredible slow improvement in technology with respect to other fields.
Yes, as long as particles need be moved in a fluid, there is a physical speed limitation.
Title: Re: Waveshare e-paper displays with SPI
Post by: Bjack795 on Aug 17, 2018, 11:09 am
Quote from: ZinggJM link=msg=3843439
[code
static const uint16_t full_refresh_time = 4500; // ms, e.g. 4273474us
    static const uint16_t partial_refresh_time = 4500; // ms, e.g. 4273474us
[/code]
Wow, huge time 4.5 seconds for a character.

Quote
Yes, as long as particles need be moved in a fluid, there is a physical speed limitation.
It should be also a problem of monopoly in the copyright of the technology, or not?


Title: Re: Waveshare e-paper displays with SPI
Post by: ZinggJM on Aug 17, 2018, 11:45 am
There are different suppliers and different technologies and different market segments.
But I am not an expert to tell. Search for EPD in Wikipedia, e.g.
But wavetables e.g. seem to be a partially hidden trade secret.

Update speed is e.g. dependent on the fluid layer thickness, particle size, and driving voltages.
E-paper panels used for e-books are in general more advanced than the ones for shelf labels.
Title: Re: Waveshare e-paper displays with SPI
Post by: h3ndrik on Aug 17, 2018, 03:06 pm
concerning the faster refresh rates: it could be possible to make some educated guesses and edit the wavetables by hand. but that would require a basic understanding of the format.

see this guy explaining it on youtube: https://www.youtube.com/watch?v=MsbiO8EAsGw&t=14m18s (https://www.youtube.com/watch?v=MsbiO8EAsGw&t=14m18s)

(no guarantee this won't permanently damage your display)
Title: Re: Waveshare e-paper displays with SPI
Post by: ZinggJM on Aug 17, 2018, 04:04 pm
Thanks! ok, this is a different video from Ben Krasnow than the one I knew. It is about the controller for the 4.2" e-paper display. A slightly modified version of his wavetable is used in GxEPD. And even Good Display and Waveshare have now the same wavetable in their actual demo sources for this display as far as I remember.

Unfortunately the 7.5" is a different story and still in the dark afaik. And while writing my previous post I came to the conclusion that fast partial update most likely is not possible with the controller of the 7.5" e-paper.

One of the mysteries is why the 7.5" and the 5.83" e-papers use the same controller but completely different waveform tables (5.83" has 3 times as long refresh). Even Good Display Sales Support could not explain this. Thats why trying to read the waveform table from flash (seems to be separate from the controller according to schema) could be interesting. Maybe I should ask in the hardware section, as I have no experience with serial flash memory and the names of their control signals.

The schema is part of the controller specs: IL0371 (http://www.good-display.com/download_detail/downloadsId=536.html)

Jean-Marc
Title: Re: Waveshare e-paper displays with SPI
Post by: Bjack795 on Aug 17, 2018, 06:54 pm
There are news of outcoming displays or projects started or any other hope on earth for whom want to use this technology?
Title: Re: Waveshare e-paper displays with SPI
Post by: ZinggJM on Aug 17, 2018, 07:28 pm
There are news of outcoming displays or projects started or any other hope on earth for whom want to use this technology?
I do not understand your question. But if you are looking for fast partial refresh on big e-papers, you may look at this: E-paper display kit With Partial Refresh & 16 Grey Level For Parallel Port EPD (http://www.good-display.com/products_detail/productId=370.html).

Different price range, and not so easy to use. Sending html pages to a browser on a kindle may be easier.
Title: Re: Waveshare e-paper displays with SPI
Post by: Bjack795 on Aug 18, 2018, 09:44 am
I do not understand your question.
I wanted only to know whether there are news of new displays coming with better characteristics.

Quote
But if you are looking for fast partial refresh on big e-papers, you may look at this: E-paper display kit With Partial Refresh & 16 Grey Level For Parallel Port EPD (http://www.good-display.com/products_detail/productId=370.html).

Different price range, and not so easy to use. Sending html pages to a browser on a kindle may be easier.
Thanks for the answer but I open the link but it sends me to the homepage of the manufacturer and not to a specific product.
Title: Re: Waveshare e-paper displays with SPI
Post by: ZinggJM on Aug 18, 2018, 10:11 am
Quote
I wanted only to know whether there are news of new displays coming with better characteristics.
So do I. Looking at the number of reads of this topic, and its increase rate, this might be the right place to ask such a question!

I invite everybody to report news about upcoming new e-papers (potentially) suitable for Arduino users here!

I do not visit the web pages of Good Display and Waveshare frequently enough to catch all new offerings, but I notice there are quite a number of new e-paper displays and variants available from Good Display.

Quote
Thanks for the answer but I open the link but it sends me to the homepage of the manufacturer and not to a specific product.
The link works for me. From the home page you would just need to click on Evaluation Kit and then click on the entry for DESTM32-T.
Title: Re: Waveshare e-paper displays with SPI
Post by: Bjack795 on Aug 18, 2018, 10:24 am
The link works for me. From the home page you would just need to click on Evaluation Kit and then click on the entry for DESTM32-T.
Ok there was a problem from the smartphone but from the PC is visible.
The price is not a problem and I see that some 6" supports fast partial refresh in parallel.
Is there someone you know that is developing this implementation?
I mean when you say "not easy to use" is it because it's not supported with libraries?

Thank you very much indeed for all the information.
Title: Re: Waveshare e-paper displays with SPI
Post by: Bjack795 on Aug 18, 2018, 10:45 am
Here it's explained in someway how to deal with it.

https://www.youtube.com/watch?v=TQbEgHc43Nk (https://www.youtube.com/watch?v=TQbEgHc43Nk)

As I said, I'm quite new to this world but I can learn fast if there is something to learn.
How exactly does this parallel update work and how this display+kit couple can be connected and controlled by an Arduino (or in my case by a Lolin D32 pro) board?
Title: Re: Waveshare e-paper displays with SPI
Post by: ZinggJM on Aug 18, 2018, 11:26 am
The video shows use of the older demo board for parallel e-paper displays from Good Display.
This board and the demo source for this board do not support partial refresh.
This board is supported by my library GxEPD (https://github.com/ZinggJM/GxEPD), but with very limited functionality compared to the SPI displays. The application code runs on the STM32 processor of the board itself.

The newer demo board DESTM32-T comes with its own demo code source, compilable with the Keil 5 or Keil 4 development environment.

I do have this board, and intend to support it with GxEPD, but my first attempt to port the demo source to the Arduino IDE failed to work. SPI e-papers and support for them are more important to the Arduino community, so the DESTM32-T is lower in my priority.

It is not easy to use because of the missing Arduino support, and the size of the demo board, and the missing alternatives to the demo board (there is no connection board available with the connector and the voltage supplies for the parallel e-paper displays).

It looks like the board on top of the base DESTM32-T, the DESTM32-Tconn-11, needed for partial refresh, contains a FPGA that "hides" the wavetable.
Title: Re: Waveshare e-paper displays with SPI
Post by: Bjack795 on Aug 18, 2018, 12:33 pm
Ok I got it, thank you for your huge work for us all.
Whenever you succeed in this task to make this display digestible for our Arduino environment you will be my personal hero.

I understand that this is not a broad spread priority, I'm so concentrated on e-Paper because my eyes suffer a little bit the normal screens so I see e-ink as a solution.

Hope that in the future the manufacturer would be more interested in making the hardware accessible with some helping software. Instead of leaving to people like you all the hard work.

The video shows use of the older demo board for parallel e-paper displays from Good Display.
This board and the demo source for this board do not support partial refresh.
This board is supported by my library GxEPD (https://github.com/ZinggJM/GxEPD), but with very limited functionality compared to the SPI displays. The application code runs on the STM32 processor of the board itself.

The newer demo board DESTM32-T comes with its own demo code source, compilable with the Keil 5 or Keil 4 development environment.

I do have this board, and intend to support it with GxEPD, but my first attempt to port the demo source to the Arduino IDE failed to work. SPI e-papers and support for them are more important to the Arduino community, so the DESTM32-T is lower in my priority.

It is not easy to use because of the missing Arduino support, and the size of the demo board, and the missing alternatives to the demo board (there is no connection board available with the connector and the voltage supplies for the parallel e-paper displays).

It looks like the board on top of the base DESTM32-T, the DESTM32-Tconn-11, needed for partial refresh, contains a FPGA that "hides" the wavetable.
Title: Re: Waveshare e-paper displays with SPI
Post by: ZinggJM on Aug 18, 2018, 01:41 pm
Thank you, Bjack795,

this is the kind of feedback that makes me do this work, for me and for all (potential) users.

Your post coincides with my intention to continue with DESTM32-T. I should have time for this now.

I will keep you informed.

Jean-Marc

PS: I think Good Display does a good job with providing this demo board and demo code, as commercial customers have enough resources to develop hardware and software according their needs starting with this.
Title: Re: Waveshare e-paper displays with SPI
Post by: Bjack795 on Aug 18, 2018, 02:31 pm
This is really the truth for the ones that are interested but don't have the capabilities to do what you do.

The comment of the company was also related to an email conversation I had with a guy doing youtube tutorials on these things that was saying that sometimes the companies gives good products but almost useless without a huge work from the users. This is also against their commerce success because less users are interested in buying their products without a good ecosystem.


Thank you, Bjack795,

this is the kind of feedback that makes me do this work, for me and for all (potential) users.

Your post coincides with my intention to continue with DESTM32-T. I should have time for this now.

I will keep you informed.

Jean-Marc

PS: I think Good Display does a good job with providing this demo board and demo code, as commercial customers have enough resources to develop hardware and software according their needs starting with this.