#40 Let the music play! Arduino based MP3 Player for music (or announcements)
|#40 Let the music play! Arduino based MP3 Player for music (or announcements)
Let the music play! This module can most certainly be used as a custom, Arduino-controlled player of music, in a pub or restaurant, for example, but it could equally be used to give out warning messages or instructions “3D printer has run out of material!” in a factory or workshop. The possibilities are endless. All you have to do is record your .mp3 or .wav files, put them onto a micro SD card, referred to as a TF TransFlash card in the documentation and you’re good to go.
We’re not using any libraries in this demo, so that you can see exactly how the commands are sent to the MP3 player and how the optional responses are returned too. It also demonstrates how easy it is to send out those commands via the SoftwareSerial library; why not the standard Serial port? Watch the video to find out!
However, you may feel more comfortable using the DFRobot MP3 Player library so I’ve included that in the links below. Just be aware that we have not experimented with that library in the video, but it looks very easy to use and takes away all the work, aka pain, in creating the command strings.
The library contains some examples that should get you going nicely too.
———————————————–
UPDATE UPDATE UPDATE
———————————————–
Just to clarify some queries some viewers had: YES you can play SPECIFIC tracks (that is, you can, if you want, play track 6 then track 1, then track 123). However, I haven’t demonstrated that here (we just play them sequentially) but if you look at the code for the Wireless Rain Receiver (video #48) you’ll see an example where I play different tracks depending on the level of rain detected.
Many thanks to Purple Planet for their music – link below
Music: http://www.purple-planet.com
—————————————————————————————————-
STOP! READ THIS IF YOU VALUE YOUR MP3 PLAYER MODULE
—————————————————————————————————-
The RX and TX from the Arduino Uno or Nano will be 5V and will damage the MP3 player which requires 3.3V on these pins. All explained in the video!
I’ve included as many links below as I could find and I *strongly* recommend you print out the ones I’ve marked as you’ll be referring to them often!
————————————————————–
Essential reading – recommended print
————————————————————–
(Note: ALL these links etc can be found here:
https://github.com/RalphBacon/MP3-Player-DFPlayer)
1. The DFrobot Wiki for the DFPlayer
http://www.dfrobot.com/wiki/index.php/DFPlayer_Mini_SKU:DFR0299
2. Link to the Mini DF Player Manual – more technical but essential if you want to know the commands
https://github.com/RalphBacon/MP3-Player-DFPlayer
3. Link to the sketch used in the demo:
https://github.com/RalphBacon/MP3-Player-DFPlayer
——————————-
Further information
——————————-
1. A massive amount of extra information from Yerke, via the Banggood forum (link was recently down but may reappear)
http://forum.banggood.com/forum-topic-59997.html
2. How to insert an advert track and then resume playing the original
http://www.dfrobot.com/forum/viewtopic.php?f=2&t=1524
3. More on where I go the music for this demo
http://www.purple-planet.com/using-our-royalty-free-music/4583818250
4. The DFPlayer library (not used in this video but easy to use)
https://github.com/DFRobot/DFPlayer-Mini-mp3
All this can be found in Github:
https://github.com/RalphBacon/MP3-Player-DFPlayer
If you like this video please give it a thumbs up, share and if not already subscribed please do so
And my channel is here:
—————————————————————–
https://www.youtube.com/c/RalphBacon
——————————————————————
How can I remember this? Memory tip: “See” Ralph Bacon, geddit?
As always Thanks for Watching!
#40 Let the music play! Arduino based MP3 Player for music (or announcements)
#40 Let the music play! Arduino based MP3 Player for music (or announcements)
Thanks for this Ralph, makes it much clearer that this could be the right module for my miniature jukebox project I am thinking about. Thumbs up!
I've been looking for a simple mp3 player to connect to the arduino for a while. I'm super thankful to you for making this video, and clearing up a lot of gripes before we get on it. 😀
sir, all your tutorials are great…. . could you please explain how to use the advertising function. i dont want to use the library.
thanks for the support sir…. could you pls make video on using a flash memory instead of sd card. which flash chip can be used and how to store audio files to that….
sir which ide are you using….. could you make a tutorial on the ide and the best practices… hopefully waiting…..
I don't have a need for such but I'll keep it in mind.
This vid's thumb don't go up! I tried. I'm thinking of including this concept in a plant-watering system, with brief sounds as indicators of a session watering house plants. Error message for failure to pump water, low water, announcement of start of session, end of session. Your examples will make things come together much faster. Best!
Ralph, again, great video. I'm looking for something that can play a sound file when a button is pushed and play another file when another button is pushed, while the first file is still playing. For example, push a button for a long "Wooooossshh" sound (6sec) and two sec later another button and a short "Ding" (0.5sec) whitout cutting the first woosh. And maybe while having a minute long background song too? I'm building a game you see, and this would be very usefull. I did receive the unit you use in this video 10 months ago but I haven't been able too experiment with it yet and I dont think it has these features. Any tip and advise is appreciated!:)
iHello Thank you for the demo. Is it possible to make a wifi internet web radio using arduino or esp8266?
I meant capture streaming music from Pandora or I heartmusic
This is brilliant. It would have saved me days of work 18 months ago, when in the end I gave up. Would it be possible to get a copy of your ino file? – I've just bought another module to try again/
Great Video! I subbed.
Hallo Ralph. I like your explanation and full documented example. Good startpoint to play with this MP3 player. Thanks for your time !
Hi this is pretty awesome. Can you show how to get this working with the ESP8266?
Hello, can you please make a video using the ethernet shield.
Hey can u help me to get the name of currently playing directory and all the directory names to display on serial port or any display ?
I'm not getting that function in any of library but it's mentioned in the data sheet.
Thanks.
Thanks for sharing 😀👍
Great presentation. I bought one right after watching you video. If I can get it to work as well as you did it’ll be a good addition to my project. Thanks
Hi Ralph. Thanx for the great content, recently found your channel due to the DFPlayer and i have learnt quite a few new tips and tricks. I was just wondering whether you have been able to get it to repeat a track?Just for clarity, i use the multiple folders option so my sounds/tracks are split into numbered folders. i have tried the following based off of the banggood link:
0x08 8 Specify repeat(NUM): This is very unstable, as every time the board reboots and a different track order is loaded, the hard coded repeat for the error/boot bugs out and plays what ever song was made to play first
0x19 25 Single loop: Cant seem to get this command to work, it specifies that it is able to loop a specified song, i have tried running the command before, during and after a track playing.
0x17 23 Loop Folder "01": This is the only one i seem to have success with, but this means isolating every track i would want to be able to repeat into their own folder, severely limiting my options.
Thanx in advance and also thanx again for the great vids!
I had a pair of those type headphones and yes, awesome set of heaphones up until the day a friend sat on them and broke them.
Thanks for the video, Ralph. very easy to follow. I'm just a beginner and trying to gain knowledge with a 'current' electronics knowledge just short of basic. I'm perplexed by the need for a voltage divider on the TX of the MP3 player. Isn't the voltage on this line provided by the MP3 Player rather than the Arduino so would be at its 'native' level of 3v3. If that is the case, wouldn't the voltage divider have the effect of dropping the voltage input to the Arduino RX pin to 2v2?
Hey, that was I quick reply, Ralph. Thanks enormously for taking the time to respond. I haven't had my Uno long so I'll read up a bit more on pin setting and, oh, I'm not brave! Last question, I promise. What does the 2k resistor achieve if the voltage divider is to reduce the voltage from the Arduino pin as would the voltage still not be 5v at the node with or without that resistor?
You used a resistor, you could use a logic level shifter on the tx rx correct?
Hi I have this mp3 player on arduino uno setup with 3 buttons (pause,back and forward) but I want to control it with a 433mhz remote control just on and of would be ok, Also I want to add a white 5v led that fades in and out in rhythm with the sound. I have spent about two months on youtube researching with little success, so I would appreciate any advice or links would be great or maybe this is a project too far for a newbie to arduino and sketch code ? thanks. The project I want it for is a Dr Who Tardis 12×6 inches that I 3d printed
Thank you loved your demo.
Is it possible to make it play spacific file when you press specific buttons? If yes do you have a code or do you know were I can get it?
I'm trying to make a project were when a switch is closed the mp3 player will play a spacific announcemant for example when a door is open it will play the specific mp3 file which say "The door is open" my problem is that if the push button is pressed continiously the file will not play, the file play's when the push button is pressed instantly. How can I fix this problem ? Thank you !!!
Hi there Ralph,it seems that the link to Yerke's work, at Banggood , no longer works .
I have shriek sound with module on start and murmur noise on playing. I use Arduino Uno and I try power from Uno and separate power with common ground. Speakers are 5W 4 Ohm. Amplifier is PAM8406. Is problem maybe with no resistors to ground from RX/TX?
Thank you for creating this comprehensive discussion on the MP3 Player module!
Adding a tiny library and the command could be entered as "next" and the arduino will translate into "1,0,0" etc …
Adding this tiny stereo amplififier behind : https://www.banggood.com/TPA3116D2-Digital-Power-Amplifier-Board-2x50W-Dual-Channel-Stereo-p-1081499.html
I see where I messed up, I just put the 1k resistor and neglected to put the 2k in. Didn't seem to kill the player, but it didn't work either. I simply re-routed my push buttons to the player and bypassed the arduino completely. It works OK I guess but I think I will rebuild it since I did it all on a perf board and both units are soldered in solidly. I used a pro mini for the setup and I think there is room for the other 2 resistors, but not sure how exactly I will wire them to become voltage dividers as you have.
Have you figured out how to put the title playing out to say a lcd 16×2 screen or perhaps a Nokia?
Anyone have any guidance if I wanted to do this, but with the SD card connected to the arduino and not built into the one like Ralph has?
Excellent content Ralph. I got my mp3 working in 10 minutes. Subbed 🙂
Ralph, love your videos. Question about the voltage splitters. I can see why you need one for the TX pin on the Arduino to drop it from 5v to 3.3v but why do you need on on the RX pin. The voltage coming back from the MP3 player should be 3.3 V and that should not cause a problem for the Arduino and since you set that pin to INPUT why would it ever generate 5v? Are you concerned about transient voltages ?
Thanks,
Richard