Skip to content

Plans to build your own Plastic Player NFC based Spotify Music Controller

Notifications You must be signed in to change notification settings

brendandawes/PlasticPlayer

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

26 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Plastic Player

Image of Plastic Player showing John Coltrane being played

An NFC based controller for Spotify using the Mopidy Server. This isn't a step by step instructables style build guide but hopefully there's enough information here to build your own version. Knowledge of building stuff like this, soldering and understanding JSON files and the like would be good.

Materials

How it Works

Watch the Video

Plastic Player has two main components — A Raspberry Pi running the Musicbox system and an Espruino WiFi based controller.

The Raspberry Pi manages and plays the music and it's this you'll connect to your stereo system.

The controller is what you can build with this repo. The controller uses 35mm photographic slides with NFC stickers to play anything on Spotify. This uses an Espruino Wifi board. Of course you don't have to use 35mm slides — it could be anything you can put an NFC sticker onto.

When you power up the Plastic Player the Espruino connects to your WiFi network and pulls down data in the form of a JSON file — I use Airtable as a simple solution but you could use anything, even a flat text file, as long as it's JSON formatted in the correct way. This JSON file contains a list of NFC tag ids with matching Spotify URIs — these are your albums. When you place an album (slide) into Plastic Player, the Espruino sees the NFC tag and looks-up that tag in the JSON file. When it finds a match it sends the corresponding Spotify URI to the Musicbox over wifi and then starts that track list playing. Plastic Player also includes controls for play/pause and skip (next track).

Raspberry Pi

Install Musicbox on a Raspberry Pi following the instructions on the Musicbox site including entering your Spotify details. Once you have this set up, check you can connect to it via your web browser — usually via musicbox.local.

Make sure to note down the ip address of the Raspberry Pi as you'll need to enter this in the code for Espruino later. You can find this out via the Terminal by typing 'ping musicbox.local'. This will show the ip address of the Raspberry Pi you have running Musicbox.

That’s all you need to do with the Raspberry Pi.

Espruino

Solder the Espruino board in the centre of the Perma-Proto board.

Connect the - and + rails on the Perma-Proto to the 3.3v terminal and the GND terminal respectively.

Wire the components to the Espruino / Perma-proto using the following pin connections.

OLED Espruino Wifi
CS GND
RST b7
DC a0
CLK b5
DATA b6
3.3 3.3
GND GND
Neo Pixel Espruino Wifi
+ 3.3
G GND
In b15
NFC Espruino Wifi
3.3 3.3
MOSI b3
SSEL b10
GND GND
Pause Button Espruino Wifi
+ 3.3
- B1
Next Button Espruino Wifi
+ 3.3
- B14

Code

Download the Javascript code from this repo. Plug-in your Espruino and using the Espruino Chrome app launch the Editor and load in the code you've just downloaded. Alter the wifi network name and password details to match your network settings and change the host to be the ip address you noted down earlier that locates the Raspberry Pi on your network. Change the PATH to be the web address of your json source.

Transfer the code to your Espruino. Hopefully it should start up and work as expected.

Enclosure

You can enclose this project in whatever you see fit but I've included the .stl files for you to use and either print at home of send to a service such as Shapeways to create the enclosure. Once you have that you can place the parts and then snap-fit the enclosure back together.

To provide power to the Plastic Player, I used a panel mount female USB (see parts list above) which I then attached to another USB lead I had cut up, wiring the cut end to the panel mount USB and plugging the male end into the Espruino as normal.

NFC Tags

Place an NFC tag on a slide and place it into the Plastic Player. Any unknown tags will display the tag ID on the OLED display. You can then use this information in the JSON file (see below).

Setting up the database of albums

Plastic Player consults a JSON file to match NFC tags with Spotify albums URIs. An example JSON schema is included in this repo. I use Airtable to easily manage and serve this file but you can use whatever you want as long as it's web accessible.

Construct your JSON file using the tag IDs and the corresponding Spotify URIs.

Once you have this JSON file done and existing on the web, and that location is in the PATH variable as detailed above, then when you place the relevant NFC tag into the Plastic Player it should talk to the Musicbox and play!

About

Plans to build your own Plastic Player NFC based Spotify Music Controller

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published