Stereo MP3 Player with Arduino and DFPlayer Module

Author : Dinesh Kumar Wickramasinghe

Introduction and Images

Hello everyone, Here again with an interesting project. If you already got bored dealing with sensors, motors, relays like stuff, here is a cool project for you. Here are some images of the project.

We are going to build a Stereo MP3 player with Arduino. Yes that's true. Using low cost DFPlayer module, we can easily do this project.

Using the link below, you can find more details of this module :

References :

The DF Player module has all the features which a MP3 player should have. Including advance equalizers, looping and shuffling functions. But here I will show you how to build a simple player with Play/Pause and Next/Preview functions. Later you can add more features.

DF Player Mini

We will do this project in two steps. First we will build a simple MP3 player with a single speaker and then I will show you how to upgrade it as a Stereo player using a simple amplifier module and two speakers.

What you need?
  • Arduino Uno (or any)
  • DF Player module
  • 1K Resistor
  • Three micro push buttons (You can add more later)
  • Small Speaker (Two for the stereo player)
  • PAM8403 Small Amplifier Module (For the stereo player)

There is an interesting library available for us to easily dealing with DFPlayer. Without using a library also we can write code but then we have to write all signals (commands) manually. So we will use this library.

Download Library

If you want to learn more about this library and the DF player features, Please read this article from DFRobot. I also referred this article while doing this project.


Here is the schematic for the simple MP3 player

Arduino DFPlayer MP3 Player

Here is the schematic for the Stereo MP3 player with PAM8403 audio amplifier module. Please note that you can use any other compatible Amplifier circuit. I used PAM8403 because it is very low cost and easy to use. Also works with 5V (can work with Arduino power)

Arduino DFPlayer Stereo MP3 Player

You can see there are three push buttons for Next, Previous and Play / Pause.

Source Code

Here is the source code for this project. You can see in the code some additional functions I’ve commented. So you can later use them and build a more advanced player. Also see the library documentation for more functions.

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

SoftwareSerial mySoftwareSerial(10, 11); // RX, TX
DFRobotDFPlayerMini myDFPlayer;

int buttonNext = 2;
int buttonPause = 3;
int buttonPrevious = 4;

boolean isPlaying = false;

void setup() {
    pinMode(buttonPause, INPUT);
    digitalWrite(buttonPause, HIGH);
    pinMode(buttonNext, INPUT);
    digitalWrite(buttonNext, HIGH);
    pinMode(buttonPrevious, INPUT);
    digitalWrite(buttonPrevious, HIGH);



    Serial.println("DFPlayer Mini Demo");
    Serial.println("Initializing DFPlayer...");

    if (!myDFPlayer.begin(mySoftwareSerial)) {
        Serial.println("Unable to begin:");
        Serial.println("1.Please recheck the connection!");
        Serial.println("2.Please insert the SD card!");
        while (true);
    Serial.println(F("DFPlayer Mini online."));


    //----Set volume----
    myDFPlayer.volume(10); //Set volume value (0~30).
    //myDFPlayer.volumeUp(); //Volume Up
    //myDFPlayer.volumeDown(); //Volume Down

    //----Set different EQ----
    //  myDFPlayer.EQ(DFPLAYER_EQ_POP);
    //  myDFPlayer.EQ(DFPLAYER_EQ_ROCK);
    //  myDFPlayer.EQ(DFPLAYER_EQ_JAZZ);
    //  myDFPlayer.EQ(DFPLAYER_EQ_BASS);

    myDFPlayer.outputDevice(DFPLAYER_DEVICE_SD);; //Play the first song
    isPlaying = true;

void loop() {
    if (digitalRead(buttonPause) == LOW) {
        if (isPlaying) {
            isPlaying = false;
        } else {
            isPlaying = true;
    if (digitalRead(buttonNext) == LOW) {
        if (isPlaying) {
            Serial.println("Next Song..");

    if (digitalRead(buttonPrevious) == LOW) {
        if (isPlaying) {
            Serial.println("Previous Song..");
Running the Player

Copy some MP3 Files to your MicroSD card and insert it to the MicroSD slot of the DF player module. Now power up your device setup

Comments Area
Add your questions and comments here. Comments will be published after the admin approval
Published By : Robert Blake
Added Date :10/9/2021 10:26:56 AM
I have just built the simple version and it works ok but I would like it to index to the next song for continious playing without having to manually step it to the next song can you help I am just a beginnger in the over 70 age bracket regards Robert
Published By : Francois
Added Date :10/4/2021 11:14:53 PM
Hi, I have it done, and works nice! I have two questions : I don't arrive to manager the level of the sound, alway very strong : myDFPlayer.volume(10) don't have effect. And it's possible to play a song, just when I turn on ? on and play a song ? thanks for you.
Published By : Marcos Paz
Added Date :1/6/2021 7:49:39 AM
Hi, I have done this today, and works ok! but with the amplifier I have a heavy noise. But without the amplifier the sound is very nice and clean... for what reason can this occur?
Published By : jboy
Added Date :1/2/2020 3:29:36 AM
can i build the stereo mp3 player without writing those codes
Published By : Leigh Halford
Added Date :11/22/2019 8:14:01 PM
Hi I have built this, including amplifier, many thanks. The music starts to play good. All buttons work as they should. As it starts the RX led lights up which I believe is correct. However after about 6 seconds, the light turns off the bluetooth and the sound stops and it makes a clicking sound. Do you have any suggestions?
Published By : Sulaiman Khan
Added Date :11/17/2019 12:44:40 PM
This code is working properly But I need a little hepl I am unable to understane the excute_CMD command and that's why I am facing a problem. I want to play a specific song like press push button 1 play song 1 press push button play song 2 press push button three play song 3 and so on So I will be thankful to you if you could help me out this problem


Similar Projects

Go Top