Skip to main content

pyFirmata ePaper display library

A library to create and send image data to an ePaper display connected to a firmata powered microcontroller.

Supports both pyFirmata and pyFirmata2 libraries!

Library supports Python 3.0+ and should (according to vermin) also support Python 2.3+

Info

Code has been tested with the Waveshare 2.9 inch black-white and red-white display.

The code should support other displays as well, because Waveshare provides .cpp and .h files for each of their displays.

Guide below should help you. If you were to run into issues after you done all the steps according to your display, then you could make an issue if there isn't one for your display yet.

Setting up

You cannot just use the default StandardFirmata.ino file without making changes to it for this code to work.

See code_pieces_for_ino.md for the changes you need to make.

After that install either pyFirmata2 OR pyFirmata library using pip.

Then you can install this library using pip install pyfirmata-epd

API/Example

Here is an example code with comments to explain the API functions:

# Import pyfirmata2
from pyfirmata2 import Arduino
# or import pyfirmata
# from pyfirmata import Arduino

# Imports
from pyfirmata_epd.epd import Epd
from pyfirmata_epd.paint import Paint, COLORED, UNCOLORED
from pyfirmata_epd.fonts import Font12, Font16

# Open connection to board:
board = Arduino(Arduino.AUTODETECT)
print('Started up')
# Always enable sampling!
board.samplingOn()

# Init epaper display:
epd = Epd(board)
# Wake the display up (since it will always go in sleep mode)
epd.Reset()

# To clear the display:
epd.Clear()

# To display pixels:
epd.DisplayFrame([0xFF, ..., 0xFF], [0xFF, ..., 0xFF]) # black-white data, red-white data



# To easily draw shapes and stuff:
paint = Paint([], 128, 296) # Init empty buffer with width of 128 (must be multiple of 8, since 8 pixels are in 1 byte) and height of 296
# Init another paint for red pixels
paintRed = Paint([], 128, 296)

# Clear paint
paint.Clear(UNCOLORED)
paintRed.Clear(UNCOLORED)

# Draw string
paint.DrawStringAt(24, 32, "e-Paper Demo", Font12, COLORED)

# Draw string with 'inversed background'
paintRed.DrawFilledRectangle(0, 64, 128, 82, COLORED)
paintRed.DrawStringAt(2, 66, "Hello world", Font16, UNCOLORED)

# Draw rectangle with cross
paint.DrawRectangle(8, 120, 48, 170, COLORED)
paint.DrawLine(8, 120, 48, 170, COLORED)
paint.DrawLine(48, 120, 8, 170, COLORED)

# Draw circle
paint.DrawCircle(96, 152, 30, COLORED)

# Draw filled rectangle
paintRed.DrawFilledRectangle(8, 200, 48, 250, COLORED)

# Draw filled circle
paintRed.DrawFilledCircle(96, 232, 30, COLORED)

# Display on epaper display
epd.DisplayFrame(paint.GetImage(), paintRed.GetImage())

The paint should look like: democode result

Extra API documentation can be found on the ReadTheDocs documentation.

Release files for pyfirmata-epd 1.0.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for pyfirmata-epd 1.0.1
File Size Uploaded
pyfirmata_epd-1.0.1.tar.gz 26.2 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for pyfirmata-epd 1.0.1
File Interpreter ABI Platform
pyfirmata_epd-1.0.1-py3-none-any.whl Python 3 none any Details

Total release size: 51.2 kB

Release files / pyfirmata_epd-1.0.1.tar.gz

Download URL pyfirmata_epd-1.0.1.tar.gz
Size 26.2 kB
Tags Source
SHA-256 checksum
How to use checksums
1fc6cabc9330bea417af6efd900ef2514603b05ad73d2eb3863c46cadf733118
BLAKE2b-256 checksum
How to use checksums
1b34ef44a0d848a9c837d2418c8a60325a753d173ad77adcb0603506a1403388
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.0.1 CPython/3.9.2

Release files / pyfirmata_epd-1.0.1-py3-none-any.whl

Download URL pyfirmata_epd-1.0.1-py3-none-any.whl
Size 24.9 kB
Tags Python 3
SHA-256 checksum
How to use checksums
165cc1ee872710f8fb6eca8e2228f809b54307e2466b2b38195312ef476c6bb1
BLAKE2b-256 checksum
How to use checksums
ecded66c770e6497ce45c780f9b57031e431a3744e010cd53d164a672243cded
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.0.1 CPython/3.9.2

Release history Release notifications | RSS feed

This release

1.0.1 This release

2 release files

1.0.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page