Friday, May 10, 2019

MP3 Player - stand alone

For an index to all my stories click this line

I know they are getting a bit outdated but there are still some uses for them: MP3 players. And sometime ago when I was surfing the net (who uses that expression nowadays.....) I stumbled upon a great MP3 module.



The module is sold and documented on the internet by several names. The first name is MP3-TF-16P and the second name is the DFPlayer Mini. Both seem to be exactly the same module.

So what is it.

It is an MP3 chip with an SD card reader on one module. The module is breadboard friendly and can be powered by any voltage between 3.2 to 5 Volts. So suitable for Arduino and ESP8266 projects. Next to that it has an onboard 3 Watt amplifier so you can direct attach a speaker. There is also a headphone / amplifier output with which you can attach a headphoe or attach it to your home stereo set.

The module supports MP3 and WMV decoding and sampling rates up to 48khz. The SD card supports FAT16, FAT32 up to 32GB with a maximum of 100 folders with each 1000 songs. The speaker and headphone connectors are attached to a 24 bit DAC with a dynamic range up to 90dB

Besides all this the module can be controlled by digital I/O ports, a resistor cascade on analog ports and by a serial interface.

Last but not least there seems to be an USB interface build in. I have found however no information or documentation on that up to now.

All in all pretty amazing specifications for a module that (at this moment) can be bought for about 1 dollar / euro from our favorite chinese suppliers !!!




Controlling the MP3-TF-16P

Like I mentioned above there are 3 methods to control this module.

- Using switches on the digital I/O pins
- Using switches with a resistor cascade on 2 analog inputs.
- Sending commands over the serial interface

As there are digital I/O pins the module can be controlled by an Arduino or an ESP8266. This can also be done by sending commands over the serial interface. There is an Arduino library available for that.

The resistor cascade needs some explanation.

Basically a range of resistors is connected to Ground. The remaining pin is connected to a switch which is connected to one of the analog inputs. Pressing a switch will therefore send an electric signal which value is dependend on the resistor value. This will trigger a specific command.
 


I think the schematic explains all.

You can find more information in the manual for this module which can be found here:

https://www.dfrobot.com/wiki/index.php/DFPlayer_Mini_SKU:DFR0299

A minimalist MP3 Player

I started with building a minimalists MP3 Player.

The only things you will be needing to build this are:

- battery holder for 3 AA batteries
- a breadboard
- some breadboard cables
- 2 switches

For the battery holder I used my own version which you can find here:
http://lucstechblog.blogspot.com/2016/04/3d-printed-battery-holder-i-was.html

In the final version I attached a switch to the VCC power line. That made it possible to switch between battery power and an USB power bank.



The switches are attached to GND and the I/O pins.
The DAC-L and DAC-R outputs arae attached to a headphone or to an amplified speaker or to an input on your home stereo set.





The above picture shows you my real-world test setup. I have used this with simple head-phones, an USB powered speaker and attached it to my stereo set.

I was impressed by the overall sound quality. It was much better as I expected from such a cheap module.

Flaws.

well yes there are a few problems / flaws.

Watch the cabling.
By using leads that are too long there is noise being picked up. This will disappear at higher volumes but is annoying at low volumes. Strange is that it did not occur all the times. Whyen skipping through the songs on the SD card the noise seemed to disappear. However best practice is to keep the lines short to avoid the noice alltogether.

No continuity
The MP3 player stops playing after each song. You will have to press the next or previous button for playing another song.

Solutions

For the noise the solution is simple: keep the leads as short as possible.

For the continuity the solution is obvious: use an Arduino or ESP to control the module. That's something that is coming up in another story.

Till then,
have fun

Luc