ESP8266 - RFID MP3 Player
This tutorial instructs you how to make an RFID MP3 player by using an ESP8266, an RC522 RFID reader, and an MP3 player module. The MP3 player module comes with a small SD card that stores various songs. Each RFID card is linked to a specific song, and the number of RFID cards corresponds to the number of songs.
When you pass an RFID card in front of the RFID reader, the ESP8266 will play the song that is linked to that particular RFID card.
Hardware Preparation
Or you can buy the following sensor kits:
1 | × | DIYables Sensor Kit (30 sensors/displays) | |
1 | × | DIYables Sensor Kit (18 sensors/displays) |
Additionally, some of these links are for products from our own brand, DIYables.
Overview of RFID/NFC RC522 Module and MP3 Player
If you do not know about RFID/NFC RC522 Module and MP3 player (pinout, how it works, how to program ...), learn about them in the following tutorials:
Wiring Diagram
This image is created using Fritzing. Click to enlarge image
See more in ESP8266's pinout and how to supply power to the ESP8266 and other components.
※ NOTE THAT:
The order of pins can vary according to manufacturers. ALWAYS use the labels printed on the module. The above image shows the pinout of the modules from DIYables brand.
Preparation
- Pre-store a list of songs that you want to play to micro SD Card.
- Insert the micro SD Card to the MP3 player module
- Connect the MP3 player module to ESP8266
- Connect the speaker to the MP3 player module to a
- Connect the speaker to a power source.
- Connect the RFID reader to the ESP8266.
Because UID is usually not printed on RFID Tag, The first step we need to do is to find out the tags' UID. This can be done by:
- Copy the below code and open with Arduino IDE
- Click Upload button on Arduino IDE to upload code to ESP8266
- Open Serial Monitor
- Tap RFID card/keyfob one by one on RFID-RC522 module
- Take note of UIDs on Serial Monitor, it looks like below:
We will use these RFID UIDs to update the ESP8266 code below
ESP8266 Code - RFID Mp3 Player
Detailed Instructions
To get started with ESP8266 on Arduino IDE, follow these steps:
- Check out the how to setup environment for ESP8266 on Arduino IDE tutorial if this is your first time using ESP8266.
- Wire the components as shown in the diagram.
- Connect the ESP8266 board to your computer using a USB cable.
- Open Arduino IDE on your computer.
- Choose the correct ESP8266 board, such as (e.g. NodeMCU 1.0 (ESP-12E Module)), and its respective COM port.
- Copy the above code and open with Arduino IDE
- Update UIDs you obtained in the preperation step to the above code.
- Upload the code to ESP8266
- Tap an RFID Tag on RFID-RC522 module one by one
- Check out the sound from MP3 Player
- If the everything run smoothly, each RFID card will be associlated with a song.
- You can mark the name of the song on each RFID card.