DEV Community

Cover image for Getting started with the Waveshare 2.7" ePaper HAT on Raspberry Pi

Getting started with the Waveshare 2.7" ePaper HAT on Raspberry Pi

Rane Wallin on August 30, 2019

Introduction I have been curious about the Raspberry Pi for a long time, but I only started working with one recently when it was provid...
Collapse
 
sergeantpol profile image
sergeantpol

Hello,
I have wired 2.7inch e-Paper HAT to my Raspberry pi Zero W as it says here: waveshare.com/wiki/2.7inch_e-Paper... .
And is actually working.
I just wanted to ask if I can enable-activate the buttons without attaching it on my Rpi board but somehow wiring them with my Rpi board.
Best regards and thanks for your contribution
Kostas

Collapse
 
ranewallin profile image
Rane Wallin

I believe what you need for that is jumper. adafruit.com/product/1951

Collapse
 
sergeantpol profile image
sergeantpol

Yeah but which pins and which holes should i connect in order to use the buttons?

Thread Thread
 
ranewallin profile image
Rane Wallin

Oh, 5, 6, 13, 19. You start counting at the top left and then down and around in a U shape form

Thread Thread
 
sergeantpol profile image
sergeantpol • Edited

Yeah thanks! It's working but I have actually one more question.
When I am running your program when should I press the buttons because on the terminal it appears the image below dev-to-uploads.s3.amazonaws.com/i/...

Thread Thread
 
sergeantpol profile image
sergeantpol

and when the running ends there is nothing I can do...
Thank you, you are already so helpful!!!

Thread Thread
 
ranewallin profile image
Rane Wallin

It looks like it may be crashing. It prints "Clear..." when it's clearing the buffer. At that point the screen should start flashing. Do you have an ide you can run it where you might see more information? I think I used a Thonny.

Thread Thread
 
sergeantpol profile image
sergeantpol
Thread Thread
 
ranewallin profile image
Rane Wallin

Did the screen flash?

Thread Thread
 
sergeantpol profile image
sergeantpol

yes, according to
epd.init() # initialize the display
print("Clear...") # print message to console
epd.Clear(0xFF)

Thread Thread
 
ranewallin profile image
Rane Wallin

So the eink display flashes? After it clears the display it should put a message to the console. That message comes from the drivers. If that's not happening, check the waveshare repo to see if they have a new version.

Collapse
 
glanzi profile image
Giacomo Lanzi

I always got this error:

Traceback (most recent call last):
  File "/home/<user>/epaper/test.py", line 4, in <module>
    import epd2in7
  File "/home/<user>/epaper/lib/epd2in7.py", line 31, in <module>
    from . import epdconfig
ImportError: attempted relative import with no known parent package
Enter fullscreen mode Exit fullscreen mode

I tried to put files in lib folder, but I got the same result.
What I did wrong? Here is the file code:

 import sys
 sys.path.insert(1,"lib")

 import epd2in7

 from PIL import Image, ImageDraw, ImageFont
 epd=epd2in7.EPD()
 epd.init()
 epd.Clear(0xFF)
Enter fullscreen mode Exit fullscreen mode

Using "./lib" gave me error, and I figured out that in this way is working. At least is finding the files.

Collapse
 
gudongfeng profile image
DONGFENG GU

Nice post, the "Accessing the buttons" section really helps a lot. I wasn't able to find an "official" document for the buttons on waveshare website. But I got redirected to here through waveshare.com/wiki/2.7inch_e-Paper.... Thank for your contribution.

Collapse
 
powersoft profile image
powersoft

Hello,

I have tied to get the files "epd2in7b.py and epdconfig.py" but could not find them.
Please can you help me with these so I can download it.
Thanks in advance.

Jan Kromhout
Hellevoetsluis-NL

Collapse
 
ranewallin profile image
Rane Wallin

Hi, it looks like they moved some things around. Try the github repo: github.com/waveshare/e-Paper/tree/...

Collapse
 
pr0ffarnsworth profile image
Thomas

i like your code :) but cant figure out what display() does, can u pls upload the old epd2in7b.py and epdconfig.py? seems that waveshare removed it :(

Collapse
 
ravens28 profile image
Ravens28

Do you manage to still use the buttons after an epd.sleep()?

Because I wanted to use a btn.was_held to get out of sleep mode... But after getting into deep sleep the buttons doesn't work anymore...

Thx for your post it helped me a lot to start my project a few month ago!

Collapse
 
ujjwalagarwal profile image
Ujjwal Agarwal

Hey Rane! Was wondering if there was a way to run a processing sketch on the epaper. You think?

Collapse
 
ranewallin profile image
Rane Wallin

I'm not sure can you give me more information about what a processing sketch is?

Collapse
 
dmeylman profile image
dmeylman • Edited

Hello,
Sorry, newbie here. I'm trying to run this on my raspberry pi 3 and get an error:
AttributeError: 'EPD' object has no attribute 'Clear'

Please help. Thanks...