Projects / MP3 player with DFPlayer Mini

MP3 player with DFPlayer Mini

Intermediate1.2 hGuided buildReviewed

Build it step by step

0 of 5 done
  1. NANODFPLAYSANDIS

    Prepare the card

    Format it FAT32, copy MP3s named 0001.mp3, 0002.mp3 and so on. Copy them in that order: the module plays in copy order.

  2. NANO

    Wire the module

    VCC, GND, TX to D10, D11 to RX through 1 kΩ.

  3. NANO

    Add the speaker

    To SPK_1 and SPK_2 (not to GND).

  4. NANO

    Add buttons

    D2, D3 and D4 each to GND.

  5. NANO

    Upload and listen

    The first song starts after about a second.

In short

How do you build an MP3 player with DFPlayer Mini?

A DFPlayer Mini plays songs from a microSD card through a small speaker, with play/pause, next and volume buttons. You need Arduino Nano, DFPlayer Mini MP3 module, SanDisk microSD card 32 GB (A1, Class 10), Speaker 8 Ω 0.5 W, Resistor 1 kΩ, Tactile push button 6 mm × 3, Breadboard 830 Tie Points and Jumper wires male to male (40 pcs, 20 cm). It takes 5 steps and about 70 minutes.

Level
Intermediate
Time
About 70 min
Parts
8

Parts list

Tick what you already own. It saves to My Garage, so “Build with what I have” knows.

Wiring

FromToWhy
DFPlayer VCC / GNDNano 5V / GNDModule power
DFPlayer TXNano D10Module replies (SoftwareSerial RX)
Nano D111 kΩ to DFPlayer RXCommands; the resistor cuts noise and protects the 3.3 V input
DFPlayer SPK_1 / SPK_2SpeakerBuilt-in 3 W amplifier output
ButtonsNano D2 / D3 / D4 to GNDPlay-pause / next / volume

Code

Arduino IDE, board "Arduino Nano". Install "DFRobotDFPlayerMini". Name files 0001.mp3, 0002.mp3 and so on in the card's root folder.

Runs on a virtual Arduino Nano in your browser, with sliders for the sensors. Happy with it? Verify and upload to your real board from the same page (Chrome or Edge on a computer).

#include <SoftwareSerial.h>
#include <DFRobotDFPlayerMini.h>

SoftwareSerial link(10, 11);
DFRobotDFPlayerMini player;
const int PLAY = 2, NEXT = 3, VOL = 4;
bool playing = true;
int volume = 18;

bool pressed(int pin) {
  if (digitalRead(pin) == HIGH) return false;
  delay(30); while (digitalRead(pin) == LOW) {}
  return true;
}

void setup() {
  pinMode(PLAY, INPUT_PULLUP); pinMode(NEXT, INPUT_PULLUP); pinMode(VOL, INPUT_PULLUP);
  Serial.begin(9600);
  link.begin(9600);
  if (!player.begin(link)) { Serial.println("DFPlayer not found: check wiring and SD card"); while (true) {} }
  player.volume(volume);         // 0 to 30
  player.play(1);                // first file in the root
}

void loop() {
  if (pressed(PLAY)) { playing ? player.pause() : player.start(); playing = !playing; }
  if (pressed(NEXT)) { player.next(); playing = true; }
  if (pressed(VOL)) { volume = volume >= 30 ? 6 : volume + 6; player.volume(volume); Serial.print("Volume "); Serial.println(volume); }
}

What the serial monitor should show

Open the serial monitor at the baud rate in the code. This is what our simulator prints for a virtual Arduino Nano with its sensors at their default values. Your numbers will follow your real readings, but the format should match.

DFPlayer not found: check wiring and SD card

Test checklist

What you should see at each check. If a reading is far off, stop and use the troubleshooting list.

CheckExpected
Power upSong 0001 plays at volume 18
Play-pause buttonPauses, then resumes from the same place
Next buttonStarts the next file
Volume buttonSteps 24, 30, then back to 6

If it does not work

"DFPlayer not found"

Swap TX and RX, check the 1 kΩ, and reseat the card.

Loud hiss or clicks

Power the Nano from a clean 5 V supply and keep the speaker wires short.

Plays the wrong song

Format the card and copy the files again in number order.

Very quiet

The built-in amplifier is small. Use an 8 Ω speaker of at least 0.5 W, or a PAM8403 board for more volume.

Still stuck? Find the fault step by step with your multimeter →

Ask Lark AI

Common questions

What parts do I need for the MP3 player with DFPlayer Mini?

Arduino Nano, DFPlayer Mini MP3 module, SanDisk microSD card 32 GB (A1, Class 10), Speaker 8 Ω 0.5 W, Resistor 1 kΩ, Tactile push button 6 mm × 3, Breadboard 830 Tie Points and Jumper wires male to male (40 pcs, 20 cm). SanDisk microSD card 32 GB (A1, Class 10): Format as FAT32.

How long does the MP3 player with DFPlayer Mini take to build?

About 70 minutes for a intermediate maker, in 5 steps.

How do I know the MP3 player with DFPlayer Mini works?

Power up: Song 0001 plays at volume 18. Play-pause button: Pauses, then resumes from the same place. Next button: Starts the next file.

DFPlayer not found: what should I check?

Swap TX and RX, check the 1 kΩ, and reseat the card.

Loud hiss or clicks: what should I check?

Power the Nano from a clean 5 V supply and keep the speaker wires short.

Plays the wrong song: what should I check?

Format the card and copy the files again in number order.

Very quiet: what should I check?

The built-in amplifier is small. Use an 8 Ω speaker of at least 0.5 W, or a PAM8403 board for more volume.