Skip to content

VeryFluffed/RFID-Jukebox

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 

Repository files navigation

RFID Jukebox (Embedded Systems Project)

The RFID Jukebox is an embedded music playback system inspired by the Minecraft jukebox mechanic. Inserting an RFID-tagged “disc” triggers playback of a corresponding song, mimicking the in-game experience using real hardware.

The project began as a Raspberry Pi–based prototype to simplify development and debugging, then evolved into a fully embedded Arduino-based system to improve efficiency, boot time, and power usage. This transition forced a fundamental redesign of both the electrical architecture and software stack, deepening my understanding of microcomputers vs microcontrollers.

Features

Here's what you can do:

  • Detect physical input via RFID.
  • Map unique RFID UIDs to audio files.
  • Play audio reliably with minimal latency.
  • Design a system that could transition from prototyping to a permanent embedded solution.

👩🏽‍🍳 The Process

There are a lot of parts on this Jukebox project, including Arduinos, 3D modeling, and 3D printing. However, I will only go over the electrical architecture.

🍓 Raspberry Pi–Based Architecture

At the core of the first version was a Raspberry Pi 4, acting as a full Linux computer responsible for:

  • RFID communication
  • Audio playback
  • Input handling
  • File management
    This approach prioritized development speed and visibility over efficiency. The RC522 RFID module communicates using the SPI protocol, with the Raspberry Pi acting as the SPI master.

Key design decisions:

  • SPI was chosen for its speed and reliability
  • The RC522 was powered at 3.3V to avoid hardware damage
  • Hardware SPI pins were used to ensure proper timing

SPI Signal Roles

  • SCK: Clock generated by the Pi
  • MOSI: Commands sent to the RC522
  • MISO: UID data returned by the RC522
  • CE (SDA): Chip select to activate the RFID reader
  • RST: Software-controlled reset
    Rather than using interrupts, the system polled for RFID tags, simplifying control flow and avoiding race conditions during early development.

The Pi runs Raspberry Pi OS (Linux), which allowed rapid iteration and debugging.

Key libraries:

  • mfrc522 → RFID communication over SPI
  • RPi.GPIO → GPIO handling
  • pygame.mixer → MP3 audio playback

Program Logic

  • The program runs in a continuous loop
  • When a tag is detected, its UID is read via SPI
  • The UID is matched against a Python dictionary
  • Each UID maps directly to an MP3 file stored on the Pi
  • Audio playback is handled entirely in software
    This architecture made the system easy to extend: adding a new disc required only assigning a new UID and MP3 file.

🤖 Arduino-Based Architecture

The final design uses an Arduino Nano, shifting from a microcomputer to a real-time embedded system. This is because Arduinos:

  • Do not run an OS
  • Cannot decode audio in software
  • Have no filesystem
    …the architecture had to change significantly.

Modular Hardware Design:

  • RC522 RFID Reader: Fast, synchronous communication, managed directly by Arduino hardware, uses fixed pins (D10–D13)
  • UART (Audio Module): Serial communication via SoftwareSerial and sends simple commands like “play track 2”
    Managing two protocols simultaneously reinforced my understanding of timing, data flow, and resource constraints in embedded systems.

Communication Protocols

  • SPI (RFID): Handles disc detection and communicates via SPI
  • RC522 RFID Reader: Handles disc detection and communicates via SPI

The Pi runs Raspberry Pi OS (Linux), which allowed rapid iteration and debugging.

Arduino Software Architecture:
The Arduino version was written in C++, requiring:

  • Explicit memory management
  • Static data structures
  • Deterministic control flow

Libraries used:

  • MFRC522.h → RFID communication
  • DFRobotDFPlayerMini.h → Audio playback
  • SPI.h and SoftwareSerial.h

Program Flow

  1. Initialize SPI and RFID reader
  2. Initialize serial communication with DFPlayer
  3. Continuously scan for RFID tags
  4. Read and assemble UID bytes
  5. Match UID using conditional logic
  6. Trigger the corresponding MP3 track
    Unlike Python, where dictionaries made mapping easy, the Arduino version required manual UID comparisons due to memory limitations—highlighting the trade-offs of low-level systems.

Results of the Transition

  • Instant boot (no OS)
  • Lower power consumption
  • More reliable long-term operation
  • Cleaner separation between sensing and actuation
    This redesign transformed the jukebox from a prototype into a true embedded system.

🏢 Physical Architecture (Brief)

The physical enclosure and disc mechanism were 3D modeled and printed to resemble the Minecraft jukebox. The design focused on:

  • Proper RFID alignment
  • Internal component clearance
  • Disc insertion and ejection
    While important for usability, the primary engineering challenge and learning focus of this project was electrical and embedded system design.

📚 What I Learned

This project significantly strengthened my understanding of embedded systems, electrical communication protocols, and hardware–software integration.

🧠 Embedded Systems Architecture

  • Learned to design systems around hardware constraints instead of relying on an operating system
  • Understood the architectural differences between microcomputers (Raspberry Pi) and microcontrollers (Arduino)

🔌 Digital Communication Protocols (SPI & UART)

  • Gained hands-on experience implementing SPI for high-speed RFID communication
  • Learned how UART serial communication is used to control dedicated peripheral modules like MP3 decoders

⚙️ Hardware–Software Integration

  • Wired and debugged peripherals pin-by-pin with strict voltage and timing requirements
  • Translated physical inputs (RFID tags) into deterministic software behavior (audio playback)

🧩 Resource-Constrained Programming

  • Adapted software design to limited memory and processing power on microcontrollers
  • Replaced dynamic Python structures with efficient, static C++ logic

⚡ System Optimization & Trade-Offs

  • Evaluated performance, power consumption, and reliability across platforms
  • Designed a more efficient final system by downgrading hardware intentionally

📈 Engineering Confidence & Problem Solving

  • Debugged issues without a full OS or graphical interface
  • Proved my ability to learn new hardware, protocols, and languages independently

About

Very quick jukebox code

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published