ESP32 and DFPlayer Mini MP3 player

Hello,

I'm trying to use an MP3 player on my ESP32 (Wemos D1 Mini Esp32).

Unfortunately, it doesn't work.

Here is my wiring diagram and my code. Do you see an error?

Thank you! :slight_smile:


#include <Arduino.h>
#include "DFRobotDFPlayerMini.h"

#define RXD2 16
#define TXD2 17
HardwareSerial mySoftwareSerial(1);
DFRobotDFPlayerMini myDFPlayer;

void setup()
{
  mySoftwareSerial.begin(9600, SERIAL_8N1, RXD2, TXD2);
  Serial.begin(115200);
  
  myDFPlayer.begin(mySoftwareSerial);

}

void loop()
{
if(mySoftwareSerial.available() >0) {
    Serial.println("Serial is available."); 
   Serial.println("début");
   myDFPlayer.play(1);
   delay(2000);
} else {
      Serial.println("Serial is not available.");
      
}
delay(2000);
}

First and major fault is the absence of powering.

Very strange naming.

Hi Railroader,

I am not sure to understand your message.
My mp3 player is powered by the ESP32.

Maybe. I took example on this sketch:

Number one: The ESP32 has no powering.
As a consequence: Does the ESP32 have power/current capacity for that when it has no powering according to Your "wiring"? No.

Could it be USB? USB is not a nuclear power plant. It usually supplies max 500 mA and that is often not enough. What need for current does Your circuitry have? And what is the ESP capable of supplying?

This is not a great example of how to use the additional hardware ports on the ESP32. I suspect at some point they were using Software Serial, then switched to hardware, and were too lazy to go back and tidy things up.

Get rid of this line altogether...

Replace this line...

With...

  Serial2.begin(9600, SERIAL_8N1, RXD2, TXD2);

Change any references to

to...

Serial2.

Here's a better example...

Also... why do you have this resistor in the circuit?
image

1 Like

It's a holdover, a TX 5V necessity.
The ESP32 is 3V so, correct, it should not be used.

1 Like

Hello again everyone,

I was able to solve the problem.

I just realized that my MP3 player had a problem: the VCC and RX pins were soldered together.

I fixed this issue and now it works.

I will nevertheless take your remarks into account and try to improve my circuit and my code according to your suggestions.

Thank you all for your answers

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