Spotify Control Center
If you’ve ever wanted a dedicated/always-on Spotify control center, something you can tap like a car stereo, display album art, switch songs, adjust volume, and watch your music progress in real time, this project is for you.
This guide will show you how to build a standalone Spotify dashboard using a Raspberry Pi, a 7-inch touchscreen, and some lightweight Python code. The final result is a clean, modern interface that displays:
- The current song playing, the artist name and the album art
- A live and accurate progress bar
- Touch-friendly play/pause, next, previous, and volume buttons
Everything is designed to be simple, responsive, and perfect for mounting on a desk, wall, nightstand, or even inside a custom enclosure.
This is a great project whether you’re into home automation, tinkering, or just want a sleek way to control your music without needing your phone. No special hardware is required besides the Pi and touchscreen, and the software is all free.
Supplies
Installing Raspberry Pi OS
The first step in preparing your Raspberry Pi is installing an OS onto the SD card. The Raspberry Pi Imager software can be downloaded from the attached link.
- Download your respective OS from this link.
- Create an image on your SD card with the Imager software.
- Insert the SD card into your Raspberry Pi.
- After installing and booting into the OS, set up internet and login details.
Create a Spotify Developer App
This project requires access to Spotify's API to retrieve accurate song data. Navigate to the Spotify for Developers website and log in with your Spotify account.
- Click on "Create app"
- Note your "Client ID" and "Client secret". These will be used later during setup.
- Customize your app name and description
- Add a redirect URI (http://127.0.0.1:8000/callback). You can use the previous link for yours as well.
- When prompted to choose an API/SDK, choose Web API.
- Save your app.
Installing Libraries
This project uses many libraries to function, and we will install them now.
- First, update your software by running sudo apt update
- Install the necessary libraries with this command: sudo apt install python3-pygame python3-pil python3-numpy python3-requests python3-alsaaudio
- Lastly, install spotipy with pip3 install spotipy
Creating the Dashboard
- Within your terminal, run the command mkdir ~/spotify-dashboard to create the directory.
- Navigate to this folder with the cd ~/spotify-dashboard command.
- Create a config file with the command nano config.py. Within this file, you will define your client ID, client secret, redirect URI, and device name. (You can name your device whatever you would like!)
Importing Libraries
We will create our code file by running the nano dashboard.py command.
- Within the dashboard.py file, we will begin the code by importing the libraries the dashboard will use.
Spotify Authorization
Next, we will configure Spotipy to authorize our client ID, secret and URI from the Spotify for Developers site.
Configuring Pygame
The next few steps of the code will address Pygame, which creates the window our dashboard will run in. This code creates the window and defines its' title, resolution, font and font size.
Defining the Buttons
This step will define the size and shape of the control buttons for our dashboard.
Album Art Loader
To retrieve the album art, we will define a function to take the data from the Spotify URL. The size can be changed depending on your display, but this will fit as it is defined.
Creating a Progress Bar
To create our progress bar, Pygame takes the data from Spotify to define where the song starts, ends, and pauses. We will create a function to draw the progress bar onscreen.
Spotify Helpers
This step will address the actual Spotify control within the dashboard. This code creates functions to retrieve playback data, detect volume changes, and it tells the onscreen buttons what to do.
Drawing the Buttons
This step will actually draw our control buttons onscreen, and label them with their corresponding function. The labels can be customized as long as they fit within the box it sits in.
Main Loop
The final step in the code is creating the while loop that will draw our dashboard completely. It will open our Pygame window, retrieve playback data, display our album art, artist name, progress bar and control buttons.
Opening the Dashboard
- Save your changes with CTRL+O and close GNU nano with CTRL+X.
- Open a new terminal window and run the command cd ~/spotify-dashboard.
- Open the virtual environment with source venv/bin/activate.
- Start the dashboard script with python3 dashboard.py.
- Your dashboard should now be open! The window will be blank (seen above) until music is playing.
- Once music plays, you are all set!