RFID Music Player
A Raspberry Pi jukebox that lets you swap songs, playlists, and system actions just by tapping RFID key fobs and cards against an RC522 reader — no screen, buttons, or keyboard needed.
The project pairs an MFRC522 RFID reader with mplayer running in slave mode. A Python daemon (rfidmp3player.py) polls the reader in an infinite loop; when it sees a tag, it looks up that tag's UID in a config file (Root/rfidconfig.txt) and translates it into an mplayer command written to a named pipe (/tmp/mplayer-control). The whole thing is wired to boot automatically via rc.local (Root/rc.local config.txt), which mounts a USB drive holding the actual MP3 library and playlists, creates the FIFO, and launches both mplayer and the reader script.
The Challenge
Map an arbitrary set of physical RFID tags to arbitrary playback behavior (play a file, load a playlist, skip/pause, or even run OS-level commands) without hardcoding logic per tag.
Key Outcomes
- A generic, data-driven dispatcher — TagToMplayer() reads the tag's UID as a config section and branches purely on an ActionType field (File/URL, Playlist, Function, OS), so adding a new tag is just adding a config block, not touching code.
- Achieved hands-free, headless control of music playback on a Pi with zero physical input devices — the RFID tag is the UI.
Tag-driven action dispatch
rfidmp3player.py reads each tag's UID as a ConfigParser section with ActionType, FileUrlFunction, and Description fields, so behavior per tag is entirely data (in rfidconfig.txt), not code.
Multiple action types per tag
Config supports four action kinds: File/URL (load a single track), Playlist (load a .pls), Function (send raw mplayer slave commands like pt_step 1/pause), and OS (run an arbitrary shell command, e.g. triggering festival text-to-speech + shutdown).
mplayer slave-mode control via named pipe
Rather than shelling out per song, the script writes commands to a FIFO (/tmp/mplayer-control) that a long-running mplayer -slave process reads, giving instant, low-overhead control without restarting the player.
Boot-time auto-start
rc.local handles the whole environment bring-up: mounts the exFAT USB drive containing the music library, creates the control FIFO, launches mplayer and the reader daemon in the background, and even announces readiness with a speech-synthesized greeting..
Playlist support via .pls files
Standard .pls playlists (Example.pls) let a single tag queue up a themed set (e.g., a "60's Music" tag) instead of just one track.
MFRC522 RFID Reader
Has excellent community support, and provides reliable 13.56 MHz RFID card detection.