$USD
  • EUR€
  • £GBP
  • $USD
PROJECTS Arduino

Arduino Application- Test DFPlayer Mini MP3 Module

DFRobot Mar 06 2015 6520

Here I'm glad to share an intersting and great project from Stonez, one of our awesome customers. He used our product DFPlayer-A mini MP3 Player to make an excellent MP3 player. Really appeciate Stonez's precious exprience this time. :-D

Learn the project below:
I found DFPlayer mini MP3 module on China auction site Taobao when I was looking for a MP3 player module for an Arduino projects.  This module is quite small and it only require few pins connections to Arduino and a speaker to work.  Looks really nice for my little project.
Actually, the module is quite capable and complicated, if you were interested, please visit A Mini MP3 Player For Arduino.
This tutorial here is just to show you how to connect DFPlayer module with Arduino and speaker and the Arduino sketch provided here just to play few sample sounds I collected from Internet.
First, I recycled a 2W, 4Omh small speaker from this little music box.



Material Needed:
  1. DFPlayer Mini module 
  1. Speaker - DFPlayer module support to to 3W
  1. SD card - 2GB ~ 32GB formatted with FAT or FAT32
  1. MP3 / WAV - audio files
  1. Arduino Uno Rev 3
  1. Few jump wires
As you can see the illustration below I made in Power Point, hardware connection is quite simple
(Forget about the cross lines...these lines are NOT supposed to be crossed.. :)


* Note: You have to separate DFPlayer Mini Module power from Arduino power or you will hear very loud noises (It took me two days to figure out this!)
 

Here is a photo of my Arduino with DFPlayer Mini connection:

*Important note for audio files. Careful read notes below will save you a lot of precious time!
  • DFPlayer Mini read both MP3 and WAV files.
  • All audio files must be placed under /mp3 folder.
  • Audio file must be named 0001.mp3, 0002.mp3.....0255.mp3 (4 letters not 2 or 3 letters)
  • Audio file names can have any characters after 4 digits, such as 0001_Bruno_Mars_Count_On Me.mp3 
  • Tested few under 1 second WAV files and they did not work
  • If one of the audio file is removed from SD cared, DFPlayer still can find it and play it! Weird! In the end, I formatted the SD card to make DFPlayer to play the music I specified.
  • Delay(seconds); You have to specify number of seconds delay for the audio file to play completely or the next audio file might be started before current audio is over!
  • mp3_play (74); means play audio file 0074.mp3
The code below is from the vendor's website and it worked without much modification.

Code here:

/*
 * Copyright: DFRobot
 * name:  DFPlayer_Mini_Mp3 sample code
 * Author:  lisper 
 * Date:  2014-05-30
 * Description: sample code for DFPlayer Mini, this code is test on Uno
 *   note: mp3 file must put into mp3 folder in your tf card
 */

#include <softwareserial.h>
#include <dfplayer_mini_mp3.h>

void setup () {
 Serial.begin (9600);
 mp3_set_serial (Serial); //set Serial for DFPlayer-mini mp3 module 
 mp3_set_volume (10);
}

void loop () {        

 mp3_play (1); //play 0001.mp3
 delay (10000); //10 sec, time delay to allow 0001.mp3 to finish playing

 mp3_play (2);
 delay (5000);

 mp3_play (5);
 delay (5000);

 mp3_play (20); //play 0020.mp3
 delay (9000);

 mp3_play (81);
 delay (6000);

 mp3_play (74); //play 0074 mp3
 delay (6000);

}

Source: Stonez56
REVIEW