With Valentine's day just around the corner, I was inspired to add something additional to make the gift a bit more special. I am testing the Mini player with Arduino, and was wondering whether I can add a light sensor so that it play the song for my Mrs when she open the gift. So this was born.
Step 1: Buy a Nice Gift
Well, I can't help you with this one, just any gift with a box big enough to put the circuit underneath will do.
Step 2: Gather All the Components
For the complete circuit you will need the following, just a disclaimer, the link is an affiliate link, so if you don't want to click you can search it through directly via banggood website or aliexpress.
- Miniplayer + 2x 1K Resistor
- LDR + 10k Resistor
- Speaker (I got mine from recycling other toys)
- LED (Optional)
- Prototyping board (Optional)
Step 3: Prepare the SD Card
Find your loved one's favourite song and copy it to the SD card.
In this example, I am copying the song (001.mp3) and put it in the folder called 006. The reason I am doing this is because I had other folders in the SD card and I want to keep it that way for other project. So in this case my mp3 file is located in sd://006/001.mp3
Step 4: Prepare the Mini DF Player
Solder the Mini DF player to the prototyping board. You will need to connect the 1K ohm resistor to the RX and TX leg of the DF player.
- Connect the RX pin of DF player to the one end of the 1K resistor and the other end of resistor to pin D11 of Arduino.
- Connect the TX pin of DF player to the one end of second 1K resistor and the other end of resistor to pin D10 of Arduino
- Connect VCC of DF player to +5V
- Connect GND of DF player to GND
- Connect SPK_1 and SPK2 to the speaker
Load the program found here to Arduino to test. You should be able to hear the song via speaker.
Step 5: Connect the LDR
Connect one leg of LDR to 5V, and the other leg to 10K resistor.
Connect the other end of the resistor to GND.
Connect the leg that join LDR and 10K resistor to Pin A0 or Arduino, Pin A0 or Arduino is analog input that will read the voltage coming in when the light is shining through the LDR.
Connect LED to Pin 13 of Arduino (Optional Step), if you would like to have this, check the second diagram.
Step 6: Test Your Circuit
Connect the final circuit for testing. In case you don't have the DFPlayer library, I had included this as an attachment.
Step 7: Add Power Source and Shrink the Size Using Arduino Nano
In this case I am using battery pack with 4x AAA battery. Reload the program to Arduino Nano, you don't need the LED, as Arduino Nano comes with LED connected to pin 13.
You can see the result in the following video.
Step 8: Put It All in the Gift and Enjoy
Now it is time to squeeze everything in the gift box, make sure the LDR is showing through to ensure plenty of light coming in when the gift is opened. And enjoy the happiness when this is open by your loved one. I hope you are well rewarded with happiness for the small effort.
Disclaimer: I am not affiliated with Swarovski nor endorsing their jewellery, the use is merely coincidental to the gift that I had purchased for my Mrs.
Please leave me a comment and subscribe if you like this.