Anyone got an MP3 player & code that works?

Ive got two identical MP3 players that the test program doesn't work. I created several 00x_.mp3 files and put them in the right (?) dirs but nothing seems to work. the baud rate isn't listed and the command examples don't match the code.
If you know of one that works and have the code can you please let me know what module you're using? Im using this:


It on a mega 2560 Serial1. It doesn't do squat.

I have not used your module so I cannot answer that.
But, in case you cannot get it to work with support from others that have more knowledge on the module, do switch to the DFPlayer Mini or DFPlayer Pro. Someone even made a better library for the MIni, and they should work with any arduino board and at least a 1 lipo cell power.
Be careful of clones though, if you decide to get one.

Yeah. thats the diag that didn't work as advertised: like this command:

7E 04 41 00 01 EF (Play with index: /01/001xxx.mp3)

Where is the directory specified? How is song 001 specifed with only 01? Or is the 01 the directory and it just defaults to the first song? Lots of vagueness.

The line:

for(int i=0;i<len;i++){ MP3.write(command[i]); Serial.print(command[i], HEX); 

prints indecipherable garbage by concatenating all the bytes without leading zeros, The RESET and WAKE commands are not covered (other sources say they're required).

I copied the code into a new stand alone sketch:

// Select storage device to TF card
static int8_t select_SD_card[] = {0x7e, 0x03, 0X35, 0x01, 0xef}; // 7E 03 35 01 EF
// Play with index: /01/001xxx.mp3
static int8_t play_first_song[] = {0x7e, 0x04, 0x41, 0x00, 0x01, 0xef}; // 7E 04 41 00 01 EF
// Play with index: /01/002xxx.mp3
static int8_t play_second_song[] = {0x7e, 0x04, 0x41, 0x00, 0x02, 0xef}; // 7E 04 41 00 02 EF
// Play the song.
static int8_t play[] = {0x7e, 0x02, 0x01, 0xef}; // 7E 02 01 EF
// Pause the song.
static int8_t pause[] = {0x7e, 0x02, 0x02, 0xef}; // 7E 02 02 EF

// Define the Serial MP3 Player Module.

void setup() {
  // Initiate the serial monitor.
  Serial.begin(115200);
  // Initiate the Serial MP3 Player Module.
  Serial1.begin(9600);
  // Select the SD Card.
  send_command_to_MP3_player(select_SD_card, 5);
}

void loop() {
  // Play the second song.
  send_command_to_MP3_player(play_second_song, 6);
}


void send_command_to_MP3_player(int8_t command[], int len){
  Serial.print("\nMP3 Command => ");
  for(int i=0;i<len;i++){ Serial1.write(command[i]); Serial.print(command[i], HEX); }
  delay(1000);
}

The serial monitor shows:

15:01:33.551 -> MP3 Command => 7E3351FFFFFFEF
15:01:34.530 -> MP3 Command => 7E44102FFFFFFEF
15:01:35.562 -> MP3 Command => 7E44102FFFFFFEF

The card(s) do NOTHING. Not even the LED blinks.

This is why I was asking if anyone had PERSONAL EXPERIENCE to share.

I have hacked this example to the point where the extra FF's are eliminated, but still no joy in Mudville.

Perhaps it's like the Catalex?
The tracks on top, no file folders.
arbitraryname001.mp3
noname002.mp3
sayonara003.mp3

And they have to be Pasted into the microSD one at a time and in order.

byte tracknumber;

#include <SoftwareSerial.h>  // Config for D5,D6 → TXD to Catalex
SoftwareSerial playerSerial (5,6);  // D6 to CatalexMP3 Data_In

// tracknaming
// whatever001.mp3
// something002.mp3
// winning003.mp3

void setup() 
{
  playerSerial.begin(9600);  // D6 to CatalexMP3 Data_In
}

void loop() 
{
  tracknumber = 1;
  playTrack();
  delay(2000); // should be Longer than track's time

  tracknumber = 2;
  playTrack();
  delay(2000); // should be Longer than track's time
}

void playTrack ()
{  
  playerSerial.write(0x7e);
  playerSerial.write(0xff);
  playerSerial.write(0x06);
  playerSerial.write(0x22);
  playerSerial.write((byte)0x00);
  playerSerial.write(0x10); // volume sound
  playerSerial.write(tracknumber); // file
  playerSerial.write(0xef);    
}

Nope:

byte tracknumber;

//#include <SoftwareSerial.h>  // Config for D5,D6 → TXD to Catalex
//SoftwareSerial playerSerial (5,6);  // D6 to CatalexMP3 Data_In

// tracknaming
// whatever001.mp3
// something002.mp3
// winning003.mp3

void setup() 
{
   Serial.begin(115200);
  Serial1.begin(9600);  // D6 to CatalexMP3 Data_In
}

void loop() 
{
  tracknumber = 1;
  playTrack();
  delay(2000); // should be Longer than track's time

  tracknumber = 2;
  playTrack();
  delay(2000); // should be Longer than track's time
}

void playTrack ()
{  
  Serial1.write(0x7e);
  Serial1.write(0xff);
  Serial1.write(0x06);
  Serial1.write(0x22);
  Serial1.write((byte)0x00);
  Serial1.write(0x10); // volume sound
  Serial1.write(tracknumber); // file
  Serial1.write(0xef);    
}

Because you're such a Nice Guy I went a pulled the microSD out of my project's Catalex.
The tracks are number first:
001nameit.mp3
002aname.mp3
003yclept.mp3
(whatever comes after the three digits the player doesn't care about)

f:\003_getupandpee.mp3
f:\001_timetogetupinthemorning.mp3
f:\002_wakeupsleepyhead.mp3
f:\01
f:\System Volume Information\WPSettings.dat
f:\System Volume Information\IndexerVolumeGuid
f:\01\001_timetogetupinthemorning.mp3
f:\01\002_wakeupsleepyhead.mp3
f:\01\003_getupandpee.mp3

I didn't use folders, everything on top.

PE - Nothing but MP3's

Have you checked the size of the card and the partition type for compatibility?

Its a 32gb microSD card. I bought several. They work in the SD card reader module in the same project.
Do you think it's DOS 8.3? It was readable by my win10 box. My 3D printer didn't like anything that isn't SD (no microSD)

What does the manufacturer say?

Is it formatted as FAT16 or FAT32? I don't think these MP3 players support anything but that format. Also check to see if 32 is supported, seems to be a lot.

The DFPlayer Mini and Catalex both use the YX5200/YX5300 chip and it supports only FAT16/FAT32 with a maximum of 32GB. I have only tested up to 8Gb myself without issues.

Doesn't say SQUAT. Like most Arduino parts it arrived alone in an envelope. The online docs I can find aren't technical.
Walmart
Here are the COMPLETE docs:

## Product details

100% brand new and high quality
The module is a kind of simple MP3 player device which is based on a high-quality MP3 audio chip. It can support 8k Hz ~ 48k Hz sampling frequency MP3 and WAV file formats.
There is a TF card socket on board, so you can plug the micro SD card that stores audio files. MCU can control the MP3 playback state by sending commands to the module via
UART port, such as switch songs, change the volume and play mode and so on. You can also debug the module via USB to UART module. It is compatible with Arduino/AVR/ARM/PIC.

Features:
Support sampling frequency (kHz): 8/11.025/12/16/22.05/24/32/44.1/48
Support file format: MP3 / WAV
Support Micro SD card, Micro SDHC Card
Onboard 3-watt mono amplifier
On-board speaker interface XH2.54-2P, can connect to external speakers such as 8 ohm 3-watt, 8 ohm 2 watt, 8 ohm 1 watt
30 class adjustable volume
UART TTL serial control playback mode, baud rate is 9600bps
Serial communication format: 8N1
Working voltage: 3.7~5.25V DC
On-board headphone jack, it can connect headphones or external amplifier.
On-board TF card connector
Dimensions: 2.3x4.3cm
8ohm 1W Speaker:
Can be directly plugged onto the Serial MP3 Player module to use.
Magnetic forms: inner magnetic
Rated impedance: 8 ohm
Rated Power: 1 W
Dimension: diameter 4.9cm/1.93inch
Great for speaker and amplifier projects DIY.

Package includes:
1 x UART Serial MP3 Music Player Module With Speaker

  • Support sampling frequency (kHz): 8/11.025/12/16/22.05/24/32/44.1/48
  • Support file format: MP3 / WAV
  • Support Micro SD card, Micro SDHC Card

I've found this description essentially verbatim on all other sites that ring up on a search for Arduino Serial MP3 Player

1 Like

I found that once before but Google drive needs me to login and I don't have any access. (sigh) I tried this path once before, but let me not leave a stone unturned.

Hasn't ANYONE on here actually USED and WRITTEN "known good" code for this? Or ANY OTHER MP3 player? I'm not wedded to this particular device.

The DFMiniPlayer, as mentioned by others, works well.

I have logged in, it has asked me for an access request, I have requested it and Google Drive has answered me with:
"Request sent
You will receive an email to let you know if the file has been shared with you."

As soon as I have it I'll upload it, but who knows what time it is now in China.
In any case, you should contact them, they are good people, they have sent me libraries and codes to evaluate before buying them.

Not so good, the built-in amplifier is a pain and you have to use the left and right headphone output and amplify it later.
At medium-high volume if the song has silences you can hear the bits decoding, although if you play from the USB port that incorporates this disappears.
It has its little problems but its use and programming is very simple, it has a very large and simple library.

I have - for both the Catalex (which I provided example of earlier) and the DFRobot (the real one, not the gray-market lookalike/s).

I thought the Catalex might work with yours (both opening with the "0x7e", perhaps a faulty assumption).

Open-Smart_MP3.pdf (629.3 KB)