Introduction To DFPlayer Mini

The DFPlayer Mini has been a favorite of many model railroaders for years for it’s ease of use for sound fx with any Arduino. I’ve used it in my projects with a Nano, Pro Mini, and Uno. Even did a sound project using an ATTiny 84 to see it it would work and it was successful.
On this page I will help to explain everything that can be done with this component. I first experimented with the DFPlayer Mini in late May of 2018, and did my first video explaining how it can be used with a sensor on June 18 2018. This video can be seen below along with a few other videos I did on projects with the Mini.
The only other component you will need to store the mp3 files is a Micro SD Card. I will go a little further later on on how to upload your files to the card since it is very critical to follow the steps to get the correct files to play.
In this video I explained a very simple way to initiate the sounds with an IR sensor. Just passing my hand over the sensor, I was able to start the sequence of sound files. Stopping the sequence was just as easy by again passing my hand over The sensor.
In the sketch below named DFPlayer_SensorStart.ino you can see how this is easily accomplished with a few lines of code and two pins on your Arduino. One for the Sensor and one for the Busy Pin which is on the DFPlayer Mini. I’ll explain this in greater detail later.
Now lets move on to explain a little more below the code examples!
Below you will find four sketches that I’ve used with the DFPlayer Mini. The first three are ones I created for my projects., the last came directly from DFRobots DFPlayer Mini Wiki Page which shows all the available commands you can use with this device. There is more information on this wiki page that goes into greater detail than what I will present here.
I will break down the most important tasks here to get you started with the DFPlayer Mini. The first and most important step is to experiment on a breadboard, but don’t get discouraged if this doesn’t work the first time. Sometimes the connections on many breadboard may become loose because of the difference in diameter of the pin and the holding receptacle. You may find that it may not work and if you touch a wire a certain way, it will magickly work. This is your first clue of bad connections.
Don’t get discouraged, find another location for your connection. This usually resolves any problem.
The most important aspect is to have fun with your project!
I’ll talk more on working with your DFPlayer Mini below the Code! We’ll go over the DFPlayer_SensorStart.Ino on this page.

Below Are A Few Photos to Familiarize Yourself With The Unit

Pin Map
Pin Description
You can reference the surrounding photos to follow along with the instructions. We’ll talk about the first project I did in the above video and go through which pins to use. I hooked this directly to a speaker, but you can hook this to an external amplifier or powered computer speakers for more volume.
VCC – 5vdc on the Arduino
RX  –  To Pin 11 TX on the Arduino
TX  –  To Pin 10 RX on the Arduino
SPK 1 – One lead on 8 Ohm speaker
GND  –  Ground to Arduino
SPK 2 – other lead on 8 Ohm speaker
BUSY – To pin 5 on Arduino
I added a 1Kohm resister to both RX & TX between the Mini and the Arduino pins for TX & RX to reduce noise in the speaker. Upon further discovery I then added a 2.2 K ohm resistor to ground on each of the RX & TX Pins on the Mini. This didn’t seem to make a difference, but I left them there anyway.
I added an IR Sensor to start/stop the sounds to pin 3 on the Arduino & connected the Busy Pin to Pin 5 on the Arduino to determine when the track is on or off.
Connection Diagram
DFPlayer Mini
You can see that there are not many wires on this project. Looking closely at the below photo, you can see where each one of the wires goes.
The resistors on the RX & TX pins of the MINI are on row 9&10 of the breadboard and jumped over to the Arduino.
The Blue connector is attached to the two speaker pins on the Mini. Two wires from there go to a speaker off view. In-between the pins on the connector is the Gnd which is jumped to the Gnd bus.
The Busy Pin on the near side of the Mini goes to Pin5 on the Arduino
The IR Sensor has three pins + – which is connected to the respective edge bus and the signal which is connected to Pin 3 on the Arduino.
There is an LED & resistor off to the right that is not used here but was in another sketch to indicate when a track was being played
The below photo shows a better view of the power bus. You can see where each of the jumpers are connected.
At the very left, partially obscured, you can see the jumpers from one side to the other for the power bus
The IR Sensor has a + & – jumper
The two 2.2K resistors on the Gnd bus are not necessary  but was left in place for added noise reduction.
VCC on the Mini is jumped to the + bus.
The Gnd from the Mini can be seen between the two pins for the speaker connector. The connector is spaced to leave a gap in-between.
Breadboard Wiring
2.2 K Resistors To Gnd

Loading Files On The Micro SD Card

Footnote From Wiki
The footnote from the DFPlayer Mini Wiki only tells a portion of the requirements for the sound files. This was my biggest frustration in my projects when I wanted specific files to play. I followed the directions to a tee from suggestions on the forum  about proper timestamps in order of sequence, but still, the files were one off. Instead of playing 0001.mp3, I would get 0002.mp3.
Here’s what I had to do:
When creating your files on the computer, put them into a separate subfolder and name them one by one as described in sequence four digits then .mp3 such as 0001.mp3, 0002.mp3, 0003.mp3, 0004.mp3 and so on for as many files as you want. you can add a description after the digits if you like to identify them easier.
Copy or Move them one-by-one to the micro sd card starting with 0001.mp3 and so forth till you have all the files for your project.
I did this on a Windows computer, I do not know if this is necessary on a Mac. Apparently when you bulk transfer files to an sd card, windows somehow changes the order of the files even if you have the correct numbering and timestamp of creation in the correct order. It puts the last clip first then starts at the beginning. When I wanted to play 0001.mp3, 000x.mp3 would play, the very last clip. This took me a long time to figure out how to do it properly since there was no help on any forum at the time. Hope this saves you some time and frustration.

Another Issue You May Encounter

The popping of the speaker when you first apply power is nearly impossible to eliminate. I noticed this on my computer speakers as well, when we loose power and then the power is restored, I can hear a loud pop and Hum in the subwoofer of the system. I assume this is something one has to deal with.
In later sketches with the DPlayer PRO, I had to set the volume in SetUp() at zero, then in the Loop set to the desired volume again to eliminate a similar issue. Have not tried this trick with the Mini as yet! It’s worth a try…

More Video Using The DFPlayer Mini

Welding Scene

Thunder & Lightning

Simple Amplifier

AT Tiny 85 Thunder & Lightning