SD Card Audio Player

In the Making Music project, you learned how to generate simple sound with the Arduino. In this project, you'll learn how to use the Arduino to play audio (MP3 and WAV) files stored on a microSD card using the DFPlayer Mini audio module.

Parts needed:
  • Arduino
  • DFPlayer Mini audio module
  • Speaker
  • Wires
  • Breadboard
  • micro SD card

  • You also need to download the DFPlayer software library which contains all of the functions for interfacing with the DFPlayer audio module.
Arduino      DFPlayer Audio module      Speaker      Breadboard     
1 Making the connections

The DFPlayer audio module requires six (6) connections.

Arduino DFPlayer Description
11 2, through a 1K resistor Arduino TX - DFPlayer RX
10 3 Arduino RX - DFPlayer TX
GND 7 GND
5V 1 5V
6 Speaker
8 Speaker
Audio module connections
2 Prepare SD card.
  • Format the SD card with the FAT or FAT32 file system.
  • Create two special folders using the names mp3 and advert.
  • Additionally you can create 99 more folders using the names 01 to 99. These 99 folder names must be exactly two digits long zero padded.
  • Copy one or more MP3 audio files into the two special folders, mp3 and advert, and to the 01 folder. You need to rename the audio files using the following format:
  • The filenames for the MP3 files that you put inside the two special folders, mp3 and advert, must start with four digits zero padded, and then optionally a long filename after. You can have up to 255 files inside this folder. For example, "0001 Welcome message.mp3"
  • The filenames for the MP3 files that you put inside the 01 to 99 folders must start with three digits zero padded, and then optionally a long filename after. You can have up to 255 files inside this folder. For example, "001 Jack and Jill.mp3"
3 Download the DFPlayer software library.
4 Install the DFPlayer software library by selecting Sketch from the Arduino IDE menu
  • then select Import Library or Include Library
  • then select Add Library or Add .ZIP Library
  • Locate and select the DFPlayer.zip file that you just downloaded in step 3. It should be in the Download folder.
  • Click the Open button.
(Refer to this document for more information on how to install a library if you run into problems.)
5 Create a new program by selecting File from the menu
  • then select Examples
  • then select DFPlayer
  • then select basic
6 Open up the monitor to see status messages as the program runs.
7 Upload and run the program.
  • The program will first play the audio file 0001.mp3 in the mp3 folder for six seconds.
  • Then it will play the audio file 001.mp3 in the 01 folder for another six seconds.
  • It will then interrupt the current song and play the audio file 0001.mp3 in the advert folder.
  • After finish playing the audio file from the advert folder, it will continue with the song that was interrupted.