Frustration-free e-paper usage for Linux

Intro

E-paper (electrophoretic display technology) has found its way into more and more products and personal projects over the last few years. One thing that hasn't come with this widespread adoption is a way to make them easier to use - they're uniquely difficult and frankly they're frustrating. Why frustrating? There are some aspects of using these displays that offer unique challenges. These tend to be one of the following:

  • They need an external DC/DC boost circuit and 24-pin 0.5mm FPC. Difficult to create on your own
  • Many displays share the same exact size/look, but are incompatible. There are two main families of controller chips (Solomon Systech and UltraChip), but even within those two there are multiple versions that can be incompatible.
  • They behave very differently compared to other all-points-addressable displays. It is unfortunately necessary to learn a bit about the physical properties of them in order to use them correctly.
  • The vendors don't provide good documentation nor good example code. The provided code may work on your hardware, but offers a minimal starting point for your project.
I've created a few ways to reduce this frustration...

The Library

I've been working with these displays for several years and have written a lot of code to talk to them. About a year ago I decided to start from a clean slate and write a comprehensive, well designed library to control them ALL. The result is bb_epaper. A portable C (with C++ wrapper) library which can talk to nearly every SPI-connected e-paper display in the market. It includes 2D graphics primitives, compressed fonts and images and uses the same API as my other display libraries. The C code is completely portable to any target hardware and I've included I/O wrapper functions to allow it to build on Arduino, ESP-IDF, and Linux. If you want to use it on STM32 or some other system, it's quite easy to provide a few lines of wrapper code to enable it. I've included a bunch of examples and relatively voluminous documentation.

A library and documentation aren't always sufficient to get things working with these displays. There are some fundamental barriers to getting them to function that create significant frustration for a large portion of the people using them.

The Tool (show_png)

Linux offers something unique and helpful to enable simplifying use of these displays. The large memory spaces, robust infrastructure and standard tooling allow the creation of powerful command line tools that can be easily executed from a shell or called from within your favorite high level programming language. I came up with the idea of an image display tool as a way to simply many common use cases of e-paper displays. It has the secondary benefit of being a very complete example project from which to grow your own. My original idea was to provide an easy way to display PNG (and BMP) images, but it has already grown into a much more complex program. The input file format is less of an issue than the other features. It currently manages grayscale thresholding and color matching to look best on the display you're using. For example, in the photo below I passed it a full color PNG image and configured the output for a 3-color (Black/White/Red) display. It does a "best effort" to match the colors and the result looks quite good. The display in use is a Pimoroni Inkyphat 3-color 2.13":

The original image below



At the time of this writing, 3-color (B/W/R) displays are being removed from the market and replaced with 4-color (Black/White/Yellow/Red). It makes sense since the addition of 1 more color doesn't add significant cost or complexity compared with the 3-color versions. The red color 'wasted' a whole memory plane and now red+yellow take its place.

To display the image above, you need to provide the tool with some info:

The e-paper adapter (GPIO connections are implied from that)
The epaper panel type
The update mode (full, fast, partial)
The input filename

All of the above can be provided in a JSON file (epaper.json) or command line parameters or both. To display that image above, you pass the following parameters:

./show_png file=~/snoopy.png adapter=pimoroni panel_2bit=EP213R_122x250

The only real challenge is correctly choosing the panel. I created a Wiki page which maps product names to my internal panel names.

Going Further

Like all software, this current version should not be considered 'the end'. Beyond its current features, I can see the next step would be to add additional image file support such as JPEG. What do you think? Please leave a comment below.

Comments

Popular posts from this blog

How much current do OLED displays use?

How to speed up your project with DMA

Fast SSD1306 OLED drawing with I2C bit banging