Go Down

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

ZinggJM

@hblockx,

It might be helpful for you to first read General Guidance and How to use the Forum and the topic of its first link How to use this forum - please read.

GxEPD2_WiFi_Example.ino is just an example. It may be helpful for you, but you may need to adapt it to your needs.

You didn't report if the example works for you with the bitmaps it shows.

If it shows only black with your BMP file, the reason might be that all pixels are too dark for the threshold for white in the example code, see e.g. line 532:

Code: [Select]
                whitish = with_color ? ((red > 0x80) && (green > 0x80) && (blue > 0x80)) : ((red + green + blue) > 3 * 0x80); // whitish


Nobody can help you with this, as your mirror.bmp is "very local" :) , nobody can access it.

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.

SimonPrinter

Any plans to support the waveshare  12.48 inch display that has esp32 headers?

ZinggJM

Any plans to support the waveshare  12.48 inch display that has esp32 headers?
Hi SimonPrinter,

Yes, this is planned but not scheduled. I got one for Christmas from a donator who wants to support my work.
But so far I found no time to start work for this e-paper display.
One reason is the donator and his questions for help on his project, that triggered some ideas for me for my GxEPD_HD library.

But it is good to know that there is interest for support of this large e-paper display.

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

SimonPrinter

#1668
Jan 24, 2020, 10:46 am Last Edit: Jan 24, 2020, 11:29 am by SimonPrinter
That's excellent news.

So I have a 2.7 inch display that I am using to test out my little PoC before I buy one of the larger screens and it doesn't seem to clear the screen correctly. I've used the out of the box loader app from Waveshare and that displays correctly so I am pretty confident that it's not the screen but when I pushed the basic examples from the repo they just fill the screen with black text and images without clearing the screen in between. Any ideas what I am doing wrong?


This is the serial output:
Code: [Select]

_PowerOn : 1
refresh : 2
refresh : 1
refresh : 9
_Update_Full : 1
_PowerOff : 1
_PowerOn : 10
_Update_Full : 2
_PowerOff : 1
_PowerOn : 2
_Update_Full : 2
_PowerOff : 1
_PowerOn : 2
_Update_Full : 1
_PowerOff : 1
_PowerOn : 9
_Update_Full : 2
_PowerOff : 2
_PowerOn : 10
_Update_Full : 1
_PowerOff : 1
_PowerOn : 9
refresh : 2
refresh : 2
refresh : 10
refresh : 9
refresh : 9
refresh : 9
refresh : 9
refresh : 9
refresh : 9
refresh : 9
refresh : 10
refresh : 10
refresh : 9
refresh : 10
refresh : 9
refresh : 9
refresh : 10
_Update_Full : 9
_PowerOff : 9
_PowerOn : 2
refresh : 2
refresh : 9
refresh : 9
refresh : 9
refresh : 9
refresh : 9
refresh : 9
refresh : 10
refresh : 9
refresh : 9
refresh : 9
refresh : 9
refresh : 9
refresh : 10
refresh : 10
refresh : 10
refresh : 10
refresh : 2
refresh : 9
refresh : 9
refresh : 9
refresh : 10
refresh : 9
refresh : 9
refresh : 9
refresh : 10
refresh : 9
refresh : 9
refresh : 9
refresh : 10
refresh : 10
refresh : 10
refresh : 9
refresh : 10
refresh : 9
refresh : 9
refresh : 9
refresh : 10
refresh : 9
refresh : 10
refresh : 10
refresh : 10
refresh : 9
refresh : 9
refresh : 9
refresh : 10
refresh : 9
refresh : 10
refresh : 9
refresh : 9
refresh : 9
refresh : 10
_PowerOff : 9
_PowerOn : 2
_Update_Full : 1
_PowerOff : 2
_PowerOff : 2
_PowerOn : 9
_Update_Full : 2
_PowerOff : 1
_PowerOn : 9
_Update_Full : 1
_PowerOff : 1
_PowerOff : 2
setup done

ZinggJM

@SimonPrinter,

Please read General Guidance and How to use the Forum and the topic of its first link Learn How To Use The Forum.

And then edit your previous post and put the diagnostic output into code tags, </>-command.

Your SPI communication doesn't work. Your wiring doesn't correspond to the constructor values.
My wiring suggestion for GxEPD2 differs from the wiring used by the Waveshare demo.
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.

SimonPrinter

#1670
Jan 24, 2020, 11:34 am Last Edit: Jan 24, 2020, 11:44 am by SimonPrinter
Your SPI communication doesn't work. Your wiring doesn't correspond to the constructor values.
My wiring suggestion for GxEPD2 differs from the wiring used by the Waveshare demo.
Thanks for the quick response. I have a Waveshare ESP8266 driver board and a 2.7 inch black and white epaper display so I have uncommented this following line in the example:

Code: [Select]

GxEPD2_BW<GxEPD2_270, GxEPD2_270::HEIGHT> display(GxEPD2_270(/*CS=15*/ SS, /*DC=4*/ 4, /*RST=5*/ 5, /*BUSY=16*/ 16));


For context here is what ends up on the screen - it looks like it's not clearing the screen between examples.

https://imgshare.io/image/k1nyw

ZinggJM

See example GxEPD2_WS_ESP32_Driver.ino
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.

SimonPrinter

See example GxEPD2_WS_ESP32_Driver.ino
That's for ESP32 right? I have the ESP8266 board - am I being really dense?

ZinggJM

Sorry, I didn't read correctly, I am watching SKI-runs on TV. Will answer later.
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.

SimonPrinter

#1674
Jan 24, 2020, 12:01 pm Last Edit: Jan 24, 2020, 12:02 pm by SimonPrinter
Sorry, I didn't read correctly, I am watching SKI-runs on TV. Will answer later.
No worries, pal, thanks for your help and for writing the library in the first place - I can be patient!

I took a look at the GxEPD example as I have been trying the GxEPD2 example until now. This worked straight out of the box using what I think are the same wiring mappings.

Code: [Select]

#if defined(ESP8266)

// for SPI pin definitions see e.g.:
// C:\Users\xxx\AppData\Local\Arduino15\packages\esp8266\hardware\esp8266\2.4.2\variants\generic\common.h

//GxIO_Class io(SPI, /*CS=15*/ SS, /*DC=4*/ 0, /*RST=5*/ 2); // arbitrary selection of D3(=0), D4(=2), selected for default of GxEPD_Class
//GxEPD_Class display(io, /*RST=5*/ 2, /*BUSY=16*/ 4); // default selection of D4(=2), D2(=4)
// Heltec E-Paper 1.54" b/w without RST, BUSY
//GxEPD_Class display(io, /*RST=D4*/ -1, /*BUSY=D2*/ -1); // no RST, no BUSY
// Waveshare e-Paper ESP8266 Driver Board
[b]GxIO_Class io(SPI, 15, 4, 5);
GxEPD_Class display(io, 5, 16);[/b]

ZinggJM

@SimonPrinter,

it is difficult for me to answer Newbie questions, when I don't get complete information in one place.

Now I have this information, but this information is confusing. If it works with GxEPD, it should also work with GxEPD2.

The combined symptoms of the diagnostics and the result on e-paper on the picture could be caused by bad contact of the BUSY line. And your picture looks like the connector isn't fully in.
Pull out the black retainer about 1mm at the blocks at both sides, then gently push in the flex connector, then push in the blocks.

I rarely test with the ESP8266 Driver board, I could do that if your problem persists, but not 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.

SimonPrinter

Thank you for your patience - I have got my proof of concept working with the GxEPD library but still not succeeded in clearing the screen with the GxEPD2 library.
I did try reseating the ribbon cable but to no avail.

ZinggJM

@SimonPrinter,

My GDEW027W3 works perfectly on ESP8266 Driver Board using library GxEPD2.

All BUSY times reported in Serial Monitor are reasonable.

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.

Geri01

#1678
Jan 27, 2020, 04:59 pm Last Edit: Jan 27, 2020, 09:33 pm by Geri01
Hello,

I need help again
what's wrong with the scetch, i get a total of four topics from iobroker via mqtt, but only two are ever shown on my epaper display, then the script hangs.

16:54:49.990 -> Connected to the WiFi network
16:54:49.990 -> Connecting to MQTT...
16:54:49.990 -> connected
16:54:50.048 -> Message arrived in topic: display_line1
16:54:50.048 -> Message:Strom 79.78 C
16:54:50.048 -> -----------------------
16:54:50.048 -> Strom 79.78 C
16:54:50.048 ->
16:54:50.048 ->
16:54:50.048 ->
16:54:50.048 -> Update_Display5
16:54:59.219 -> Busy Timeout!
16:54:59.219 -> _PowerOn : 10000974
16:55:09.497 -> Busy Timeout!
16:55:09.497 -> _Update_Full : 10001135
16:55:20.401 -> Busy Timeout!
16:55:20.401 -> _PowerOff : 10000454
16:55:20.401 -> While vorbei
16:55:20.401 -> Message arrived in topic: display_line2
16:55:20.401 -> Message:Strom 7.12 A
16:55:20.401 -> -----------------------
16:55:20.401 -> Strom 79.78 C
16:55:20.401 -> Strom 7.12 A
16:55:20.401 ->
16:55:20.401 ->
16:55:20.401 -> Update_Display5
16:55:30.435 -> Busy Timeout!
16:55:30.435 -> _PowerOn : 10000369
16:55:40.498 -> Busy Timeout!
16:55:40.498 -> _Update_Full : 10000729
16:55:50.560 -> Busy Timeout!
16:55:50.560 -> _PowerOff : 10000365
16:55:50.560 -> While vorbei

Code: [Select]

#include <GxFont_GFX.h>

#include <GxEPD2_BW.h>
#include <GxEPD2_3C.h>
#include <Fonts/FreeMonoBold9pt7b.h>
#include <Fonts/FreeMonoBold18pt7b.h>

#include <ESP8266WiFi.h>
#include <PubSubClient.h>







GxEPD2_BW<GxEPD2_154_D67, GxEPD2_154_D67::HEIGHT> display(GxEPD2_154_D67(/*CS=15*/ SS, /*DC=4*/ 4, /*RST=5*/ 5, /*BUSY=16*/ 16)); // GDEH0154D67
 
const char* ssid = "FRITZB";
const char* password =  "1111111111111111";
const char* mqttServer = "IP";
const int mqttPort = 1883;
const char* mqttUser = "User";
const char* mqttPassword = "PW";


String _DisplayLine1 = "";
String _DisplayLine2 = "";
String _DisplayLine3 = "";
String _DisplayLine4 = "";


WiFiClient espClient;
PubSubClient client(espClient);
 
void setup() {

 display.init(115200);
  Serial.begin(115200);
 
  WiFi.begin(ssid, password);
 
  while (WiFi.status() != WL_CONNECTED) {
    delay(500);
    Serial.println("Connecting to WiFi..");
  }
  Serial.println("Connected to the WiFi network");
 
  client.setServer(mqttServer, mqttPort);
  client.setCallback(callback);
 
  while (!client.connected()) {
    Serial.println("Connecting to MQTT...");
 
    if (client.connect("ESP8266Client", mqttUser, mqttPassword )) {
 
      Serial.println("connected"); 
 
    } else {
 
      Serial.print("failed with state ");
      Serial.print(client.state());
      delay(2000);
 
    }
  }

 
 // client.publish("esp/test", "Hello from ESP8266");
client.subscribe("display_line1");
client.subscribe("display_line2");
client.subscribe("display_line3");
client.subscribe("display_line4");
}
 
void callback(char* topic, byte* payload, unsigned int length) {



 
  Serial.print("Message arrived in topic: ");
  Serial.println(topic);
 
  Serial.print("Message:");
  for (int i = 0; i < length; i++) {
    Serial.print((char)payload[i]);
   
  }

   if ( strcmp( topic, "display_line1" ) == 0 )
  {
    _DisplayLine1 = "";
    for (int i = 0; i < length; i++) {
      _DisplayLine1 += (char)payload[i];
    }
  }

  if ( strcmp( topic, "display_line2" ) == 0 )
  {
    _DisplayLine2 = "";
    for (int i = 0; i < length; i++) {
      _DisplayLine2 += (char)payload[i];
    }
  }



  if ( strcmp( topic, "display_line3" ) == 0 )
  {
    _DisplayLine3 = "";
    for (int i = 0; i < length; i++) {
      _DisplayLine3 += (char)payload[i];
    }
  }

  if ( strcmp( topic, "display_line4" ) == 0 )
  {
    _DisplayLine4 = "";
    for (int i = 0; i < length; i++) {
      _DisplayLine4 += (char)payload[i];
    }
  }
 

 
  //_DisplayLine1 += (char)payload[i];
  Serial.println();
  Serial.println("-----------------------");

  Serial.println(_DisplayLine1);
  Serial.println(_DisplayLine2);
  Serial.println(_DisplayLine3);
  Serial.println(_DisplayLine4);


 



 UpdateDisplay();


}




void UpdateDisplay()


{
//display.init(115200);

 
  Serial.println("Update_Display5");
  display.setRotation(1);
display.setFont(&FreeMonoBold9pt7b);
display.setTextColor(GxEPD_BLACK );
 
  display.firstPage();
  do
  {
     
    display.setCursor(0, 15);
     display.print(_DisplayLine1);
   
     
   display.setCursor(0, 30);
   display.print(_DisplayLine2);

   display.setCursor(0, 45);
   display.print(_DisplayLine3);

   display.setCursor(0, 60);
   display.print(_DisplayLine4);


   
 
  }
  while (display.nextPage());
  Serial.println("While vorbei");

 
}



 
void loop() {

 client.loop();
}

Geri01

is it possible to use gxepd2 without a do while loop? So enter direct commands like gxepd?

Go Up