In this Project, we learn, how to play an audio file using an Arduino UNO and a DF Player Mini. You will learn how to wire the DF Player Mini to the Arduino and connect the DF Player Mini to a speaker.

I am using:-

1. Arduino UNO………. https://amzn.to/3VtMWWc

2. DF Player mini…….. https://amzn.to/3OM8A4e

3. Speaker……………… https://amzn.to/3ZLACDd

4. Jumper wires……… https://amzn.to/3DbNs4X

5. Bread board……….. https://amzn.to/3ZtgynJ

6. SD Card……………… https://amzn.to/4f6YV2R

 

Code:-

#include “SoftwareSerial.h”
#include “DFRobotDFPlayerMini.h”

SoftwareSerial mySerial(10, 11); // RX, TX (use Pins 10 and 11 for communication)
DFRobotDFPlayerMini myDFPlayer;

void setup() {
Serial.begin(9600); // Debugging
mySerial.begin(9600); // DFPlayer communication
if (!myDFPlayer.begin(mySerial)) {
Serial.println(“DFPlayer Mini initialization failed!”);
while (true);
}
Serial.println(“DFPlayer Mini ready.”);

myDFPlayer.volume(30); // Set volume (0 to 30)
myDFPlayer.play(1); // Play the first track (0001.mp3)
}

void loop() {
// Do nothing. The audio file will play automatically.
}

Library for DF Player mini:- https://github.com/DFRobot/DFPlayer-Mini-mp3

 

More Projects

Our Products