RFID Triggered Audio System

by Surge_Tech in Circuits > Arduino

88 Views, 1 Favorites, 0 Comments

RFID Triggered Audio System

instructables thumbnail.png

Introduction

In this tutorial, we’ll create an RFID-based audio player that plays specific audio tracks based on the RFID tag scanned. This device can be used for interactive experiences, such as in escape rooms or as a unique audio player. We’ll use an OLED screen for user feedback, displaying messages such as "Equipment Activated" or error notifications if the tag is unrecognized.


Download the code for this project from its GitHub Page.

Supplies

  1. Microcontroller: Arduino Nano (or any other Arduino board)
  2. OLED Display: Adafruit SSD1306 128x32
  3. RFID Reader: MFRC522
  4. DFPlayer Mini: An audio player module with an SD card
  5. SD Card: 32GB or less, preloaded with audio files
  6. 1kΩ Resistor
  7. Jumper Wires: For connections
  8. Breadboard (Optional): For easy wiring

Gather and Install Required Libraries

Before starting, ensure that the following libraries are installed in your Arduino IDE:

  1. Adafruit GFX Library
  2. Adafruit SSD1306 Library
  3. MFRC522 Library
  4. DFRobotDFPlayerMini Library

To install these:

  1. Open the Arduino IDE, go to Sketch > Include Library > Manage Libraries.
  2. Search for each library by name and click Install.


Prepare Your Audio Files

  1. Prepare your audio files for the DFPlayer Mini module.
  2. Naming Requirement: Name each audio file using the following format: 0001"name".mp3, 0002"name".mp3, etc.
  3. Transfer these audio files onto an SD card.
  4. Insert the SD card into the DFPlayer Mini.
Tip: Ensure the SD card is 32GB or less for compatibility.


Example files with the correct naming requirements can be found on this project's GitHub Page in the audio-files folder.

Insert the SD card into the DFPlayerMini.

Build the Circuit

FEVJPWTM2NL7FJY.png

Follow the wiring guide below to connect each component to the Arduino Nano:

Pin Connections

  1. OLED Display (128x32):
  2. GND → GND
  3. VCC → 5V
  4. SCL → A5 (SCK)
  5. SDA → A4
  6. RFID Reader (MFRC522):
  7. RST → Pin 9
  8. SDA → Pin 10
  9. DFPlayer Mini:
  10. RX → Pin 4
  11. TX → Pin 5 (place a 1kΩ resistor between TX and Pin 5)
  12. BUSY → Pin 6

Notes

  1. Confirm all components are securely connected.
  2. Adjust pin numbers in the code if you modify the setup.

For other boards (if not using an Arduino Nano)

If you are using a different microcontroller the most impacted change will be the wiring to the RFID module. Reference the RC522 GitHub for other pain layouts. Using the correct pin layout is necessary for the RFID module to work.

After using the correct layout for your case, use the pin out diagrams for the OLED Display, and DFPlayerMini to edit the code to match your case.

Prepare the RFID Tags

FXWGUUXM2OQT5A3.jpg


Each RFID tag has a unique UID (identifier) that allows us to assign it to a specific audio track. To configure your tags:

  1. Use the DumpInfo example code provided with the RFID library to find the UID of each tag.
  2. In the project code, locate the tagUIDs array and replace the 00 placeholders with the actual UID values of each tag.
Example: If your tag's UID is 4A B2 1F, enter it in the code exactly as shown.


For a full tutorial on how to use the DumpInfo program watch the video above.

The original code was made from 7 primary tags and 7 backup tags however, this can be changed and the back ups fields removed if it will not serve a purpose.

Upload the Code to Arduino

  1. Open the Arduino IDE and load the code for this project.
  2. Connect your Arduino board to your computer and select the appropriate Board and Port under Tools.
  3. Upload the code to the Arduino.

Testing and Operation

  1. Power On: Once powered, the OLED display will show messages like “Equipment Activated” and “Ready to Scan.”
  2. Scanning a Tag: When an authorized RFID tag is scanned, the corresponding audio track will play through the DFPlayer Mini.
  3. Error Handling: If an unrecognized tag is scanned, an error message will display on the OLED screen.

Troubleshooting


  1. No Sound: Check the SD card formatting and ensure files are named correctly.
  2. OLED Display Not Working: Double-check wiring, especially the SCL and SDA connections.
  3. RFID Tag Not Recognized: Ensure the UID is entered correctly in the code.

Optional Improvements and Ideas


  1. Multi-language Support: Add support for additional languages in the OLED messages.
  2. Track Cycling: Program multiple audio tracks per tag, cycling through with each scan.
  3. Amplifier: Connect to an amplifier for a louder sound output.
  4. 3D Printed Case: Model and design a 3D printed case to make a mobile device for escape rooms.