Muhammad_Munir
Published © GPL3+

DF Player Mini Interface with ESP32

How to play mp3 file with ESP32 by using DF Player Mini

BeginnerFull instructions provided1 hour10,027
DF Player Mini Interface with ESP32

Things used in this project

Hardware components

ESP 32
×1
DF Player mini
×1
3 Watt speaker
×1
Bread Board
×1
Jumper wires
×1

Software apps and online services

Arduino IDE
Arduino IDE

Story

Read more

Schematics

Diagram

Code

Code

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

// Use pins 2 and 3 to communicate with DFPlayer Mini
static const uint8_t PIN_MP3_TX = 26; // Connects to module's RX 
static const uint8_t PIN_MP3_RX = 27; // Connects to module's TX 
SoftwareSerial softwareSerial(PIN_MP3_RX, PIN_MP3_TX);

// Create the Player object
DFRobotDFPlayerMini player;

void setup() {

  // Init USB serial port for debugging
  Serial.begin(9600);
  // Init serial port for DFPlayer Mini
  softwareSerial.begin(9600);

  // Start communication with DFPlayer Mini
  if (player.begin(softwareSerial)) {
   Serial.println("OK");

    // Set volume to maximum (0 to 30).
    player.volume(20);
    // Play the first MP3 file on the SD card
    player.play(1);
  } else {
    Serial.println("Connecting to DFPlayer Mini failed!");
  }
}

void loop() {

 
   }

Credits

Muhammad_Munir

Muhammad_Munir

77 projects • 48 followers
I am Arduino programmer, also expertise in ESP32 and 8266 wifi modules.

Comments