MP3 player with DFPlayer Mini
Build it step by step
0 of 5 donePrepare 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.
Wire the module
VCC, GND, TX to D10, D11 to RX through 1 kΩ.
Add the speaker
To SPK_1 and SPK_2 (not to GND).
Add buttons
D2, D3 and D4 each to GND.
Upload and listen
The first song starts after about a second.
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
- Development BoardsBuyArduino Nano × 1
- InterfacesBuy
- SBC AccessoriesBuyFormat as FAT32
- Motors & ActuatorsBuy
- PassivesBuyResistor 1 kΩ × 1
- SwitchesBuy
- PrototypingBuy
- PrototypingBuy
Tick what you already own. It saves to My Garage, so “Build with what I have” knows.
Wiring
| From | To | Why |
|---|---|---|
| DFPlayer VCC / GND | Nano 5V / GND | Module power |
| DFPlayer TX | Nano D10 | Module replies (SoftwareSerial RX) |
| Nano D11 | 1 kΩ to DFPlayer RX | Commands; the resistor cuts noise and protects the 3.3 V input |
| DFPlayer SPK_1 / SPK_2 | Speaker | Built-in 3 W amplifier output |
| Buttons | Nano D2 / D3 / D4 to GND | Play-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.
| Check | Expected |
|---|---|
| Power up | Song 0001 plays at volume 18 |
| Play-pause button | Pauses, then resumes from the same place |
| Next button | Starts the next file |
| Volume button | Steps 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 →
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.
