I cant seem to get sound no mater what, have tried 3 different libraries, swapped out Uno, DFPlayer mini mp3, speaker (tried headphones, buzzer ...) re-format 2 different micro SD and tested they play on other player... I have attached present code being used which gives the result of showing as connected (unless I remove the SD card) and repots as playing tracks. the light on the DFPlayer shows when initialising but not when 'playing' (not playing)
Files are verified as MP3 in windows, are the only files on the SD card and are in MP3 directory, and (now) simply labelled as 0001.MP3 and 0002.MP3
Wiring is as per all the diagrams (re-checked multiple times) with 1k resistor (and have tired without) - communication is clearly taking place (as per above) so have tried everything imaginable with the sound files (now just using low res electronic sounds to try and get something)
I notice that this has been asked before, but never comes to a conclusion?
#include <DFRobotDFPlayerMini.h>
#include <Wire.h>
#include <SoftwareSerial.h>
SoftwareSerial mySerial(4,3); // RX, TX
DFRobotDFPlayerMini DF;
void setup()
{
mySerial.begin(9600);
Serial.begin(9600);
Serial.println();
Serial.println(F("DFRobot DFPlayer Mini Demo"));
Serial.println(F("Initializing DFPlayer ... (May take 3~5 seconds)"));
if (!DF.begin(mySerial)) { //Use softwareSerial to communicate with mp3.
Serial.println(F("Unable to begin:"));
Serial.println(F("1.Please recheck the connection!"));
Serial.println(F("2.Please insert the SD card!"));
while(true);
}
Serial.println(F("DFPlayer Mini online."));
DF.volume(10);
delay(100);
}
void loop()
{
DF.play(1);
delay(2000);
Serial.print("Played 1 ");
DF.play(2);
delay(2000);
Serial.print("Played 2 ");
DF.play(0);
delay(2000);
Serial.println("Played 3 ");
delay(2000);
}
DFRobot DFPlayer Mini Demo
Initializing DFPlayer ... (May take 3~5 seconds)
DFPlayer Mini online.
Played 1 Played 2 Played 3
Played 1 Played 2 Played 3
Played 1 Played 2 Played 3
Start with this:
Do not make any changes to it. Do it exactly and it should work. The you can modify it from there.
2 Likes
OK have sound
start, next etc make a track play
Bottom line - 'Play' does not work - or at leas not as specified.
How do I play a specific sound?
1 Like
Following on from previous post
'play' command does not work - so how do I play a specific sound
Also - how do I link/quote previous post with all details?
https://forum.arduino.cc/t/dfplayer-mini-no-sound/889376?u=p54hotter
This seems a bit cumbersome.
Why did you start a new thread when you introduced the current question in the old thread?
Paul
simple - because it's not being looked at let alone answered. Same as other questions I have looked at asking about similar problem (probably same root cause) which are all 'no solution' and have been 'dropped'.
Ok, but what do you consider a "play command" to be and how are you using it? I am not aware of your board being able to play a "specific sound". Please explain so I can understand it.
Paul
All details are on linked post/question - which you say you have seen.
Next or previous or even start make a track/file/sound play, but play does not.
I want to play a specific sound (one of 3 stored as MP3 file on micro SD card) depending on other inputs. but despite trying every imaginable labelling and placing in directories or root (depending who's posts/examples you believe) *.play(1), or any of many variations tried does nothing.
I have even tried serial.write - but clearly don't know enough to set this up to send the hex string specified on the card's sites.
Do you mean this example code will not work for you?
Paul
correct - nor will many other example codes - including the version I posted
You waited less than 24 hours before reaching that conclusion. Both specious reasoning and a foolish mistake. Do not crosspost again.
Soo frustrating!
I am not the first one to have a problem with this command - none have been answered - all dropped/left hanging. when I read through posts, there is usually only one real attempt to answer, so if underlying issue is not addressed then, it never is. If it was answered in other posts I would never have posted at all.
My original 'no sound' has been partially solved meaning that the cause of the problem is clearer - therefore changing the title clarifies the issue. This also means that people like me in the future will turn up what they need by searching the issue.
All I have really got, rather than answering my problem, is 2 people pushing their own stuff! - here's my projects site, here's my libraries. clearly what I need is where I have stuffed up, made a stupid mistake or misunderstood required syntax - or and admission that there is a problem - guess that's not coming on this one!
You don't and it's one of the reasons why cross-posting is verboten.
You appear quite agitated. Especially for someone expecting free help. Sometimes the answer might not be forthcoming and sometimes the questioner refuses the answer upon delivery. 
Did you build the example that I sent you exactly, every wire, switch, and bit of code?
In this particular case I told someone I'd build one of these soon and figure out the commands because I happen to need it for a project I'm working on. Either that was you, or with all of your reading you must have seen it on that thread?
Also, there is a section for paid work if this project is beyond your scope of capabilities.
I did - it worked - until changed to Play command which I think I need. also adding or changing to start or next etc into code I posted then plays, but does not give desired result. all of this is stated quite clearly above.
My suspicion is that the mp3 file labels have some other detail required, or that the library doesn't work for this command as it conflicts with setup for similar commands - which is going beyond my present capabilities and I hope I don't need to learn to that detail to make a project work.
I have the same problem.
If I use DF.next() it works fine.
If I use DF.play() it doesn't.
I always get "DFPlayerError:Get Wrong Stack" and "Time Out!"
No clue.
1 Like
This might sound really dumb, but did you name the file:
0001.mp3
because you just need to name it 0001.
If you do a deep dive into your files you'll see that the sd card adds ANOTHER .mp3 extension- which means you've actually got a file name of:
0001.mp3.mp3
And that's why your player keeps playing the one file over and over, as it can't find the file its looking for.
And yes, it took me an hour to figure that out the first time too.
Tried both ways, more and less zero's... checked card contents via command prompt window... placing in root, mp3, MP3 etc. selecting via 'next' all files seem play no mater what label or directory variation.
Well, I just tried your code ...
and you are 100% correct it does not work.
I don't know if they have coded the Play function wrong- as I tried the Get Started example in the Examples file and it didn't work either.
So I have done 3 things for you:
A) I changed the library to Df Mini Fast by PowerBroker. Please download and use that from the Libraries menu.
B) I changed your RX/TX lines back to the traditional digital pin 10 and 11 placement. I don't THINK that was the issue as I tried that on the Get Started example and it didn't work there either, but there could be a pin being used I'm not aware of and
C) I rewrote your code, tested it, and it works:
#include <DFPlayerMini_Fast.h>
#if !defined(UBRR1H)
#include <SoftwareSerial.h>
SoftwareSerial mySerial(10, 11); // RX, TX
#endif
DFPlayerMini_Fast DF ;
void setup()
{
Serial.begin(115200);
#if !defined(UBRR1H)
mySerial.begin(9600);
DF.begin(mySerial, true);
#else
Serial1.begin(9600);
DF.begin(Serial1, true);
#endif
Serial.println("Setting volume to max");
DF.volume(30);
}
void loop()
{
DF.play(1);
delay(2000);
Serial.print("Played 1 ");
DF.play(2);
delay(2000);
Serial.print("Played 2 ");
DF.play(3);
delay(2000);
Serial.println("Played 3 ");
delay(2000);
}
I also maxed out the volume at 30 so you would hear it. Let me know if you have any more issues.
2 Likes
Thanks halloweenrick,
I've tried your code with the MiniFast (just added the missing #include <DFPlayerMini_Fast.h> at the beginning).
Same behaviour.
I changed the Loop in this way:
void loop()
{
DF.play(1);
delay(2000);
Serial.print("Played 1 ");
DF.play(2);
delay(2000);
Serial.print("Played 2 ");
DF.play(3);
delay(2000);
Serial.println("Played 3 ");
DF.playNext();
delay(2000);
Serial.println("Played Next ");
delay(2000);
}
No sound played till DF.playNext(), that worked.
SD contains 25 mp3 files named 0001.mp3, 0002.mp3, ... , 0025.mp3 in a folder named mp3
I will try with another SD and I will try some testing on SD formats, cause atm I have no clue
Just tried and get error
compilation terminated.
exit status 1
Error compiling for board Arduino Uno.
will try changing code but using this library (have tried 4 other libraries but not this one)