Home
JAQForum Ver 20.06
Log In or Join  
Active Topics
Local Time 08:16 05 May 2024 Privacy Policy
Jump to

Notice. New forum software under development. It's going to miss a few functions and look a bit ugly for a while, but I'm working on it full time now as the old forum was too unstable. Couple days, all good. If you notice any issues, please contact me.

Forum Index : Microcontroller and PC projects : Catalex $6 MP3 player module...

     Page 1 of 3    
Author Message
Grogster

Admin Group

Joined: 31/12/2012
Location: New Zealand
Posts: 9066
Posted: 03:22pm 01 Jan 2015
Copy link to clipboard 
Print this post

This thing is really awesome for the price.

You can find it here.

In this thread, I aim to add some code and other comments in the hope that it may be useful for other memebers to get one of these things going ASAP.

I will be adding some info on a PCB hack later on, which will involve adding a BUSY line, which the module does not give you, but the SSOP chip on the module does have.

A BUSY line is really useful with a module like this, as you can then just monitor the BUSY line to find out when the module has finished playing a song or whatever, then the Micromite or other MCU will know it can play another song.

The module is controlled by a serial connection @ 9600 8N1, and the command strings are USUALLY 8 bytes long, but depending on the command, can be more then that. The length of the data sent to the module is one of the bytes in the command string, so the module knows how many bytes to expect.

Here is some simple MicroMite code to control the module:


'CATALEX serial MP3 player tester 1A


'SETUP CONSTANT COMMAND STRINGS
SONG=1:VOLL=1:FOLD=1:SNG1=1:SNG2=1
P$=chr$(&h7E)+chr$(&hFF)+chr$(&h06):E$=chr$(&hEF)
H0$=chr$(&h00):H1$=chr$(&h01):H2$=chr$(&h02)
Z$=H0$+H0$
INI$=P$+chr$(&h09)+Z$+H2$+E$ 'Initalize
NXT$=P$+chr$(&h01)+Z$+H0$+E$ 'Next Song
PRE$=P$+chr$(&h02)+Z$+H0$+E$ 'Previous Song
SLP$=P$+chr$(&h0A)+Z$+H0$+E$ 'Sleep
WAK$=P$+chr$(&h0B)+Z$+H0$+E$ 'Wake
RST$=P$+chr$(&h0C)+Z$+H0$+E$ 'Reset
PLA$=P$+chr$(&h0D)+Z$+H0$+E$ 'Play
PAU$=P$+chr$(&h0E)+Z$+H0$+E$ 'Pause
STO$=P$+chr$(&h16)+Z$+H0$+E$ 'Stop
SHF$=P$+chr$(&h18)+Z$+H0$+E$ 'Shuffle


open "com2:9600" as #1

DO:LOOP



'--------------------------------
'BUILD CUSTOM COMMAND STRING SUBS
'--------------------------------

sub BUILD_PWI (SONG)
PWI$=P$+chr$(&h03)+Z$+chr$(SONG)+E$ 'Play With Index
end sub

sub BUILD_SVL (VOLL)
SVL$=P$+chr$(&h06)+Z$+chr$(VOLL)+E$ 'Set Volume
end sub

sub BUILD_SCP (SONG)
SCP$=P$+chr$(&h08)+Z$+chr$(SONG)+E$ 'Single Cycle Play(repeat track)
end sub

sub BUILD_PFF (FOLD,SONG)
PFF$=P$+chr$(&h0F)+H0$+chr$(FOLD)+chr$(SONG)+E$ 'Play Folder/File
end sub

sub BUILD_CPF (FOLD)
CPF$=P$+chr$(&h17)+Z$+chr$(FOLD)+E$ 'Cycle Play Folder
end sub

sub BUILD_GPI (SNG1,SNG2)
GPI$=P$+chr$(&h21)+H0$+chr$(SNG1)+chr$(SNG2)+E$ 'Group Play with Index
end sub

sub BUILD_PWV (VOLL,SONG)
PWV$=P$+chr$(&h22)+H0$+chr$(VOLL)+chr$(SONG)+E$ 'Play With Volume
end sub

sub BUILD_EQS (EQSL)
EQS$=P$+chr$(&h07)+Z$+chr$(EQSL)+E$ 'Equalizer Select
end sub


This code is very basic(if you'll pardon the pun!), in that it just sets up some strings with the command bytes needed to get the module working. You could store these strings in an array if you wanted, but it is just as easy to have them as seperate strings, IMHO.

If you run the code, then [CTRl]+[C] to break the DO/LOOP, then at the command prompt type ? #1,NXT$, the module should start playing a song.

Probably the most useful of the commands, are those that allow you to select the song you want to play, and if you want that song to repeat automaticaly or not.

The simple BUILD subs do this for you, so that - for example - if you wanted to play song ten on the card, you would issue the command BUILD_PWI (10). This will build the PWI$ to play song #10. You then play it with the command ? #1,PWI$

PWI$ will play the selected song once, then stop.
To play the same song over and over until manually stopped, you would call BUILD_SCP (10), and then ? #1,SCP$ - that will play song #10 over and over again, until you stop the module with the likes of ? #1,STO$ or ? #1,RST$.

At this stage, I have not been able to effect any shuffle mode or equalizer settings, despite the commands being listed in the manual - perhaps I am not issuing them correctly. The vital commands for selecting a song and playing it, stopping, pausing etc are all working fine.

NOTE: If you pause a song, you have to issue a PLAY command to un-pause it - not issue another pause command.

I will be updating this thread as I develop and play with this some more. I will also link to a ZIP with all the files/manuals etc in it.

EDIT: Link to module documents ZIP file
Edited by Grogster 2015-01-03
Smoke makes things work. When the smoke gets out, it stops!
 
viscomjim
Guru

Joined: 08/01/2014
Location: United States
Posts: 925
Posted: 05:13am 02 Jan 2015
Copy link to clipboard 
Print this post

Grogster, thanks for this. I too am playing with this module and the module I used for the micro mite "antique radio" is no longer in production. This unit is pretty nice and I agree, why didn't they pull out the busy line!!!! Anyway, I look forward to your progress and will be keeping an eye out on this thread. I also agree, the sound quality is pretty damn good.
 
Grogster

Admin Group

Joined: 31/12/2012
Location: New Zealand
Posts: 9066
Posted: 01:54pm 02 Jan 2015
Copy link to clipboard 
Print this post

Your fantastic wooden retro radio thing - how did that go down with the mother-in-law anyway?

As for your module - that was the MDFLY one, was it not? I have one of them here, but I think the eBay module was simply the first of the two I laid my hand on at the time, so it was this one I started playing around with.

I have also been experimenting with using this for "Talking" projects. The module seems very quick to respond, allowing use of very short files. I have found that any file under 100k in size is ignored, so singular short word files won't play.

I am using uncompressed WAV files for this test instead of MP3, as there is no real need to go to the trouble of compressing WAV to MP3 these days, with the size and cheapness of uSD cards.

My test files are things like "Basement." and "Ground" for my model elevator project - the module says them when the cabin arrives at, or passes by, any given floor.

I generated the voice files using Google Translate. Just type in what you want said in the English box, and then click the little speaker icon, and voice synthesis will speak the words for you. With the help of Goldwave or Audacity etc, you can then record the system mixer to get a file of the speech, and then edit each spoken item down to seperate WAV files for the module to play.
Smoke makes things work. When the smoke gets out, it stops!
 
bigmik

Guru

Joined: 20/06/2011
Location: Australia
Posts: 2870
Posted: 02:05pm 02 Jan 2015
Copy link to clipboard 
Print this post

  Grogster said  
My test files are things like "Basement." and "Ground"


Grogs,

If the short files wont play try something like "Ladies Underwear! Going down"




Regards,

Mick


Mick's uMite Stuff can be found >>> HERE (Kindly hosted by Dontronics) <<<
 
Grogster

Admin Group

Joined: 31/12/2012
Location: New Zealand
Posts: 9066
Posted: 02:17pm 02 Jan 2015
Copy link to clipboard 
Print this post

Heh, heh - you a fan of the classic too eh? (that would be Are You Being Served?)

Here is a message for all backsheders:

Multi-language message for members.

This is an example of what can be done with Google Translate, and some form of system mixer recorder. I used Goldwave.

The message is in English, German, Italian, French, Spanish, Russian, Chinese and Japanese.


Smoke makes things work. When the smoke gets out, it stops!
 
Grogster

Admin Group

Joined: 31/12/2012
Location: New Zealand
Posts: 9066
Posted: 04:16pm 02 Jan 2015
Copy link to clipboard 
Print this post

UPDATE: Module obviously expects 128kB blocks, which could be understandable, really.

Any file LESS then 128kB is just ignored, and you can't play it.
If I make a file with one word and some extra silence on the end of it to stretch out the filesize to 129kB, it plays fine.

I know it is immature and puerile, but you can probably guess the word I was experimenting with.... (starts with F )
Smoke makes things work. When the smoke gets out, it stops!
 
bigmik

Guru

Joined: 20/06/2011
Location: Australia
Posts: 2870
Posted: 10:23pm 02 Jan 2015
Copy link to clipboard 
Print this post

  Grogster said  
The message is in English, German, Italian, French, Spanish, Russian, Chinese and Japanese.


No Kiwi translation?

Mick
Mick's uMite Stuff can be found >>> HERE (Kindly hosted by Dontronics) <<<
 
Grogster

Admin Group

Joined: 31/12/2012
Location: New Zealand
Posts: 9066
Posted: 12:26am 03 Jan 2015
Copy link to clipboard 
Print this post

No, but the English voice seems to be an Aussie sheela, so that's close enough.
Smoke makes things work. When the smoke gets out, it stops!
 
BobD

Guru

Joined: 07/12/2011
Location: Australia
Posts: 935
Posted: 12:52am 03 Jan 2015
Copy link to clipboard 
Print this post

  Grogster said   No, but the English voice seems to be an Aussie sheela, so that's close enough.

so it speaks Orstrailyan too. Very good.
 
viscomjim
Guru

Joined: 08/01/2014
Location: United States
Posts: 925
Posted: 04:14pm 03 Jan 2015
Copy link to clipboard 
Print this post

Hey Grogster, I am making a little sound unit similar to the "EASY BUTTON" from staples office supplies. Not sure if you have ever seen one, but google it if you haven't. You basically press it and it utters the words "that was easy". BORING!!! Mine is using the catalex unit that you are messing with. However, in the interest of saving space I am using an 8 pin pic12f1840 and great cow basic, which is quite close to mmbasic. I was able to port my micromite code to great cow with very little effort.

This is running on a 9v battery, so between the pic, the catalex and the amp, I need to shut it down completely once the unit plays its thing. A tilt switch powers up the unit and the pic will turn on a fet to keep it running till done. I haven't implemented the on time yet, and since the busy signal is not available, I will just run each track for a fixed period of time. It will cycle through 10 different tracks which are kept track of using the pic's eeprom since it completely powers down each time. This of course could be hundreds of tracks.

I found a great little mono amp that goes for $0.99 ea. that can't be beat. Running into a 4 ohm speaker at 3.3v, it is amazing how loud it is. Here is a website with a bit of detail on the unit, but I purchased from china for less. Also a great stereo complement for the catalex unit is this one. I purchased a few of these also and they too kick some butt for their size. Really amazing. I only wish that catalex put the audio out on pins instead of the 3.5mm jack. As you know, this is how the mdfly unit is which makes it nice for a pcb with on board amp. Oh well...

Here is the GCBasic code that I am using... It doesn't yet have the gpio used for turning on and off the fet. More to come...




#CHIP 12F1840, 32

#DEFINE USART_BAUD_RATE 9600 'setup uart
#define USART_BLOCKING



DIM CCMD(10)
DIM CATALEX AS STRING

EPREAD 0, TRACK 'read stored track number
IF TRACK > 10 THEN TRACK = 1
IF TRACK = 0 THEN TRACK = 1 'in case it initially reads 0

CCMD(1) = 0x7E 'things that will always send
CCMD(2) = 0xFF
CCMD(3) = 0x06
CCMD(5) = 0x00
CCMD(8) = 0xEF

'MAIN
wait 750 MS 'let things settle after power up
INITCAT
SENDCCMD 0x0F, 0x01, TRACK
TRACK = TRACK + 1 'make next track number
EPWRITE 0, TRACK 'store track number for next power up
end


SUB INITCAT
SENDCCMD 0x0B, 0x00, 0x00 'WAKE CATALEX
WAIT 50 MS
SENDCCMD 0x09, 0x00, 0x02 'SELECT TF CARD
WAIT 50 MS
SENDCCMD 0x06, 0x00, 0x09 'SET VOLUME TO 9 or whatever you want
WAIT 50 MS
END SUB

SUB SENDCCMD(BYTE4, BYTE6, BYTE7)
CCMD(4)=BYTE4
CCMD(6)=BYTE6
CCMD(7)=BYTE7
CATALEX = ""
FOR I = 1 TO 8
CATALEX = CATALEX + CHR(CCMD(I)) 'build command
NEXT I
HSERPRINT CATALEX 'serial send to catalex
END SUB
 
Grogster

Admin Group

Joined: 31/12/2012
Location: New Zealand
Posts: 9066
Posted: 04:32pm 03 Jan 2015
Copy link to clipboard 
Print this post

Learning GC BASIC at the same time, are you?

Clever boy.

One language is enough for me at any one time.
Smoke makes things work. When the smoke gets out, it stops!
 
viscomjim
Guru

Joined: 08/01/2014
Location: United States
Posts: 925
Posted: 04:42pm 03 Jan 2015
Copy link to clipboard 
Print this post

The nice part is that the two are very similar (thank goodness). I actually copied and pasted the code from uMite (mmedit) and pasted into GCB. Made a few little changes and BINGO. Not too hard on the old noggin.
 
marcwolf

Senior Member

Joined: 08/06/2009
Location: Australia
Posts: 119
Posted: 06:44pm 09 Feb 2015
Copy link to clipboard 
Print this post

Many thanks for this.
I have been helping a friend with a 'Dalek' project. One of the things is to get the voice and that is to mix either a 13hz, 15hz, or 25hz tone in with a Ring Modulator.

As this has a repeat then it's perfect for providing the tone.


Plus also for firing noises and the dreaded "EXTERMINATE!!!!!"

Many thanks
Dave
Edited by marcwolf 2015-02-11
Coding Coding Coding..
Keep those keyboards coding..
RAW CODE!!!!!
 
melbnz
Newbie

Joined: 31/07/2016
Location: New Zealand
Posts: 2
Posted: 08:39pm 01 Aug 2016
Copy link to clipboard 
Print this post

HI, Not sure if this is should be a new thread so happy to be guided on this! I'm new to the forum, new to MM and haven't coded for decades but have inner confidence!

I'm planning on building a mp3 player using MM and associated MP3 unit(s). The objective is to have a device that will play audio books and podcasts predominately from SD card(s) into a set of ear buds. I need the unit to remember where it's at (in time) in a file being played when paused or powered off , and be able to resume at a later date. Similarly fro podcast to remember where it is in the list and play next. I'm open to techniques such as deleted a played file.

Future additions may be radio unit, buttons to fast forward or rewind 15 mins, LCD display, clock, web file update etc, etc...

I have lots of bits including this MP3 unit http://www.dfrobot.com/index.php?route=product/product&product_id=1121&search=mp3&description=true#.V6A9pDXkWAU. This is a serial driven device with its own SD slot. I also have a few of these http://www.dx.com/p/jtron-20050299-mp3-decoder-board-w-tf-usb-green-298187#.V6A97DXkWAU which could be hacked and then aggregate audio back to common headphones (maybe just lash them in parallel!)

So i need some pointers on code, or possible techniques, others may have written to drive external MP3 players and have the 'breakpoint' resume from pause ability which is critical for the audio books as most files are 1 hour long.

So end of my ramble... if anyone has inclination and time to share some thoughts I'd appreciate that :) Plus patience as I'm busy with other things and have to learn this all; ready by Xmas would be nice.
Thanks in advance Mike

PS love some of the great projects you guys have done.
 
Grogster

Admin Group

Joined: 31/12/2012
Location: New Zealand
Posts: 9066
Posted: 09:38pm 01 Aug 2016
Copy link to clipboard 
Print this post

Hello.

Welcome to the forums.

melbnz's first link

melbnz's 2nd link

As you have reached the end of this thread, you no doubt know about the Catalex MP3-player module, so I won't bother going over that again, other then to say that to the best of my knowledge, you cannot ask it to start playing at a specific time-index of a song. This is required if you need it to remember where it was when you power off, and resume again when you power back on again.

I have not studied those other modules you posted other then a quick look, but the the DX-dot-com unit does not appear to have any controls other then button type - I did not see any serial ability on that one, so that would be completely out, as you would have no hope of telling it you wanted to start from song X at a certain point, as you can only skip/pause/play kind of thing. This still looks like an interesting module though for $2.50, the price is just so good I am temped to get a few just to play with. So long as instant playback was not a requirement, then these could be setup with the MM controlling the "Buttons" as a form of control. Certainly a nice price-point on that one!

Do other members here know of any MP3 modules that allow random-access playback?

EDIT: When I read a bit more about the 2nd module, you CAN have it playback from the point it was powered off - this is exactly what you need, so now all we need to do, is interface it to the MM chip, which should be quite easy.Edited by Grogster 2016-08-03
Smoke makes things work. When the smoke gets out, it stops!
 
jman

Guru

Joined: 12/06/2011
Location: New Zealand
Posts: 711
Posted: 09:53pm 01 Aug 2016
Copy link to clipboard 
Print this post

Hi

This module can pause
http://www.dfrobot.com/index.php?route=product/product&product_id=1121&search=mp3&description=true#.V6A9pDXkWAU

Great info can be found here MP3 Data

I have some working code for this module if you need some pointers

Regards
Jman

 
Grogster

Admin Group

Joined: 31/12/2012
Location: New Zealand
Posts: 9066
Posted: 10:00pm 01 Aug 2016
Copy link to clipboard 
Print this post

Pause WHILE THE POWER IS OFF?

He needs a module that will work like a car-stereo, and it will remember where it was playing when powered off, and resume playback from the same place when powered back up again. Does that module do that? I ask, as you have played with that module - no pun intended....
Smoke makes things work. When the smoke gets out, it stops!
 
jman

Guru

Joined: 12/06/2011
Location: New Zealand
Posts: 711
Posted: 11:37pm 01 Aug 2016
Copy link to clipboard 
Print this post

Hi

I read it as either or
  Quote  when paused or powered off

Nope the module needs power to resume

Jman
 
melbnz
Newbie

Joined: 31/07/2016
Location: New Zealand
Posts: 2
Posted: 12:09am 02 Aug 2016
Copy link to clipboard 
Print this post

Thanks for the welcome and coping with my poor typing and English! Any basic code would be welcomed so i can start to see how things hang together. Thanks for the pointers so far.
I'll try and make my web links as hyperlinks next time!
Mike
 
Grogster

Admin Group

Joined: 31/12/2012
Location: New Zealand
Posts: 9066
Posted: 12:31am 02 Aug 2016
Copy link to clipboard 
Print this post

Without either of those modules to play with, I can't help any further with code, but I think I might get a couple of those $2.50 ones to play with, as they are so cheap.

Use the Hyperlink button when you reply - forth from the left on the button-bar, right beside the bold, itallic and underline buttons.

A box will pop up, type in what you want the link to say, press ENTER, paste your link into the new pop-up, press ENTER - done.
Smoke makes things work. When the smoke gets out, it stops!
 
     Page 1 of 3    
Print this page
© JAQ Software 2024