Go Down

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

programista25

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.

ZinggJM

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.
No personal message please; any question may be useful for other users. Use code tags for code. Make links clickable with URL tags. Provide links to the product in question.

ZinggJM

#437
Mar 07, 2018, 10:49 am Last Edit: Mar 08, 2018, 09:12 am by ZinggJM
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

No personal message please; any question may be useful for other users. Use code tags for code. Make links clickable with URL tags. Provide links to the product in question.

programista25

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.

Fritom

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);

}



ZinggJM

#440
Mar 07, 2018, 09:07 pm Last Edit: Mar 07, 2018, 09:13 pm by ZinggJM
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
No personal message please; any question may be useful for other users. Use code tags for code. Make links clickable with URL tags. Provide links to the product in question.

ZinggJM

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
No personal message please; any question may be useful for other users. Use code tags for code. Make links clickable with URL tags. Provide links to the product in question.

Fritom

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

ZinggJM

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
No personal message please; any question may be useful for other users. Use code tags for code. Make links clickable with URL tags. Provide links to the product in question.

Fritom

Well, picture got size 90x90 pixels so this should be ok. So what am I doing wrong?

ZinggJM

#445
Mar 11, 2018, 03:52 pm Last Edit: Mar 11, 2018, 05:34 pm by ZinggJM
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.
No personal message please; any question may be useful for other users. Use code tags for code. Make links clickable with URL tags. Provide links to the product in question.

ykolly

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.


ZinggJM

#447
Mar 12, 2018, 08:25 pm Last Edit: Mar 13, 2018, 03:44 pm by ZinggJM
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.
No personal message please; any question may be useful for other users. Use code tags for code. Make links clickable with URL tags. Provide links to the product in question.

johnny2001

Hello,

Quick Question

I trx to display äüöèàé on then eink with display.println("äöü"),

How can i do that?

Tahnks in advanced

jonathan

ZinggJM

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
No personal message please; any question may be useful for other users. Use code tags for code. Make links clickable with URL tags. Provide links to the product in question.

Go Up