lewolf1
September 20, 2025, 4:45pm
1
Hi,
I've tried many fixes with my setup, but can't make it work somehow.
I'm trying to initialize a DFPlayer mini with an Arduino Nano ESP32, but have had no success so far.
See below for the wiring and the code, I'd appreciate any hints!
#include "Arduino.h"
#include "DFRobotDFPlayerMini.h"
HardwareSerial mySerial(1);
const int RX_PIN = 6;
const int TX_PIN = 7;
DFRobotDFPlayerMini myDFPlayer;
void setup() {
Serial.begin(115200);
mySerial.begin(9600, SERIAL_8N1, RX_PIN, TX_PIN);
if (!myDFPlayer.begin(mySerial, true, true)) {
Serial.println(F("Error: Couldn't initialize.));
while (true);
}
Serial.println(F("DFPlayer Mini initialized!"));
myDFPlayer.volume(20);
Serial.println(F("Volume set to 20"));
Serial.println(F("Playing Track 1..."));
myDFPlayer.play(1);
}
void loop() {
// If I ever get here lol
}
PaulRB
September 20, 2025, 4:48pm
2
The 1K resistor is not necessary. The Nano ESP32 and the DFPlayer mini are both 3.3V devices. But the 1K should not stop it from working.
2 Likes
The ESP tx should go to the DF rx - and the ESP rx should go to the DF tx.
place a
delay(2000);
in the line after the mySerial.begin
3 Likes
PaulRB
September 20, 2025, 4:54pm
4
Wouldn't it be better to put
while (!mySerial);
in place of the delay()?
1 Like
lewolf1
September 20, 2025, 4:57pm
6
So I'd do:
const int RX_PIN = 0;
const int TX_PIN = 1;
then?
PaulRB
September 20, 2025, 4:59pm
7
No, because the player is connected to pins 6, 7
1 Like
What's "6" assigned to? Where's it going?
What's "7" assigned to? Where's it going?
1 Like
lewolf1
September 20, 2025, 5:04pm
9
I thought your answer above suggested moving the connected ESP PINs from 6/7 to the labeled TX/RX-PINs (D0/D1).
D6 is connected to DFPlayer RX, D7 is connected to DFPlayer TX.
And you have defined D6 to be an Rx pin, and D7 to be a Tx pin.
So you have two receivers connected, and two transmitters connected.
That is a problem.
A transmitting pin must be connected to a receiving pin. And vice versa.
1 Like
lewolf1
September 20, 2025, 5:16pm
11
I see, I switched them around since a lot of posts suggested that, whoops.
After switching them one last time, it actually works! I could swear I tried this, but apparently not. I incorporated @runaway_pancake 's suggestion too, adding a delay after the serial.begin().
Thanks everyone for helping me out!
Last time I ever answer a "DFPlayer" 'question' again.
1 Like