Also read!
Home / Tools / Arduino / DFPlayer mp3 player module for Arduino

DFPlayer mp3 player module for Arduino

Arduino is an open-source platform that facilitates Assembly and prototyping projects. By now you should know that the Arduino can light Leds, Turn motors, receive analog voltage, Print values on a LCD display, and now finally play MP3 with the DFPlayer module.


This is the module.


Has microSD card input. It also has a USB port and auxiliary analog audio, but it doesn't have the connectors. Not tested, but I think it would be possible to weld a connector and make it work!


The module has two chips, I believe that is an MP3 decoder and a stereo amplifier, up to 3W!


Below the pinout. Look at the DAC_R, DAC_L to analog input and the USB- and USB for USB port. Anyone who wants to can read the datasheet and try to understand what it's for each pin.

arduino mp3 pinout

To connect to the Arduino UNO I used this pinout.

arduino mp3

Downloaded the library DFPlayer-Mini-mp3 and I tried to run the sample programs. All a drug. I decided to make my own sample program using the library:

#include <SoftwareSerial. h>
#include <DFPlayer_Mini_Mp3. h>

SoftwareSerial mySerial(10, 11); // RX, TX

void setup () {
Begin serial. (9600);
mySerial. begin (9600);
mp3_set_serial (mySerial); //set softwareSerial is DFPlayer-mini mp3 module
delay(10); // delay 1ms to set volume


mp3_set_volume (10); // value 0 ~ 30

void loop () {
If (Serial. available()) {
char command = read Serial.();

switch (command) {
case ‘ S ’:
case ‘ N ’:
case ‘ P ’:

With the program that I made, the MP3 player plays files from the SD card in the order they are written. To touch just open the Serial Monitor in 9600 and send “N” to the next song and “P” to the previous. It worked! Below is my connection. I left two loose wires to connect to the speaker, in my case it was a headset. I simply lay on the headset connector, on only one side, to listen it was working.


The library is a drug, but the label worked. I couldn't receive via serial the name of the song, or any other information, but I was able to raise and lower the volume, play at random and loop. Very cool, pity that the support is awful.

I leave the link to the product and to the datasheet, If someone wants to do a new library:

Product –

Datasheet –

About Adriano Moutinho

Adriano Moutinho
Professor of Electronics technician at CEFET-RJ, Telecommunications engineer, Master in computer science and a Ph.d. in Civil Engineering. In addition to crazy China products buyer.


  1. I really like your tutorial, helped me understand this shield. How do I make it run a specific music. Example, I want him to run the music 001.mp3.
    I used this command line and it didn't work:
    case ‘ P ’:

    When I put “N” works normally. But I want in a list that he run only the specific song.

    Help me?

Leave a Reply

Your email address will not be published. Required fields are marked *