RFID Phonograph Music Player
Embedded music player using Raspberry Pi with RFID-triggered playback, synchronized lyrics, and FFT-based LED rhythm visualization.
Overview
A Cornell University embedded systems project that reimagines the phonograph for the modern era. The system automatically plays music and displays synchronized lyrics when an RFID tag is placed near the reader, with real-time rhythm visualization on an LED matrix panel.
System Architecture
Components
| Component | Function |
|---|---|
| Raspberry Pi 4 | Central processing unit running Python |
| PN532 RFID Reader | 13.56MHz NFC reader via SPI interface; each tag has a unique 4-byte ID |
| piTFT Screen | 320x240 touchscreen for synchronized lyrics display via Pygame |
| 32x16 RGB LED Matrix | Real-time frequency spectrum visualization driven by 11 GPIO pins |
| Audio speakers | Music playback via Pygame mixer |
Technical Highlights
FFT-Based Rhythm Visualization
The LED matrix displays real-time frequency analysis computed via Fast Fourier Transform:
- Analyzes audio in 0.1-second windows using Python’s
wavemodule and NumPy - Maps frequency spectrum (50–11,000 Hz) into 32 frequency bands corresponding to 32 LED columns
- Normalizes intensities to 16 brightness levels (mapped to 16 LED rows)
- Pre-generates frequency data as
.npyfiles to minimize real-time computational load on the Raspberry Pi - LED columns are driven via bit-shifting across ABC row-select pins with dual RGB pin sets for color control
Synchronized Lyrics Display
- Custom LRC file parser converts
[mm:ss.cs]timestamps to elapsed seconds - Rolling 3-line display shows previous, current (highlighted), and next lyrics
- Handles boundary conditions at song start and end gracefully
- Dynamically updates based on elapsed playback time from Pygame mixer
Multi-Process Architecture
Resolved complex resource contention between three SPI/GPIO devices through process isolation:
- Main process: RFID tag detection loop and task orchestration
- LED process: Separate process via
subprocess.Popen()with elevated priority (os.nice(-10)) to eliminate LED flickering caused by CPU contention - Lyrics thread: Runs as a thread to allow proper
pygame.quit()execution on song completion - Inter-process communication via global variables and signal handling for clean shutdown
Dual SPI Management
One of the trickiest challenges: enabling simultaneous operation of two SPI interfaces on the Raspberry Pi:
- SPI0 (GPIO 18): piTFT touchscreen display
- SPI1 (GPIO 16): PN532 RFID reader via Adafruit CircuitPython library
- Discovered and resolved a GPIO 18 conflict where both piTFT and LED matrix claimed the same pin — solved by reassigning LED control to GPIO 27 (originally a piTFT button pin)
Demo
Successfully tested with multiple songs including “Common People” (Pulp), “Thunder” (Imagine Dragons), and “Welcome to New York” (Taylor Swift).
Developed with Yiyang Zhao (yz2952) at Cornell University, December 2023.