DFplayer Mini communication issue

I bought a DFplayer Mini from Digikey to use in a project that will trigger sounds.

I have connected an Arduino Nano and Uno to the DFplayer mini using the wiring diagram included in the wiki and using the test code. The DFplayer does nothing unless I grond the IO pins, and then a sound will play.

I’ve connected it every way I could find, and it still does nothing unless I ground the pin manually. I am using pins 10/11 on the arduino for RX/TX connections, and I’ve swapped them every which way and still nothing.

I have no idea what I am doing wrong. There’s not that many wires/connections.

Hi wholesomejoe.

Can you provide pictures of your wiring, along with the code you’re using?

Here you are. This is just the latest one I’ve tried. I’m powering via the USB port for now, but I have a external battery stopped down with a buck converter that I’ve also tried to use.

Here’s the code:

#include <DFPlayerMini_Fast.h>

#if !defined(UBRR1H)
#include <SoftwareSerial.h>
SoftwareSerial mySerial(10, 11); // RX, TX
#endif

DFPlayerMini_Fast myMP3;

void setup()
{
  Serial.begin(115200);

#if !defined(UBRR1H)
  mySerial.begin(9600);
  myMP3.begin(mySerial, true);
#else
  Serial1.begin(9600);
  myMP3.begin(Serial1, true);
#endif
  
  delay(1000);
  
  Serial.println("Setting volume to max");
  myMP3.volume(30);
  


}

void loop()
{
    for (int i = 0; i < 10; i++)
    {
    myMP3.play(i);
    delay(5000);
    }
}

Your wiring diagram looks okay, how did you wire the speaker?

https://wiki.dfrobot.com/DFPlayer_Mini_SKU_DFR0299

Please try teh “GettingStated” example on that wiki page:

/***************************************************
DFPlayer - A Mini MP3 Player For Arduino
 <https://www.dfrobot.com/index.php?route=product/product&product_id=1121>

 ***************************************************
 This example shows the basic function of library for DFPlayer.

 Created 2016-12-07
 By [Angelo qiao](Angelo.qiao@dfrobot.com)

 GNU Lesser General Public License.
 See <http://www.gnu.org/licenses/> for details.
 All above must be included in any redistribution
 ****************************************************/

/***********Notice and Trouble shooting***************
 1.Connection and Diagram can be found here
 <https://www.dfrobot.com/wiki/index.php/DFPlayer_Mini_SKU:DFR0299#Connection_Diagram>
 2.This code is tested on Arduino Uno, Leonardo, Mega boards.
 ****************************************************/

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

SoftwareSerial mySoftwareSerial(10, 11); // RX, TX
DFRobotDFPlayerMini myDFPlayer;
void printDetail(uint8_t type, int value);

void setup()
{
  mySoftwareSerial.begin(9600);
  Serial.begin(115200);

  Serial.println();
  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(10);  //Set volume value. From 0 to 30
  myDFPlayer.play(1);  //Play the first mp3
}

void loop()
{
  static unsigned long timer = millis();

  if (millis() - timer > 3000) {
    timer = millis();
    myDFPlayer.next();  //Play next mp3 every 3 second.
  }

  if (myDFPlayer.available()) {
    printDetail(myDFPlayer.readType(), myDFPlayer.read()); //Print the detail message from DFPlayer to handle different errors and states.
  }
}

void printDetail(uint8_t type, int value){
  switch (type) {
    case TimeOut:
      Serial.println(F("Time Out!"));
      break;
    case WrongStack:
      Serial.println(F("Stack Wrong!"));
      break;
    case DFPlayerCardInserted:
      Serial.println(F("Card Inserted!"));
      break;
    case DFPlayerCardRemoved:
      Serial.println(F("Card Removed!"));
      break;
    case DFPlayerCardOnline:
      Serial.println(F("Card Online!"));
      break;
    case DFPlayerPlayFinished:
      Serial.print(F("Number:"));
      Serial.print(value);
      Serial.println(F(" Play Finished!"));
      break;
    case DFPlayerError:
      Serial.print(F("DFPlayerError:"));
      switch (value) {
        case Busy:
          Serial.println(F("Card not found"));
          break;
        case Sleeping:
          Serial.println(F("Sleeping"));
          break;
        case SerialWrongStack:
          Serial.println(F("Get Wrong Stack"));
          break;
        case CheckSumNotMatch:
          Serial.println(F("Check Sum Not Match"));
          break;
        case FileIndexOut:
          Serial.println(F("File Index Out of Bound"));
          break;
        case FileMismatch:
          Serial.println(F("Cannot Find File"));
          break;
        case Advertise:
          Serial.println(F("In Advertise"));
          break;
        default:
          break;
      }
      break;
    default:
      break;
  }
}

It’ll be interesting to see what your debug log looks like…

Regards,

Just directly to the Speaker Ins on either side of the GND pin. I had stopped connecting it, because it was a pain to keep moving wires, when the light indicates if a sound is actually being played, and I couldn’t even get that to work.

I’ll try this code and see what happens.

This is what I get with the sample code in the serial monitor.

DFRobot DFPlayer Mini Demo
Initializing DFPlayer … (May take 3~5 seconds)
Unable to begin:
1.Please recheck the connection!
2.Please insert the SD card!

Hi wholesomejoe,

There are a number of hardware reasons why things may not be working just right, too.

You have fairly long wire jumpers going between the UNO and the DFplayer Mini. This can sometimes cause problems. Shortening them might help.

Also, putting a capacitor or two on the breadboard between Vcc and Gnd might help, as it provides a local energy source for the player during short duration, high current demand periods. The typical value for this is a 0.1uF ceramic cap, and providing an additional larger cap such as 10uF to 22uF low ESR tantalum or aluminum electrolytic cap might give additional support if the high current draw is extended for longer periods, which can cause voltage droop.

Looking through some of the documentation, it looks like the DFplayer Mini is really designed to be used with around 4.2V, though they say it can work on a range of 3.3V up to 5V. I note that on page 9 of the manual, they state the following:

On DFRobot’s wiki page for this product, they show this 1K resistor on RX, which acts as a level shifter of sorts.

This may work, but I think a better way to do it is with a voltage divider, such as shown here. This should properly scale the voltage to that of the DFPlayer Mini:

One could also use an actual level shifter IC, such as one of these, but you will need to make an adapter board to use them with your breadboard.

Thank you for the help!

I have resistors on both TX/RX right now, I’m also powering the DFplayer independently of the Arduino now using a battery bank, and a step down converter, dropping the voltage down to 4.2v for the DF player, and powering the arduino with the USB. Still getting the same thing, of nothing happening unless I manually ground the “play next” pin.

It’s a little hard to tell on your picture, but you do have your serial jumpers in pins 10 and 11 on the arduino, correct? It looks like they might be in 10 and 12, but it’s kind of blurry when zoomed in.

You don’t want to put a resistor on the TX line of the DFplayer, as that might prevent the RX pin of the Arduino from recognizing a logic “1” from the DFplayer as such. Also, there is a small percentage chance that the RX pin of the DFplayer could be damaged from previous exposure to 5V.

Additionally, make sure you tie the grounds from the Arduino and your separate power supply together so that you don’t have any voltage level mismatches, which could cause erroneous behavior and possibly damage.

They are in 10 and 11. I triple checked. It’s hard to see sometimes even in person because the connectors and labels are so small.

It’s so weird I keep getting conflicting info on this, some people say resistors on both, some say only the TX.

When you say “tie the grounds for the arduino and power supply together, do you mean having the gnd wire from the arduino and supply going to the same side of the mother board rails or something else?”

Hi wholesomejoe. I think you worded it correctly.

Generally speaking, the negative of each power supply should be tied together (same breadboard rail) when there are two different voltages of DC power sources powering one circuit.

Example: 5vDC and a 12vDC power supplies the Negatives should be both tied together (on same breadboard conducting rail)

1 Like

Regarding resistors on TX or RX of the DFplayer, you want to protect the DFplayer from excessive voltage coming from the higher voltage Arduino output pin. This means you want to drop voltage coming from the Arduino’s TX (transmit) pin through a resistor to the DFplayer RX (receive) pin. Going the other way, from the DFplayer TX pin to the Arduino RX pin, the voltage is already lower, so putting a resistor in that line will drop it still further, and this risks potentially dropping it low enough that the Arduino does not recognize the “High” signal as a logic “1”. Therefore, the resistor divider should only go between the Arduino TX pin and the DFplayer RX pin.

Regarding grounding, yes, you should run a wire from the Arduino GND pin to a point on your breadboard which is electrically connected to the GND of your separate DFplayer power supply. This way the voltages (potentials) of all points on both the Arduino and the DFplayer are relative to the same ground potential. If you didn’t do this, the GND of the Arduino could be many volts above or below the GND of the DFplayer (because they are not connected together), which would mean the voltage of the various pins of each device would be off by that same amount. This can cause communication errors, and if there is a great enough difference, damage could result.

so as you suggested…

I have the following connections made.

I have a breadboard with both the dfplayer mini and the nano connected, with jumpers connecting the 2 rails on either side of the breadboard.

I have the following DFplayer connections.

PIN 1 VCC ------> Breadboard rails RED
PIN 2 (RX) -------->Arduino PIN11 (TX) with a 1k resistor on the Arduino side at that pin.
PIN 3 (TX) --------->Arduino PIN10 (RX)
GND -----> Breadboard rails BLUE

ARDUINO is being powered via USB, and the GND pin is connected to the same set of rails on the BLUE side.
DFplayer is being powered by a talent cell usb battery, stopped down to 4.2v with a buck converter that is connected via the same rails RED/BLUE

When I do this, everything seems to have power, but the DFplayer does nothing unless I put another GND wire on the other GND pin, and touch the other end to the surrounding pins that are intended for “NEXT TRACK” and “PREVIOUS TRACK” functions if the player was being used as a standalone unit. The CODE I am using is just the test code provided by DFrobot, and I have all of the required libraries installed… SoftwareSerial, etc.

This is completely baffling to me.

I did see a recommendation elsewhere on the web to place a short jumper wire between the two ground pins, and the shorter the better. Because I have not seen the schematic of the DFplayer board, I can’t say for sure why they even have two ground pins, but it does make sense to connect them together as well. The implication is that the board is only a two layer board, which means it probably does not have a good ground plane, and this can cause electrical noise issues. Providing a short jumper between the two pins might help a bit. Aside from this, it seems like you have the hardware side covered, assuming the DFplayer is still functional.

Another area to consider is the SD card itself. It looks like the IC on this device is pretty fussy about the way the card is formatted and the naming structure. It needs to be formatted using a FAT16 or FAT32 structure, and naming of the files has to be done in a very specific manner. I am not an expert on SD cards, but I believe that it is difficult or impossible to format a card larger than 32GB with FAT32 and larger than 2GB with FAT16, so your card should be no larger than 32GB.

I found a thread on the Arduino Forum where someone had a similar problem as you, and they solved it by reformatting their card and implementing the file and naming structure described there.

1 Like

Yeah, I’m using a 32gb card, but I’ve also tried a 4gb and a 16gb, I’ve tried formatting to FAT16/32, copying the files, and even just using ONE singular file on the card, and just trying to put the files in the root.

The dfplayer works fine if I use it in standalone mode, but it will still do nothing when connected to Arduino.

I have ordered a new DFplayer from Digikey, as soon as it comes in I will try it to see if the original one was faulty. Anything I should make sure I avoid doing in case I burned the last one?

It turns out, my issue all along was a faulty breadboard. The connections just weren’t being made as they should due to loose connections. I swapped breadboards and everything started working. I now have two dfplayers lol.

1 Like

Good troubleshooting wholesomejoe. I know the headache of this, one time I purchased a brand-new breadboard and re-done many circuits on it, turns out the breadboard never had good connections from the start.

I am not sure if it was the manufacturing oils used on the busbars or a plating issue. I went back to ole-trustworthy for the time being but I suppose I could have gave it a shot of contact cleaner. Either way you’re not alone in these breadboard frustrations.

1 Like