How to use DFPlayer Pro to play MP3
What is a DFPlayer Pro?
 Replacing DFplayer Mini
 Since the old model is not the most stable and many random problems are encountered, we are going to use this new model instead.
The DFPlayer Pro is an upgrade of the DFPlayer Mini MP3 Player for Arduino. It is a small and low-priced MP3 module with an internal storage of 128MB. The module can be used as a stand-alone module with an attached battery, speaker and push buttons or used in combination with an Arduino UNO or any other with RX/TX capabilities. Know More
This tutorial is based on using Arduino UNO.
Wiring
Wiring up the sensor is less complex than the previous version with the labelled pins.

- VIN to 5V (Power)
- GND to GND (Ground)
- RX to D2
- TX to D3
- R+ to Speaker(+) red wire
- R- to Speaker(-) black wire
- Connect L+ & L- if you want stereo audio
File handling
- You can download our example-sounds.zip.
- Connect the module to a computer with a USBC cable.
- Create a folder called mp3.
- Place the mp3 files into that folder.
Library
DFRobot_DF1201S library will be used for this module. We have a tutorial on how to install a library here.
Get Started
#include <DFRobot_DF1201S.h>
#include "SoftwareSerial.h"
SoftwareSerial DF1201SSerial(2, 3);  //RX  TX
DFRobot_DF1201S DF1201S;player;
void setup(void){
  Serial.begin(115200);
  DF1201SSerial.begin(115200);
  while (!DF1201S.player.begin(DF1201SSerial)) {
    Serial.println("Init failed, please check the wire connection!");
    delay(1000);
  }
  DF1201S.player.setVol(0);
  DF1201S.player.switchFunction(DF1201S.player.MUSIC);
  delay(2000);
  /*
    SINGLECYCLE = 1,  /**<Repeat one song 
    ALLCYCLE,         /**<Repeat all 
    SINGLE,           /**<Play one song only 
    RANDOM,           /**<Random
    FOLDER,           /**<Repeat all songs in folder 
  */
  DF1201S.player.setPlayMode(DF1201S.player.SINGLE); 
  DF1201S.player.setVol(20);
}
void loop(){
  DF1201S.if(!player.isPlaying()){ //if player is not playing
    player.playSpecFile("/mp3/005.001.mp3"); //play 001.mp3 in folder "mp3"
    String fileName = DF1201S.player.getFileName();
    Serial.print("playing: ");
    Serial.println(fileName);
  delay(1000);}
}
 
        
