EFX-TEK

TEK Talk => Audio => Rogue Robotics uMP3 Player => Topic started by: JonnyMac on March 04, 2007, 01:09:43 PM

Title: Using the uMP3 with the Prop-1
Post by: JonnyMac on March 04, 2007, 01:09:43 PM
The uMP3 player from Rogue Robotics (http://www.roguerobotics.com/) is a great way to add high-quality, stereo audio to your prop or display, and with just a little bit of effort and code (provided below), you can control it with the Prop-1.

The uMP3 player requires two control lines: TX (transmit to) and RX (receive from).  The Prop-1.TX pin (5) will connect to the uMP3.R pin; the Prop-1.RX pin (4) will connect to the uMP3.T pin.  The Prop-1 can provide 5v power to the uMP3 as well.  I typically build a custom cable.   As with other serial devices, the ULN2803 output driver chip will interfere with the uMP3 player and needs to be modified.  This is easy: simply pull the ULN2803 from its socket, remove pins 1 - 4 (corresponds to I/O P5 - P4) with diagonal cutters, and then reinstall the ULN2803.  Use the diagram below as a guide for removing the correct pins from the ULN2803 (the dotted line idicates the UN2003, the seven-channel version).

(http://www.efx-tek.com/files/uln2803_p4-p7.jpg)

By removing pin 1 of the ULN2803 the P7 output is available for serial communications with EFX-TEK serial accessories like the DC-16 and RC-4.

To connect the Prop-1 to the uMP3 I built a custom cable using 0.025" female crimp pin sockets and shells.  These parts are available from www.jameco.com:

Part numbers edited: 26 JAN 2008


#100766   female crimp pin
#108812   2-pin shell
#157382   3-pin shell
#159266   crimper tool

Use #22-gauge stranded wire to make the cable. Here's a diagram of my cable:

(http://www.efx-tek.com/files/ump3_custom_cable.jpg)


black   Vss (ground)
red   Vdd (+5vdc)
white   transmit (to uMP3)
yellow   receive (from uMP3)

Note that you may need to reconfigure the uMP3 to work with the Prop-1's baud rate.  For this you'll need to connect your PC to the uMP3 and use a terminal to change the uMP3 settings, specifically the baud and response delay parameters.  Complete details on this process as well as loading new firmware into the uMP3 are explained in my Nuts & Volts column from December 2005; you can read that article online here:

http://www.parallax.com/dl/docs/cols/nv/vol6/col/nv128.pdf

I've found that the easiest way to connect to the uMP3 is with Parallax's USB2SER converter.  You can find it here:

http://www.parallax.com/detail.asp?product_id=28024

The program below is fairly full-featured as it will let you play from a list of files store in an EEPROM table.  To play a file you'll put the file number into a variable called "theMP3" and then call the Play_MP3 subroutine.  The subroutine will wait until the file is done before returning.  The program is constructed such that you can return to the main body without waiting for the song to finish, and then check on it later with the Check_Status subroutine.


' =========================================================================
'
'   File....... uMP3_Demo.BS1
'   Purpose....
'   Author..... Jon Williams, EFX-TEK
'   E-mail..... jwilliams@efx-tek.com
'   Started....
'   Updated....
'
'   {$STAMP BS1}
'   {$PBASIC 1.0}
'
' =========================================================================


' -----[ Program Description ]---------------------------------------------


' -----[ Revision History ]------------------------------------------------


' -----[ I/O Definitions ]-------------------------------------------------

SYMBOL  Sio             = 7                     ' for DC-16, RC-4; no ULN
SYMBOL  Trigger         = PIN6                  ' setup = DN
SYMBOL  TX              = 5                     ' to UMP3.R; no ULN
SYMBOL  RX              = 4                     ' to UMP3.T; no ULN


' -----[ Constants ]-------------------------------------------------------

SYMBOL  Baud            = OT2400

SYMBOL  Yes             = 1
SYMBOL  No              = 0


' -----[ Variables ]-------------------------------------------------------

SYMBOL  char            = B2                    ' character value
SYMBOL  theMP3          = B3                    ' MP3 file pointer
SYMBOL  eePntr          = B4                    ' EEPROM memory pointer
SYMBOL  lottery         = W5                    ' random value


' -----[ Initialization ]--------------------------------------------------

Reset:
  PAUSE 2000                                    ' let uMP3 start

Prod_uMP3:
  SEROUT TX, Baud, (13)                         ' send CR
  SERIN  RX, Baud, char                         ' get response
  IF char <> ">" THEN Prod_uMP3                 ' wait for ">"


' -----[ Program Code ]----------------------------------------------------

Main:
  RANDOM lottery
  IF Trigger = No THEN Main

  theMP3 = lottery // 3                         ' make 0 - 2
  GOSUB Play_MP3                                ' play it

  PAUSE 5000
  GOTO Main


' -----[ Subroutines ]-----------------------------------------------------

' Put file # to play in "theMP3"
' -- "theMP3" will be modified by subroutine

Play_MP3:
  eePntr = 0                                    ' reset pointer
  IF theMP3 = 0 THEN Send_Cmd                   ' at position, play it

Fast_Fwd:                                       ' move to selected title
  READ eePntr, char                             ' retrieve a character
  eePntr = eePntr + 1                           ' advance pointer
  IF char <> 0 THEN Fast_Fwd                    ' if not ., try again
    theMP3 = theMP3 - 1                         ' else, decrement file#
    IF theMP3 > 0 THEN Fast_Fwd                 ' if > 0, not at title yet

Send_Cmd:
  SEROUT TX, Baud, ("PC F /")                   ' start play command

Send_Name:                                      ' send file title
  READ eePntr, char
  eePntr = eePntr + 1
  IF char = 0 THEN Finish_Cmd
    SEROUT TX, Baud, (char)
    GOTO Send_Name

Finish_Cmd:
  SEROUT TX, Baud, (".MP3", 13)                 ' send extention + CR

Wait_For_Stop:                                  ' let song finish
  PAUSE 100
  GOSUB Get_Status
  IF char <> "S" THEN Wait_For_Stop
    RETURN

' -------------------------------------------------------------------------

Get_Status:
  SEROUT TX, Baud, ("PC Z", 13)                 ' request status
  SERIN  RX, Baud, char                         ' will be "S" or "P"
  RETURN


' -----[ EEPROM Data ]-----------------------------------------------------

' MP3 files are stored in root of SD card
' Table below needs only name, followed by a zero
' Keep names short to conserve EE space

MP3s:
  EEPROM ("Hello", 0)                           ' file #0
  EEPROM ("Wolf", 0)                            ' file #1
  EEPROM ("Scream", 0)                          ' file #2



Title: Re: Using the uMP3 with the Prop-1
Post by: JonnyMac on March 04, 2007, 02:51:36 PM
And if you're wondering how to do that same thing with a Prop-2, here's how (Note that I take advantage, where possible, of PBASIC 2.5 features):


' =========================================================================
'
'   File....... uMP3_Demo.BS2
'   Purpose....
'   Author..... Jon Williams, EFX-TEK
'   E-mail..... jwilliams@efx-tek.com
'   Started....
'   Updated....
'
'   {$STAMP BS2}
'   {$PBASIC 2.5}
'
' =========================================================================


' -----[ Program Description ]---------------------------------------------


' -----[ Revision History ]------------------------------------------------


' -----[ I/O Definitions ]-------------------------------------------------


Sio             PIN     15                      ' for DC-16, RC-4; no ULN
TX              PIN     14                      ' to UMP3.R; no ULN
RX              PIN     13                      ' to UMP3.T; no ULN
Trigger         PIN     12                      ' setup = DN


' -----[ Constants ]-------------------------------------------------------

#SELECT $STAMP
  #CASE BS2, BS2E, BS2PE
    T2400       CON     396
    T4800       CON     188
    T9600       CON     84
    T19K2       CON     32
    T38K4       CON     6
  #CASE BS2SX, BS2P
    T2400       CON     1021
    T4800       CON     500
    T9600       CON     240
    T19K2       CON     110
    T38K4       CON     45
#ENDSELECT

Inverted        CON     $4000
Open            CON     $8000
EfxBaud         CON     Open | T38K4            ' for DC-16, RC-4
ump3Baud        CON     Open | T9600            ' for uMP3 player

Yes             CON     1
No              CON     0


' -----[ Variables ]-------------------------------------------------------

char            VAR     Byte                    ' character value
theMP3          VAR     Byte                    ' MP3 file pointer
eePntr          VAR     Word                    ' EEPROM memory pointer
pos             VAR     Word                    ' uMP3 file position
loopNum         VAR     Byte                    ' file loop # in cycle
lottery         VAR     Word                    ' random value


' -----[ Initialization ]--------------------------------------------------

Reset:
  PAUSE 2000                                    ' let uMP3 start

Prod_uMP3:
  DO
    SEROUT TX, ump3Baud, [CR]                   ' send CR
    SERIN  RX, ump3Baud, [char]                 ' get response
  LOOP UNTIL (char = ">")                       ' wait for ">"


' -----[ Program Code ]----------------------------------------------------

Main:
  RANDOM lottery
  IF (Trigger = No) THEN Main

  theMP3 = lottery // 3                         ' make 0 - 2
  GOSUB Play_MP3                                ' play it

  PAUSE 5000
  GOTO Main


' -----[ Subroutines ]-----------------------------------------------------

' Put file # to play in "theMP3"
' -- add DATA label entries to LOOKUP as required

Play_MP3:
  LOOKUP theMP3, [SFX0, SFX1, SFX2,
                  SFX3, SFX4, SFX5], eePntr     ' get base address

Send_Play_Cmd:
  SEROUT TX, ump3Baud, ["PC F /"]               ' start play command

Send_Name:                                      ' send file title
  DO
    READ eePntr, char
    eePntr = eePntr + 1
    IF char = 0 THEN EXIT
    SEROUT TX, ump3Baud, [char]
  LOOP

Finish_Cmd:
  SEROUT TX, ump3Baud, [".MP3", CR]             ' send extention + CR

Wait_For_Stop:                                  ' let song finish
  DO
    GOSUB Get_Status
  LOOP UNTIL (char = "S")
  RETURN

' -------------------------------------------------------------------------

' Gets status from uMP3
' -- "P" = playing, "D" = paused, "S" = stopped
' -- also gets file position and loop number of play cycle

Get_Status:
  SEROUT TX, ump3Baud, ["PC Z", CR]
  SERIN  RX, ump3Baud, [char, DEC pos, DEC loopNum]
  RETURN


' -----[ EEPROM Data ]-----------------------------------------------------

' MP3 files are stored in root of SD card
' Table below needs only name, followed by a zero
' Keep names short to conserve EE space

SFX0            DATA    "Hello", 0
SFX1            DATA    "Wolf", 0
SFX2            DATA    "Scream", 0
SFX3            DATA    "Chuckie", 0
SFX4            DATA    "Exorcist", 0
SFX5            DATA    "Lightning", 0
Title: Re: Using the uMP3 with the Prop-1
Post by: JonnyMac on March 04, 2007, 04:47:41 PM
Prop-1 version redux.

As you can see, the BS2 has the ability to resolve DATA label addresses at compile time.  The BS1 can't do this, but I can, so I decided to update the first program using manual address resolution to see if it saved any space.  It does.  This means you can add more file names to the program which is more valuable to a prop than searching through a list of names looking for zeros (that also takes time).

To add another file to this version of the program you would need to to two things:

1. Add the EEPROM statement at the end -- don't forget the trailing zero.
2. Update the LOOKUP statement at the beginning of the Play_MP3 subroutine to include the new address.

You can count the characters manually, which I do, but then I also confirm by using the Memory Map view set to ASCII mode.  I've highlighted the starting characters of each file.  Remember that the Memory Map uses hexadecimal mode, so $000 [row] + $B [column]= $B [address] --> 11 (starting location for "Scream").

(http://www.efx-tek.com/files/ump3_mem_map.png)


' =========================================================================
'
'   File....... uMP3_Demo-v2.BS1
'   Purpose....
'   Author..... Jon Williams, EFX-TEK
'   E-mail..... jwilliams@efx-tek.com
'   Started....
'   Updated....
'
'   {$STAMP BS1}
'   {$PBASIC 1.0}
'
' =========================================================================


' -----[ Program Description ]---------------------------------------------


' -----[ Revision History ]------------------------------------------------


' -----[ I/O Definitions ]-------------------------------------------------

SYMBOL  Sio             = 7                     ' for DC-16, RC-4; no ULN
SYMBOL  Trigger         = PIN6                  ' setup = DN
SYMBOL  TX              = 5                     ' to UMP3.R; no ULN
SYMBOL  RX              = 4                     ' to UMP3.T; no ULN


' -----[ Constants ]-------------------------------------------------------

SYMBOL  Baud            = OT2400

SYMBOL  Yes             = 1
SYMBOL  No              = 0


' -----[ Variables ]-------------------------------------------------------

SYMBOL  char            = B2                    ' character value
SYMBOL  theMP3          = B3                    ' MP3 file pointer
SYMBOL  eePntr          = B4                    ' EEPROM memory pointer
SYMBOL  lottery         = W5                    ' random value


' -----[ Initialization ]--------------------------------------------------

Reset:
  PAUSE 2000                                    ' let uMP3 start

Prod_uMP3:
  SEROUT TX, Baud, (13)                         ' send CR
  SERIN  RX, Baud, char                         ' get response
  IF char <> ">" THEN Prod_uMP3                 ' wait for ">"


' -----[ Program Code ]----------------------------------------------------

Main:
  RANDOM lottery
  IF Trigger = No THEN Main

  theMP3 = lottery // 3                         ' make 0 - 2
  GOSUB Play_MP3                                ' play it

  PAUSE 5000
  GOTO Main


' -----[ Subroutines ]-----------------------------------------------------

' Put file # to play in "theMP3"
' -- add starting location(s) of file names manually

Play_MP3:
  LOOKUP theMP3, (0, 6, 11), eePntr

Send_Cmd:
  SEROUT TX, Baud, ("PC F /")                   ' start play command

Send_Name:                                      ' send file title
  READ eePntr, char
  eePntr = eePntr + 1
  IF char = 0 THEN Finish_Cmd
    SEROUT TX, Baud, (char)
    GOTO Send_Name

Finish_Cmd:
  SEROUT TX, Baud, (".MP3", 13)                 ' send extention + CR

Wait_For_Stop:                                  ' let song finish
  GOSUB Get_Status
  IF char <> "S" THEN Wait_For_Stop
    RETURN

' -------------------------------------------------------------------------

Get_Status:
  SEROUT TX, Baud, ("PC Z", 13)                 ' request status
  SERIN  RX, Baud, char                         ' will be "S" or "P"
  RETURN


' -----[ EEPROM Data ]-----------------------------------------------------

' MP3 files are stored in root of SD card
' Table below needs only name, followed by a zero
' Keep names short to conserve EE space

MP3s:
  EEPROM ("Hello", 0)                           ' file #0, eePntr = 0
  EEPROM ("Wolf", 0)                            ' file #1, eePntr = 6
  EEPROM ("Scream", 0)                          ' file #2, eePntr = 11
Title: Re: Using the uMP3 with the Prop-1
Post by: avgjoefriday on January 26, 2008, 01:57:41 PM
Hi Jon,

I am considering trying out a uMP3 after this post. Thanks for the details!
I hopped over to Jameco's website and it seems some of the part numbers have changed since this post.

I think these are correct, but was hoping someone could confirm.

http://www.jameco.com/Jameco/catalogs/c281/P103.pdf
Jameco #100766, Mfg # JS-1105-T-R, Female Crimp Pin
Jameco #100812, Mfg # JS-1108-02-R, 2-pin shell
Jameco #157383, Mfg # JS-1108-3-R, 3-pin shell

http://www.jameco.com/Jameco/catalogs/c281/P188.pdf
Jameco #159266, Mfg # HT-213-R, D-Sub Pin Crimping Tool

Thanks!

Scott
Title: Re: Using the uMP3 with the Prop-1
Post by: JonnyMac on January 26, 2008, 02:18:21 PM
Thanks for the heads-up, Scott; I've updated the part numbers in the original post.
Title: Re: Using the uMP3 with the Prop-1
Post by: avgjoefriday on January 26, 2008, 07:26:22 PM
Jon,

The uMP3 appears to have two ground pins now in its header row.  Based upon the N&V column and the posts above, I am guessing the ground in your picture goes to the input power ground pin.  Can the uMP3's TTL serial ground pin remain unused?

Layout here:
http://www.roguerobotics.com/files/ump3/documentation/UMP3-110-A1-102.pdf

Thanks
Scott

Title: Re: Using the uMP3 with the Prop-1
Post by: JonnyMac on January 26, 2008, 07:45:22 PM
If you're connecting the uMP3 to the Prop-1, Prop-2, or Prop-SX with the cable assembly I describe above, you only need one -- ground on the uMP3 is common.  If you're using a separate power supply, then you'll want to use ground near the RX and TX pins to connect to the controller, and the other ground will go to the external supply.
Title: Re: Using the uMP3 with the Prop-1
Post by: tds234 on March 30, 2008, 09:14:13 AM
 For anyone considering these devices I want to stress how important it is to set the response timeout when using these with a prop controller like a Prop-1. Once again, Jon comes through. I was struggling with a uMP3  for quite a while and getting very little assistance from the OEM but looking through the column that Jon wrote I find the 'ST R" command that happens to be undocumented by the original company in the documentation that I was able to download from them. Once this was set to 'ST R 5' everything started to work swimmingly. And these devices, although a tad expense, rock if you want very complex sound systems under complete serial control. I don't mean to take ANYTHING away from the AP-8 (I have a few of those and like them very well) but having the ability to play MP3's opens up a bunch more possibilities than either the AP-8 or the Cowlacious boards (again I have many of both of those two and I like them for more limited sound effects situations). The sound quality is a high as the MP3 you make and you can spend time editing your sound to get it exactly the way you want without having to worry about re-recording.
Title: Re: Using the uMP3 with the Prop-1
Post by: davisgraveyard on April 03, 2008, 08:49:39 PM
OK, I have the uMP3 and I made your custom cable with all the correct parts from Jameco.   I am trying to connect it to Hyperterminal to see what version of the Firmware I have.   I am using the cable connected to a Prop-2 to give the uMP3 power.  I am using my USB to serial connector that I use for Prop-1 programming and connecting it to the uMP3.   But I am not seeing the ">" character show up?  I can hit enter and I see the activity light flash on the uMP3.   I have the port set to 9600 N-8-1 and flow control is set to none.  The USB device is coming up as COM5 and it works fine when I use the pBASIC IDE.   

I want to send the ST R 5  command to get it configured so I can program the Prop-2 to play a sound.   

Any suggestions?

Jeff
Title: Re: Using the uMP3 with the Prop-1
Post by: JonnyMac on April 03, 2008, 10:28:46 PM
I don't think I understand how you're connecting to the uMP3.  I always use a Parallax USB2SER as it provides the USB to TTL serial conversion and has separate RX and TX pins (you need that for the uMP3). 
Title: Re: Using the uMP3 with the Prop-1
Post by: davisgraveyard on April 04, 2008, 10:05:26 AM
I am using the USB Serial Adaptor with the BS1 Serial Adaptor attached so I can connect it to the uMP3. 

A picture is worth a 1000 words.

(http://www.davisgraveyard.com/img_0047.jpg)
Title: Re: Using the uMP3 with the Prop-1
Post by: JonnyMac on April 04, 2008, 04:44:21 PM
The BS1 Serial Adapter will not work -- it doesn't use the same polarity as standard serial signals.
Title: Re: Using the uMP3 with the Prop-1
Post by: davisgraveyard on April 05, 2008, 07:33:40 PM
SO I could just build a 9pin-din with 2 wires coming off the correct pins to connect it to the uMP3?

Title: Re: Using the uMP3 with the Prop-1
Post by: davisgraveyard on April 05, 2008, 07:42:31 PM
The USB2SER from Parallax is $32.95.   Seems kinda expensive for just talking to the uMP3 which only cost me $99.    THe USB to Serial Adaptor from you guys is only $14.95.  Seems like that gets me close and I already have one.   What do you suggest?

Title: Re: Using the uMP3 with the Prop-1
Post by: JonnyMac on April 06, 2008, 12:40:58 AM
The Parallax USB2SER is not the only adapter available, it's just the only one I've used.  If you can find a cheaper adapter that goes from serial (or USB) to TTL serial in True mode (the BS1 serial adapter doesn't, and the USB to Serial adapter does not give you TTL levels) then that will work. 

I don't mean to sound insensitive, but this problem was not created by Parallax or EFX-TEK -- it is Rogue that made a device that requires a PC for setup yet is not easy to connect to a PC....

You could always try to send the new setup commands with a Prop-2, but you wouldn't be able to get the feedback easily.
Title: Re: Using the uMP3 with the Prop-1
Post by: livinlowe on April 06, 2008, 11:25:34 AM
As far as the USB2ser goes, while it may be a bit expensive, from what I've read on the parallax forums, it also the one that works. I'm looking to get a laptop soon, and I'm sure I'll be joining you in contemplating buying one  :P
Title: Re: Using the uMP3 with the Prop-1
Post by: JonnyMac on April 06, 2008, 01:14:57 PM
The USB2SER is very useful tool; at the moment I've got one hooked up to a different MP3 player that I'm experimenting with.  In my book it's worth the money -- it can be used to connect a PC to any kind of microcontroller circuit.
Title: Re: Using the uMP3 with the Prop-1
Post by: tds234 on April 06, 2008, 01:19:03 PM
I'll tell you what I did:

1) I hooked up the device to the EFX-tek serial inverter. I tied the TX and RX wires together to the white wire on the inverter and used Hyperterminal to get it going. Once I got the ">" back and achieved basic connectivity I set the baud rate to 2400. I never got this connection to work for more than one command in a row.

2) With the Baud rate now set to something that the Prop-1 can handle I wrote a few lines in my program to set the other settings that I needed:
  PAUSE 10000                                    ' let uMP3 start
  SEROUT TX, Baud, ("ST R 5", 13)
  SEROUT TX, Baud, ("ST H 1",13)
  DEBUG "start"

3) Now it all works for me under basic serial control. I use separate TX and RX lines on the prop controller to talk to it (wish it worked more like the EFX-TEK devices and didn't chew up 2 pins)

If it's still causing you problems I'll set it all up and take a photo if you need it.
Title: Re: Using the uMP3 with the Prop-1
Post by: davisgraveyard on April 06, 2008, 02:41:07 PM
Jon, should I get the EFX-Tek serial inverter instead of the USB2SER?   I am also going to be doing some Vixen work with the Prop-2 to control servos along with the uMP3.     I don't care if the USB2SER is a little expensive for an adapter if it is the easiest way to do things I will get it.  But the Serial Inverter sounds like it is needed for Vixen programming so.....???

Jeff
Title: Re: Using the uMP3 with the Prop-1
Post by: JonnyMac on April 06, 2008, 03:41:49 PM
Let me try to clarify: you need the USB2SER from Parallax.  This device translates USB serial to TTL-level serial with separate channels (TX and RX) -- with this you can connect to the uMP3 player for configuration, or to the VMUSIC2 player, as I'm doing today (to run the player from a terminal). 

The neat thing about the VMUSIC player is that the provide you with a configuration utility that lets you put a new bootloader onto the USB flash dirve to update the player -- I did this today so that I could commuicate at 38.4K baud (its default is 9600). 

"Scary" Terry Simmons will be posting information on his web site today about using the VMUSIC player with the Prop-1 and Prop-2.  I just started playing today and will be focusing on the SX.
Title: Re: Using the uMP3 with the Prop-1
Post by: ilusion on April 08, 2008, 05:44:22 PM
Quote from: davisgraveyard on April 05, 2008, 07:42:31 PM
The USB2SER from Parallax is $32.95.   Seems kinda expensive for just talking to the uMP3 which only cost me $99. <snip> What do you suggest?

Just about anything that will level shift from RS-232 (+/-12v) to TTL (5V) should work, a MAX-232 chip (http://sodoityourself.com/max232-serial-level-converter) for example. A solution I used (before I had a USB2SER, which is very nice BTW!) is the Pololu 23201a serial adapter partial kit (http://www.pololu.com/catalog/product/127). Here's a picture of the kit:

(http://www.pololu.com/picture/thumbnail/0J110.jpg?size=200)

It retails for $9.99 + shipping, or you can spend $11.50 for the same thing if you don't want to spend a few moments soldering the .100 pins and the DB9 shell (the SMT chip comes pre-soldered on the "kit" version, hence the "partially assembled notation). :)

Also, I did a LOT of experimenting with the uMP3. In fact, the proof-of-concept code demo I sent to Rogue was the reason for the addition of the "ST R 5" string which, by the way, specifies how long the uMP3 should pause (mS? uS? can't remember) after it receives a command before it sends a response. If I recall correctly, the reason for the pause is to give the Basic Stamp time to switch from performing a serial "xmit" mode to performing a serial "receive" mode. :)

And, for anyone who wants to play with it, I created a BSII based demo for the uMP3 that causes the player to play an "ambient" sound continuously and then jumps to an "event" sound when a trigger is sensed on the BSII. The code for the demo is here:

http://www.spiderspreyground.com/howto/ump3 (http://www.spiderspreyground.com/howto/ump3)

FWIW, I used uMP3 units in my haunt controllers (http://www.spiderspreyground.com/howto/hcboard/images/14-hc-insitu.jpg), my decontamination chamber (http://www.spiderspreyground.com/howto/Decon-Demo-1.wmv), the RoboSpinArt (http://www.robospinart.com/site/index.php/media/) machines, and of course THE PONGINATOR (http://www.youtube.com/watch?v=iPSoFYHywJw). I've been very pleased with them. :)

IMPORTANT NOTE: If the unit ever goes to a "LED is constantly lit, but unit no longer responds/plays", you just need to use the FIRMWARE UPDATE tool (http://www.roguerobotics.com/files/ump3/firmware/ump3-110-12.zip) from the Rogue Robotics web site to download the firmware to the uMP3 from your PC to restore function.

This is the one show-stopper annoyance I've seen occur (once in a while) with some of the units I have.

Hope this helps anyone trying to use this neat little player. ;D

Vern

Title: Re: Using the uMP3 with the Prop-1
Post by: davisgraveyard on April 09, 2008, 06:05:36 PM
OK, I got my USB2SER today from parallax. I was able to use hyperterminal to check the version and set the timeout.  I also used it to test the uMP3 and play a sound file on the media card.

Now I am trying to play the same file using a Prop-2 controller.  I have made my cable.  But before I go choping off pins I want to make sure that is what I need to do for the Prop-2?   If I start hacking up my ULN2308 chip then I am sort of stuck with using this uMP3 with the Prop-2 I have huh?   Does the ULN2003 do anything for me?  I have one of those too?

With the Prop-2 I have all sorts of pins available.   Any reason I need to use 4 & 5?   I am also going to control 4 servos with this board and 2 pairs of LED's.   So including the uMP3 I will have 8 outputs (2 for the uMP3, 4 servos, 2 LED pairs).   How would you lay it out on the Prop-2?

Jeff
Title: Re: Using the uMP3 with the Prop-1
Post by: davisgraveyard on April 09, 2008, 06:11:01 PM
For those that have used the uMP3 with a prop.  How did you handle the amplification of the audio signal?  Powered Speakers?   Run the signal to a amplifier then to the speakers?   The audio level coming off of the uMP3 doesn't seem loud enough to use directly?

Jeff
Title: Re: Using the uMP3 with the Prop-1
Post by: ilusion on April 09, 2008, 06:35:03 PM
Quote from: davisgraveyard on April 09, 2008, 06:05:36 PMWith the Prop-2 I have all sorts of pins available.   Any reason I need to use 4 & 5?

For what its worth, you don't need to use TWO pins if all you want to do is tell the uMP3 to play a sound/song. One pin is for sending the command to the uMP3, the 2nd pin is to receive status back from the uMP3.

In most of my systems, I use just ONE pin to send a command to the player. Basically I expect the uMP3 to play the song I instruct it to play. I don't bother waiting for the response from the player and then examining that response.

Waiting for the response from the player is "blocking code" i.e. Your BSII will "hang" waiting for serial input. If it doesn't come, you can have the BSII time out and continue, but during that wait time it cannot execute any code. By sending the the command, then continuing on in the program I avoid a situation where the BSII could "hang" for the SERIN timeout period and possibly screw up the show. :)

I only hook up both pins if I need to get status back from the player (i.e. wait for notification from uMP3 that sound is finished, then do next step) or when I'm debugging. :)

Vern
Title: Re: Using the uMP3 with the Prop-1
Post by: ilusion on April 09, 2008, 06:36:47 PM
Quote from: davisgraveyard on April 09, 2008, 06:11:01 PMFor those that have used the uMP3 with a prop.  How did you handle the amplification of the audio signal?  Powered Speakers?

I've used computer speakers and I've also run the output into a mixer/pa system. The output from the uMP3 is "line level" not even loud enough to run headphones IIRC.

Vern
Title: Re: Using the uMP3 with the Prop-1
Post by: davisgraveyard on April 09, 2008, 06:40:55 PM
I was just going to ask if both pins were really needed.  Seems like the fire and forget approach would be fine.    I am going to use the uMP3 with a talking skull.  So it will be important to keep the sound file being played in sync with the servo motions being sent.  I still think a single transmit of PC F /file.mp3 is all I need.   I can't think of a reason to use the recieve unless I want to check on the status of the file being played and use it to sync the movements?

Jeff
Title: Re: Using the uMP3 with the Prop-1
Post by: ilusion on April 10, 2008, 08:41:03 AM
Quote from: davisgraveyard on April 09, 2008, 06:40:55 PMI can't think of a reason to use the receive
An example I can think of off the top of my head:

1) You send a command to play "dialog" for your skull
2) You poll the uMP3 waiting for the sound to finish
3) When "sound finished" is detected, you:
-- send a command to turn on a strobe light
-- send a command to the uMP3 to play a thunder shot
4) You poll the uMP3 waiting for the sound to finish
5)  Send a command to turn off the strobe light

Now granted, the above sequence (i.e. speech followed by thunder and lighting) could be done in a "fire and forget" mode by setting a "pause" command in your code equivalent to the length of the speech.

However, by using feedback from the uMP3 you could change the speech by swapping memory cards or use the RANDOM command to choose different stored speeches of different length w/o having to change your code. :) Does this make sense?

Vern
Title: Re: Using the uMP3 with the Prop-1
Post by: JonnyMac on April 10, 2008, 09:01:08 AM
I would recommend the feedback line as well; it lets you know that the uMP3 is in fact ready as well as status that you can use as Vern points out above. 

BTW, another MP3 player that works via serial but has no stand-alone input is the Vinculum VMUSIC2.  It only costs about $40 and can be configured to work with the Prop-1, Prop-2, or Prop-SX.  Like the uMP3 player, it really should use two lines (TX and RX).  Scary Terry has a write-up on his web site.

http://www.scary-terry.com/vm2/vm2.htm
Title: Re: Using the uMP3 with the Prop-1
Post by: ilusion on April 10, 2008, 10:10:14 AM
Quote from: JonnyMac on April 10, 2008, 09:01:08 AMBTW, another MP3 player that works via serial but has no stand-alone input is the Vinculum VMUSIC2.

Thats a very cool device. One of the guys in our local robot group brought one out for a bit of show and tell. :) Another item in the "serial controlled MP3 player" is the Daisy unit:

http://www.teuthis.com/html/daisy_mp3.html (http://www.teuthis.com/html/daisy_mp3.html)

I picked up the kit at the last Maker Faire and built one. Its very nice as well, though a bit on the pricey side (about the same cost as the uMP3+import/shipping).

I think the reason I stick with the uMP3 is that I already know how to control it and I have code snips I can easily recycle from other programs. cut/paste done! :)
Title: Re: Using the uMP3 with the Prop-1
Post by: davisgraveyard on April 11, 2008, 11:07:07 AM
I am using a Prop-2 to play a single MP3 on the uMP3.   I have built the cable.  I have used a USB2SER to setup the uMP3.   But when I try to play the MP3 from the Prop-2 nothing happens.   I have removed pin 15-13 on the left side of the ULN.    I am sure the cable is correct and connected to the proper pins.   What else could be wrong?   Does the setup pins on the Prop-2 matter?   There are all on the DN side?

Here is the program

' =========================================================================
'
'   {$STAMP BS2}
'   {$PBASIC 2.5}
'
' =========================================================================


' -----[ I/O Definitions ]-------------------------------------------------

TX              PIN     14                      ' to UMP3.R; no ULN
RX              PIN     13                      ' to UMP3.T; no ULN

' -----[ Constants ]-------------------------------------------------------

T9600           CON     84
Open            CON     $8000
ump3Baud        CON     Open | T9600            ' for uMP3 player


' -----[ Variables ]-------------------------------------------------------

char            VAR     Byte                    ' character value
pos             VAR     Word                    ' uMP3 file position
loopNum         VAR     Byte                    ' file loop # in cycle


' -----[ Initialization ]--------------------------------------------------

Reset:
  PAUSE 2000                                    ' let uMP3 start

Prod_uMP3:
  DO
    SEROUT TX, ump3Baud, [CR]                   ' send CR
    SERIN  RX, ump3Baud, [char]                 ' get response
  LOOP UNTIL (char = ">")                       ' wait for ">"


' -----[ Program Code ]----------------------------------------------------

Main:
  GOSUB Play_MP3                                ' play it

  PAUSE 5000
  GOTO Main


' -----[ Subroutines ]-----------------------------------------------------

Play_MP3:

  SEROUT TX, ump3Baud, ["PC F /SPEACH.MP3",CR]               ' start play command

Wait_For_Stop:                                  ' let song finish
  DO
    GOSUB Get_Status
  LOOP UNTIL (char = "S")
  RETURN

' -------------------------------------------------------------------------

' Gets status from uMP3
' -- "P" = playing, "D" = paused, "S" = stopped
' -- also gets file position and loop number of play cycle

Get_Status:
  SEROUT TX, ump3Baud, ["PC Z", CR]
  SERIN  RX, ump3Baud, [char, DEC pos, DEC loopNum]
  RETURN
Title: Re: Using the uMP3 with the Prop-1
Post by: JonnyMac on April 11, 2008, 01:28:23 PM
Make sure that P14 is connected to the R input on the uMP3, and that P13 is connect to the T output.  Also, you should have common ground between the two boards.

I've always had good luck with the uMP3 and can't see why your program shouldn't work.
Title: Re: Using the uMP3 with the Prop-1
Post by: davisgraveyard on April 11, 2008, 05:59:10 PM
What do you mean by common ground between the two boards?   The black wire of the cable is conneced to the G on the uMP3 and to the B pin of P13.

Title: Re: Using the uMP3 with the Prop-1
Post by: davisgraveyard on April 11, 2008, 06:33:17 PM
Looks like I got it working.  The email I got with your post isn't showing up here?   You suggested using T9600 intead what you were doing in yours.  That did the trick.  It is working great now.  Now I just need to record a real speach, get the moving skull working, and program the head movements to the audio.  No problem.

Jeff
Title: Re: Using the uMP3 with the Prop-1
Post by: JonnyMac on April 11, 2008, 06:47:44 PM
Glad you got it working, Jeff.  I know how frustrating chasing gremlins can be.  I've spend the last week trying to make the SX48 behave nicely as a motor controller using its internal PWM generators -- it has been ugly at times.  Celebrate small victories as they always lead to larger ones.