DFPlayer MP3 Player Features
The DFPlayer module music player that can use both Serial and MicroSD to play an audio. This module can support up to 32 GB MicroSD with FAT16 and FAT32 formats. It also has an internal amplifier.
Note
Do not forget to connect the VCC and the GND of the module to 5V and GND of Arduino.
You can download the DFPlayer module datasheet here.
DFPlayer MP3 Player Module Datasheet
1 file(s) 422.65 KB
DFPlayer Module Pinout
This module has 16 pins:
- VCC: Module power supply – 5 V
- GND: Ground
- RX: Receive information through serial protocol
- TX: Send information via serial protocol
- SPK1: The first speaker output
- SPK2: The second speaker output
You can see Pinout of this module in the following image.
Required Materials
Hardware component
Software Apps
Interfacing DFPlayer MP3 Player Module with Arduino
Step 1: Circuit
Connect the module to Arduino accoring to the following image.
Step 2: Code
Install following library on your Arduino first.
Note
If you need more help with installing a library in Arduino read this tutorial: How to install a library on Arduino.
Upload the following code to Arduino.
/*
modified on Sep 8, 2020
Examples from https://github.com/PowerBroker2/DFPlayerMini_Fast
Home
*/
#include <DFPlayerMini_Fast.h>
#if !defined(UBRR1H)
#include <SoftwareSerial.h>
SoftwareSerial mySerial(10, 11); // RX, TX
#endif
DFPlayerMini_Fast myMP3;
void setup()
{
Serial.begin(115200);
#if !defined(UBRR1H)
mySerial.begin(9600);
myMP3.begin(mySerial);
#else
Serial.begin(9600);
myMP3.begin(Serial1);
#endif
Serial.println("Setting volume to max");
myMP3.volume(30);
delay(20);
Serial.println("Playing track 1 for 5 sec");
myMP3.play(1);
}
void loop()
{
//do nothing
}
Comments (2)
Looking at the connection drawing it appears there is a 1K-ohm resistor and a 680-ohm resistor. They aren’t mentioned in the parts list, but I assume they are necessary. I intend to use one of these dfPlayers in a project I am working on and appreciate your small but informative project.
Hi. We’re glad this project has been useful for you.
According to the page 9 of the datasheet of this module, the module’s serial port is 3.3V TTL level. So, it is “recommended” to connect a 1K resistor in series or use a voltage divider of any kind.