DF Player Mini Not Playing Full MP3

The current issue I have right now is that no matter the size of the MP3, whether it be a few seconds or a minute long, the last part of the audio clip is never played. I have also noted that the audio will automatically cut off 10 seconds in. For clips less than 10 seconds, the full clip is never played except for say the first 70-80%. I can confirm that the audio clips on my sd card is what I want, its just playback using the DF Player Mini is not working as I intended. Below is my code:

#include "Arduino.h"
#include "SoftwareSerial.h"
#include "DFRobotDFPlayerMini.h"

SoftwareSerial mySoftwareSerial(10, 11); // RX, TX
DFRobotDFPlayerMini myDFPlayer;

const int  buttonPin = 2;
int buttonState = 0;
int lastButtonState = 0;

const int busyPin = 6;
int busyState = 0;

int redPin = 9;
int greenPin = 8;
int bluePin = 7;

void setup()
  pinMode(redPin, OUTPUT);
  pinMode(greenPin, OUTPUT);
  pinMode(bluePin, OUTPUT);


  Serial.println(F("DFRobot DFPlayer Mini Demo"));
  Serial.println(F("Initializing DFPlayer ... (May take 3~5 seconds)"));

  if (!myDFPlayer.begin(mySoftwareSerial)) {  //Use softwareSerial to communicate with mp3.
    Serial.println(F("Unable to begin:"));
    Serial.println(F("1.Please recheck the connection!"));
    Serial.println(F("2.Please insert the SD card!"));
    while (true);
  Serial.println(F("DFPlayer Mini online."));

  myDFPlayer.volume(20);  //Set volume value. From 0 to 30
  delay (100);
  delay (100);


void loop()
  buttonState = digitalRead(buttonPin);
  busyState = digitalRead(busyPin);

  if (buttonState != lastButtonState) {
    if (buttonState == LOW) {
      // if the current state is LOW then the button went from off to on:

    // Delay a little bit to avoid bouncing

  if (busyState == LOW) {

    analogWrite(redPin, 255);
    analogWrite(greenPin, 192);
    analogWrite(bluePin, 203);

  }  else {

    analogWrite(redPin, 0);
    analogWrite(greenPin, 0);
    analogWrite(bluePin, 0);
  // save the current state as the last state, for next time through the loop
  lastButtonState = buttonState;

So I don't see anything terribly wonky about your code except the use of delays-which always mess up everything. The DFRobotDfPlayerMini library is dated and is more complex than what you need for this program. Try the DF Mini Fast Library written by PowerBroker here:

It is also downloadable directly from the Libraries on Arduino IDE. Try to do the sample program included with the Library first, get that working, then go from there. The only other thing I can possibly think of is that both the RX and TX lines need resistors- you didn't include a wiring diagram so I'm just guessing here.

My wiring diagram is essentially what was shown on their wikipedia page with the added addition of the resistor on the TX line as recommended by you. I have tried running the example from the DFPlatyerMini_Fast library and the problem still persists when playing a 1 minute clip using both .play() and .loop(). For the .play(), I extended the delay to 15 seconds and the problem still persists. For .loop(), only the first 10 seconds is played.

Just an idea...

If you are using variable bitrate MP3s (VBR or ABR) try making a constant bitrate (CBR) MP3.

There is supposed to be some additional information in the VBR header giving the length or playing time but sometimes the information is wrong or corrupted, or some player software can't handle it correctly and the playing-time gets messed-up.

From what I've tested, it seems like this could be the case. Saving the MP3 as CBR with certain rates will either not play the clip at all, or play it longer or shorter compared to other rates. Though as of right now, I am still currently trying to find the perfect rate in order to play the entire clip. I am doing this through Audacity with a Project Rate of 8000Hz, 16-Bit PCM, Mono. If there is better settings for this I would love to know as I am not very familiar with audio.

Best I've gotten is 7 seconds of play time with a rate of 32kbps

I am doing this through Audacity with a Project Rate of 8000Hz, 16-Bit PCM,

PCM is not MP3. PCM is the uncompressed format used in regular WAV files and on audio CDs. MP3 doesn't have a bit depth (16-bits).

The only specs I found for the DFplayer say it supports all of the standard sample rates (Hz/kHz). It doesn't say anything about VBR/CBR or Joint Stereo etc. so I assume it's supposed to work with all of those variations but there might be bugs...

I'm not sure what kind of quality you're after but the sample rate ("Project Rate" in Audacity) limits the high frequencies (treble) and the audio is limited to half of the sample rate.* 8kHz is approximately "telephone quality" with the highs limited to 4kHz. As you may know, CDs have a sample rate of 44.1kHz which allows audio beyond the theoretical/ideal human hearing limit of 20kHz.

The bitrate in kbps is kilobits per second and it's an indication of file size, the amount of compression and quality. There are 8 bits in a byte so you can divide by 8 to get file size in kilobytes per second. Just for reference, CDs are 1411kbps and the "best" MP3 setting is 320kbps. 32kbps is "low quality" and unsuited for music but it can be OK for voice/communication.

  • That's just the nature of digital audio (or any kind of digital signal). The easiest way to think about it is that you need one sample for the top-half of the waveform and one sample for the bottom.