- Learn Linux
- Learn Electronics
- Raspberry Pi
- LPI certification
- News & Reviews
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.
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).
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)
inkyphat.text((x, y), message, inkyphat.RED, font)
inkyphat.text((x2, y2), message2, inkyphat.BLACK, font)
The image file is below: