Hi, this little tutorial is to explain how to make the DF Player work to play specific files when called from Arduino. This Small player is a little bit tricky, and the datasheet’s I found on the internet were helpful, but not very clear.

Test the DF Player.

dfplayer-test

Insert an mirco Sd card with a soundfile in the player and connect a power source. When you make a connection between Gnd and ADKEY_1, the Led on the player should light up. When you have a speaker connected between SPK_+ and SPK_-, you should also hear the sound file.

Ready to connect the Arduino to the Rx and Tx pins of the DF Player. Tx of the Arduino to the Rx of the Df Player and Rx of the Arduino to the Tx of the Df Player

Now you have to prepare the mirco Sd Card.

  • Create a folder and name it 01
  • Put a few mp3 files in this folder and name them 01.mp3 02.mp3 03.mp3 … and so on

If you want play specific voice or sound files, it’s essential to create numbered folders 01 to a max of 99. Inside each folder the files need to be numbered from 001 to 255.

The bytes we have to transmit from the Arduino to the Df player should be like this

datastring

I tryed to make the checksum work, but I failed. So I found out, by simply leaving the checksum away, everything worked fine 🙂

I wrote this little test program to play sound file 01 in folder 01. If this works for you, you can play around with it, to understand how to switch between folders and files.


byte DFData[] = {0x7E,0xFF,0x06,0x0F,0x00,0x01,0x01,0xEF}; //Play sound01 in folder01
void setup() {
Serial.begin(9600);

}

void loop() {

for (int i = 0; i <= 7; i++) {
Serial.write(DFData[i]);
}
delay(5000);
}


 

The command 0x0F is for playing sounds in a folder. If you use 0x03 instead, it will play files from the root of your Sd card, but it will ignore the numbering. For the player the first file is the first uploaded, so you can not address them with there number, if you use 0x03 as command.

With this line you can Set the volume to max. Command 0x06 and Value max = 0x1E (0-30 in decimal)

byte DFData[] = {0x7E,0xFF,0x06,0x06,0x00,0x00,0x1E,0xEF};

to reset the player:

byte DFData[] = {0x7E,0xFF,0x06,0x0C,0x00,0x00,0x1E,0xEF};

I’m still working on this. If I find new things, I’ll post them here

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s