Albums With NFC Tags to Automatically Play Spotify Music on Chromecast




Introduction: Albums With NFC Tags to Automatically Play Spotify Music on Chromecast

This project started with the idea of making an album collage of my most played artists on Spotify. After some playing with the Spotify API in Python, I thought it would be nice to link these album covers to their Spotify URI's and start playing them by simply touching them with my phone. The automation app allows to automatically play the touched albums on a Chromecast device.

Step 1: What You Will Need

  • NFC tags: As many programmable tags as you have albums you want to display. (Better buy some more as you can never have to many NFC tags at home) I bought mine in bulk from AliExpress (100 tags for about 10 $ ).
  • An android phone with NFC
  • NFC TagWriter by NXP, a free android NFC writer application

  • Automate, a free android automation application to automate actions

  • A Spotify account. This project was written to be used with Spotify: a Spotify URI ( Uniform Resource Identifiers for sharing and locating artists, albums, searches, playlists and songs within the Spotify library) is written on a NFC tag and later on read by Automate to start playing music on Spotify (and possibly cast to your Chromecast).

  • (Optional) A Chromecast device. If you have no device to cast to, the music will simply start playing on your smartphone.

  • (Optional) Album covers: you can use album covers you already have at home. I did not have any album covers as all my music is streamed from Spotify so I downloaded the album covers with the Python script from step 2a and printed them as non-glare pictures at 10 cm x 10 cm.

Step 2: Getting Album Covers and Spotify URI's

There are two ways you can obtain the album covers and Spotify URI's:

  • Step 2a explains how you can automatically download the album covers of your top artists in Spotify using a Python script I wrote. This script also automatically generates the necessary .csv file with all the Spotify URI's to the albums on Spotify. This .csv file is needed in step 3 to write the NFC tags.
  • Step 2b explains how you can obtain album covers and Spotify URI's manually without running Python scripts and installing Python packages. This step is simpler but is a lot of work if you have to download multiple album covers manually, search for every URI yourself and copy and past them into the necessary .csv file.

Step 2a: Automatically downloading album covers and Spotify URI's with a Python script

In this step 10 album covers of each of your 60 most played artists on Spotify are automatically downloaded by a Python script I wrote. At first the Python package Spotipy should be installed on your PC. On systems with pip installed this can be done by:

$ pip install spotipy

The Python script can be found on my Github as You run the script from a terminal or command prompt as:

$ python <Spotify_username>

The first time you run the script a link will be opened in your default browser to give the script access to read your Spotify "user-top" statistics. After giving the application access, you are directed to a link starting with Copy the whole link and paste it in the terminal or command prompt to give the script the necessary permissions. Hereafter the program downloads 10 album covers per artists into the folders Covers/<artist_name/ It is for you to decide which albums you want print for your collage and which you want to discard. I printed mine as 10 cm x 10 cm non-glare pictures at an online photo printing service for about 0.10 EUR apiece. Besides album covers, also a .csv file is generated containing all the Spotify URI's of the albums downloaded. This .csv file is named TagWriter_mass_encoding.csv and is already formatted to use in the TagWriter application to easily write multiple NFC tags. It is strongly recommended to remove all rows of albums that you did not print and do not want to write an NFC tag for. If there are album covers that you printed which were not downloaded by the Python script, look at step 2b to manually add the Spotify URI to the .csv file.

Step 2b: Manually downloading album covers and finding Spotify URI's

If you do not want to use the Python script to automatically download album covers of your top artists on Spotify, follow this step. With a simple Google image search you can find all the album covers you want to print. I printed mine as 10 cm x 10 cm non-glare pictures at an online photo printing service for about 0.10 EUR apiece. You also need to search for every album the Spotify URI. This is done in the Spotify desktop app as can be seen in the print screen. Select the album options and go to share>'Copy Spotify URI'. The Spotify URI should be added to a .csv file which is formatted especially for the TagWriter app which we will use to easily write multiple NFC tags. A template with some example data is presented in the screenshot and can be downloaded on my Github page as Tagwriter_mass_encoding.csv. Be sure to fill in this template with your Spotify URI's and a meaningful description. When ready, save this file again as a .csv file.

When you have printed your album covers, place one NFC tag on the back of every album cover. It is best to place the NFC tags at the same position on the albums in order to read the tags more easily.

Step 3: Writing Spotify URI's With TagWriter

The Tagwriter_mass_encoding.csv file will be used as an input for the NFC TagWriter by NXP android app. Please install this app on your NFC android phone via the Google Play Store. The Tagwriter_mass_encoding.csv file should be stored on your smartphone for the application to access it. To write the NFC tags from the .csv file follow the next steps:

  1. In the home screen of the TagWriter app select 'Write Tags"
  2. Select "Write from CSV"
  3. Go to your .csv file and select it by LONG pressing the file
  4. At the top right you see Dataset index (1/6). This means that the application correctly read the 6 entries in the .csv file (see the screenshot in step 2b for the 6 entries in the template). Select "Write"
  5. In the next screen you see the content of the current item. In the screenshot this is "spotify:album:32MqLe..." which corresponds to the first entry in my Tagwriter_mass_encoding.csv template. This entry has the description White Lies: BIG TV so this content should be written to the tag on this album cover.
  6. Bring your phone to the NFC tag to write the spotify URI to the tag. When the tag is perceived by your NFC chip, it will be written automatically. The NFC chip of your smartphone should be very close to the chip in order to do this. If this does not happen easily, do a Google search to find the exact location of the NFC chip on your device.

Step 4: Using Automate to Start Playing Music by Smartphone Touch

Automate is an automation app like Tasker but it uses a more intuitive flow diagram approach and has a completely free version. I already wrote the flow for this project so you only need to import the flow into the app and change some settings to your configuration. The flow can be downloaded from within the Automate app by selecting the community icon in the upper right corner and searching for "Spotify album from NFC tag to Chromecast". The flow diagram is presented in the screenshot above. You will need to change some blocks for your Chromecast and Spotify app configuration:

  • The upper left variable block: in the English version of the Spotify app the available devices are presented under a text element named "Devices Available". If your app is in another language, change the value of this block.
  • The next block: Here the name of your Chromecast device is stored. If yours is different from "Living room", change the value of this block.
  • If you have a slower Android device: try changing the time of the delay blocks in order to get the correct click interactions.
  • If you only want to play music on your device and not cast to Chromecast: remove the output flow line from the bottom "Delay 3s" block.

When running this flow in the background, you should be able to play the album on your smartphone or Chromecast by simply touching the album cover at the NFC tag location. If something does not work correctly, look at the Logs of the Automate flow.

Step 5: Remarks

  • I placed about 45 album covers in a large frame (100 cm x 60 cm). Against my expectations the NFC tags were easily read behind the small glass plate.
  • The Spotify URI's of playlist are also supported by the Automate flow. You can look for the Spotify URI of your favorite playlists and write them on a TAG in the same way as the previous steps.
  • The Spotify API does not allow to query a user's most played albums. That is why first the most played artists are queried and then the album covers of the 10 top albums of that artist are downloaded .
Audio Contest 2018

Participated in the
Audio Contest 2018

Be the First to Share


    • Lamps Challenge

      Lamps Challenge
    • CNC and 3D Printing Contest

      CNC and 3D Printing Contest
    • Puzzles Challenge

      Puzzles Challenge



    Question 3 years ago on Step 3

    Hi thanks for this I have tried to write the nfc tags but nothing happens. I have put the uri into chrome and it just searches it. The nfc tag is written correctly but the uri does not open spotify


    Answer 11 months ago

    Hey Paul
    Could you find any solution?
    Happy for any help!


    Answer 2 years ago

    First of all very ggod tutorial....Thanks a lot for this.
    I have the same problem, The link only will open in the chrome browser, furthermore the workflow doesnt start working. May be because i am using the german spotify? Ihave changed it to "Verfügbare Geräte" instead ov the english text. And i donot want to start a chromecast, would this be the problem? Anybody an idea?


    Question 11 months ago on Introduction

    Hi there,
    Many thanks for this great step by step guide. Just running into trouble when scanning the nfc Tag. It opens Spotify, but that’s it. Neither is the stored album shown nor played automatically.
    Tried multiple things, also adjusted the automate flow, but it looks like it’s not getting the actual album link

    Anyone who faced the same challenge and could solve it?



    Question 2 years ago on Step 5

    Hello, 2 years later I find that solutions have not come a long way since your great post. Would you happen to know of any new ways of doing this? that could run on IOS instead of Android? - I am basicaly trying to do exactly the same thing as you did.


    Question 2 years ago on Step 5

    Instead of using a chromecast, I want to use my Google Home speaker, but I'm not really sure how to change the instructions. Could you help


    Question 2 years ago

    Automate opens up Spotify's search but the field remains blank and nothing happens.


    3 years ago

    Great work! I am not really into coding but I got it to work without problems and I love it. Put NFC tags next to my door so I can decide what kind of music I want to hear.

    But I have a question that might be also interesting for you. I am sure that this is possible but I not yet figured out how to do it. Imagine walking into another room, holding your phone against the door or wall and playback immediately switches to the corresponding room. This would work great with a chromecast in every room as the tag would just tell Spotify to use this particular chromecast as output device.

    If you are also interested in this implementation I would be really pleased with some hints how to realise ist! :D


    Reply 3 years ago

    It is nice to hear you managed to do this and that you enjoy it :)
    Changing the streaming device is a great suggestion. For me it would be very convenient to change the music from my headphones (thus my phone) to my Chromecast when I enter the house. I have thought about the solution since you posted your comment but I didn't had any time to try the implementation until tonight. Here is my solution that I just tested successfully:

    1) Write the different device names on different tags. You can do this the same way as step 3 in the above instructable.
    For example: I wrote <Living room> (without the <>) as plain text with the TagWriter app on an NFC tag for my Chromecast device.
    2) Download the flow I made for this feature:
    You can see the flow in this image: It is actually simpler than the flow in the Instructable.
    3) Start the flow in the automate app.
    4) Play some music on Spotify. You can only change the streaming device when you are already playing something on your phone or another device.
    5) Go to your home screen and touch the NFC tag with your phone. Your Spotify should automatically switch to the device_name you just scanned.

    I hope this works for you as well. If you have any questions or remarks, please comment. It is always nice to have some feedback.

    Kind regards,


    4 years ago

    This is really cool. You could do loads more with NFC tags playing sounds. For blind people for instance, you could add tags to items so that when you wave a phone over them it plays a sound from a web address telling them what it is or how to use it. I'm fact, that's so obvious now that I'm sure someone must have done it already. Or just more fun stuff, you could put a tag on your door handle so that your entry theme song plays when you come into the room.


    Reply 4 years ago

    In fact*


    4 years ago

    This is a really clever project, and nicely executed. Well done!