Arduino - Test DFPlayer Mini MP3 Module
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 this page.
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:
- DFPlayer Mini module
- Speaker - DFPlayer module support to to 3W
- SD card - 2GB ~ 32GB formatted with FAT or FAT32
- MP3 / WAV - audio files
- Arduino mini Pro
- 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!)
***********
UPDATE: Someone left a message in this blog below, please try it out!
Hello everybody! There is another solution for getting rid of noise. Just put down DC voltage to 4.0 - 4.3 Volts. Arduino is still able to operate and DFplayer recommends to use 4.2V, my experiments prove this.
***********
***********
UPDATE: Someone left a message in this blog below, please try it out!
Hello everybody! There is another solution for getting rid of noise. Just put down DC voltage to 4.0 - 4.3 Volts. Arduino is still able to operate and DFplayer recommends to use 4.2V, my experiments prove 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
Programming 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); }Here is the video: