E-paper HAT from Waveshare. Test with UNO

Hi there
I'm trying to do a very simple test of a Waveshare 2.7 inch e-paper HAT display from a UNO. I'd just like to see that the display is alive. I've tried the following Waveshare-provided code but the display remains dead. I've checked the SPI-hardware interface carefully several times.
Any advice is highly appreciated.
Cheers
Anders B

#include <SPI.h>
#include <epd2in7b.h>
#include "imagedata.h"
#include <epdpaint.h>

#define COLORED     1
#define UNCOLORED   0

void setup() {
  // put your setup code here, to run once:
  Serial.begin(9600);
  Epd epd;

  if (epd.Init() != 0) {
    Serial.print("e-Paper init failed");
    return;
  }

  /* This clears the SRAM of the e-paper display */
  epd.ClearFrame();

  /**
    * Due to RAM not enough in Arduino UNO, a frame buffer is not allowed.
    * In this case, a smaller image buffer is allocated and you have to 
    * update a partial display several times.
    * 1 byte = 8 pixels, therefore you have to set 8*N pixels at a time.
    */
  unsigned char image[1024];
  Paint paint(image, 176, 24);    //width should be the multiple of 8 

  paint.Clear(UNCOLORED);
  paint.DrawStringAt(0, 0, "e-Paper Demo", &Font16, COLORED);
  epd.TransmitPartialBlack(paint.GetImage(), 16, 32, paint.GetWidth(), paint.GetHeight());

  paint.Clear(COLORED);
  paint.DrawStringAt(2, 2, "Hello world!", &Font20, UNCOLORED);
  epd.TransmitPartialRed(paint.GetImage(), 0, 64, paint.GetWidth(), paint.GetHeight());
  
  paint.SetWidth(64);
  paint.SetHeight(64);

  paint.Clear(UNCOLORED);
  paint.DrawRectangle(0, 0, 40, 50, COLORED);
  paint.DrawLine(0, 0, 40, 50, COLORED);
  paint.DrawLine(40, 0, 0, 50, COLORED);
  epd.TransmitPartialBlack(paint.GetImage(), 10, 130, paint.GetWidth(), paint.GetHeight());
  
  paint.Clear(UNCOLORED);
  paint.DrawCircle(32, 32, 30, COLORED);
  epd.TransmitPartialBlack(paint.GetImage(), 90, 120, paint.GetWidth(), paint.GetHeight());

  paint.Clear(UNCOLORED);
  paint.DrawFilledRectangle(0, 0, 40, 50, COLORED);
  epd.TransmitPartialRed(paint.GetImage(), 10, 200, paint.GetWidth(), paint.GetHeight());

  paint.Clear(UNCOLORED);
  paint.DrawFilledCircle(32, 32, 30, COLORED);
  epd.TransmitPartialRed(paint.GetImage(), 90, 190, paint.GetWidth(), paint.GetHeight());

  /* This displays the data from the SRAM in e-Paper module */
  epd.DisplayFrame();

  /* This displays an image */
  epd.DisplayFrame(IMAGE_BLACK, IMAGE_RED);

  /* Deep sleep */
  epd.Sleep();
}

void loop() {
  // put your main code here, to run repeatedly:

}

@andersborgstrom, Hi, welcome to the forum!

Please read How to get the best out of this forum!

Please note that I don't answer technical questions in personal messages. But you forced my attention.

My experience with the actual versions of Waveshare example code is they work, if all is set correctly.

Therefore, posting the example is welcome, helps other responders, but not important for me.

The important information would be your wiring, point to point (pin to pin).
And all settings on the HAT.

And for all other readers a link to your display, preferably of the Waveshare website.

Do you get any diagnostic output in Serial Monitor?

Jean-Marc

Hi Jean-Marc

Thanks for welcoming me.

Sorry for using the forum incorrectly. I've read through the rules and will comply to my best effort. :slight_smile:

I will do a tidy post around wiring, HAT-settings, link-to-display etc in the right way.

No response on the serial monitor. I believe the if-sentence stops further execution.

Cheers and thanks! Hope to hear from you more.

Anders

This is strange. Add a delay(1000) after both Serial.print().
Please report memory used from compilation.

Jean-Marc

2.7inch e-Paper HAT (B) Manual - Waveshare Wiki
The 2.7inch e-Paper (B) raw panel was updated to the V2 version. The controller and the driver codes are different and the codes of the two versions are not compatible with each other. Except for the software, the outline of the two versions is the same. If you are the regulars of this display, please note that you need to update your driver codes with the new version refer to our new examples for the V2 version. if your the first time buy and use this display, just need to download and use the new V2 examples. The V2 version has a "V2" sticker on the backside of the display panel. Please confirm the version by the sticker.

I tried the delay(1000) after both Serial.prints with no change. The serial monitor just delivers the "e-Paper init and clear\r\n" message before the "if (epd.Init() != 0)" statement so there is a stop in execution there as I understand. I have also tried to insert a homemade breakpoint "Serial.print("BP"); further down in the code to see if the program run progresses but there is no sign of that in the serial monitor. It stops in the if-statement.

The wiring is double-tripled-quadruple checked as in the attached picture. Not showing the exact epd-board but exactly the same signals as in mine 2.7 inch e-Paper HAT from Waveshare.

#include <SPI.h>
#include "epd2in7b.h"
#include "imagedata.h"
#include "epdpaint.h"

#define COLORED     0
#define UNCOLORED   1

void setup() {
	// put your setup code here, to run once:
	Serial.begin(115200);
	Epd epd;
  
	Serial.print("e-Paper init and clear\r\n");
 delay(1000);
	if (epd.Init() != 0) {
		Serial.print("e-Paper init failed\r\n");
    delay(1000);
	return;
	}
 
	/* This clears the SRAM of the e-paper display */
	epd.ClearFrame();

	/**
	* Due to RAM not enough in Arduino UNO, a frame buffer is not allowed.
	* In this case, a smaller image buffer is allocated and you have to 
	* update a partial display several times.
	* 1 byte = 8 pixels, therefore you have to set 8*N pixels at a time.
	*/
	unsigned char image[1024];
	Paint paint(image, 176, 24);    //width should be the multiple of 8 

	paint.Clear(UNCOLORED);
	paint.DrawStringAt(0, 0, "e-Paper Demo", &Font16, COLORED);
	epd.TransmitPartialBlack(paint.GetImage(), 16, 32, paint.GetWidth(), paint.GetHeight());

	paint.Clear(COLORED);
	paint.DrawStringAt(2, 2, "Hello world!", &Font20, UNCOLORED);
	epd.TransmitPartialRed(paint.GetImage(), 0, 64, paint.GetWidth(), paint.GetHeight());

	paint.SetWidth(64);
	paint.SetHeight(64);

	paint.Clear(UNCOLORED);
	paint.DrawRectangle(0, 0, 40, 50, COLORED);
	paint.DrawLine(0, 0, 40, 50, COLORED);
	paint.DrawLine(40, 0, 0, 50, COLORED);
	epd.TransmitPartialBlack(paint.GetImage(), 10, 130, paint.GetWidth(), paint.GetHeight());

	paint.Clear(UNCOLORED);
	paint.DrawCircle(32, 32, 30, COLORED);
	epd.TransmitPartialBlack(paint.GetImage(), 90, 120, paint.GetWidth(), paint.GetHeight());

	paint.Clear(UNCOLORED);
	paint.DrawFilledRectangle(0, 0, 40, 50, COLORED);
	epd.TransmitPartialRed(paint.GetImage(), 10, 200, paint.GetWidth(), paint.GetHeight());

	paint.Clear(UNCOLORED);
	paint.DrawFilledCircle(32, 32, 30, COLORED);
	epd.TransmitPartialRed(paint.GetImage(), 90, 190, paint.GetWidth(), paint.GetHeight());

	/* This displays the data from the SRAM in e-Paper module */
	Serial.print("show paint.image\r\n");
	epd.DisplayFrame();

	/* This displays an image */
	Serial.print("show array\r\n");
	epd.DisplayFrame(IMAGE_BLACK, IMAGE_RED);

	/* Deep sleep */
	Serial.print("sleep\r\n");
	epd.Sleep();
}

void loop() {
  // put your main code here, to run repeatedly:

}

And sorry, i forgot to report memory from compilation. It is:

"Sketch uses 25500 bytes (79%) of program storage space. Maximum is 32256 bytes.
Global variables use 459 bytes (22%) of dynamic memory, leaving 1589 bytes for local variables. Maximum is 2048 bytes."

This is a different information than in your post #3.

The Waveshare code may hang in WaitUntilIdle();, it has no Busy Timeout.
Check if you have a V2; you may need to use the epd2in7b_V2 code.

I have tried both versions (also V2) with no success. Do you have any suggestion on how to tackle the WaitUntil Idle()-issue?

Skickat från min iPhone

I will answer your question as soon as you reported if your display has the V2 sticker.
Please also report the inking on the flex connector of the panel.
A picture of the backside of the display might also help.

See attached pictures.

I can’t see anything about V2 on the module. The flex connector is marked ”WFIO19OCZ22 LE”
Anders

Thank you for the information. This is not a V2.
It has the original panel. My panel from Good Display named GDEW027C44 has the inking WFI0190CZ22 LW
In epd2in7.cpp in method int Epd::Init(void) { (line 99) you could add Serial.print(...) for debug before and after each WaitUntilIdle(); - there is only one - to verify where it hangs.

Some controllers check on POWER_ON, if the panel driving voltages reach the correct level.

Jean-Marc

I'm struggling. Is it better to try the GxEPD-version?

Yes, I think you could try with GxEPD2. It is known to Library Manager, easy to install.
Note that the default wiring is different:

// mapping suggestion for AVR, UNO, NANO etc.
// BUSY -> 7, RST -> 9, DC -> 8, CS-> 10, CLK -> 13, DIN -> 11

but you can just change the constructor parameters to your wiring.

But I still think you have a hardware issue. Check continuity of your wiring with an ohm meter.

Did you prove it hangs in the first WaitUntilIdle();?

@andersborgstrom, I may have discovered the reason for your issue.

I wanted to add the information, that you may need to use the shortened reset pulse with GxEPD2. See GxEPD2_Example.ino line 120. Your display board has the "clever" reset circuit.

In epd2in7/epd2in7.cpp line 263:

void Epd::Reset(void) {
    DigitalWrite(reset_pin, HIGH);
    DelayMs(200);   
    DigitalWrite(reset_pin, LOW);
    DelayMs(10);
    DigitalWrite(reset_pin, HIGH);
    DelayMs(200);   
}

But in epd2in7b_V2.cpp line 129:

void Epd::Reset(void) {
    DigitalWrite(reset_pin, HIGH);
    DelayMs(200);   
    DigitalWrite(reset_pin, LOW);
    DelayMs(2);
    DigitalWrite(reset_pin, HIGH);
    DelayMs(200);   
}

They forgot to add this fix, when they replaced the original board with the "clever" reset circuit, while still using the original panel.

Maybe this helps.

Jean-Marc

2.7inch_e-Paper_HAT_Schematic.pdf

1 Like

Hi Jean-Marc
The shortened resetpulse made the trick!

 DelayMs(2);

Thank you so much! I would never found this myself!

I'm happy!

Cheers
Anders

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.