DFPlayer Mini

The DFPlayer Mini MP3 module: a microSD card slot, a decoder and a small amplifier on a 16-pin board.

It plays numbered files from the card when told to over a 9600-baud serial link. Aliases: MP3 player, DFPlayer, DFRobot MP3 module.

Pins

Pin What it does
VCC Supply, 3.2 to 5 V.
RX Serial in, 3.3 V logic: put 1 k in series from a 5 V board.
TX Serial out, 3.3 V logic.
BUSY Low while a file plays.
IO_1, IO_2 Buttons to ground: a short press plays the previous or next file, a long press steps the volume down or up.
GND, GNDb Ground (two pins).
SPK_1, SPK_2, DAC_R, DAC_L The speaker and line outputs.
USB+, USB-, ADKEY_1, ADKEY_2 USB and the resistor-ladder keys.

While it runs

The face shows the file playing and how far into it it is. The card is described by the props: tracks files (10) in the root and in each of folders folders (2), each seconds long (20).

Reading it on an Arduino

With DFRobot's library, which Mokxi ships as DFRobotDFPlayerMini.h:

#include <SoftwareSerial.h>
#include <DFRobotDFPlayerMini.h>
SoftwareSerial link(10, 11);    // RX, TX
DFRobotDFPlayerMini player;

void setup() {
  link.begin(9600);
  player.begin(link);
  player.volume(20);            // 0 to 30
  player.play(1);               // the first file on the card
}

What the model gets right

From the DFPlayer Mini manual:

The frames: ten bytes, 7E FF 06, the command, the ack flag, the parameter, a checksum and EF, at 9600 baud 8N1. A bad checksum or frame is answered with an error.

Start-up: it reads the card, then reports it online; commands before then are answered busy.

The commands: play by number, in folders and the MP3 folder, next and previous, pause, resume and stop, looping one file or all, random play, volume, EQ, sleep and reset, each acknowledged when asked. A file past the card is an error.

The queries: state, volume, EQ, file and folder counts, and the current file.

The end of a file is reported twice, as the module does, and BUSY is low while one plays.

What it does not model

Sound. There are no recordings in a simulator, so the speaker and DAC outputs stay silent and the card is a count of files and a length. USB, the ADKEY ladder and the advertisement feature are accepted and ignored.

Common mistakes

Driving RX straight from a 5 V pin: the module's inputs are 3.3 V. Put 1 k in series.

Expecting files to play in name order: the module numbers them in the order they were copied onto the card.

See it in action

Jukebox plays the card's files one after another. Open it at /templates.