Skip to content

elliotwutingfeng/spotify-album-art-matrix

Repository files navigation

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.
  • LM2596S 12V to 5V step-down voltage regulator module with USB output (like this one but you can find it a lot cheaper on Chinese e-commerce sites).
  • 12V DC power supply capable of providing at least 1.5A current.
  • 2 wire splitters, one for 5V, and one for GND.
  • At least 8 male-to-male jumper wires.
  • At least 3 male-to-female jumper wires.
  • 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.

Important

We are using 12V DC power supply and a step-down voltage regulator module, because powering this many addressable LEDs directly from the Arduino is prone to under-voltage issues, which can cause the LED matrix panels to display wrong colors.

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.

Important

The refresh token will expire after 6 months, upon which you will need to run the get_refresh_token.py script again and obtain a new 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 Data line of 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 power supply is unplugged when connecting the LED matrix panel to avoid any potential short circuits or damage to the components.

  1. Designate 1 wire splitter for 5V, and 1 wire splitter for GND.

  2. Connect the 5V terminal of all WS2812B LED matrix panels to the 5V wire splitter.

  3. Connect the 5V output of the LM2596S step-down voltage regulator module to the 5V wire splitter

  4. Connect the GND terminal of all WS2812B LED matrix panels to the GND wire splitter.

  5. Connect the GND output of the LM2596S step-down voltage regulator module to the GND wire splitter.

  6. Connect the main LED matrix panel Data In (⚠️ not Data Out) to Arduino Digital Pin 6 (with optional 470 Ω resistor in series)

  7. Plug in the Arduino to the USB output of the LM2596S step-down voltage regulator module.

  8. Plug in the DC 12V power supply to the LM2596S step-down voltage regulator module, and switch it on.

  9. Now play a song on Spotify. You should see 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

1 star

Watchers

0 watching

Forks

Contributors