Skip to content

elliotwutingfeng/spotify-album-art-matrix

spotify-album-art-matrix

LICENSE

Stream album art from your Spotify account to a 32 by 32 WS2812B LED matrix via an Arduino UNO R4 WiFi board.

animation

Album art by Tom Lehrer; public domain.

You Will Need

  • Spotify Developer Account with Spotify Premium access
  • Python 3.14+ for obtaining Spotify API refresh token.
  • Arduino UNO R4 WiFi with USB cable.
  • Four pieces of 32 by 8 (or 16 by 16) WS2812B addressable LED matrix panel. Total size of combined panels should be 32 by 32 pixels.
  • 3 jumper wires for connecting the combined LED matrix to the Arduino.
  • Optional: 470 Ω resistor to prevent voltage spikes from damaging the LED matrix.
  • Optional: Enclosure for the Arduino and LED matrix panel; IKEA SANNAHED 35x35 cm works well, the inner 24x24 cm mount opening can be enlarged with a pen knife to fit the LED matrix panel snugly.

Setup

Spotify API and WiFi Credentials

  1. Install Arduino IDE on your computer.

  2. Clone this repository.

  3. Copy arduino_secrets_dev.h to arduino_secrets.h and update your WiFi credentials in arduino_secrets.h.

    cp --update=none ~/spotify-album-art-matrix/arduino_secrets_dev.h ~/spotify-album-art-matrix/arduino_secrets.h
  4. Sign in to your Spotify Developer account (Spotify Premium is required).

  5. Create a Spotify app.

  6. Fill in the following details

    • App name: Album Art Matrix
    • App description: Display Spotify album art on a WS2812B LED matrix.
    • Redirect URIs: http://127.0.0.1:3000/callback
    • APIs used: Select Web API.
  7. Agree with the Terms of Service and click "Save".

  8. In the Spotify dashboard, select your newly created app and copy the Client ID and Client secret to the spotify-album-art-matrix/arduino_secrets.h file under the fields CLIENT_ID and CLIENT_SECRET.

  9. Run the following script to obtain the REFRESH_TOKEN for Spotify API access:

    python3 get_refresh_token.py

    Copy the refresh token from the output to the spotify-album-art-matrix/arduino_secrets.h file under the field REFRESH_TOKEN.

Hardware Setup

  1. From Arduino IDE, install Arduino UNO R4 Boards from Board Manager.

  2. Install the following libraries from Library Manager:

  3. Open and upload spotify-album-art-matrix.ino to your Arduino; ensure that the correct board (Arduino UNO R4 WiFi) and port are selected. Once uploaded, unplug the Arduino.

  4. Daisy-chain the 4 WS2812B LED matrix panels together (Data Out of the first panel to Data In of the second panel, and so on). Data Out of the last panel should not be connected to anything.

  5. Depending on how you arrange the panels, and how your panels are manufactured, you may need to adjust the Adafruit_NeoMatrix *matrix = new Adafruit_NeoMatrix variable configuration in spotify-album-art-matrix.ino to ensure the pixels are mapped correctly.

Caution

Ensure that the Arduino is unplugged when connecting the LED matrix panel to avoid any potential short circuits or damage to the components.

  1. Connect the main WS2812B LED matrix panel to the Arduino as follows:

    • LED matrix panel GND to Arduino GND
    • LED matrix panel 5V to Arduino 5V
    • LED matrix panel Data In (⚠️ not Data Out) to Arduino Digital Pin 6 (with optional 470 Ω resistor in series)
  2. Plug in the Arduino, and play a song on Spotify. The LED matrix panel should light up and start displaying the album art of the currently playing track.

Default State

When no Spotify client is active or when playback is completely stopped, baby panda 🐼 will be shown instead.

panda-matrix

Sources

Disclaimer

  • This is not an official Spotify product or service.

About

🎧🖼️ Stream album art from your Spotify account to a 32 by 32 WS2812B LED matrix via an Arduino UNO R4 WiFi board

Topics

Resources

License

Code of conduct

Stars

Watchers

Forks

Contributors