A Python + Node.js music player driven by NFC or RFID tags.
Go to file
Annika Backstrom a6a9050afc Fix Vagrant dev environment
Adding the `-L` flag to nodemon, else it doesn't see our changes.
2019-12-14 18:59:32 -05:00
bin Update project for new NFC-EXPLORE build 2018-12-08 05:16:02 +00:00
init Add systemd init file with hardcoded path 2017-04-08 12:25:23 -04:00
jukebox Add support for scripting directory 2019-12-14 16:20:21 -05:00
static attempt client reconnection of closed websockets 2017-04-09 22:08:34 -04:00
templates Let templates handle their own dependencies 2017-04-09 11:51:17 -04:00
.gitignore Move media player path into config 2017-04-10 23:08:59 -04:00
LICENSE Add MIT License 2017-04-08 13:49:15 -04:00
README.md Fix Vagrant dev environment 2019-12-14 18:59:32 -05:00
Vagrantfile Fix Vagrant dev environment 2019-12-14 18:59:32 -05:00
config.json.sample Add support for scripting directory 2019-12-14 16:20:21 -05:00
config.json.vagrant Filter out @F messages from mpg321 2017-04-09 15:08:32 -04:00
nodemon.json Fix Vagrant dev environment 2019-12-14 18:59:32 -05:00
package-lock.json Move nodemon back to a dev dependency 2019-12-14 14:47:49 -05:00
package.json Fix Vagrant dev environment 2019-12-14 18:59:32 -05:00
player.js Add support for scripting directory 2019-12-14 16:20:21 -05:00
requirements.txt Update project for new NFC-EXPLORE build 2018-12-08 05:16:02 +00:00

README.md

Rasperry Pi RFID Jukebox

Disclaimer: this is a perpetual work in progress!

This is a personal project of Annika Backstrom for using a Raspberry Pi as an RFID-controlled "jukebox". Given an RPi with attached MFRC522, UIDs from 1K MIFARE tags can be associated with media (MP3 files) and actions (currently, STOP and PAUSE).

Components

  • Jukebox app with web frontend (node.js)
  • RFID tag reader (Python)
  • MP3 player (mpg321, not included)

Setup

This section is incomplete (of course) and parts are tuned to my setup and for my own convenience:

  1. Clone project
  2. Copy config.json.sample to config.json
  3. Edit config.json for your setup
  4. Install Node.js
  5. npm install (node.js dependencies)
  6. virtualenv lib # make a python virtualenv
  7. lib/bin/pip install -r requirements.txt

Development

This project supports Vagrant, if you don't want to install the packages locally:

vagrant up
vagrant ssh -c 'cd /vagrant && npm run watch'

You can also just run from the checkout if your environment supports it.

npm run watch will use nodemon to restart the server when any file changes.

Dummy versions of mpg321 and the tag reader are available in the bin directory. These are node scripts, so you would include them in your config.json like so:

{
    "tag_reader": ["node", "./bin/tag-reader-dummy"],
    "mpg321": ["node", "./bin/mpg321-dummy"]
}

config.json

The following keys are available:

  • port -- web server port

  • tag_reader -- path to tag reader script. jukebox expects the tag reader to spit out a unique string for each tag (e.g. 10 character hex UID)

  • mpg321 -- path to mpg321 executable. should be run in "remote control" mode (-R), reading commands from stdin.

  • stop_id -- id of the card that stops playback

  • pause_id -- id of card that pauses playback

  • debug -- true to enable some extra logging