Muhammad_Munir
Published © GPL3+

Play Audio With Arduino & DF Player Mini

How to Play Audio With Arduino & DF Player Mini

BeginnerFull instructions provided7,946
Play Audio With Arduino & DF Player Mini

Things used in this project

Hardware components

Arduino Nano R3
Arduino Nano R3
×1
Df Player Mini
×1
Speaker
×1
Jumper wire
×1
Bread Board
×1
1k Resistor
×1

Story

Read more

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 = 2; // Connects to module's RX 
static const uint8_t PIN_MP3_RX = 3; // Connects to module's TX 
SoftwareSerial softwareSerial(PIN_MP3_RX, PIN_MP3_TX);

 

// Create the Player object
DFRobotDFPlayerMini player;

void setup() {

pinMode(wirePin, INPUT);
pinMode(endPin, INPUT);

  // 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(30);
    // 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