The DF Player - HW-247A is a compact and versatile MP3 player module designed for embedded systems and DIY projects. It can play audio files directly from a micro SD card and features a built-in amplifier, making it ideal for standalone audio playback. The module supports various audio formats, including MP3 and WAV, and can be controlled via serial communication, GPIO pins, or even standalone mode.
The DF Player - HW-247A has 16 pins, but not all are required for basic operation. Below is the pinout:
Pin | Name | Description |
---|---|---|
1 | VCC | Power supply input (3.2V to 5.0V DC). |
2 | GND | Ground connection. |
3 | RX | UART receive pin for serial communication. |
4 | TX | UART transmit pin for serial communication. |
5 | SPK_1 | Positive terminal for mono speaker output. |
6 | SPK_2 | Negative terminal for mono speaker output. |
7 | DAC_R | Right channel of stereo audio output (line-level). |
8 | DAC_L | Left channel of stereo audio output (line-level). |
9 | IO_1 | GPIO control pin 1 (used for standalone mode or triggering specific functions). |
10 | IO_2 | GPIO control pin 2 (used for standalone mode or triggering specific functions). |
11 | BUSY | Output pin that indicates playback status (HIGH = playing, LOW = idle). |
12-16 | NC | Not connected (reserved for internal use). |
0001.mp3
, 0002.mp3
).Below is an example of how to control the DF Player - HW-247A 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 software serial at 9600 bps
Serial.begin(9600); // Initialize hardware serial for debugging
Serial.println("Initializing DF Player...");
delay(1000);
// Send initialization command to DF Player
mySerial.write(0x7E); // Start byte
mySerial.write(0xFF); // Version
mySerial.write(0x06); // Length
mySerial.write(0x09); // Command: Select device
mySerial.write(0x00); // Feedback
mySerial.write(0x02); // Parameter 1: SD card
mySerial.write(0x00); // Parameter 2
mySerial.write(0xFE); // Checksum (high byte)
mySerial.write(0xED); // Checksum (low byte)
mySerial.write(0xEF); // End byte
Serial.println("DF Player initialized.");
}
void loop() {
// Example: Play the first audio file (0001.mp3)
Serial.println("Playing track 1...");
mySerial.write(0x7E); // Start byte
mySerial.write(0xFF); // Version
mySerial.write(0x06); // Length
mySerial.write(0x03); // Command: Play track
mySerial.write(0x00); // Feedback
mySerial.write(0x00); // Parameter 1: High byte of track number
mySerial.write(0x01); // Parameter 2: Low byte of track number
mySerial.write(0xFE); // Checksum (high byte)
mySerial.write(0xF7); // Checksum (low byte)
mySerial.write(0xEF); // End byte
delay(5000); // Wait for 5 seconds before repeating
}
No Sound Output:
Module Not Responding to Commands:
Playback Stops Abruptly:
Can I use a 3.3V microcontroller with the DF Player? Yes, but use a logic level shifter on the RX pin to avoid damaging the module.
What is the maximum speaker power supported? The module supports up to 3W speakers with a 4Ω impedance.
Can I play audio files in a specific folder? Yes, but you need to use folder-specific commands via UART. Refer to the module's datasheet for details.