Interfacing e-Paper Display Using Raspberry Pi

Upgrade your paper to e-paper (electrophoretic display).

Introduction

Electronic paper, also sometimes electronic ink (e-Ink) or electrophoretic display (EPD), are display devices that mimic the appearance of ordinary ink on paper. Unlike conventional flat panel displays that emit light, electronic paper displays reflect light like paper. This may make them more comfortable to read, and provide a wider viewing angle than most light-emitting displays. – Wikipedia

In this tutorial, we will share how to interface e-paper display using Raspberry Pi.

Video

This video shows how to interface e-paper display using Raspberry Pi.

Hardware Preparation

This is the list of items used in the video.

Sample Program

This is python3 sample program to display basic shapes and text on e-paper using Raspberry Pi. You may need to install a few libraries with following commands:

sudo pip3 install adafruit-blinka
sudo pip3 install adafruit-circuitpython-epd
sudo apt-get install ttf-dejavu
sudo apt-get install python3-pil
# E-Ink:
# – https://my.cytron.io/p-2.9-inch-e-ink-raw-display-panel-tri-color?tracking=idris
# – https://my.cytron.io/p-universal-e-paper-raw-panel-driver-hat?tracking=idris
#
# References:
# – https://learn.adafruit.com/2-13-in-e-ink-bonnet/usage
# – https://gist.github.com/ScientificProgrammer/bd08a1474c6e5f0a8f102b35ac2533f1
import time
import digitalio
import busio
import board
from PIL import Image, ImageDraw, ImageFont
from adafruit_epd.epd import Adafruit_EPD
from adafruit_epd.il0373 import Adafruit_IL0373
# First define some color constants
WHITE = (0xFF, 0xFF, 0xFF)
BLACK = (0x00, 0x00, 0x00)
RED = (0xFF, 0x00, 0x00)
# Next define some constants to allow easy resizing of shapes and colors
BORDER = 20
FONTSIZE = 24
BACKGROUND_COLOR = RED
FOREGROUND_COLOR = WHITE
TEXT_COLOR = BLACK
spi = busio.SPI(board.SCK, MOSI=board.MOSI, MISO=board.MISO)
ecs = digitalio.DigitalInOut(board.CE0)
dc = digitalio.DigitalInOut(board.D25)
rst = digitalio.DigitalInOut(board.D17)
busy = digitalio.DigitalInOut(board.D24)
srcs = None
display = Adafruit_IL0373(
128, 296, spi,
cs_pin=ecs,
dc_pin=dc,
sramcs_pin=srcs,
rst_pin=rst,
busy_pin=busy
)
display.rotation = 3
image = Image.new("RGB", (display.width, display.height))
# Get drawing object to draw on image.
draw = ImageDraw.Draw(image)
# Draw a filled box as the background
draw.rectangle(
(0, 0, display.width, display.height),
fill=BACKGROUND_COLOR
)
# Draw a smaller inner foreground rectangle
draw.rectangle(
(BORDER, BORDER, display.width BORDER 1, display.height BORDER 1),
fill=FOREGROUND_COLOR,
)
# Load a TTF Font
font = ImageFont.truetype("/usr/share/fonts/truetype/dejavu/DejaVuSans.ttf", FONTSIZE)
# Draw Some Text
text = "Hello World!"
(font_width, font_height) = font.getsize(text)
draw.text(
(display.width // 2 font_width // 2, display.height // 2 font_height // 2),
text,
font=font,
fill=TEXT_COLOR,
)
# Display image.
display.image(image)
display.display()
time.sleep(180)
draw.rectangle(
(0, 0, display.width, display.height),
fill=FOREGROUND_COLOR
)
display.image(image)
display.display()

view raw
RPieInk29.py
hosted with ❤ by GitHub

Thank You

References:

Thanks for reading this tutorial. If you have any technical inquiries, please post at Cytron Technical Forum.

Please be reminded, this tutorial is prepared for you to try and learn.
You are encouraged to improve the code for better application.

1 thought on “Interfacing e-Paper Display Using Raspberry Pi”

  1. Hi
    I am having trouble getting it to display anything, here is there errors.

    ^CTraceback (most recent call last):
    File “epaper.py”, line 89, in
    display.display()
    File “/usr/local/lib/python3.7/dist-packages/adafruit_epd/epd.py”, line 81, in display
    self.power_up()
    File “/usr/local/lib/python3.7/dist-packages/adafruit_epd/il0373.py”, line 96, in power_up
    self.busy_wait()
    File “/usr/local/lib/python3.7/dist-packages/adafruit_epd/il0373.py”, line 89, in busy_wait
    time.sleep(0.01)
    Hope its possible you can help.

    Thanks

Leave a Comment

Your email address will not be published.

Share this Tutorial

Share on facebook
Share on whatsapp
Share on email
Share on print
Share on twitter
Share on pinterest
Share on facebook
Share on whatsapp
Share on email
Share on print
Share on twitter
Share on pinterest

Latest Tutorial

Ultrasonic HC-SR04P Using Raspberry Pi Pico
Object Sense With Servo Using Maker Pi RP2040
Build Otto DIY Robot Using Maker Pi RP2040
Raspberry Pi RP2040 vs STM32F1 vs SAMD21G18 vs ESP32-S2
The Easiest Way to Print Temperature Tower Using Cura 4.9.1 Plugins
Tutorials of Cytron Technologies Scroll to Top