Go Down

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

Afanget

#615
May 22, 2018, 12:06 pm Last Edit: May 22, 2018, 02:34 pm by Afanget
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 :) )



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

Deous

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

tudro

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

XOIIO

#618
Jun 02, 2018, 01:07 pm Last Edit: Jun 02, 2018, 01:24 pm by XOIIO
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.

ZinggJM

#619
Jun 02, 2018, 02:47 pm Last Edit: Jun 02, 2018, 02:50 pm by ZinggJM
@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.
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

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
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.

epicface2304

#621
Jun 06, 2018, 01:41 am Last Edit: Jun 06, 2018, 01:43 am by epicface2304
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() {}






ZinggJM

@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.
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.

epicface2304

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

johweb

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 !

johweb

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...

ZinggJM

#626
Jun 08, 2018, 03:48 pm Last Edit: Jun 08, 2018, 03:50 pm by ZinggJM
@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.
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.

johweb

#627
Jun 09, 2018, 02:40 pm Last Edit: Jun 09, 2018, 02:43 pm by johweb
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

ZinggJM

@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).

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.

johweb

Thanks for the hints.
I'll tell you if I success... ;)

Go Up