Notify - DFPlayer-Mini MP3

.

Plugin details

Type: Notify

Name: DFPlayer-Mini MP3

Status: COLLECTION

GitHub: P065_DRF0299_MP3.ino

Maintainer: TD-er, JK-de, tonhuisman

Used libraries: .

Introduction

The ESP module can control the MP3-player module “DRPlayer Mini (DFR0299/YX5200)” and the “YX5300” module with 3.5mm output for speaker(s). Other than MP3 (sampling frequencies up to 48kHz) WAV files are also supported. The file names can be whatever but if you would like to be sure to play the correct file you should use the following name schema:

0000.mp3, 0001.mp3, 0002.mp3, 0003.mp3 ... 2998.mp3, 2999.mp3

Configuration

../_images/P065_DeviceConfiguration.png

Name In the Name field a unique name should be entered.

Enabled When unchecked the plugin is not enabled.

See: Serial Helper configuration

GPIO - RX The GPIO pin that is wired to the player’ RX pin. No information can be retrieved from the unit, so no connection to TX is needed. NB: The TX pin will be reset to - None - on save!

Volume The default volume setting at startup. When using the vol command, this value will be updated, but not saved. When opening the configuration, and saving the settings, it will be saved though. Also, using the save command will save the setting once changed by the vol command.

Supported hardware

DFPlayer Mini

../_images/P065_DFPlayer-Mini-MP3-Player.jpg

YX5300

../_images/P065_YX5300-MP3-Player.jpg

.

Commands available

Command

Extra information

play,<number>

Example:

play,12 to play the 12th track available on the SD card.

Starts playing the nth file on the SD-card. Acceptable numbers 0..2999.

stop

Stops playing the current file immediately.

vol,<volume>

Example:

vol,15

Change the playback volume to the set level. Acceptable values 1..30. When 0 (or no argument) is provided, the max. volume will be set!

Volume is also stored in the settings, but not saved untile either a save command is used, or the settings of the device is saved from the web interface.

eq,<type>

Example:

eq,4

Select the equalizer configuration. Acceptable values 0..5.

0 = Normal

1 = Pop

2 = Rock

3 = Classic

4 = Jazz

5 = Base

mode,<mode>

Example:

mode,3

Select the playback mode. Acceptable values 0..3.

0 = Repeat

1 = Folder repeat

2 = Single repeat

3 = Random

NB: To have actual repeat playing a track, the repeat command should also be enabled.

NB2: This command does not work on all players, it may start a play,<mode> with repeat enabled instead. That seems hardware related.

repeat,<0|1>

Example:

repeat,1

To set repeat mode. Default is off, acceptable values 0 or 1.

0 = Off

1 = On

How to play a track

HTTP

http://<ESP IP address>/control?cmd=play,14

This plays track number 14. The song will be stopped once completed, unless repeat is enabled.

Rules

To start playing a song at startup of the ESP for 30 seconds, these rules can be added:

On System#Boot do
  vol,10
  play,255 // file number 255
  timerSet,1,30 //play the song for 30 seconds (this is a generic command!)
Endon

On Rules#Timer=1 do
  Stop
Endon

MQTT

Topic:

<unit name>/cmd

Payload/message:

play,188

This will play the song number 188.

Change log

Changed in version 2.0:

improved 2021-05-01 Moved (most) documentation to new format from the wiki.

added 2021-05-01 Added mode and repeat commands

added Major overhaul for 2.0 release.

New in version 1.0:

changed 2023-03-11: Add support for ESP32 by enabling/adding ESPEasySerial configuration.

added Initial release version.