I'm trying to play sound with my dfplayer mini and an esp32, it worked well but I want it to be louder.
I bought an 8ohm 30W speaker and an OEP30W amplifier.
but I'm only producing noise. Some help would be appreciated
Here's the wiring diagram I came up with (i have little to no knowledge about this topic)
Maybe there are some obvious mistakes
I'm using the example of the dfplayer mini library
#include "Arduino.h"
#include "DFRobotDFPlayerMini.h"
// Define the Serial2 pins for UART communication
#define RXD2 16
#define TXD2 17
// Create a DFPlayer instance
DFRobotDFPlayerMini myDFPlayer;
void setup() {
// Initialize Serial Monitor for debugging
Serial.begin(115200);
Serial.println("Initializing DFPlayer Mini...");
// Initialize Serial2 for DFPlayer Mini
Serial2.begin(9600, SERIAL_8N1, RXD2, TXD2);
// Begin DFPlayer communication
if (!myDFPlayer.begin(Serial2)) {
Serial.println("Unable to begin communication with DFPlayer Mini!");
Serial.println("1. Please check the wiring.");
Serial.println("2. Insert an SD card with MP3 files.");
while (true); // Stop here if initialization fails
}
Serial.println("DFPlayer Mini initialized successfully.");
// Set volume (0 to 30)
myDFPlayer.volume(10);
Serial.println("Volume set to 10.");
}
void loop() {
// Play the first song
Serial.println("Playing track 1...");
myDFPlayer.play(1); // Plays the first track on the SD card
delay(10000);
}
Thanks for your message, I can now hear the desired audio but I still have a lot of noise that I didn't have without the amplifier.
I'm not sure where to go next.
an DC-DC isolated converter to avoid ground loop maybe ?
some condensators to filter out some frequencies ?
What type of noise? White noise, rattle, mains hum? Something else?
In your first setup, you had a return path. Via the buck converter. But that is a bad idea...
Can you try to connect in- to the gnd of the df player? (I see now that someone else gave you this hint already..).
Do you have a datasheet for the amplifier? You might need to add a capacitor in series with the signal...
And what impedance does your df player expect?
Maybe add a redistor from the point where L and R are mixed to ground... same value as the other 2 resistors..
Did you try to set volume to 30?
here's a youtube link to listen to the noise (it was with the volume at 5)
Can you try to connect in- to the gnd of the df player?
the in- to the gnd of the df player worked for me. i just have some noise
Do you have a datasheet for the amplifier?
I was not able to find a detailed datasheet of this amplifier i tying to take inspiration from this video
And what impedance does your df player expect?
it's for a 8ohm speaker (i'm not sure if it's what you are asking)
Did you try to set volume to 30?
It's better at a high voulume because the volume of the noise is constant.
so when my audio is louder it makes the noise less audible
thanks for the replies
the noise is barely noticeable on high volume and with an amplified version of the audio
I'm expecting some 100nf and 1000uf to try to filter the remaining noise
I'm marking the first reply as the solution but it was a combination of that and a higher volume that you proposed that fixed it for me
Is there a volume control knob? If not you may want to add one. It will turn-down any noise coming from the DFPlayer along with the signal and you can probably still get the full amplifier power at less than 100% volume.
BTW - You can't get 30W from 12V into an 8-Ohm speaker... With a bridge amplifier you can get about 8.5W. With a single-ended amp 1/4 that, or little more than 2W.
Power can be calculated as Voltage Squared/Resistance. That's RMS voltage which is 0.354 x peak-to-peak. With a regular single-ended amplifier the peak-to-peak can't exceed the power supply voltage. With a bridge amp you double the peak-to-peak voltage for 4 times the power.
I cannot find a schematic of the board or a datasheet on the chip. But maybe you can reduce the gain of the amplifier... (by adding a redistor somewhere) and then put your dfplayer near max volume. That should increase signal/noise ratio...
As you can see, you can set the gain via g0 an g1...
Here it is set to max (g0 and g1 tied to vcc). Put g0 and or g1 to gnd to decrease gain...
No idea if your board is wired like this one.
Forget my earlier suggestion for a resistor to gnd and series capacitor. It is probably already there...
I don’t have an ESP32, but are you sure you have RX/TX connections right. Look like you have TX to TX and RX to RX?
Probably a typo, as I don’t see how it would work at all otherwise.