Elektroda.com
Elektroda.com
X

DFPlayer Mini - a short description of a cheap MP3 player

grala1 11337 18
This content has been translated flag-pl » flag-en View the original version here.
  • Hello all.
    I would like to introduce you to a cheap Chinese MP3 player - DFPlayer Mini.
    The cost of such a player is less than $ 1.5.
    DFPlayer mini has the ability to play music in MP3 or WAV format from the built-in micro SD card reader, you can also play music by connecting a USB flash drive to the player. The storage medium should not be larger than 32GB and should be FAT16 or FAT32 format.
    This player has the ability to control both by connecting goldpins and through the UART interface with a speed of 9600 bps.
    It has dimensions of 20.5 x 20.5 x 13 mm.
    DFPlayer Mini - a short description of a cheap MP3 player
    DFPlayer Mini - a short description of a cheap MP3 player
    I became interested in the player after reading the article of one of the forum users, where he described a changer emulator he had created for cars of the VAG group.
    https://www.elektroda.pl/rtvforum/topic3380561.html
    The player was ordered directly from China, after 3 weeks it was in my hands.
    Basic "analog" control is shown in the picture below.
    DFPlayer Mini - a short description of a cheap MP3 player
    This way, you can turn on the next / previous track, turn it down / up.
    You can connect a small speaker directly to the player - I used 1.5W 8?.
    Unfortunately, the device has an output only for one loudspeaker, but you can get stereo through the DAC_R, DAC_L outputs where you should connect them through an amplifier or you can connect headphones here.
    The device can be powered from 5V, power consumption less than 15mA, increases when you connect a USB device.
    Tracks recorded on a storage medium should be properly named - e.g. 001, 002 etc. Tracks should be grouped in folders that are also numbered - 01, 02, etc.
    The maximum number of folders is 99 and the maximum number of songs in a folder is 255.
    If we do not use the control that turns on the appropriate track number, we will only use the previous / next track, then tracks and folders can be named freely.
    Below is the player pinout
    DFPlayer Mini - a short description of a cheap MP3 player
    As for communication via UART, use the settings as in the picture below.
    DFPlayer Mini - a short description of a cheap MP3 player
    It should be remembered that although the device is powered from 5V, the UART voltage level is 3.3V and for this reason, a 1k? resistor should be added between the Tx of the device sending the commands and the Rx of the player (if we use the 5v standard in the device sending the commands, at 3.3V the resistor is redundant). I used a 10k? resistor because I had one at hand.
    DFPlayer Mini - a short description of a cheap MP3 player
    The video below (sorry for not the best quality) shows sending commands using the COM Port Toolkit program and the USB-UART converter based on the FT232 chip.
    [movie: 6bf572119f] https://filmy.elektroda.pl/83_1511229427.mp4 [/ movie: 6bf572119f]
    The basic commands are:
    - next 0x7E FF 06 01 00 00 00 EF
    - previous 0x7E FF 06 02 00 00 00 EF
    - quieter 0x7E FF 06 04 00 00 00 EF
    - louder 0x7E FF 06 02 00 00 00 EF
    The above commands do not include checksums, they can be sent without sums or with a checksum.
    How to calculate the checksum?
    We count it in hexadecimal.
    The command with the checksum for switching on the next track is:
    7E FF 06 01 00 00 00 FE FA EF
    where FE FA is the checksum.
    We need to add FF + 06 + 01 + 00 + 00 + 00 = 106 together
    0-106 = FA EF which gives our checksum.
    When sending a command to the device, you can request a response and it will be clear that the command has been understood.
    In the video below, a short presentation of the player control through the AVR processor which supports the buttons (NEXT, PREV, VOL +, VOL-) here, then sends the appropriate commands, receives from the device information about the current SD card or connected USB drive and sends the command 0x7E FF 06 01 00 00 00 EF for sequential playback of tracks. There is also a remote control via IR.
    [movie: 6bf572119f] https://filmy.elektroda.pl/18_1511229716.mp4 [/ movie: 6bf572119f]
    The disadvantages that I noticed with this player are the inability to connect a second loudspeaker, no possibility of scrolling, no memory of the track being played after turning off the power and the volume set, no possibility to play songs in the order with "analog" control (feeding the mass to the appropriate goldpins) - after the end of playback track, you have to force the next track to play, this problem can be avoided when controlling via UART.

    The player can be used to build a watch where you can hire it to play the bugle call at the full hour or as a wake-up call, an MP3 doorbell, etc.
    Below is the documentation for the DFPlayer mini.

    Cool? Ranking DIY
    About Author
    grala1
    VAG group specialist
    Offline 
    grala1 wrote 9616 posts with rating 4443, helped 1412 times. Live in city Kalisz. Been with us since 2006 year.
  • #2
    Marek_Ertew
    Level 16  
    Allow me to attach a handful of comments to expand the description.

    1. The module can act as a card reader. After connecting it to the computer, the playback is interrupted and the inserted SD card is visible in the system as a normal USB memory. I recommend connecting the uUSB socket to the module and alternately connecting a standard USB cable or a USB OTG cable to it (a USB memory stick is plugged into the socket).
    Pay attention to the supply voltage!

    2. If we are talking about voltage, the guts of the module are powered by 3v3 voltage which also powers the USB, SD and UART interfaces. The module has a built-in stabilizer and can be powered with voltage from 3v3 to 5v. Therefore, the entire module can be connected to 3v3 and 5v only to the USB socket.

    3. According to the documentation, the checksum and response request are recommended when uC is clocked with the built-in RC oscillator or ceramic resonator. When using quartz, the checksum can be omitted, not sending these two bytes.
    I fired my module using the arduino library that sends the checksum. Unfortunately, I currently have no way to check whether the module will work without checksums. I gave my art in the name of a higher idea, I am waiting for another one.

    4. There are also other addressing modes. For example, you can address 3,000 files in a single directory or suspend the current music, play a short message and go back to suspended music. Unfortunately, I will not check that either.
  • #3
    ditomek
    Level 22  
    How about the sound quality?
    Can the module be used to build a stationary mp3 (as another element of a stereo system)?
  • #4
    grala1
    VAG group specialist
    I am not an audiophile but for me the sound is ok in the loudspeaker and headphones, I tested it in the car and it sounds quite good to me.
    As I wrote earlier, one of the users made a car changer emulator on it, so let me quote his statement:
    GrzesiekN wrote:
    Just back from assembling in the car. Earlier, I wrote that the audio signal quality is very good. I made that statement by looking at the oscilloscope while playing test signals on my desk. Now I can say that I wouldn't change anything. Everything from the sub-bass to the whistle works. I do not expect a complaint.
    best regards
  • #5
    Marek_Ertew
    Level 16  
    I cannot complain about the sound quality. Only interference occurs when uC is sending data to the module. This is how I used uC powered by 5V and gave a 2k resistor on the uC-> module data line.

    However, the module lacks:
    - reading the current playback position,
    - rewinding or playing from a specific point in time,
    - access to the file system, e.g. reading the name of files / directories,
    - the simplest play queue, eg the command "when you finish the current file, open the indicated".
    I guess I'm asking too much ;) It remains to look for a better alternative at an equally attractive price.
  • #6
    grala1
    VAG group specialist
    I have 10k and I can't hear any noise.
    As for reading the current position, you can set a timer that will count from the moment of information from the player that a new track is coming and reset it when the information about playing the next track appears again.
    Queuing could also be done, you only need to hire a processor. If the songs are to be played one after the other, from what I remember it is command 11.
    There is no reading of the track names and no scrolling what I wrote about at the beginning.
  • #7
    silelis
    Level 12  
    I have two questions regarding this module:
    1) Is there a 10 ohm resistor on the USB D + and D + lines ??? Usually, I have encountered such a solution, is it here on the module?
    2) What size capacitors should I give for DAC_L and DAC_R ?? Are these also on the module ??
  • #8
    grala1
    VAG group specialist
    I do not use any resistors at the USB connector and no capacitors at the speaker output.
  • #9
    silelis
    Level 12  
    I have a question regarding the naming of folders and files on the medium.

    The datasheet says that they must be in the form 001, 002, 003, 00N, where the name of the first directory need not be 001, but e.g. 007 and it will be the first in the command.

    And has anyone checked whether directories can be called names (without letters) and whether directory numbers are then sorted alphabetically?

    The same goes for the names of the songs. I am asking because the nomenclature by numbers is quite artificial and is average for commercial applications.
  • #10
    wojdyl1
    Level 8  
    Hello,
    encouraged by a simple mp3 player, I bought this module.
    I connected according to the instructions (from the very beginning of the post). 3.3V battery power, 0.5W 8 ohm speaker, and unfortunately it doesn't work for me. 1 GB micro SD card with FAT32 formatted and uploaded file 001.mp3. after turning on the power, nothing happens, when I press playback, the light on the module lights up, then it goes out and a short humming sound starts from the speaker. After that, everything goes silent.
    Do you have any ideas on how to start it? I will be grateful for any idea. I only have a meter and a soldering iron :)
  • #11
    grala1
    VAG group specialist
    Try to supply 5V.
    If this does not help, disconnect the speaker and then check if the diode goes out.
    I had the same and it looked like the speaker was overloading the module.
  • #12
    Marek_Ertew
    Level 16  
    @ wojdyl1 , I bet that the amplifier and speaker overload the 3.3V stabilizer, the voltage drops out and therefore everything turns off. Try to connect speakers with an amplifier to the line output, or as a last resort headphones through a serial capacitor between the stereo output (one channel is enough) and ground.

    The second option is as advised @ grala1 , increasing the supply voltage. In my opinion the 3.3V supply voltage is too low for this module. The "guts" of the module and the SD card require a voltage of 3.3V, but the player has a built-in stabilizer. In my opinion, the supply voltage should be at least 3.6V (discharged li-ion battery) and max 5V.
    The only thing you need to be careful about is the controls. If you connect the player to a 5V microprocessor, you need to add a serial 1k resistor on the uC (TX) -> player (RX) line.
  • #13
    wojdyl1
    Level 8  
    Thank you very much for the hint, I checked and everything is correct, the loudspeaker was too heavy on the module.
    Now I plugged in the earpiece and everything started to work.
    Thank you again.

    Added after 40 [minutes]:

    I have one more question, what external speaker can I use for the module so that it works well reproducing the speech, only 3.3V power supply without amplifier.
    Headphones are not an option. What were you using?
  • #14
    Marek_Ertew
    Level 16  
    The player has two audio outputs that work simultaneously. One is a stereo line output (poor performance), the other is a mono output through the built-in amplifier (separate circuit on the PCB).

    Your speaker problem may lie in:
    1.too weak 3.3V power supply (the voltage drops under load),
    2. damaged amplifier or loudspeaker (I doubt it),
    3. the amplifier is just so designed that it does not want to work with a low supply voltage.
    Please write where did you get 3.3V voltage and why can't you use higher voltage? A lithium battery usually has a higher voltage and in most stationary devices you can find a voltage of 5V or higher (a stabilizer is included).
    If you can't win with the supply voltage, replace the speaker with any other one (maybe the one has a short circuit) and put voltage filtering capacitors near the player.
    If both of the above methods fail, then playing with a special loudspeaker will not be of much use. The final solution is to add an additional amplifier. For example, PAM8302 available e.g. here: https://www.adafruit.com/product/2130 will work at 3.3V and in combination with a 4? speaker you have a chance to get almost 1W power.
  • #15
    wojdyl1
    Level 8  
    it turned out that the power supply did not give the correct current and therefore the module could not cope, and only with a low load you could listen to something. I installed the batteries on the phone and everything started working. Thank you for your help.
  • #16
    umbrella2
    Level 9  
    Hi.
    I wanted to assemble a toy for my little ones on this particular layout, but I have a problem.
    I wish I could run 36 songs with 36 buttons.
    I can see that direct control can be done via ADKEY1 and 2 ports but unfortunately selecting tracks with this method ends up at position 14.
    So the control had to be done through the arduino and the RX and TX ports. I just don't know how to do it. I found the KEYPAD library here:

    Link

    but how to assign path names there.

    Please help. The little ones will probably be delighted if Dad succeeds.
  • #17
    Tomek515
    Level 23  
    Could this module be used in such a way that after applying voltage it would automatically play the path?

    Maybe you can recommend something else ready that could perform such functions
  • #18
    Bogdan 6
    Level 15  
    And here you have my program for operating this MP3 with a selection of folders for the remote control, you have to read the remote control codes yourself using arduino
    Code: c
    Log in, to see the code
  • #19
    jankus
    Level 2  
    Hello!
    I have a different kind of problem.
    I did so that it uses resistors to recreate certain folders / files in a folder.
    It works fine, but ... the problem is that if you hold a certain button longer, it plays in a loop indefinitely until the power goes out or another button / track is pressed.
    Does anyone have an idea how to disable / work around this problem?
    I was figuring out how to cut off the mass here for some time after pressing the button ... but unfortunately I did not come up with anything.
    The button is monostable and has only one make contact.
    Maybe some relay with a capacitor backup ... I didn't think of anything clever.
    Any simplest solution to this problem?
    Kind regards
    ps As a last resort I will add some Tiny or Nano but I'd rather avoid it because it's about a few pieces that I have already made.