The DF Player Mini is a compact MP3 player module designed for embedded audio applications. It can play audio files directly from a micro SD card and supports popular audio formats such as MP3, WAV, and WMA. The module features a built-in amplifier, making it capable of driving small speakers directly. It can be controlled via serial communication, making it an excellent choice for projects requiring audio playback, such as interactive displays, voice alerts, or IoT devices.
Below are the key technical details of the DF Player Mini:
Parameter | Value |
---|---|
Operating Voltage | 3.2V - 5.0V |
Operating Current | 20mA - 30mA |
Supported Audio Formats | MP3, WAV, WMA |
Storage Media | Micro SD card (up to 32GB) |
Communication Interface | UART (Serial) |
Output Power (Speaker) | 3W (4Ω speaker, 5V supply) |
Output Power (Headphone) | 30mW (32Ω headphones) |
Dimensions | 22mm x 20mm x 3.5mm |
The DF Player Mini has 16 pins, but only a subset is commonly used in most applications. Below is the pinout and description:
Pin | Name | Description |
---|---|---|
1 | VCC | Power supply input (3.2V - 5.0V). |
2 | GND | Ground connection. |
3 | RX | Serial data input (connect to TX of microcontroller). |
4 | TX | Serial data output (connect to RX of microcontroller). |
5 | SPK_1 | Speaker output (+). Connect to one terminal of a speaker. |
6 | SPK_2 | Speaker output (-). Connect to the other terminal of a speaker. |
7 | DAC_R | Right channel audio output for external amplifier or headphones. |
8 | DAC_L | Left channel audio output for external amplifier or headphones. |
9-16 | Other Pins | Reserved for advanced features (e.g., IO control, ADKEY, BUSY, etc.). |
To use the DF Player Mini in a circuit, follow these steps:
VCC
pin to a 3.3V or 5V power source and the GND
pin to ground.SPK_1
and SPK_2
pins.RX
pin of the DF Player Mini to the TX
pin of your microcontroller (e.g., Arduino UNO) and the TX
pin of the DF Player Mini to the RX
pin of the microcontroller.Below is an example of how to control the DF Player Mini using an Arduino UNO:
#include "SoftwareSerial.h"
// Define RX and TX pins for SoftwareSerial
SoftwareSerial mySerial(10, 11); // RX = Pin 10, TX = Pin 11
void setup() {
mySerial.begin(9600); // Initialize SoftwareSerial at 9600 baud
Serial.begin(9600); // Initialize hardware Serial for debugging
// Send initialization commands to DF Player Mini
sendCommand(0x3F, 0, 0); // Reset the module
delay(1000); // Wait for the module to reset
sendCommand(0x06, 0, 15); // Set volume to 15 (range: 0-30)
Serial.println("DF Player Mini initialized.");
}
void loop() {
// Play the first track on the SD card
sendCommand(0x03, 0, 1); // Play track 1
delay(5000); // Wait for 5 seconds
// Pause playback
sendCommand(0x0E, 0, 0); // Pause playback
delay(2000); // Wait for 2 seconds
// Resume playback
sendCommand(0x0D, 0, 0); // Resume playback
delay(5000); // Wait for 5 seconds
}
// Function to send commands to the DF Player Mini
void sendCommand(uint8_t command, uint8_t param1, uint8_t param2) {
uint16_t checksum = 0xFFFF - (0xFF + 0x06 + command + param1 + param2) + 1;
// Send command packet
mySerial.write(0x7E); // Start byte
mySerial.write(0xFF); // Version
mySerial.write(0x06); // Length
mySerial.write(command); // Command
mySerial.write(0x00); // Feedback (0x00 = no feedback)
mySerial.write(param1); // Parameter 1
mySerial.write(param2); // Parameter 2
mySerial.write(highByte(checksum)); // Checksum high byte
mySerial.write(lowByte(checksum)); // Checksum low byte
mySerial.write(0xEF); // End byte
}
sendCommand
function constructs and sends the command packet required to control the DF Player Mini.10
and 11
in SoftwareSerial
with the desired pins for RX and TX if needed.9600
for proper communication.No Sound Output:
SPK_1
and SPK_2
pins.Module Not Responding:
RX
and TX
pins are correctly connected (crossed with the microcontroller's TX
and RX
).Distorted Audio:
Micro SD Card Not Detected:
Serial
monitor to debug communication between the microcontroller and the module.By following this documentation, you should be able to successfully integrate the DF Player Mini into your projects and troubleshoot common issues effectively.