I was inspired by the idea of the project due to my deep love for music. I found similar projects which I took as a reference. It also might be a nice gesture for older people, who don't know much about technology and smartphones, so that they can play their favorite songs as they were used to with radios in the past.
My project idea is a small music player, where you can play your favorite songs just by a card slide.
Throughout the diploma, Fusion 360 was our main CAD program, that's why I used it to design my final project enclosure.
I thought about a simple design that would be at the same time, cool.
I started by measuring the dimensions of my components, to make sure there will be enough room for everything inside the enclosure.
The design process went as follows:
I started by designing the front face of the body and made some openings for the other components (RFID, Potentiometer knob, Button).
I made many construction lines to help me fix the openings and also to ease the mirroring of the tabs.
The back part was pretty much the same design as the front, except for the rectangular shape in the middle, and of course, the openings.
I also made openings for the 3D-printed parts of the speakers.
For the first side, I had to make openings for the Arduino power and to upload the code.
The second side had nothing special. It was just holding everything together.
Also designing the base was pretty straightforward, except for the holes made for Arduino. They needed some good measuring.
After finishing all the sketches:
I extruded them all to 3mm.
I made sure everything fit in place by assembling all the parts using the joint feature.
I saved each part (component) as .dxf to prepare them for laser cutting.
The speakers I used had no holes to be fixed using screws. So, I designed a part to be 3D-printed, so that it can hold the speakers. I estimated the diameter and the height of the speakers to design the part.
For slicing, I used Ultimaker Cura. I used Prusa i3 MK2 for printing.
For finishing .dxf files and removing the construction lines, I used LaserCAD. The whole enclosure was made out of Plywood.
I modified the cut parameters to Speed: 15 and Power:75 .
Eman, a FabLab intern, helped me with the fabrication process and also add those cute butterflies on the front part, where those openings in the front part were mandatory for the RFID to be able to scan the cards.
Back Part fabrication
After fabrication, I assembled all the parts to make sure they all fit together properly. Fortunately everything was fine.
I then dissembled some parts to enclose the electronic parts.
I sent the files to the Laser Cutter and waited for them to be done.
Arduino UNO
RFID RC522 (R/W)
RFID Cards
DFPlayer Mini (mp3 player)
Micro SD-Card
0.5 W Stereo Speakers
Small breadboard
Tactile button
Potentiometer Knob
Jumpers
User Input: RFID Card read by the RFID Reader.
Speakers
After making sure what exact components I will use, I started working on them on two steps, as I had to make sure that each part works properly:
I searched on how mp3 player reads tracks from the SD Card and how it is connected to the Arduino and speakers.
I used the DumpInfo example from the DFPlayerMini Arduino library to test the basic functionality of the player.
I pretty much did the same steps with the RFID and made sure it worked.
Components used in the project
Combining the two main functionalities in the projects, here's how it works:
Each RFID Card has its own UID (unique ID).
According to the UID (unique ID), each card will be attached to a single song on the SD card.
The RFID Card will be scanned by the RFID Reader.
Depending on the UID on the scanned card, the mp3 player will play the attached song.
After checking the datasheets for my components, I found that the operating voltage for them all is within the 5V range, which is why I chose to use the 9v adapter. I used it to power the Arduino and powered the rest of the components directly from the Arduino's 5V (DFPlayer) and the 3V (RFID Reader).
I started by importing the necessary libraries for the RFID and MP3 modules.
I set the RST_PIN of the RFID module, which is an input for reset, to pin 9.
Also, the SS_PIN, which acts as a signal input when the SPI interface is enabled, to pin 10.
Then I defined the TX and RX of the MP3 player module to pins 2 and 3.
I instantiated a SoftwareSerial object (which allows serial communication on other digital pins of the Arduino) and passed the TX and RX pins to it as parameters.
I did the same with the RFID object and passed the SS and RST pins to it as parameters.
I then created a DFPlayer Mini object, which we'll be dealing with in the rest of the code.
Code Snippet 1
Code Snippet 2
I started the communication between the Arduino board and a computer or other devices.
I used an if condition to know if the MP3 player is properly working.
DumpVersionToSerial shows details of MFRC522 Card Reader details.
Code Snippet 3
Inside the void loop:
The RFID UID consists of four UID Bytes, so I made a for loop to read each one of them and assigned the whole UID to the variable content.
The following code lines are actually the whole function of the project:
I made an if condition to check the UID that was previously stored in the content variable is the one that was actually scanned. If so, play the first track from the SD Card.
If it's the other card, play the second song.
I only used two cards for this project so an if else was enough.
After ensuring that the wire connections were right and the parts fit together, I assemcled all the parts of the body.
Everything went as expected and the project performed the minimum features successfully.
Demo video for the final output
The code for the RFID and MP3 player were pretty straightforward separately.
Each one worked perfectly alone, but when I merged the code, the MP3 player used to turn off and not communicate. Also, the RFID sometimes didn't work.
All in all, I spent about a week not knowing why they both are not working together, and I made sure the code was right more than once.
Fortunately, on the final day, when I was supposed to hand out the project, my instructor and I walked through all of the codes line by line. Nothing was actually wrong with the code logic itself, but it was the way the lines were ordered.
Anyways, my biggest advice for anyone, is that they should know how to debug their code, as it will save them much time.
I wanted to add some other simple features, but time is not always your friend..
As complete features, I wanted to add :
A button to be able to pause/play the song.
An audio amplifier to control the volume of the song.