Contents

Interfacing DFPlayer MP3 Player with Arduino

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 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

Arduino UNO R3 × 1
DFPlayer × 1
male-female-jumper-wire × 1

Software Apps

Arduino IDE

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.

https://github.com/PowerBroker2/DFPlayerMini_Fast

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 }
Liked What You See?​
Get Updates And Learn From The Best​

Comments (2)

  • Bruce Munck Reply

    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.

    May 10, 2021 at 11:45 pm
    • Mehran Maleki Reply

      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.

      May 11, 2021 at 4:43 am

Leave a Reply

Your email address will not be published. Required fields are marked *