Catalex MP3 Player w/ Speaker

Fellow programmers, I have this board from DX:

I am not new to Arduino programming, but I simply can’t get this to work. All I get are clicks from the speaker when I send commands. I am using an UNO, but I have also tried with my Mega 2560.

I named three .MP3 files 001.mp3, 002.mp3, 003.mp3

Here is the code:

//code rearranged by Javier Muñoz 10/11/2016 ask me at javimusama@hotmail.com
#include <SoftwareSerial.h>

#define ARDUINO_RX 6//should connect to TX of the Serial MP3 Player module
#define ARDUINO_TX 5//connect to RX of the module
SoftwareSerial mySerial(ARDUINO_RX, ARDUINO_TX);//init the serial protocol, tell to myserial wich pins are TX and RX

////////////////////////////////////////////////////////////////////////////////////
//all the commands needed in the datasheet(http://geekmatic.in.ua/pdf/Catalex_MP3_board.pdf)
static int8_t Send_buf[8] = {0} ;//The MP3 player undestands orders in a 8 int string
                                 //0X7E FF 06 command 00 00 00 EF;(if command =01 next song order) 
#define NEXT_SONG 0X01 
#define PREV_SONG 0X02 

#define CMD_PLAY_W_INDEX 0X03 //DATA IS REQUIRED (number of song)

#define VOLUME_UP_ONE 0X04
#define VOLUME_DOWN_ONE 0X05
#define CMD_SET_VOLUME 0X06//DATA IS REQUIRED (number of volume from 0 up to 30(0x1E))
#define SET_DAC 0X17
#define CMD_PLAY_WITHVOLUME 0X22 //data is needed  0x7E 06 22 00 xx yy EF;(xx volume)(yy number of song)

#define CMD_SEL_DEV 0X09 //SELECT STORAGE DEVICE, DATA IS REQUIRED
#define DEV_TF 0X02 //HELLO,IM THE DATA REQUIRED
                
#define SLEEP_MODE_START 0X0A
#define SLEEP_MODE_WAKEUP 0X0B

#define CMD_RESET 0X0C//CHIP RESET
#define CMD_PLAY 0X0D //RESUME PLAYBACK
#define CMD_PAUSE 0X0E //PLAYBACK IS PAUSED

#define CMD_PLAY_WITHFOLDER 0X0F//DATA IS NEEDED, 0x7E 06 0F 00 01 02 EF;(play the song with the directory \01\002xxxxxx.mp3

#define STOP_PLAY 0X16

#define PLAY_FOLDER 0X17// data is needed 0x7E 06 17 00 01 XX EF;(play the 01 folder)(value xx we dont care)

#define SET_CYCLEPLAY 0X19//data is needed 00 start; 01 close

#define SET_DAC 0X17//data is needed 00 start DAC OUTPUT;01 DAC no output
////////////////////////////////////////////////////////////////////////////////////


void setup()
{
  Serial.begin(9600);//Start our Serial coms for serial monitor in our pc
mySerial.begin(9600);//Start our Serial coms for THE MP3
delay(500);//Wait chip initialization is complete
delay(200);//wait for 200ms
   sendCommand(CMD_SEL_DEV, DEV_TF);//select the TF card
}

void loop()
{
  sendCommand(CMD_PLAY_WITHVOLUME, 0X0F01);//play the first song with volume 15 class
  delay(1000000);//the programm will send the play option each 100 seconds to the catalex chip
}

void sendCommand(int8_t command, int16_t dat)
{
 delay(20);
 
 Send_buf[0] = 0x7e; //starting byte
 Send_buf[1] = 0xff; //version
 Send_buf[2] = 0x06; //the number of bytes of the command without starting byte and ending byte
 Send_buf[3] = command; //
 Send_buf[4] = 0x00;//0x00 = no feedback, 0x01 = feedback
 Send_buf[5] = (int8_t)(dat >> 8);//datah
 Send_buf[6] = (int8_t)(dat); //datal
 Send_buf[7] = 0xef; //ending byte

  for(uint8_t i=0; i<8; i++)
 {
   mySerial.write(Send_buf[i]) ;//send bit to serial mp3
   Serial.print(Send_buf[i],HEX);//send bit to serial monitor in pc
 }
 
 Serial.println();
}

which was taken right out of the forum.

Could this be a bad module?
Is there any way to test to see what may be wrong?

What is the feedback bit for?

Kindly,
nvantas

Update:

The output is this:

7EFFFFFFFF69002FFFFFFEF 7EFFFFFFFF6220F1FFFFFFEF

Looks like too many bytes are output.

I am thinking the written output should be: 7E0622000F01EF

This is what Seial.print(HEX) is displaying anyway.

This is what Seial.print(HEX) is displaying anyway.

It would display data differently if you used uint8_t as the type of Send_buf.

Post a picture showing how that device is connected to the UNO and/or the Mega.

Thank you for answering Paul.

I changed the Send_buf from int8_t to byte and I get better output:

The card select command is: 7EFF69002EF and the play with sound command is: 7EFF6220F1EF

Much better than the extra ffs that come with negative ints.

There is no leading 0 for short numbers like the 6, but I am not sure that matters.

I took a picture of my actual circuit, but I don't have a URL to post it to. Anyway, there are only 4 connections:

VCC is connected yo Arduino UNO 5v Power pin GND is connected Arduino UNO GND Power pin

TX is connected to Arduino UNO Digital pin 6 (ARDUINO_RX) RX is connected to Arduino UNO Digital pin 5 (ARDUINO_TX) Note: I even tried a 1k resister on this pin.

SoftwareSerial mySerial(ARDUINO_RX, ARDUINO_TX);

I DID try swithing the RX and TX pins. Could that have blown the unit out? I don't see why this would, but I guess it could if the internal circuitry cannot handle it.

but I am not sure that matters.

I am. It doesn't.

Can you provide a link to the device? I'm wondering if it is a 5V device.

Are the mp3 files at the root level?

Does the device/library expect the extension to be mp3? Or MP3?

Thank you, I am relieved I didn’t blow it up. They are not expensive, but at 10 days, the wait is long.

Here are the pics of my setup. I tried renaming the files to 00X.MP3 (caps), but that didn’t work either

Her are the bytes written out. I wrote this to the Standard serial port with a space between them for clarity.

Looks good to me.

7E FF 6 9 0 0 2 EF
7E FF 6 22 0 F 1 EF

Here is the link to the MP3 player: http://www.dx.com/p/uart-serial-mp3-music-player-module-w-1w-speaker-for-arduino-440175?tc=USD&gclid=Cj0KCQjwiLDMBRDFARIsACNmiX92zYwACtbaRVxQqafXyuFF3PGFXwx6u47A5cNuCzNUzQrIJJS_OQcaAvZbEALw_wcB#.WYyW31WGOpo

The specs say:
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
  • It is great for DIY

I am using a 64mb micro sd chip.

I tried a couple of different MP3 and WAV files. I tried to figure out the sampling rate, but don’t have the software to do that. I am primarily a C# programmer, so I could roll my own, but…

The site that showed the code and how to connect the board had a free library list. I just grabbed a few from there for a test. I included it.

Thank you again for helping!

Was scanning for projects using Open Smart serial MP3 player and came across your post. Just curious if you ever got your project to work. One thing I noticed is that you were using the Catalex command set, which has a "version" number as the second byte (0XFF). The command set for the Open Smart version of the serial MP3 player does not use the version number. And some of the commands are different. So I suspect that was the root of all your problems.

I've had pretty good success using this device, but their file structure makes it a little cumbersome.