I have problems about playing sound by DFPlayer MP3 using TF card.
These are the photos of the TF card's folder, the connection I have made and the code.
After uploading, the Serial Monitor displayed 'Initializing Success' which I assume that the DFPlayer had been connected correctly. However, the LED on the DFPlayer did not light up as same as tutorials, the Speaker did not play either.
Please someone figures out my problems and thank you for your help.
What do you mean using pins 2 and 3 of arduino to connect with DFPlayer? Which pins of DFPlayer should I connect with? I thought that the RX, TX connections are enough.
About the module, I bought it from the most reliable electonic store in my area. Also the store has many 5 stars feedbacks on the module, so I believe the module can not be fake.
About the speaker, I bought it online and I lost its receipt somewhere. It is a 1.5 Inch full range speaker. Also, when I replace the nano with an uno and reupload the sketch, I heard small buzzing sound from the speaker repeatedly, the DFPlayer got hotter.
There's widespread confusion about the DFR module's file format requirement. Your MP3s in the root can be named however you like. They do not need prefix numbers. The instruction
myDFPlayer.play(N);
will play the Nth track on the card. Where N is the Nth track that was copied or moved to the card.
I think the issue has arisen because of poor documentation, largely due to translation flaws. Of course, most users will therefore need numbering, as I do, to manage the implications.
Didn't understand your first code (not a C/C++ programmer).
Will study your latest sketch this morning.. Meanwhile, I'm sure you don't need pinMode for the Rx/Tx pins?
Yes. I guess the doc suggesting the numbering was a "trick" because most OS copy files to the SD in the file name order when you do a bulk copy, so that was ensuring file 001.mp3 was copied over before file 002.mp3 etc...
The key error in your code was that you had Tx/Rx reversed. Otherwise I've kept the sketch below close to yours (although I would personally make some other changes). It works as expected on a Uno.
#include <SoftwareSerial.h>
#include <DFRobotDFPlayerMini.h>
#define rx 10
// #define rx 11
#define tx 11
// #define tx 10
SoftwareSerial mp3Serial(rx, tx);
DFRobotDFPlayerMini mp3Player;
void setup()
{
// put your setup code here, to run once:
// pinMode(rx, INPUT);
// pinMode(tx, OUTPUT);
mp3Serial.begin(9600);
Serial.begin(115200); // my preference
mp3Player.begin(mp3Serial);
mp3Player.volume(15);
mp3Player.play(2); // Play the second track that was copied to the mSD.
}
void loop()
{
}
THANK YOU SO MUCH FOR YOUR GREAT HELP!!!!! I AM SO EXCITED RIGHT NOW
It took me nearly 3 DAYS finding errors and turned out that it was REVERSED WIRING!!!
You are right, naming files does not matter at all. I have tried changing the file name with your great code and it played sound normally.