Now reading

code • September 25, 2022

I built a display that shows the book I’m reading and how many books I read this year. It’s powered by my GitHub Action to track books, a Raspberry Pi, epaper.js, and an e-paper module.

The now reading book display is in a black frame. It shows the book 'How to Read Now' by Elaine Castillo. Book goal 86 out of 100 books read.

Refactor read-action

Before I started this project, I knew I would need to update read-action. The action only stored the date that I finished a book, so to show the book I’m reading, I needed the add the start date. This kicked off a series of small refactors:

I updated the sample iOS Shortcut to handle the new API format and date options.

Design the display

Knowing that the resolution on the e-paper module is low and only supports gray-scale, my design took on a retro vibe. I considered using cover book art, but knew the image would start to degrade given the small scale.

See the Pen Now reading... by Katy DeCorah (@katydecorah) on CodePen.

I made a few more tweaks and published the now reading page on my archive site, where it will automatically update as I start a new book.

Set-up the Raspberry Pi

I used Raspberry Pi Imager to format my SD card and make sure it could connect to wifi. Once the device connected to wifi, from my computer, I connected via SSH to the Raspberry Pi. I followed the steps to install epaper.js with some bumps. My Raspberry Pi is several generations behind the recommended specifications.

One new thing I learned is that you can make nvm install unofficial Node builds with:

NVM_NODEJS_ORG_MIRROR=https://unofficial-builds.nodejs.org/download/release/ nvm install 16

Display the display

Finally, I ran the epaper.js command and my site appeared! I was pleasantly surprised that the design only need an increase the font-weight to improve the contrast.

Next, I spent $8 at Target on a 4x6 frame, spray painted it black, and cut a black frame to match the screen. After negotiating with some masking tape, the e-paper module fit snugly in the frame.

Keep the display updated

On the Raspberry Pi, I used crontab to update the display every hour. To do this, I created a separate script to make sure crontab can access node_modules:

#!/bin/bash
export NVM_DIR="/home/.nvm"
[ -s "$NVM_DIR/nvm.sh" ] && . "$NVM_DIR/nvm.sh"
ejs display rpi-4in2 "https://katydecorah.com/archive/books/now/"

Next, I ran crontab -e and added my cron job:

0 * * * * /home/display.sh > ejs.log 2>&1

The last bit > ejs.log 2>&1 generates logs for the job, which was immensely helpful in debugging.

Build your virtual library

Over the past few years, I have jumped back into reading, but I don’t own a lot of physical books. I love audiobooks and ebooks, and supporting my local library. Building a virtual library is a fun way to remember the books I read and I look forward to designing more virtual library views for my display.

Keep reading code