Dynamically display the currently playing album art on an LED matrix panel. This project integrates with Last.fm to fetch the album art and handles image format conversion, resizing, and uploading to the board.
- Service Agnostic: Compatible with any music service that scrobbles to Last.fm.
- Public API Use: Utilizes a public API without the need for a sign-up.
- Efficient API Use: Only polls the API every 10 seconds by default and does not pull the album art if it has not changed.
- Auto Power Off: The LED matrix panel will automatically turn off after 10 minutes of inactivity (configurable).
-
Follow Pimoroni's guide to attach the LED matrix panel to the Interstate75
-
Install CircuitPython (tested with 9.1.3) on the Interstate75, following the guide from Pimoroni
-
Attach the board to your computer via USB
- To set up the project, ensure you have Python installed and use the following command to install the required Python packages:
pip install -r requirements.txt
-
Copy
code.py
from theinterstate75
folder of the project to the root of the board (CIRCUITPY). This code will run every time the board boots. -
Press
RST
button on the board to restart.
Before running the application, create a file called .env
(without an extension) at the root of the project with the following content (replace your_lastfm_username
with your username):
LASTFM_USER=your_lastfm_username
Then update the drive letter of the board in config.py to refer to the drive letter where CIRCUITPY is mounted, e.g.:
BOARD_DRIVE_LETTER = 'D'
config.py:
LOOP_SLEEP_S
: The time in seconds between each poll of the API. Default is 10 seconds.REQUEST_TIMEOUT_S
: The time in seconds to wait for a response from the API. Default is 10 seconds.OUTPUT_IMAGE
: The path to the image on the board that will be updated with the album art. Default isart.bmp
. Ensure this matchesOUTPUT_IMAGE
in code.py.
code.py:
DISPLAY_TIMEOUT_S
: The time in seconds that the LED matrix panel will display the same image before turning off. Default is 600 seconds (10 minutes).OUTPUT_IMAGE
: The path to the image on the board that will be updated with the album art. Default isart.bmp
. Ensure this matchesOUTPUT_IMAGE
in config.py.
To start the application ensure the board is connected to the computer and run the main script:
python main.py
The board may require restarting after reattaching to the computer. Press the RST button on the back of the board to restart.
The project relies on a few external libraries, listed in requirements.txt
:
Pillow
for image processingpython-dotenv
for environment variable managementRequests
for making HTTP requests
This project incorporates code from and was inspired by music-screen-api by hankhank10.
It was also inspired by my previous project NowPlaying (which displays the currently playing track on a Waveshare e-ink display), as well as a similar project on reddit.
To understand how to use the Last.fm API for fetching album art, refer to the Last.fm API documentation.