How to eliminate speaker pop when initialising a DFPlayer Mini module?

I thought I'd discovered the answer to this problem by searching through the forum.

However an older fix no longer seems to work (or I'm not implementing it correctly)

I refer to this post made by @xl97 :

I have an Arduino UNO R3 connected to the computer and powered via USB

The DFPlayer is set up on a breadboard.

Pin 10 of the Arduino is connected to the TX pin on the DFPlayer module (with a 1K resistor).
Pin 11 is connected to the RX pin (with a 1K resistor).
GND in connected to GND.

I'm powering the DFPlayer with 5V (a 7.5V 1.5A power adapter plugged into the wall and connected to a breadboard power supply that has a built in 5V and 3.3V regulator).

Finally there's a small 8ohm speaker (I believe it's 1W) connected to the SPK_1 & SPK_2 pins.

I'm running a basic example sketch from the DFPlayer library and everything is working as expected.

I have it all set up and working correctly. The only issue is the loud pop from the speakers when the DFPlayer initialises. The pop also occurs when disconnecting the external power source.

I followed the fix in the link above, making the small change to the CPP file in the library.

After disconnecting the USB cable and restarting the IDE software, I reconnected the cable, reopened the software and and uploaded the same example sketch from the library.

Now the DFPlayer fails to initialise. In the Serial Monitor it reads the following:

Unable to begin:

  1. Please recheck the connection!
  2. Please insert the SD card!

After this failed I undid the change I made to the CPP file and reloaded everything. Everything went back to normal. The sketch works and the DFPlayer initialises fine.

To be clear, the only line I changed in the CPP file was the "reset();" line.

I simply changed that one line to "//reset();" and saved over the original file.

Originally, I thought it might be because @xl97 was using a different version of the library.

The change is said to have been made on line 103 of the sketch, but in my version of the library it's 109.

So I looked through the available versions of the library here:

Looking back through the older versions, only 1.0.2 has the "reset();" on line 103.

I deleted my version of the library from the IDE and installed the older version and repeated all of the previous steps, but the same thing happened. I even made sure I was using the example sketch that comes with that version of the library.

I must be missing something, or there's something different about my DFPlayer.

It was purchased last year directly from DFRobot and has a 2021 batch number on the packaging.

I bought a few at once and they all have the same issue.

The LED on the module is blue, but I can't make out some of the lettering on the chips on the underside of the device.

The audio amplifier is an "8002A" (that much I can read) but the other (larger) chip says "DFROBOT" followed by some lettering and numbers, ending with "SP3"

I hope all of that is clear.

There's nothing special about the sketch. It's an example sketch from the DFPlayer library called "getStarted"

There's nothing special about the wiring. It's all hooked up as it should be, because I've had it running and even played around with the sketch to play different tracks, change the volume etc.

But for the purposes of testing, I used the example sketch in it's default state without any changes.

And just to reiterate. Everything "works" until I change "reset();" in the CPP file to "//reset();"

Then I get the error in the Serial Monitor when trying to initialise the player.

If @xl97 and @Protonerd are still around I'd love to know what you think.

Have I missed something? or does this fix only work with "older" versions of the module?

Thank you.

I did some more digging and found an alternative solution to half of the problem.

The post below shows how to eliminate the loud pop from the speaker by making a change in the sketch. I'm using one of the default libraries, but the post refers to a different library. The same solution can be applied though and it worked for me.

Here's the post with the solution.

Here's what I did.

I deleted an older library and did a fresh install of version 1.0.3. I chose this one over 1.0.5 because it's the one linked to on the DFPlayer wiki page and I'm not sure what changes were made in the latest release or why they don't link to it themselves.

There's an example sketch in the library called "getStarted" which I opened.

In the void setup of the sketch, there's an if statement that looks like this:

  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){
      delay(0); // Code to compatible with ESP8266 watch dog.
    }
  }

All I did was add a true and false statement to the first line. The false statement refers to the reset. By turning it off, it stops the huge pop from the speaker on startup.

The true statement has something to do with "isACK" judging from the CPP file, but it's lost on me. It doesn't appear to make a difference if you set it to true or false. If you know what this does please fill me on on the juicy details.

Here's the same code with the small changes made to the first line.

  if (!myDFPlayer.begin(mySoftwareSerial, true, false)) {  //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){
      delay(0); // Code to compatible with ESP8266 watch dog.
    }
  }

I didn't know how to make the false statement for the reset without first including a true or false statement for the "isACK" because my knowledge of coding is limited.

This solved the large pop from the speakers when initialising the DFPlayer...

But there's still a slight (almost inaudible) pop whenever the DFPlayer is turned on or off via a power source.

There must be a reason for this and a way to eliminate it. I mentioned my connections in the previous post so perhaps someone can make something of it?

I read somewhere it could have something to do with feeding 5V into the module. Running the same setup on 3.3V instead of 5V didn't seem reliable and introduced poor sound quality. A happy middle ground might do the trick, but I'll have to wait for some more components before I can test it out.

I'll do some more digging, but any suggestions based on the information I've given would be appreciated.

It sounds like you've done a pretty thorough job of trying to fix it through coding- I feel like whatever noise or "pop" you're experiencing is ground loop.
First way may be to change your speakers. When I do an audio project with Arduino I prefer this kind or similar- where I can just plug the Dupont wire from the DF Mini direct into the speaker. You can get off Ebay and AliExpress as well for cheaper:

Also you can use an optoisolator to reduce the ground loop. There are different kinds but I prefer one like this one, also available on Ebay and AliExpress cheaper:

I have this on a prop that uses powered computer speakers and it not only had the pop but also that annoying speaker hum. I wired this between the DFMini and the speakers and the problem was completely fixed.

Thanks for the reply @halloweenrick

I think you're right, the problem stems from the wiring setup or the components in some way.

I picked up some of the those speakers you suggested. I bought the 8ohm, 3W version with the female connections. I figured they'd be handy to have around for testing even though they're physically too big for the project I'm working on. Nice speakers, but they didn't solve the popping sound.

I also have three small/mini speakers. They're all 8ohms, one of them is 1.5W and I think the other two are 1W. These suffer from the same popping sound as well.

I decided against the second recommendation for two reasons. In my neck of the woods the item is twice the price. You can probably get cheaper versions, but I'd have no idea if what I'm buying is good or not. I might need a few of them too. My project is going to use multiple DFPlayers and speakers (if I can get them to work the way I want) so it may prove costly in the long run.

My idea of dropping the voltage only half worked and I should have been clearer in the beginning:

Dropping the voltage to 3.3V doesn't eliminate the pop when the power is turned on, but it DOES make it quieter than it was at 5V. However, it DOESN'T make it quieter when you turn the power off again. 3.3V also makes the DFPlayer cut off a few seconds into a song.

The more voltage, the louder the pop when turning the power on, but the pop always stays the same volume when turning the power off, regardless of the voltage.

I've tried powering the DFPlayer with 3.3V and 5V from the Arduino.

I've tried powering it with 3.3V, 4V and 5V using various regulators to regulate 7.5V (1.5A) from a power adapter plugged into a wall.

The same problem is present in all scenarios and it's noticeable enough to be annoying.

I did some more research into why speakers in general can make noise when powering on or off and as expected there's never just one answer.

It could be the ground loop as you've suggested. I'm going to look more into that first before I try anything else.

Another reason could be the DFPlayer's on board amplifier. In my case it's the 8002A. I might try using an external amplifier instead, but again this adds cost if I have to do that for every DFPlayer in my project. It might be worth a try just to confirm if it solves the problem though.

You could upgrade the module from mono to stereo sound by adding a stereo amplifier, but at that point it's probably cheaper to buy a DFPlayer Pro which has a stereo amplifier built into it already.

As a side note, I have a DFPlayer Pro.

When I tested it out it suffered from the same huge pop the DFPlayer had in the beginning, but because they both use completely different libraries I'm unable to solve it the same way I did before.

For now, I'll go and research this ground loop you speak of.

Thanks again!

I looked into ground loop solutions and couldn't come up with anything that worked for my circuit. I tried eliminating the second loop by having everything powered by and grounded to the Arduino, but it didn't make a difference. There could be something I'm overlooking.

I gave the DFPlayer Pro a shot and started playing around with it. It suffers from the same BIG pop the DFPlayer Mini did, but couldn't be solved in the same way. In addition there were 3-4 smaller pops as the player initialises or goes through the void setup functions.

As soon as it reaches the void loop in the sketch it plays flawlessly. When you turn the power off, even if you're midway through playing a song, there's no popping from the speaker at all, unlike the DFPlayer Mini.

I decided to connect a physical switch on the positive line of the speaker between the Pro and speaker. Not ideal, but after turning on the Pro and waiting a couple of seconds, you can turn on the speaker using the switch and everything is good to go. The popping never has a chance to reach the speaker. If I wanted to take advantage of the left and right channels, I'd need a separate switch for each speaker. Either way that's too many switches to press.

Enter the transistor to replace the job of the manual switches.

Since the popping occurs while the Pro is starting up and immediately disappears when the void loop starts, having the transistors turn HIGH at the beginning of the loop turns the speakers on after the popping has already finished. And since there's no popping at all with the Pro when you turn the power off again, there's no reason to turn the speakers off first and then the Pro.

I'm not sure what's causing the popping sounds with both the DFPlayer Pro and the DFPlayer Mini. The Pro isn't talked about as much as the Mini so the information on it is sparse. While the transistor solution isn't "fixing" the problem, at least it's effectively muting the problem so it can't be heard. This makes the Pro perfectly usable for my needs.

With some playing around, it might be possible to use the same method to solve the popping on the Mini as well. It should work to eliminate the pop when turning the power on at least. Then if you tell the transistors to turn the speakers off when the Mini has detected a song or sound has finished playing, you'd should be free to turn the Player off and avoid the pop there as well.

But, I haven't tested it on the Mini yet.

If using a transistor to solve this is bad practice, or if anyone has any alternative suggestions, feel free to chime in. It's a hassle to have to use them, but they're small and they're cheap, so as long as they do the job I can live with it.

As of now, the transistor solution works for the Pro so I can breathe a sigh of relief, but I'll play around with the Mini some more and see if I can answer my original question. I'll report back if I find anything useful.