Introduction: Retro CD/Spotify/Alexa Player

About: I enjoy making things. All kinds of things from woodworking and electronics to programming. You can see my projects on my YouTube Channel.

What do you do with all of your old CDs that are just collecting dust? Well, turn them into an overly complex system to play music on Spotify of course.

I wanted to find a clever way to use my old CDs that were just collecting dust since I listen to all of my music via Spotify. I had some NFC stickers laying around just waiting to be used in a project, so I thought, why not slap them onto some CDs and see what we can make? And like that, a new project was born. All that was missing was an understanding of the Spotify API which did not take long to learn. I wired a NFC reader to an ESP32 microcontroller and wrote some code to call the Spotify APIs to play music on an Echo Dot. The final piece was a wooden case to hold it all. It turned out awesome and even gives off an unexpected retro vibe. Check out my videos below for all the details of how I made it.

Supplies

Step 1: Assemble the Electronics

There are just two pieces that make up the electronics for this project, the ESP32 Microcontroller and RFID-RC522 NFC reader. We use SPI interface of the RFID-RC522 to communicate with it.

There are seven connections we need to make to wire the NFC reader to the ESP32. See the wiring diagram above.

VCC supplies power for the module. It is connected to the 3.3V (pin 1) on the ESP32.

RST is an input for Reset and power-down. It is connected to GPIO 22 (pin 14) on the ESP32.

GND is the Ground Pin and needs to be connected to GND (pin 2) on the ESP32.

IRQ is an interrupt pin that can alert the microcontroller when RFID tag comes into its vicinity. I don't use this pin, therefore it is left unconnected.

MISO pin acts as Master-In-Slave-Out when SPI interface is enabled. It is connected to SPI_MISO (pin 10) on the ESP32

MOSI (Master Out Slave In) is SPI input to the RC522 module. It is connected to SPI_MOSI (pin 15) on the ESP32

SCK (Serial Clock)accepts clock pulses provided by the SPI bus Master. It is connected to SPI_CLK (pin 9) on the ESP32

SDA pin acts as Signal input when SPI interface is enabled. It is connected to GPIO 21 (pin 11) on the ESP32

Step 2: Create NFC Tags With Spotify Links

A key part of the design of this project is the data that is read from the NFC tag. Other projects like this tend to simply use the unique ID that comes prewritten on every NFC tag. This means that there is nothing they have to do to the tags, instead they create a lookup in their source code to map the NFC tag ID to the Spotify album ID. The upside of this approach is you never have to write any data to the NFC tag. The downside of this approach is you have to update your source code or lookup table each time you want to add a new NFC tag and album.

I took the approach that I wanted my source code to not need a lookup table, but instead it would get all the data it needs to play the Spotify album from the NFC tag. Therefore I store the Spotify shareable link to the NFC tag. When I want to add new NFC tags and albums I don't have to change my source code or worry about updating a lookup table, I simply write a Spotify link to a new NFC tag. This also has the benefit that I can use these tags with the NFC reader on my phone to open those albums in the Spotify App.

I created a YouTube video short that walks through these steps, so watch it as well.

Steps:

  1. Purchase some NFC Tags.
    1. I used Mifare Ultralight C 192 bytes. The Spotify links are only about 50 bytes, so you don't need much space on the NFC tags.
  2. Install NFC Tools app on your phone.
    1. You need an App on your phone that will write data to the NFC Tags. I used "NFC Tools" on my Android phone.
  3. Copy your Spotify link onto your clipboard
    1. Opening Spotify
    2. Select the album or playlist
    3. Open the menu for the selected item
    4. Select share,
    5. Select copy link
  4. Write Spotify link to tag
    1. Open NFC Tools on your phone.
    2. Select the write tab
    3. Select add a record
    4. Select URL.
    5. Select "https://"
    6. Paste the Spotify URL into edit box for example https://open.spotify.com/album/5IJm0boSQuEBLiYNZJKV2Y?si=89eC_RS7Ti6s-Evnr4kNeg.
    7. Delete the http:// at the beginning of the URL
    8. Delete the question mark and everything after it at the end of the URL (delete everything bolded in the example URL).
    9. Click Ok
    10. Click write.
    11. Place the NFC tag against the back of the phone
    12. You should see "Write complete!"
    13. The tag is done and has the URL on it.
  5. Repeat this for as many tags as you want to create.

Step 3: Programming

The source code for this project can be found in this GitHub Repo. I walk through the ESP32 source code in the video above and cover how to get access to the Spotify API in the second video.

To communicate with the NFC reader, I am using the MFRC522 Arduino library by miguelbalboa located here. It worked right out of the box for me after I wired the RFID-RC522 to the ESP32. When I instantiate the MFRC522 object, I pass 22 for the SS pin and 21 for the RST pin since these are the GPIO pins I used on the ESP32.

To communicate with Spotify API, I wrote my own class. You must create yourself an App in the Spotify API dashboard to generate a Client Id and Client Secret that you will use in the ESP32 source code. Watch the Spotify Web API video above for more details on these steps.

Step 4: Build a Case

And finally I made a case to house all of the electronics and provide nice aesthetics for this project.

I've become a big fan of using walnut in my projects since using it for my subscriber count display and on air sign. I used walnut for the sides and birds eye maple for the front. One of my design goals for the case was to make it look like the Echo Dot was a speaker mounted in a box. I also wanted the CD to sit on top in a way that nicely displayed the cover art. And finally I wanted the NFC reader to not be visible.

I started with a cardboard mock up of the box to figure out over all dimensions and placement of things. Then I took that information and fabricated the final box out of wood. I really love how the horizontal grain of the walnut turned out. I wasn't exactly trying for a retro look, but it turned out gorgeous.

Step 5: Share You Project

If you build one, I would love to see it, so share it with me on twitter @MakerAtPlay1 or Instagram @makeratplay

Microcontroller Contest

Participated in the
Microcontroller Contest