Application for the library, a train scheduler tracker
Line graphing utility
Scatter plot utility
Bar graph utility
I randomly bought an e-paper display, and wanted to learn how to use it, so I decided to write a python library for Raspebrry Pi to make use of some of its features. Being an e-paper display - and a cheap one at that - the refresh rate is rather slow (around 7 seconds) which makes application an important consideration in how to use it. The application must be something which does not have a high refresh rate, and which holds the same image on the screen for a long time. The three applications I came up with were graphing/data logging, e-reader, and train schedule.
What it does
Train Schedule This utility pulls data from the MBTA real-time API to display the upcoming trains for a specified station. The user can specify the location, and the program will pull the upcoming trains in both directions and then list the direction of the train and how much time until that train departs. A separate class was written for this, called mbta, which holds all the methods to interact with the real-time API.
Graphing The graphing utility gives the users a few choices on how to display data. There are three choices: scatter plot, line plot, and bar graph. Two arrays are input into any of these choices, the x-coordinates and the y-coordinates. A title and axes label can be added to the graph in a similar way to matplotlib or Matlab. The program will automatically scale the data to fit on the available screen space, and will label the axes with the scaled values.
E-Reader A string can be input to the program to be displayed on the e-paper screen. It will be split up into lines which can fit across the screen, and also by how many lines can fit per page. At the bottom of the screen a simple UI is shown which tells the user which page they are on out of the max number of pages. The physical buttons on the bottom of the screen are used to change the page, reaching a hard stop at the first and last page. In the future this could be a good area to build upon, being able to load files and also have more rich formatting on the screen such as italics, bold, and others.
How I built it
Waveshare, the company who makes this e-paper display, provides a simple library to write frame buffers to the display. To use the display, I had to draw these frame buffers. This was done using the Python Imaging Library (PIL) to draw images from combinations of lines, rectangles, and text. I created a class to hold all of the eink methods and properties which greatly simplified the usage of the library.
What's next for E-paper Library
There are a ton of other applications possible for this project which could be explored in the future. It could be a great stock tracker, cryptocurrency tracker, or a data logger for temperature or light just to name a few. The library makes it easy to build upon, so the possibilities are only limited by creativity!