November 21, 2024, 03:46:02 AM

News:

Be sure to checkout our Vixen interfaces in the Library forum -- if you want PC automation at near zero cost, EFX-TEK and Vixen is a great combination of tools.


Using the uMP3 with the Prop-1

Started by JonnyMac, March 04, 2007, 01:09:43 PM

Previous topic - Next topic

livinlowe

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
Shawn
Scaring someone with a prop you built -- priceless!

JonnyMac

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.
Jon McPhalen
EFX-TEK Hollywood Office

tds234

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.

davisgraveyard

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

JonnyMac

April 06, 2008, 03:41:49 PM #19 Last Edit: April 06, 2008, 03:46:16 PM by JonnyMac
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.
Jon McPhalen
EFX-TEK Hollywood Office

ilusion

April 08, 2008, 05:44:22 PM #20 Last Edit: April 08, 2008, 06:24:28 PM by ilusion
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 for example. A solution I used (before I had a USB2SER, which is very nice BTW!) is the Pololu 23201a serial adapter partial kit. Here's a picture of the kit:



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

FWIW, I used uMP3 units in my haunt controllers, my decontamination chamber, the RoboSpinArt machines, and of course THE PONGINATOR. 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 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

--
"Why are we in this Handbasket? And where are we going?!"

davisgraveyard

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

davisgraveyard

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

ilusion

April 09, 2008, 06:35:03 PM #23 Last Edit: April 09, 2008, 06:37:45 PM by ilusion
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
--
"Why are we in this Handbasket? And where are we going?!"

ilusion

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
--
"Why are we in this Handbasket? And where are we going?!"

davisgraveyard

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

ilusion

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
--
"Why are we in this Handbasket? And where are we going?!"

JonnyMac

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
Jon McPhalen
EFX-TEK Hollywood Office

ilusion

April 10, 2008, 10:10:14 AM #28 Last Edit: April 10, 2008, 10:11:48 AM by ilusion
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

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! :)
--
"Why are we in this Handbasket? And where are we going?!"

davisgraveyard

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