Back to Blog
How-to Guides 2026-11-20 Kunkune 0 views

DFPlayer MP3 Module: Playing Audio with Arduino

DFPlayer MP3 Module: Playing Audio with Arduino

Learn how to use the DFPlayer Mini MP3 module with Arduino to play audio from a micro SD card via serial commands. Covers wiring, file naming, and code.

What the DFPlayer Mini Can Do for Your Arduino Project

The DFPlayer Mini is a compact MP3 decoder that plays audio files from a micro SD card. It can run standalone with a button and speaker, or under serial control from an Arduino or ESP32. This guide focuses on UART control so you can trigger sounds, voice announcements, or music in your project.

Key Specifications That Shape Your Setup

Preparing the SD Card with Audio Files

The DFPlayer Mini reads MP3 or WAV files from a micro SD card (FAT16/FAT32, up to 32GB). Files must be named with four-digit numbers, such as 0001.mp3, 0002.mp3, and placed in the root directory. This numbering system is how the module identifies tracks. For example, to play track 1, you send a command to play file 0001.

Wiring the DFPlayer Mini to Arduino

Connect the DFPlayer Mini to your Arduino using a serial connection. The module uses UART at 9600 baud. Use SoftwareSerial on pins 10 (RX) and 11 (TX) to avoid interfering with the hardware serial port used for uploading sketches.

  1. Power: Connect VCC to Arduino 5V and GND to GND.
  2. Serial RX (on module) to Arduino TX (pin 11): This pin receives commands from the Arduino.
  3. Serial TX (on module) to Arduino RX (pin 10): This pin sends acknowledge bytes back to the Arduino.
  4. Speaker: Connect a 4–8 ohm speaker to the SPK_1 and SPK_2 terminals. The built-in 3W amplifier drives it directly.

Programming the Arduino to Play Audio

Install the DFRobotDFPlayerMini library via the Arduino Library Manager. In your sketch, include SoftwareSerial and the library, then initialize the DFPlayer object. Use the play() function to start a track by its number. For example, myDFPlayer.play(1) plays file 0001.mp3. The module sends an acknowledge byte when it receives a command, which you can check for debugging.

What the Supplied Information Does Not Cover

The catalog does not specify the exact pinout for the module connector or provide a schematic. It also does not detail the complete serial command set beyond play, stop, skip, and volume. For advanced features like equalizer settings or looping, refer to the DFPlayer Mini datasheet from the manufacturer. The module's 3W amplifier is suitable for notifications and short effects; for room-filling music, consider adding an external amplifier on the line-out pins.

Related Articles

Customer Service
Home
Products
Cart
Profile