This is a quick project I cobbled together only days before the Pi Party. It's an epaper badge showing my name and information, but also a slideshow of my recent Pi projects. A portable portfolio and business card, if you will. Geeky and semi useful?
Hardware
The following hardware components are used in this project:
- Raspberry Pi Zero / Pi Zero W
- 8GB microSD card
- Pimoroni Zero LiPo
- Pimoroni 2200mAh Lithium Ion battery
- Pi-Supply PaPiRus 2.7"
- Adafruit M2.5 Standoffs (4x)
Because the Zero LiPo is not stack-compatible with the PaPiRus display (the JST connector bumps into the RTC battery), I soldered the power connection to the Pi Zero using some ribbon wire. A switch connected to the Zero LiPo's EN and GND pins makes it possible to turn the power on and off without having to disconnect the battery.
A 3D printed plate allows me to fasten all components using spacers, and includes two "ears" with rings to attach a lanyard to. A slot at the top prevents the backside of the GPIO pins from bumping into the plate and some slots at the bottom are used to fasten a battery using zipties or velcro straps.
The 3D model for the plate can be found on thingiverse: http://www.thingiverse.com/thing:2175935
Software
As with most projects, the Pi needs to be set up first. I've written a guide on how to do this easily without the need to connect a screen or keyboard: Headless Raspberry Pi Setup with Raspbian Jessie
Once the basic setup is taken care of, a few additional things need to be done. The first one is to enable SPI and I2C. This can easily be done using the "raspi-config" utility, and using menu 5 "Interfacing Options".
Next, is the installation of the PaPiRus software, which has improved quite a bit since the last time I used it. Only two commands are required:
- installation of the software:
curl -sSL https://goo.gl/i1Imel | sudo bash
- configuration of the display size:
sudo papirus-set [1.44 | 1.9 | 2.0 | 2.6 | 2.7 ]
Finally, to be able to display images on the PaPiRus, some conversions are required. GIMP can make these conversions easily and is available for free for Windows, Linux and OSX. I found the "threshold" function to be the best way to create a good black and white image.
Following steps need to be taken:
- resize images to resolution of display: 2.7" = 264x176
- use threshold function to find the right balance between black and white (Colors > Threshold)
- convert to 1-bit color scheme (Image > Mode > Indexed > 1-bit palette)
- save as *.bmp (where * is a number starting at 0, so "0.bmp" then "1.bmp", etc ...)
Using SCP, upload all converted images to a folder of your choice onthe Pi:
scp *.bmp pi@<hostname>.local:images/
The images can now be used by the PaPiRus.
Code
A folder containing 1-bit black and white pictures is read by the script. The script then waits for button presses in order to display the desired image(s). In my case, the buttons have been programmed to perform following actions:
- button 1 displays a single image, my logo
- button 2 displays a single image, my social links
- button 3 cycles through all my project photos, changes on every press of the button
- button 4 cycles through all images automatically (logo, links & projects), as a slideshow
Upload the code to the Pi using SCP and ensure it is run at boot time using a cron job:
sudo chmod +x /home/pi/ebadge.py
sudo crontab -e ... # m h dom mon dow command @reboot sudo /home/pi/ebadge.py
The full code can be found below:
Video
Top Comments