SPE035 mp3 player

Hi, First post here but been lurking awhile. After several years away from programming I have just restarted after another member on here introduced me to the Picaxe range of micro controllers. I had some (limited) success so far with playing with these things but have run up against a problem with the SPE035 mp3 module recently purchased. I built the module without problems and after preparing a micro SD card with suitably named sound files I powered it up. And low and behold it works brilliantly just using the previous/play/next buttons and the supplied speaker. So far so good. Now what I need to do is play selected files one at a time under computer control and a switched input. I can see how to program the 18M2 which I've chosen for the project, but what I can't make it do is to "talk" to the module and make it play a file. I have copied and pasted the example programs from the module's manual and they don't work. I've also written some simple code just to test it but nothing. I've read the manual till I'm blue in the face and sure I am sending the correct instruction and data but all I get is silence from the module. The module has a led that lights up when it's busy ie playing a song but it does nothing except when playing the module manually. Has anyone had any success with this unit and got any tips? Many thanks
 

hippy

Technical Support
Staff member
Welcome to the PICAXE forum.

The programs were tested and checked to work with the 14M2 which the AXE171 board uses and there are example programs included with the latest PICAXE Editor 6 which can be loaded and modified for other PICAXE chips.

There may be some issue in translating the code for another PICAXE chip or a wiring issue so it would help if you could post your code which does not work, a circuit diagram of how things are connected, and a photo of what you have.

It could potentially be that the SD Card works with the buttons but is not configured correctly for the way the PICAXE would control it. This could happen if MP3 files were not placed in the directory the PICAXE program is expecting, or the PICAXE is trying to access a file which does not exist.
 
Hi Hippy and thank you for the welcome. For the moment, let's ignore my own coding efforts and tell you that I am using the sample program from the Picaxe Editor which is the latest version. I can paste that here if required. To simplify matters I am using the same I/P and O/P ports as in the software, obviously using the pin configuration for the 18M2. There is no cct diagram as such to show you - the Pic is connected to GND and VC+ from a 5v regulator (it shares this with the module). The I/P and O/P ports are connected directly to the 5 pin header on the module, no other components, that's it. (I don't have any pull up/down resistors - could that be the problem?). The only other thing I changed in the software is to play file 0001.mp3 rather than 0010.mp3 as I only have 9 files currently on the card. All files are stored in the MP3 folder in the root of the card which is 2Gb. I have tried formatting the card with FAT and FAT32 on my desktop before copying the files over one by one as suggested. The files are small 5-6 seconds long. I also tried using folder and file arrangement xx/xxx.mp3 as described in the manual with my own simplified code - again this worked OK with the buttons. However, I really need to get it working with the sample prog before I start playing with the code again.

There are only two possible problem areas I can think of, either there is a hardware fault on the Rx side of the module or there is a mismatch in the serial data transmission between Rx and Tx. I've tried tinkering with BAUD rates etc. to no effect. Remember the module works perfectly well by pressing the buttons.
 

hippy

Technical Support
Staff member
With the buttons working and the songs playing it would seem unlikely that the SEP035 or player module were faulty.

The supplied sample code for the 14M2 specifies C.3 for receiving serial data from the SPE035. That is Serial Out on an 18M2 so won't work without change, and it could potentially damage both the SPE035 and PICAXE by connecting two outputs together.

There are a number of sample programs so it would be best to post your code as you have edited that, just so someone can check.

The SD Card seems to have the MP3 files in the right place so it could be a wiring issue; a photo of the setup usually shows that up if it is the case.

The sample programs print out SERTXD progress information; perhaps include details of what they show when the program is downloaded and run.
 
OK, So here is the code with minor changes from sample. I'm now using C.5 rather than C.3 following on from your last comment. Song title and volume changed.

Ignore the graphic at start of code, this is as it comes in sample. Actual connections are B.4 to module Rx, C.2 to module "Busy" and C.5 to Tx on module.
 

Attachments

hippy

Technical Support
Staff member
Code:
Symbol BAUD_FREQ = M[b]16[/b]
Symbol BAUD      = T9600_[b]8[/b]
There is a mismatch there which causes the chip to not send at 9600 baud in the bottom 'send:' routine.

The SETFREQ 'M' value and the Baud rate 'T9600_' suffix have to match and "8" was the frequency used with the 14M2 so that should probably be -

Code:
Symbol BAUD_FREQ = M[b]8[/b]
Symbol BAUD      = T9600_8
Hopefully with just that change everything should start working.
 
Code:
Symbol BAUD_FREQ = M[b]16[/b]
Symbol BAUD      = T9600_[b]8[/b]
There is a mismatch there which causes the chip to not send at 9600 baud in the bottom 'send:' routine.

The SETFREQ 'M' value and the Baud rate 'T9600_' suffix have to match and "8" was the frequency used with the 14M2 so that should probably be -

Code:
Symbol BAUD_FREQ = M[b]8[/b]
Symbol BAUD      = T9600_8
Hopefully with just that change everything should start working.
Hi Hippy, Thanks, I've just tried that and still no joy. TBH I think that was how it was set when I first tried it but I've been playing around with the code to make it work and that was one of the changes I made.
 

Bill.b

Senior Member
Hi

When installing a SP035 on my bot I found that if I had the files on the SP card in the rout directory I could play them With the buttons but not
through the 14m2.

I had to place the files in a sub directory MP3 before the files could be accessed by the 14m2.

This is the code I used for my bot
Code:
#Picaxe 14M2
'#Terminal 4800
'setfreq m8              .-------------- Serial IN 
 '                       |
;                        | .------------------------------------------.
;           PICAXE-14M2  | |                                          |
;          .-----------. | | -.- V+     V+ -.-   SPE035 (DFP-Mini)    |
;         -| B.5   C.0 | | |  |             |   .-----------------.   |
;      .---| B.4   C.1 |-' |  |             `---| VCC        BUSY |---'
;      |  -| B.3   C.2 |<--'  |  .------------->| RX         USB- |-
;      |  -| B.2   C.3 |<-----|--|--------------| TX         USB+ |-
;      |  -| B.1   C.4 |-     |  |             -| DACR     ADKEY2 |-
;      |  -| B.0   C.5 |      |  |     |\  _   -| DACL     ADKEY1 |-
;   .--|---| 0V  _  V+ |------'  |     | \|+|---| SPK1  ___   IO2 |-
;   |  |   `----' `----'   ___   |  8R |  | |  -| GND  |   |  GND |---.
;   |  `------------------|___|--'     | /|_|---| SPK2 |   |  IO1 |-  |
;   |                                  |/       `------|___|------'   |
;  _|_ 0V                  1K0                                    0V _|_  
                                                  
Symbol TX        = B.4
Symbol RX        = C.3
Symbol BUSY_PIN  = pinC.2
Symbol BAUD_FREQ = M8
Symbol BAUD      = T9600_8
symbol BAUDPX	= N2400_4
symbol SerialData = b10
Symbol cmd       = b0
Symbol arg       = w1 ; b3:b2
Symbol arg.lsb   = b2
Symbol arg.msb   = b3
Symbol counter   = w2

High TX
Pause 2000
cmd = $09 : arg = $0002 : Gosub Send
Pause 4000
cmd = $06 : arg = 40 : Gosub Send
Pause 1000
main:
serin  C.1, BAUDPX, B11,b10
PAUSE 100
if b11 <> "A" then
	goto main
endif
if b10 < 66 then
	goto main
endif
  Select case b10
	case 21	'use selector
   		cmd = $12 : arg = 1 : Gosub Send
	case 22	'Remote control
   		cmd = $12 : arg = 2 : Gosub Send
	case 23	'line follower
   		cmd = $12 : arg = 3 : Gosub Send
	case 24	'follow me
   		cmd = $12 : arg = 4 : Gosub Send
	case 25	'light follower
   		cmd = $12 : arg = 5 : Gosub Send
	case 26	'Light avoidence
   		cmd = $12 : arg = 6 : Gosub Send
	case 27	'Wall follower
   		cmd = $12 : arg = 7 : Gosub Send
	case 28	'Learn - playback
   		cmd = $12 : arg = 8 : Gosub Send
	case 29	'Lost My way
   		cmd = $12 : arg = 9 : Gosub Send
	case 30	'fall down step
   		cmd = $12 : arg = 10 : Gosub Send
	case 31	'Found you
   		cmd = $12 : arg = 11 : Gosub Send
	case 32	'bot model 1
   		cmd = $12 : arg = 12 : Gosub Send
	case 33	'Video ON
   		cmd = $12 : arg = 13 : Gosub Send
	case 34	'Video OFF
   		cmd = $12 : arg = 14 : Gosub Send
	case 35	'Slow Speed
   		cmd = $12 : arg = 15 : Gosub Send
	case 36	'high Speed
   		cmd = $12 : arg = 16 : Gosub Send
	case 37	'battey Low
   		cmd = $12 : arg = 17 : Gosub Send
	case 38	'Sierin
   		cmd = $12 : arg = 18 : Gosub Send
	case 39	'noise 1
   		cmd = $12 : arg = 19 : Gosub Send
	case 40	'noise 2
   		cmd = $12 : arg = 20 : Gosub Send
	case 41	'noise 3
   		cmd = $12 : arg = 21 : Gosub Send
	case 42	'noise 4
   		cmd = $12 : arg = 22 : Gosub Send
	case 43	'overload
   		cmd = $12 : arg = 23 : Gosub Send
	case 44
   		cmd = $12 : arg = 24 : Gosub Send
	case 45
   		cmd = $12 : arg = 25 : Gosub Send
	case 46
   		cmd = $12 : arg = 26 : Gosub Send
	case 47
   		cmd = $12 : arg = 27 : Gosub Send
	case 48
   		cmd = $12 : arg = 28 : Gosub Send
	case 49	'
   		cmd = $12 : arg = 29 : Gosub Send
	case 50	'
   		cmd = $12 : arg = 30 : Gosub Send
	case 51	'
   		cmd = $12 : arg = 31 : Gosub Send
	case 52
   		cmd = $12 : arg = 32 : Gosub Send
	case 53
   		cmd = $12 : arg = 33 : Gosub Send
	case 54
   		cmd = $12 : arg = 34 : Gosub Send
	case 55
   		cmd = $12 : arg = 35 : Gosub Send
	case 56
   		cmd = $12 : arg = 36 : Gosub Send
	case 57
   		cmd = $12 : arg = 37 : Gosub Send
	case 58
   		cmd = $12 : arg = 38 : Gosub Send
	case 59	'
   		cmd = $12 : arg = 39 : Gosub Send
	case 60	'
   		cmd = $12 : arg = 40 : Gosub Send
	case 61	'
   		cmd = $12 : arg = 41 : Gosub Send
	case 62
   		cmd = $12 : arg = 42 : Gosub Send
	case 63
   		cmd = $12 : arg = 43 : Gosub Send
	case 64
   		cmd = $12 : arg = 44 : Gosub Send
	case 65
   		cmd = $12 : arg = 45 : Gosub Send
	case 66
   		cmd = $12 : arg = 46 : Gosub Send
end Select
	B10 = 0

  	Pause 1000
  	Do While BUSY_PIN = 0
  		 Pause 100
  	Loop
  	pause 1000
	goto main

Send:
  SetFreq BAUD_FREQ
  Pause 10
  SerOut TX, BAUD, ( $7E, $FF, $06, cmd, $00, arg.msb, arg.lsb, $EF )
  SetFreq MDEFAULT
  arg = 0
  Return

Bill
 
Thanks for reply Bill. That is how I've got them, in sub folder MP3. I'll take a look at your code later and see if there is anything else I could try.
 
Hi guys, I still haven't been able to get this project working. It's really annoying as there is hardly anything to it. I've checked the solder joints on the board and can't find anything wrong. I've tried another 18M2 I had spare. I've tried all the code in the manual making pin and code changes as applicable. If they sold the 14M2 project kit on it's own I'd be tempted to get it, but they don't although they sell this, the SPE 035, with or without the project pcb!! The module still works fine on it's own, just not via Picaxe control. Can I send it back to them to test it? Any help would be most appreciated, else Ive got something that is of no use to me - another dumb mp3 player I do not need. Thanks in anticipation.
 

billhayley

New Member
I used one of these in an existing project which had a 14m chip in it, with infra control so pin 3 was being used and both the out pins for motor control.So with a picture from the manual of both chips 14m2 and 14m i reassigned the pins then altered the code accordingly. As you are using an 18m this complicates the reassigment as it appears to have a completly different lay out. But if you analysise it carefully and use the two diagrams it should work mine did. I subsequently realised that while the songs were playing I could not control the motors. So as I had brought the complete kit I added the infra to the 14m2 by using irin then i didnt need pin3. Only problem I had was that there is no circuit diagram in the downloaded instructions so in the end I had to solder the infra directly to the bottom of the in pin to make it work. Im sure its just the pin assigments in your case that need altereing. Hope this helps dont give up.
 

Technical

Technical Support
Staff member
You can send the MP3 module back to test and there is always a small possibility that it is faulty, but the other button tests would imply that it is working. Before that we would suggest you attempt a simpler layout, placing the chip directly on the breadboard. There are lots of possible places with your existing hybrid layout for bad joints / connections - have you done a continuity test from pin to pin on each connection?

You can also test with a simpler program, just using the TX pin to trigger the file called '0001.mp3' without using the inputs to detect when it is finished.

Can you also print a screenshot showing the contents of the sd card when inserting into a computer. If the filenames are wrong they will still play with the button - but not with the serial commands.
 
You can send the MP3 module back to test and there is always a small possibility that it is faulty, but the other button tests would imply that it is working. Before that we would suggest you attempt a simpler layout, placing the chip directly on the breadboard. There are lots of possible places with your existing hybrid layout for bad joints / connections - have you done a continuity test from pin to pin on each connection?

You can also test with a simpler program, just using the TX pin to trigger the file called '0001.mp3' without using the inputs to detect when it is finished.

Can you also print a screenshot showing the contents of the sd card when inserting into a computer. If the filenames are wrong they will still play with the button - but not with the serial commands.
Thanks for your reply. I have already tried just using the Tx without the inputs as this is how I intend to use it anyway. I have bitten the bullet and ordered the complete mp3 kit which comes with the 14M project board and another SPE035. By building this I will be able to see which part isn't working - if it's the SPE035 I will send it back and if it's my 18M2 cct I will do as you suggest and rebuild it. Worse case scenario (should be) I end up with one working player and best, I might end up with two! Thanks again for your input.
 
Last edited:
I used one of these in an existing project which had a 14m chip in it, with infra control so pin 3 was being used and both the out pins for motor control.So with a picture from the manual of both chips 14m2 and 14m i reassigned the pins then altered the code accordingly. As you are using an 18m this complicates the reassigment as it appears to have a completly different lay out. But if you analysise it carefully and use the two diagrams it should work mine did. I subsequently realised that while the songs were playing I could not control the motors. So as I had brought the complete kit I added the infra to the 14m2 by using irin then i didnt need pin3. Only problem I had was that there is no circuit diagram in the downloaded instructions so in the end I had to solder the infra directly to the bottom of the in pin to make it work. Im sure its just the pin assigments in your case that need altereing. Hope this helps dont give up.
Hi Bill, thanks for your reply. I will look again at the pin assignment and see if I have it right or not. Please see my reply above to "technical" re buying another kit. I will post back on here when I have it sorted as it may help others in the future. Thanks.

PS Love "Rock Around The Clock" ;)
 
Re-acting to Hex inputs

Following on from my (hopefully) successful build of the mp3 player, I want to choose a track (from 16 available) to play by responding to a logical input across 4 input pins ie 0-F Hex. My idea is to use one of these to select the inputs then a separate input (push button) as a "trigger" to read the other 4 inputs and re-act accordingly via something like a CASE instruction. I can work out most of this myself except how to transpose the 4 inputs from a hex to a decimal output that I can use in the CASE code. I'm thinking it's going to be a logical string of 'ands' and 'nots' eg if p1 = 1 and p2 = 0 and p3 = 1 and p4 = 0 then "variable dec" = 10.

I hope that makes sense. If it helps to understand my request: I am building a model railway with a station. The station will have a speaker that makes various announcements such as "The train now standing at platform........." etc.
 
Right guys, built the Axe-171 kit with spe035 today and it all works fine first time. So tried the original spe035 with the new axe-171 board - zilch. Swapped over the sub module player and Eureka!! That was the problem all along and thankfully nothing I've done! So I've tried both spe035 with the "good" module and my 18M2 code and bread board. and everything working as I want it to. Hoorah! So now I can move on to the next step, post#16 above.

In the mean time, I have a duff mini player module. I'm hoping Picaxe will replace FOC so how do I go about getting that authorised?
 

tmfkam

Senior Member
I seem to recall that on one of my DfPlayer modules, the soldering on the header pins was a little poor giving some low resistance readings on the serial in and busy out pins. Removing some solder with desolder braid then re-soldering them restored working order to the module.


Worth trying?
 
I seem to recall that on one of my DfPlayer modules, the soldering on the header pins was a little poor giving some low resistance readings on the serial in and busy out pins. Removing some solder with desolder braid then re-soldering them restored working order to the module.


Worth trying?
I'll have a look and if I see anything suspicious I might do as you say. Trouble is I don't want to negate any warranty if I have to send it back. Thanks for info.
 
Top