Go Down

Topic: DFplayer cannot start with Speaker attached (Read 561 times) previous topic - next topic

amikulics

Hello, I am trying to use a DFplayer to make sounds synchronized with lights and I have used a DFplayer before. I'm just using a simple program to figure everything out but here is the code:

Code: [Select]
#include "Arduino.h"
#include "DFRobotDFPlayerMini.h"
#include "SoftwareSerial.h"

int button = 6;
boolean isPlaying = false;
 
DFRobotDFPlayerMini myDFPlayer;
SoftwareSerial mySerial(10, 11);

void setup()
{
  pinMode(button, INPUT);
  mySerial.begin (9600);
  Serial.begin (115200);
 
  if (!myDFPlayer.begin(mySerial)) {  //Use softwareSerial to communicate with mp3.
    Serial.println(F("Unable to begin:"));
    while(true);
  }
 
  Serial.println(F("DFPlayer Mini online."));
 
  Serial.println("start");
  myDFPlayer.volume(10);
  Serial.println("done");
}

void loop()
{
  if (digitalRead(button) == HIGH)
  {
    Serial.println("test");
   
    if(isPlaying)
    {
      myDFPlayer.pause();
      isPlaying = false;
    }else
    {
      myDFPlayer.play(1);
      isPlaying = true;
    }
   
  }
 
}


I have the DFPlayer with vcc to 5v, RX to pin 11, TX to pin 10, Speaker + to positive side of speaker ground to ground, and speaker - to negative side of speaker.
My problem is strange: If i have the speaker connected and start the arduino the DFplayer makes a loud popping noise and I get the message that it is unable to start. But with the speaker disconnected I can start the arduino, connect the speaker, and then it works as it should.
So in short I can only get it to play sounds if i connect the speaker after it is turned on. My only theory is maybe the DFplayer does something with the speaker when it is first powered? but I couldn't find any other posts with a problem like this. Any ideas as to what is causing this issue?

Power_Broker

First off, I suggest you consider using a faster, more efficient DFPlayer library.

Next, double check your wiring. I'm looking at the pinout for the DFPlayerMini, but I don't see "Speaker+":


For wiring the DFPlayerMini, use the following connections:
"The desire that guides me in all I do is the desire to harness the forces of nature to the service of mankind."
   - Nikola Tesla

Grumpy_Mike

Quote
My only theory is maybe the DFplayer does something with the speaker when it is first powered?
No.

It is more than likely a power supply issue. Put a large capacitor, say 450uF or greater across the power and ground of the player. If that doesn't cure it then add a large capacitor in series with one of the speaker leads. Finally up the current capability of the power supply driving this.

Hachey

I found I needed to use a separate power source to the Nano (and I use a diode to adjust the 5V in to the 4.2V ideal for the DFPlayer), rather than using the power through it.

It seems OK to take the power from an ESP32 to power the DFPlayer though.

When Nano is connected to laptop it causes buzzing as well.

And GND from DFPlayer to Nano as well as From DFPlayer to Speaker.

DAC to a 3.5mm audio jack socket and/or to amplifier gets good sound.


amikulics

Following the advice here I tried to use my breadboard power supply that came with my arduino kit and it made a huge difference. I can now get the sounds to play like they're supposed to.

Go Up