DFPlayer Mini MP3 Module Testing
HTML-код
- Опубликовано: 6 июл 2024
- Demonstration and testing with explanation about using the DFPlayer Mini MP3 Module. Includes both “analog” standalone versions and digital interfacing for control via micro-controller serial port. DIY Arduino code included.
More information and downloads from www.fadstoobsessions.com
Related videos:
• Subscriber Question: D...
Demonstration of timed triggering and playing of tracks with the DFPlayer Mini MP3 Module.
• Subscriber Question: D...
Demonstration of the "play all" (i.e., looping tracks) function of the DFPlayer Mini MP3 Module.
Video Timeline Index
00:00 Introduction
01:25 Basic Minimum Circuit
02:35 Minimum Circuit Demo
03:43 AD Key Control Version
04:37 SD Card File Naming Format
05:39 AD Key Control Demo
06:46 Current Consumption Test
07:50 Micro-controller Interfacing
09:26 Firmware Coding/Arduino Uno
10:45 Code Explanation
12:45 Micro-controller Control Demo
Code library github.com/DFRobot/DFPlayer-M...
Green screen from www.zapsplat.com“
Music clips royalty-free from RUclips Audio Library. - Наука
Very nice, and thank you! Straight to the point, I fell confident that I can set one of these up now and actually get it to work! Good job.
The most definitive demo yet!!! It beats reading their useless datasheet. Thank you for compiling it all in one demo.
You learn something new everyday.
Thanks. I was desperately searching for the 'loop' function when using as a standalone. Sorted!
Glad to have been able to help
What was the solution for looping through all MP3’s on the card when using as stand alone? Was it simply grounding the ad_key1 pin? Not sure that I saw that in this demo.
That was on point. Exactly what I needed. Great work, Thank you so much!
Glad it was helpful!
Not gonna lie, this was fascinating to me!
Just learned something new, thank you🙌🏻
Keep up the good work!
Great video, super clear, You ROCK! ✊
Thanks for the kind words, much appreciated.
Great video! Keep it up 👍🏾
Thanks! You too!
Thanks for the tutorial!!
Happy to help!
Thanks very much for sharing, I just need this information for my back track sounds
Glad it was helpful!
Very helpfull i was strugeling with the file system but now it works thx
Glad I could help
Thanks for explaining in detail all aspects. excellent video.
Glad it was helpful!
@@FadsToObsessions any ideas on auto play on power on? I tried having ADKEY_1 grounded before power on, but no luck...
I checked my notes and that should work - connecting ADKEY 1 to gnd, and then on power-up should play all tracks present on the SD card on a loop. I have some old video clips recorded for a barking dog alarm based on this module, which includes auto playing etc, I'll try to tidy this up and post on YT over the next few days
@@FadsToObsessions I do appreciate your answering. I have tried this and didn't work. Maybe there is a slide difference in the mp3 units we have... again, thanks a lot.
You are correct about possible differences between modules (the components I have been using were purchased a few years ago now!) - I know these things can be frustrating, so I have placed pictures of the module I am using on my web site ( www.fadstoobsessions.com/Electronics-Projects/Random.php ) so you can reference against your physical module, also, a video demonstrating the wiring etc for 'auto-play' at power-on.
I like it very much.
I have managed to access 20 folders on a MicroSD card with a folder that even has over 300 songs in it, the other folders have various number of songs using Mega 2560 Pro and 20 buttons, each accessing a separate folder, lots of pins, buttons and wires, not using ADKey scheme of 2 pins. Now looking to add Leds to indicate which folder is in use
Very cool
Woah interesting !
Well explained! Thanks.
I've ordered a DF miniplayer in hope I'll have more success with this than the DRF0534 player, which has onboard flash memory rather than using an SD card, but has an almost unintelligible data sheet (in English anyway!). But now also wondering if the code you used to send Commands to the DF Miniplayer might work with the DRF0534 - they seem to be related products.
Thanks again
Good luck - If you get a chance and are successful with using DF Mini code with DRF0534 - would appreciate if you could comment back, onboard flash rather than SD card can be advantageous for particular applications
Many thanks, had/have a couple of dfplayer boards and assumed both had blown because I couldn't get anything out of them, not even the LED. Video was extremely useful, now to integrate to Alexa!
Great to hear - if you have time, would be very interested in your results with Alexa
The basics are, to get around the DFPlayer file naming restrictions, I will use a PHP routine to read all track and artist names from current local files and load this text into a database table. A column within the same table have consecutive numbers for each file. The file will then be copied to an SD card using the new index as the new filename with leading zeros where needed. New tracks can then be added to the end of the table quite easily. You can ask Alexa for any words within the track title or any words within the artist name and Alexa would use the correct index through a simple query carried out by Alexa. This would then be sent to a tiny D1 mini which sends the commands to the DFPlayer. Stay in touch for more info.
thanks, will do.
thank you i'm about to use this to paly selected tracks using buttons and was wondering how accurate those screwy resistor values they quoted had to be. Even looked for them but to no avail. so Seeing that you can use normal value resistors is a great help.
No problem 👍
Thankyou, 🙏gracias me fue muy util tu video, lo usaré para un radio cibi, para tener la opcion de varios sonidos en un solo chip,saludos de México 🇲🇽 lindo y querido 👍
Feliz de haber podido ayudarte - tu proyecto suena muy interesante
Nice and comprehensive review of the module. What are the 2 USB pins for? A thumb drive?
Thanks, yes your correct, pins 14/15 for connecting a USB thumb drive
Very clear explanation, thanks.
May i ask what is the best battery and speaker to use if i want to create a tiny mp3 for kids?
The MP3 module requires DC 3.3 to 5V, so just 3 or 4 series AA or AAA batteries probably suffice (likely least expensive option), but perhaps a 3.7V LiPo pack would give you smaller size (and be rechargeable), something from RC drone/car maybe suitable. In terms of speaker, any 4 or 8 ohm speaker (perhaps salvaged from discarded item, or search ebay using "4 ohm 3W mini speaker") - best if you can use a salvaged speaker/items, otherwise, overall cost starts to increase quickly (and likely just easier to purchase ready to go commercial MP3 player - unless to want to customize in a particular way).
@@FadsToObsessions
Clear. Thanks a lot
Great video you are to be commended, just a quick question. Without using the arduino setup What would happen when the song ends? Will it play the next song on the sd card? Is it possible to have the song play Once? at a push of a button and when the song ends it simply stops until you press it again? If you had just the single file on the sd card?
Using the "ADkey control" (i.e., without Arduino and using the resistor ladder setup, section 4 page 15 of the datasheet) if use 33K resistor, the function is just play (or pause if playing) the "current track" (which if only one file on the card, will be that file) and then when the track is finished, the player stops (and if press 'play' again will play the same song). To get the previous or next track, would need to use additional buttons with 24K and 15K resistors respectively.
@@FadsToObsessions Thankyou very much, very helpful
You are a Genius! This is just what i need. One noob question, ¿Is there a volume limitation?
Thanks for the kind words (but unfortunately, far from a genius 🤓).
The component has a built in 3W amplifier that can direct drive 8/16ohm speakers, with 30 levels of adjustable volume within that range. The speakers I used in the video, salvaged from an old analog TV, were "plenty loud" with the module, and I generally only used it about mid volume (otherwise too loud in a normal office/bedroom sized space).
Take the normal care with earphones, it can be very loud with them.
Great video. Can you attach a potentiometer as volume control instead of long pressing a switch?
Thanks. Unfortunately you cannot use a potentiometer in this case, the volume control on the unit is digital input only.
@@FadsToObsessions thanks for your help
or you can build a decoder
Thanks for you video. Im trying to do something really simple with this..
So using the example blink project. I want a noise to play every time the led comes on.. However when I add player.play (1) it cases my led to flash like crazy.
To put this in context this is for a halloween prop. Every 30 secs the arduino turns on a relay that triggers a motor, at which point I want it to play a scary sound. Thought it would be simple but i'm not getting anywhere fast.
Would appreciate your help
Kevin, I did a quick test circuit and some demo code (see ruclips.net/video/IQr6QTyons4/видео.html) showing timed triggering for playing a sound file. Hope this helps.
Brother, I want to use a potentiometer to control the next/previous song. or any other rotating method. can I do this with this module?
I think you could, using the AD key connection method, where pin 12 (ADKEY1) is connected via suitable resistor to ground via a push button, see ruclips.net/video/gMv2xGHLXdU/видео.html If you replace all the resistors with a single potentiometer (a 50K may be enough) and the pot wiper to ground via a push button. Then when the pot is set to a specific value, and the button pressed, you would get that particular function. However, the pot by itself (without the push button to ground) would not work.
Fantastic tutorial. Would it be possible to connect multiple df players to one arduino, and have each connected to their own speaker? I am attempting to make an instrument that plays a noise by the push of a button and each button/noise would have its own speaker. Thanks in advance.
You would need a multiplexer (like HEF4051) so that a single arduino (with the TX pin through a voltage divider) could then control multiple DFPlayer's (the HEF4051 would allow up to 8 to be separately controlled). Each DFplayer would have its own speaker. The push button for each DFplayer I suppose would be connected to the ADKEY1 pin via a 33K resistor (if I understand what you a trying to do). You could maybe do this without even using the Arduino, if you don't need the arduino to select tracks, change volume etc.
@@FadsToObsessions I appreciate the response. Would an L293DNE or a 74HC595 have the same function? Also, through the ADKEY1 pin, what would I name the mp3 file if I was not going to use an Arduino? And do you have any troubleshooting tips for when the df player won't respond with its blue LED, but the speaker is still receiving power?
Unfortunately, neither the L293DNE (a H-Bridge driver) or a 74HC595 (a shift register) can be used in place of a HEF4051 (a multiplexer). The mp3 files should be named 0001.mp3, 0002.mp3 etc (see 4:50 in the video). The blue LED not working is a bad sign. Recommend double checking DFplayer is Ok by hooking up the basic standalone circuit (see 1:25 in the video), check and double check your wiring and power supply, and then see if it works (see 2:40 in the video). At 2:40 in the video, it shows that when powered on, nothing happens (blue LED not lit) until you press one of the play buttons. Good luck.
@@FadsToObsessions Thank you for your time. I was able to use no resistor to utilize the segment 1 command on ADKEY1, as well as the segment 5 command on ADKEY2 . My main issue was a proper power supply, as I fried one module, and the rest had insufficient power. This was corrected through the use of a desktop power supply.
Thanks for commenting back on your success/trouble shooting - will be perhaps helpful to others. Cheers.
been lookin in to this player, but where can i find the refrens regarding what resister to use for specific tracks? i want 5 tracks to be played but cant find information in the documentation what resistor is needed for tracks.
Figure 5-5 in the datasheet gives the resistor values for each "key" and the function each "key" provides is listed in the table at the start of section 4 of the datasheet (or there is a diagram at the start of section 4 also) - so for example, K7 (key 7 is "playback track 4) which would be a resistor 9K1 ohms. I have a copy of the datasheet here is you need www.fadstoobsessions.com/Downloads-Products/Downloads-Products.php
I'm using the DFPlayer Mini in the standalone mode. I've set it to "loop all" by connecting a 51 ohm resistor from pin 12 to ground. It works fine but in that configuration, the volume adjustment function (via the I/O pins) stopped working. Is that by design? If yes, is there a workaround? Also, there is a time gap between songs in the loop mode. I know the gaps are not from the songs as these sound files were edited without any gaps to be played seamlessly. Is there a way to remove the gap between songs?
If I understand your setup, you have a 51Kohm resistor directly between pin12 to ground, and then other resistors (of appropriate value) connected from pin12 to ground via momentary push buttons, for the other functions (e.g., ~25Kohm for volume down). This means the DFmini is "seeing" a resistor value of 51Kohm all all times on pin 12 (which is constantly calling the "loop" function) and then when you press the volume down button for example, the 51Kohm and then the 25Kohm are in parallel, so equal to 17Kohm, which is no function. Using resistors, you need to have them all connected via push buttons. The gaps between the songs is a limitation of the DFmini. This is the time it takes the unit to access the files from the SD card and start playing. So, you can't "loop all" and have a continuous sound track from various stored files (which would be nice for certain applications).
how much is the gap?
What's the maximum ohm of the speaker? Sorry for the newbie question.
I've used both 8 ohm and 16 ohm speakers, the datasheet states "drive speaker less than 3W" - the speaker in the video is 16 ohm
How can I change between folders? Thanks so much!
you need to use command 0F "specify playback of a folder" (see table 3.2.1 of the datasheet page 4). This command has two "parameters" the "folder" and the "track" (both folders and tracks need to follow the naming convention using "numbers" for the track and folder names). Section 3.3.4 shows the command and examples. You must specify both the folder and the file name to target a track.
Outstanding video. Do you think I can find a way to restart a sound quickly. I have a model train and need the Chuff sound. I trigger it by observing drive wheel rotation with iR and two white straps. At low speed the chuff sounds off loud the dies away. But at high speed the device can not react. I wanted a restart to here the Loud start. Retriever loud start at higher speed. Is there a way to rapid restart. Dennis in Virginia on Frankentrain Laboratories.
Dennis,
The DFPlayerMini will start/restart playing a track/sound file as soon as it receives the command from the MCU, and the existing track (if any) will immediately cease playing "automatically". I have a couple of examples that you could perhaps modify showing how to repeat playing tracks, both looping through files
ruclips.net/video/IQr6QTyons4/видео.html
and replaying at set intervals
ruclips.net/video/udgf_-x0JqI/видео.html
The only "limitation" is that there is a "seek time" involved with the electronics within the DFPlayer Mini getting the info/data from the SD card etc. This means there would be a brief pause between "repeats/restarts" (only in the order of 10's of milliseconds, but enough to be noticeable when listening) - annoying if trying to get a "continuous" sound from a "sound clip" for example, but in your application, perhaps fine.
@@FadsToObsessions I have been testing the sounds and fine if the button is help the iunit kinda goes to auto repeat until you do a slow cycle. I think for the money I can add the ADAftruit button fob and radio receiver with a opto chip 4 channels and get a remote operation for my train engines for less that $20. We are designing a PCB to mount this up and put it in the trains tender. Yippee! Cool sounds on the cheap. Great video Hey where can i get the datasheets? Dennis
the datasheet for the MP3 player module is in my downloads
www.fadstoobsessions.com/Downloads-Products/Downloads-Products.php
and then scroll down in the "Datasheets" section - you'll need to join as a member (which is free) which is just to stop spam-bots and scrapers etc. I'll PM you a copy as well.
Great video , but can you answer me a question. I am making a sound generator for a model steam train. I only need to play one sound file that goes " Chuffff" and that only lasts about 1 second . I need to trigger it relative to the trains speed so when its running slow it may get triggered every 2 seconds ," Chuff silence Chuff " etc. when it speeds up a little perhaps 1 trigger a second I would get " ChuffChuffChuff" . All good so far but now we get quite fast and the triggers come faster than it takes to play the full sound sample , What I need is for the trigger to cut off the current playback and restart it from the beginning so I get " ChuChuChu or even ChChChCh. Is this possible and if so how ? I dont want it to have to wait untill each chuff has played out its full length . I had planned to use an optical interupt on the trains axle but I worried that if the train stopped with the optical trigger closed it would keep repeating but I suppose using an MCU I could get it to trigger an interrupt on a rising edge so if it stopped when interupting it couldnt play again until the trigger from the optical sensor dropped low and then high again. Sorry for the long post but if you could let me know if and how the sound can be stopped and restarted back at the beginning I would be grateful ..... Don
Don, the DFPlayerMini will restart playing a track/sound file as soon as it receives the command from the MCU, and the existing track (if any) will immediately cease playing "automatically". I have a couple of examples showing how to repeat playing tracks (both looping through files and replaying at set intervals) ruclips.net/video/IQr6QTyons4/видео.html and ruclips.net/video/udgf_-x0JqI/видео.html
The only "limitation" is that there is a "seek time" involved with the electronics within the DFPlayer Mini getting the info/data from the SD card etc. This means there would be a brief pause between "repeats" (in the order of 10's of milliseconds, but enough to be noticeable when listening) - annoying if trying to get a "continuous" sound from a "sound clip" for example, but in your application, perhaps fine.
Thanks for the reply , it sounds encouraging so will give it a try and report back how it goes
I can only get 4 segments, I can't use resistors to get 5 or more segments on ADKEY1 and ADKEY2. Please help. Thanks!
Double check your resistor values (and connections to pins/ground etc), double check you have named the "segments" (which are just the files on the SD card) correctly (see 04:40 in the video), that's the best I can offer at the moment. Over the next few days, I'll recreate the circuit with more than four "segments" using resistors/buttons and post the results.
Thank you for the video. I am making a talking pumpkin.
Great idea - and also with a motion sensor so it triggers when somebody goes by? - if you have time, let me know how it goes. We don't have Halloween as such where I live, but you've prompted me to make a talking Santa for the garden for this coming Xmas !!
@@FadsToObsessions Yes, I can use an HC-SR04 Ultrasonic Sensor Module. My programming skills are lacking. A talking Santa sounds like a good idea. You can pickup a Santa Mask off of Amazon for $16.00. You can also pickup a DF Player Audio Voice Music Module for Arduino pretty cheap, it is used as a music player, but any MP3 file can be loaded via PC.
Hey I am trying to use the DFplayer mini as a standalone(powering it now with an arduino), because I want to keep my entire project as small as possible. However when my mp3 file hits a loud note my speaker (1 watt, 8 ohm) simply just stops. do you have any tips?
The voltage regulator on an arduino (well at least with a Uno or similar) is only ~1A and if powered from USB, you should limit total max draw to be only 500mA. From www.arduino.cc/en/Main/arduinoBoardUno>
"The Arduino/Genuino Uno has a resettable polyfuse that protects your computer's USB ports from shorts and overcurrent. ... If more than 500 mA is applied to the USB port, the fuse will automatically break the connection until the short or overload is removed."
So, unfortunately, you will probably need to look at providing a separate supply for the speaker.
@@FadsToObsessions Thank you for the quick and concise answer. I will look into it :)
HELP! I copied your code line for line, but it won't actually adjust the volume. The other features work (next/previous and play/pause). What's going wrong?
Since the play/pause etc are working, therefore your code would appear correct and is successfully connected to the MP3 player, sending commands via the serial port etc. The same function is used to send all the commands, so in the first instance maybe a hardware problem. You could check that the variable theVolume is initialised properly (int theVolume = 15;) before the main loop, as with my modules, the default at power-up appears to be maximum volume. On power-up, if your module isn't playing very loudly, again indicting hardware and/or power problem. You could try hooking it up with the resistor ladder (~ 4:30 in the video) and checking that the volume can be adjusted with push buttons - this would check that the module is working ok.
Please, is this MP3 module stereo or not and wich pinout for the stereo mode. Thank you.
Yes the module does output stereo. Pin 4 and pin 5 are the right and left channel respectively. But, these outputs are for earphone or your own amplifier, not to speakers directly.
@@FadsToObsessionsThank you.
Hello, I say play music if a condition is met in the loop in the arduino, but the first 1 second of the music is constantly repeated. Why does it do this?
What I want: If that condition is met, let the music play until it ends and then stop, but it doesn't do this, as if it is constantly sending requests for that music to be played.
Does your setup work normally otherwise, i.e., not using a loop, but just sending a "start" command, and the track plays? If so, hardware probably Ok and a code problem, otherwise, maybe something with the wiring. Send your code to admins@fadstoobsessions.com and I'll have a quick look if you want.
I made doorbell from this
can this play a single file on power up somehow? or does it need a micrcontroller? -- thanks
The DFPlayer does not have "play file on power-up" functionality as far as I know. So, a microcontroller as you say, or perhaps some external circuitry (maybe a RC time delay with a Schmitt buffer to trigger low the ADKEY1 (pin 12) to play track 1) will be needed. Microcontroller likely easiest, getting an active low trigger on start-up with "passive" components possibly "tricky" depending how the DFPlayer reacts on power-up.
@@FadsToObsessions Yeah thanks. I didn't get any documentation -- your video is excellent. Yes, just a circuit to give that pin a pulse with the proper resistor "should do it". That pin must be an AD converter. Clever what they do with the different resistance values.Where did you find the datasheet? -- thanks
Not sure now, but I added the datasheet to my downloads
www.fadstoobsessions.com/Downloads-Products/Downloads-Products.php
and then scroll down in the "Datasheets" section - you'll need to join as a member (which is free) which is just to stop spam-bots and scrapers etc
Is it possible to play one song without decreasing the volume?
yes, you can play a song/track with whatever volume you require (if the default start-up volume is OK for your application, you don't need to change)
Can it play multiple sound at once?
Not as far as I know, just a single "track" at a time.
that interesting, you could listen to pokemon soundtrack on mp3
where is the barking dog player?
Thanks! I tried looping sound on my DFplayer and it isn't working, any idea why?
I'm assuming you have the other functions working, so basic connections etc OK otherwise. First recommendation would be checking the resistor values, which for the loop all function, the datasheet states 51K ohm - although I found the value doesn't need to be "exact" but fairly "close" (so maybe you are not close enough??), secondly, perhaps check the naming of your files on the SD card - need to adhere the datasheet naming format, as maybe this could be causing interference.
@@FadsToObsessions thanks for the reply! Where should I put the 51k resistor?
@Nerya Have a look at 4:30 in the video, this gives a schematic diagram. The 51K resistor is from pin 12 to a momentary push switch and then from the switch to ground. In the video, this is the short horizontal purple wire on the bottom, then through the vertical orange etc. I did not have 51K, so used a 47K and a 3.9K together in series.
@@FadsToObsessions But what if I want it to interface directly and only with an Arduino nano? As in automatically play a loop without pressing a button
@Nerya Oh, in that case, after hooking-up the nano (see 7:50 in the video for schematic etc if you haven't done this already) will need to add some code (see 9:30 in the video). The datasheet page 4 section 3.2 lists the various commands available. In the example code in the video, I have a function called "do_MP3_Cmd()" which can be used to send the desired command. For loop all, try using do_MP3_Cmd(0x11,0,1) to start repeat all playback and do_MP3_Cmd(0x11,0,0) if you want to stop repeat all playback.
What is fomat of sdcard should be work with it?
I have mine, a SanDisk 16GB microSD, formatted as FAT32 - so can drop 'n drag files from Windows 10/PC
@@FadsToObsessions hmm it's may be work with exFat fomat??
It's commonly used for mobile devices now days
The datasheet only says " ... provides micro SD card driver, and supports FAT16 and FAT32 file systems.", so more than likely probably not. If you do try with exFat, and have time, please post back your findings.
يتعذر الاشتراك ولا يوجد جرس-يتعذر التعليق-لا أعلم .
Google translate = "Can't subscribe, no bell-can't comment-don't know"
Perhaps try again later, something "wrong" with youTube at the time?
ربما حاول مرة أخرى لاحقًا ، هل حدث خطأ ما في RUclips في ذلك الوقت؟