Third party cookies may be stored when visiting this site. Please see the cookie information.

PenguinTutor YouTube Channel

World Book Day - Raspberry Pi and Pimoroni InkyPHat Badge

Update Since creating this project there are some new ePaper style ID badges based around microcontrollers rather than the Raspberry Pi. Please see the following for alternatives to the original Raspberry Pi based ID badge:

Today is World Book Day. For the last few years I've been supporting my local school by helping run their book sale. Last year I dressed up as The Wizard of Oz complete with Wearable Electronic flashing bow tie. This year I am a little more subtle as I won't be wearing a full costume, but still keeping with the wearable electronics I've gone for a Raspberry Pi powered electronic badge.

InkyPHat wearable Raspberry Pi badge for World Book Day

The badge is based around a Raspberry Pi Zero W, mounted in a Pimoroni PiBow case and a InkyPHat display. The display is based around ePaper / eInk technology (similar to how the original Kindle works). This means it uses very little power and will continue to display the output even after the power is switched off. It does have a bit of a flicker when it refreshes the screen (which takes a few cycles to update), but that only draws attention to the badge. Unlike most other ePaper displays this one can display more than one colour. It can display images in Red, Black and White (although one of these is likely to be the background colour).

You can see the badge in action on the short video below:

I've also included the source code of the program, for this you will also need a png file which needs to be created using a 3 colour palette (more details of how to create an Inky Phat compatible image are provided here).

Source code for Raspberry Pi InkyPHat World Book Day badge

#!/usr/bin/env python

import inkyphat
import time
from PIL import ImageFont, Image

font = ImageFont.truetype(inkyphat.fonts.FredokaOne, 32)

message = ""
w, h = font.getsize(message)
x = (inkyphat.WIDTH / 2) - (w / 2)
y = (inkyphat.HEIGHT / 2) - (h / 2)

font2 = ImageFont.truetype(inkyphat.fonts.FredokaOne, 28)
message2 = "Books are\nFun!"

w2,h2 = font.getsize(message)
x2 = (inkyphat.WIDTH / 2) - (w2 / 2)
y2 = (inkyphat.HEIGHT / 2) - (h2)

while 1:
inkyphat.text((x, y), message, inkyphat.RED, font)


inkyphat.text((x2, y2), message2, inkyphat.BLACK, font)

The image file is below:

World book day InkyPHat image