Issue with DFPlayerMiniMp3 and ESP8266

I've tried different examples and libraries but no matter what I try I cannot get ESP8266 and DFplayer Mini to work together.

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

SoftwareSerial mySoftwareSerial(0, 2); // RX, TX
DFRobotDFPlayerMini myDFPlayer;

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

I've connected the VCC the Dfplayer to 3v on the Nodemcu. and RX input on the player to gpio2 on the Nodemcu and TX output to gpio0.

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!

and I've also tried changing the software serial library to ESPSoftwareserial. and I've tried different pins. I've tried other boards. Any help would be greatly appreciated.

individually they work?
I do not see ESP8266 in your code.

is very old as code, but I think it works.

If I remember correctly with the Player you have to respect a delay on the begin.
try to use it outside the if ,is a test unfortunately I don't remember.

But seeing the code it looks correct, but are you using an ATTINY? Because I see pins 0 and 2.

I'm using the esp8266 gpio pins D3 and D4, and I've added a delay after the begin and tried running it outside the if statement. still getting the same results unfortunately. and I've tried using hardware serial instead and still doesn't work

I fixed it. I had to change the myDFPlayer.begin(mySoftwareSerial, false); to myDFPlayer.begin(mySoftwareSerial, true, false);

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.