This project displays album artwork and song info on a 4", 5.7" or 7,3" e-ink display from the Spotify web api.
You can also control Spotify via the 4 Buttons on the Pimoroni Display.
The original concecpt came from Ryan Ward and his video: Youtube Video
This version is updated to account for the latest OS changes, virtual environments, and adds button controlls.
Button functions:
- Button A - next track
- Button B - previous track
- Button C - play/pause
- Button D - toggle repeat order: track, context(playlist), off
I recommend a Raspberry Pi Zero 2 with GPIO pins, which has the necessary power and is small enough to make a sleek final product.
The display refresh time is ~30 seconds.
- Create a new application within the Spotify developer dashboard
- Edit the settings of the application within the dashboard.
- Set the redirect uri to local url http://localhost/redirect
- For the the Rapsberry PI Zero 2 use the "Raspberry PI OS Lite (64-bit)"
- Download the install script
wget https://raw.githubusercontent.com/Gabbajoe/spotipi-eink/main/setup.sh
chmod +x setup.sh
- Install the software:
bash setup.sh
After the spotipi-eink is installed you will have 2 new systemd services:
- spotipi-eink-display.service
- spotipi-eink-buttons.service (only for Pimoroni displays)
This services run as the user with you used to execute setup.sh.
You control the services via systemctl start, stop, status (services-name). Example get the status of spotipi-eink-display.service:
spotipi@spotipi:~ $ sudo systemctl status spotipi-eink-display.service
● spotipi-eink-display.service - Spotipi eInk Display service
Loaded: loaded (/etc/systemd/system/spotipi-eink-display.service; enabled; preset: enabled)
Drop-In: /etc/systemd/system/spotipi-eink-display.service.d
└─spotipi-eink-display_env.conf
Active: active (running) since Tue 2023-10-31 09:30:05 CET; 27min ago
Main PID: 4108 (python3)
Tasks: 1 (limit: 383)
CPU: 5min 13.455s
CGroup: /system.slice/spotipi-eink-display.service
└─4108 /home/spotipi/spotipi-eink/spotipienv/bin/python3 /home/spotipi/spotipi-eink/python/spotipiEinkDisplay.py
Oct 31 09:30:05 spotipi systemd[1]: Started spotipi-eink-display.service - Spotipi eInk Display service.
Oct 31 09:30:06 spotipi spotipi-eink-display[4108]: Spotipi eInk Display - Service instance created
Oct 31 09:30:07 spotipi spotipi-eink-display[4108]: Spotipi eInk Display - Loading Pimoroni inky lib
Oct 31 09:30:07 spotipi spotipi-eink-display[4108]: Spotipi eInk Display - Service started
In the file spotipi/config/eink_options.ini you can modify:
- the displayed title and artist text size
- the direction of how the title or artist text line break will be done, top-down or bottom-up
- the offset from display borders
- disable the small album cover
- the size of the small album cover
- the font that will be used
Example config:
[DEFAULT]
width = 640
height = 400
album_cover_small_px = 200
; possible values are inky or waveshare4
model = inky
; disable smaller album cover set to False
; if disabled top offset is still calculated like as the following:
; offset_px_top + album_cover_small_px
album_cover_small = True
; cleans the display every 20 picture
; this takes ~60 seconds
display_refresh_counter = 20
username = theRockJohnson
token_file = /home/spotipi/spotipi-eink/config/.cache
spotipy_log = /home/spotipi/spotipi-eink/log/spotipy.log
no_song_cover = /home/spotipi/spotipi-eink/resources/default.jpg
font_path = /home/spotipi/spotipi-eink/resources/CircularStd-Bold.otf
font_size_title = 45
font_size_artist = 35
offset_px_left = 20
offset_px_right = 20
offset_px_top = 0
offset_px_bottom = 20
offset_text_px_shadow = 4
; text_direction possible values: top-down or bottom-up
text_direction = bottom-up
; possible modes are fit or repeat
background_mode = fit
- Raspberry Pi Zero 2
- Pimoroni Inky Impression 4"
- Waveshare 4.01inch ACeP 7-Color E-Paper E-Ink Display HAT
- Pimoroni Inky Impression 5.7"
- Pimoroni Inky Impression 7.3"
With the latest Raspberry PI OS Bookworm /var/log/syslog is no longer an option for logs. Instead, you have to use journalctl. To view the spotipi-eink-display.service and spotipi-eink-buttons.service logs use the following command:
# see all time logs
journalctl -u spotipi-eink-display.service -u spotipi-eink-buttons.service
or
# see only today logs
journalctl -u spotipi-eink-display.service -u spotipi-eink-buttons.service --since today
Spotipi-eink creates its own Python environment because since Raspberry PI OS Bookworm insists on protected environments for Python See:
This should be unnecessary, but if you wish to manually execute the Python script you can load into the Virtual Python environment with the following commands. When in the Virtual Python environment, Terminal will display (spotipienv):
cd ~
. spotipi/spotipi-eink/spotipienv/bin/activate
Additionally you need to export the following 3 environment variables on you shell that the spotipy library is working. You can fnd the values for them in then file /etc/systemd/system/spotipi-eink-display.service.d/spotipi-eink-display_env.conf
export SPOTIPY_CLIENT_ID=''
export SPOTIPY_CLIENT_SECRET=''
export SPOTIPY_REDIRECT_URI=''
To leave the Virtual Python environment just type: deactivate
- SpotiPi E-Ink - for Inky Impression 5.7" Case
- Pimoroni Inky Impression Case - for Inky Impression 5.7" Case
- Inky Impression 5.7" Frame
- DIY Raspberry Pi Spotify Eink Thing Case - for Inky Impression 5.7" Case
- Inky Impression 7.3 e-Paper frame/case
- Pimoroni 7 color EInk display Frame
- Spotipi-eink Waveshare 4 inch case
- Desktop Case for pimoroni Inky Impression 4" (7 colour ePaper/eInk HAT) and Raspberry Pi Zero/3 A+
- Picture frame for pimoroni Inky Impression 5.7" (ePaper/eInk/EPD) and raspberry pi zero
- Enclosure for pimoroni Inky Impression (ePaper/eInk/EPD) and raspberry pi zero
Example picture of my 4" display in the Pimoroni Desktop case:
Just recently(2024/08/16) the GPIO Kernel Module in Raspberry PI OS changed.
You may notice with an OS update that your Pimironi display stoped working or even find the error message
Woah there, some pins we need are in use!
Chip Select: (line 8, GPIO8) currently claimed by spi0 CS0
Here you need to add dtoverlay=spi0-0cs
to the end of your /boot/firmware/config.txt
example:
sudo vi /boot/firmware/config.txt
put it in the [all] section at the end of the file a line like this:
[all]
dtoverlay=spi0-0cs
and reboot the pi. Thank you @conrat4567 for bringing that to my attention