Catalex Serial MP3 Player

MurrayJ

Senior Member
Just bought a couple of these MP3 players for a project and I am struggling to understand the Arduino code example given. I haven't received them yet and so cant try any code, but I wish to understand a bit before they arrive and use them for my picaxe shield. I dont need a full program, just a line or two to show how to send a serial command to play an MP3 from the module.

Here is the Arduino code provided, any pointers would be greatly appreciated.

Code:
/***********************************************************/
//Demo for the Serial MP3 Player by Catalex
//Hardware: Serial MP3 Player *1
//Board:  Arduino UNO R3
//IDE:	  Arduino-1.0
//Function:  To play the first song in the micro sd card.
//Store: http://www.aliexpress.com/store/1199788
//          http://www.dx.com/
#include <SoftwareSerial.h>

#define ARDUINO_RX 5//should connect to TX of the Serial MP3 Player module
#define ARDUINO_TX 6//connect to RX of the module
SoftwareSerial mySerial(ARDUINO_RX, ARDUINO_TX);

static int8_t Send_buf[8] = {0} ;

#define CMD_SET_VOLUME 0X06
#define CMD_PLAY_W_INDEX 0X08
#define CMD_SEL_DEV 0X09
  #define DEV_TF 0X02
#define CMD_PLAY 0X0D
#define CMD_PAUSE 0X0E
#define CMD_SINGLE_CYCLE 0X19
  #define SINGLE_CYCLE_ON 0X00
  #define SINGLE_CYCLE_OFF 0X01
#define CMD_PLAY_W_VOL 0X22

void setup() 
{
	mySerial.begin(9600);
	delay(500);//Wait chip initialization is complete
    sendCommand(CMD_SEL_DEV, DEV_TF);//select the TF card  
	delay(200);//wait for 200ms
	sendCommand(CMD_PLAY_W_VOL, 0X0F01);//play the first song with volume 15 class
}
void loop() 
{

}

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]) ;
  }
}
catalex serial mp3 player.jpg
 

premelec

Senior Member
"#include <SoftwareSerial.h>" this means there is a bunch more code contained in SoftwareSerial.h which you need to look at also - good luck!
 

neiltechspec

Senior Member
Doesn't look that difficult from the datasheet, forget that arduino stuff - just adds confusion.

I would have thought something like this below should be a starter.

Code:
#picaxe 08m2

setfreq m16

serout c.1,t9600_16,($7E,$FF,$06,$0B,$00,$00,$00,$EF) 'wake up player
pause 1000
serout c.1,t9600_16,($7E,$FF,$06,$09,$00,$00,$02,$EF) 'select TF socket
pause 1000
serout c.1,t9600_16,($7E,$FF,$06,$0F,$00,$01,$01,$EF) 'play the song: /01/001xxx.mp3
Neil.
 

viscomjim

New Member
Hi MurrayJ, Did you ever get this unit to play anything for you? I have one also, not using picaxe but am using mmbasic and not have too much luck. If you get anywhere, keep us posted....

Thanks!!!!!
 

MurrayJ

Senior Member
I haven't received my unit yet, its coming from china so will take anything up to a month to get to me. I was just wanting to have an idea on how to get it working before it got to me.
 

erco

Senior Member
Another option is a "Music Angel" MP3 player on Ebay. Self contained unit has stereo amp, speakers, housing, USB-charged internal LiPo battery. Takes a micro SD/TF card. Great sound in a tiny package. Control buttons can be hacked for play, pause, volume, skip, etc. Comes in various sizes, I like this one best. Can be won at auction for $6-7, this BIN is under $9 shipped:

http://www.ebay.com/itm/Mini-USB-Portable-Audio-Stereo-Speaker-Micro-SD-TF-MP3-Music-Angel-Player-MD05-/261446230239?pt=LH_DefaultDomain_2&hash=item3cdf68e0df
 

MurrayJ

Senior Member
Sorry it took so long to get back to you all, the MP3 unit arrived just before Christmas, and I just got it out to try. Worked first go, and simple to get running thanks to your help. The starter code was -

serout s.1,t9600,($7E,$FF,$06,$09,$00,$00,$02,$EF) 'select TF socket
pause 1000
serout s.1,t9600,($7E,$FF,$06,$0F,$00,$02,$03,$EF) 'play the song: /02/003xxx.mp3

That is all that is needed to play an mp3, couldn't be simpler.
 

the old fart

Senior Member
Hi Guys,
I've been trying to play a folder on a loop.
After lots of googling, I found that the instructions for playing a folder are wrong.

Shown: 7F FF 06 17 00 00 01 EF
should be: 7F FF 06 17 00 01 00 EF

Change 01 for 02,03 etc for other folders.

my program, not pretty but it works.
Code:
;catalex mp3 08M2 V2 player

#Picaxe 08M2
SetFreq m8  'Must be set to 8mhz or 16mhz for Serout command to work at 9600 baud

Init:  
w10=0
pause 1000
serout C.4,T9600_8,($7E,$FF,$06,$0c,$00,$00,$00,$EF); reset chip
pause 4000
	
serout C.4,T9600_8,($7E,$FF,$06,$09,$00,$00,$02,$EF) 'Select TF socket on Catalex	
HIGH c.0 ; on board led
pause 4000
LOW c.0
;set voume
readadc C.1,w11; volume 0 to255 10Kohm pot
pause 50
w9=w11/8 min 10 max 30
high c.0; on board led
serout C.4,T9600_8,($7E,$FF,$06,$06,$00,$00,w9,$EF); volume 
pause 500
low c.0


Main:

folder1:
serout C.4,T9600_8,($7E,$FF,$06,$17,$00,$01,$00,$EF); loop play folder 01
loppi:

if pinc.3=1 then goto folder2; select switch

readadc C.1,w11; volume 0 to255
pause 50
if w10=w11 then goto skipsvol; if same level then skip vol set
w10=w11
w9=w11/8 min 10 max 30
high c.0
serout C.4,T9600_8,($7E,$FF,$06,$06,$00,$00,w9,$EF); volume 
pause 500
low c.0
skipsvol:
goto loppi

;=========== folder 2===================

folder2:

serout C.4,T9600_8,($7E,$FF,$06,$17,$00,$02,$00,$EF); loop play folder 02

lopp2:
if pinc.3=0 then goto folder1

readadc C.1,w11; volume 0 to255
pause 50
if w10=w11 then goto skipvol2
w10=w11
w9=w11/8 min 10 max 30
high c.0
serout C.4,T9600_8,($7E,$FF,$06,$06,$00,$00,w9,$EF); volume 
pause 500
low c.0

skipvol2:

goto lopp2
Hope this helps you, as these are great players.
 

erco

Senior Member
A handy module to have on my bench. Surprisingly good sound out of a dollar store amplified speaker.

 

newplumber

Senior Member
@ erco good job explaining it all ..funny how its 2.78 and ur older post i think was 9 bucks so if I wait
a few more years maybe they will pay me to take it :)
 

Jeff Haas

Senior Member
I've used a couple of these in displays that have run for days continuously...they work great! If anyone here remembers the old thread about the Tenda MP3 players, these do just as good a job, but exclude features that you don't need if you're controlling them with a micro. They also have the headphone jack included on board, where the Tendas do not.
 
Top