May 12, 2024, 01:27:29 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.


Simple Prop1/VM2 Question

Started by Specter, October 19, 2009, 06:02:22 AM

Previous topic - Next topic

Specter

Just a quickie here-

I am using a single Prop1 to control 3 different props. Here's what I want to happen:

Tree- light comes on, plays tree.mp3 on vm2, light fades off when sound is done
Tomb- motor comes on, immediately plays tomb.mp3, motor turns off when sound is done
Grave - motor comes on and runs for xx seconds, motor turns off.

The 3 props will be ran with a xx second gap in between each other.

Question 1: Can the prop1 play specific sound files off the VM2? Or does it have to play all the tracks at the same time until they finish?

Question 2: Is there a problem with running a motor off the prop 1 (again, using relays) while at the same time playing a sound file on the VM2? Or do we have to wait for the sound file on the VM2 to finish playing before I can run the motor?

I wish I had bought a different mp3 player board- didn't know this was such a pain in the butt to get working until after I bought it. Maybe I'll switch it out in the future! I wanted an AP8 but the website says out of stock... ;(

Thanks for the help!

livinlowe

1. Yep, see this thread : http://www.efx-tek.com/php/smf/index.php?topic=1081.0

2. Yes, you would send a play command to the VM2, then continue on with your program.

Yeah, the Vmusic is a pain. I haven't got mine working because I don't have a USB memory stick under 1G (and try finding one, sheeesh!) to flash the memory on it.

Hope this helps!
Shawn
Scaring someone with a prop you built -- priceless!

Specter

Oh man- I didn't know that about it! It needs a 1G stick or less in order to flash the memory? DANG... that's a problem! Shoot- maybe I can order something else. What do you recommend instead?

livinlowe

October 19, 2009, 06:39:46 AM #3 Last Edit: October 19, 2009, 06:47:57 AM by livinlowe
Well, don't take my advice as "the bible". I just looked at this : http://www.scary-terry.com/vm2/vm2_trouble.htm

I recommend the uMP3 player from rogue robotics. About $70. (Edit: You have to use the boo42 promo code to get this price.) If that's too steep, then the CAP/3 player from cowlicous. Here are the links:

http://www.cowlacious.com/AudioProd.htm

www.roguerobotics.com/products/electronics/ump3

You can get sub 1G USB drives from TigerDirect. But at ~$6, you have to buy something else or your shipping is as much as the product! (more if you want it quick)

Hope this helps!
Shawn
Scaring someone with a prop you built -- priceless!

Specter

ok, thanks for the help. I'll try to cancel my order before they ship it out. If not, maybe I'll give this a go this year...
Thanks!

JonnyMac

I'm with Shawn, the uMP3 is a better product.  I just recommended it to a haunt here in Burbank yesterday. 

The CAR/P is a nice product, but doesn't give you access to individual sounds like the VM, uMP3, AP-8, etc. 

As I pointed out in your other post, it's a good idea to run heavy motors from their own supply.  You can get inexpensive, moderate/high-current power supplies from online dealers like All Electronics.

Here's a mock-up of a program using the uMP3.  If you get your VM sorted let me know and I'll convert the code to use it.

' =========================================================================
'
'   File.......
'   Purpose....
'   Author.....
'   E-mail.....
'   Started....
'   Updated.... 19 OCT 2009
'
'   {$STAMP BS1}
'   {$PBASIC 1.0}
'
' =========================================================================


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


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


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

SYMBOL  RX              = 7                     ' to UMP3.T; no ULN
SYMBOL  TX              = 6                     ' to UMP3.R; no ULN
SYMBOL  Trigger         = PIN5                  ' keep ULN; is pull-down
SYMBOL  GraveMotor      = PIN2
SYMBOL  TombMotor       = PIN1
SYMBOL  Light           = 0


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

SYMBOL  IsOn            = 1                     ' for active-high in/out
SYMBOL  IsOff           = 0

SYMBOL  Yes             = 1
SYMBOL  No              = 0

SYMBOL  Baud            = OT2400


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

SYMBOL  timer           = B2
SYMBOL  mp3             = B3                    ' MP3 file pointer
SYMBOL  last            = B4
SYMBOL  eePntr          = B5                    ' EEPROM memory pointer
SYMBOL  char            = B6                    ' character value
SYMBOL  idx             = B7

SYMBOL  lottery         = W5                    ' random value


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

Power_Up:
  GOSUB UMP3_Stop                               ' stop if playing
  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 ">"

Reset:
  PINS = %00000000
  DIRS = %00000111


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

Main:
  timer = 0                                     ' reset timer

Check_Trigger:
  RANDOM lottery
  PAUSE 5                                       ' loop pad
  timer = timer + 5 * Trigger                   ' update timer
  IF timer < 100 THEN Check_Trigger             ' wait for 0.1 sec input


Run_Tree:
  mp3 = 0
  GOSUB UMP3_Play                               ' start audio
  HIGH Light                                    ' light on
  GOSUB UMP3_Wait                               ' hold for audio

Fade_Out:
  FOR idx = 255 TO 0 STEP -1                    ' fade out
    PWM Light, idx, 2
  NEXT
  PAUSE 1000                                    ' delay before tomb


Run_Tomb:
  mp3 = 1
  GOSUB UMP3_Play
  TombMotor = IsOn
  GOSUB UMP3_Wait
  TombMotor = IsOff
  PAUSE 1000                                    ' delay before grave


Run_Grave:
  GraveMotor = IsOn
  PAUSE 1000                                    ' set run time
  GraveMotor = IsOff

  GOTO Reset



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

' Put file # to play in "mp3"

UMP3_Play:
  eePntr = 8 * mp3                              ' convert to pointer

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

Send_Name:                                      ' send file title
  FOR idx = 1 TO 8                              ' max is 8 characters
    READ eePntr, char                           ' get a character
    IF char = 0 THEN Finish_Cmd                 ' if 0, we're at end
    SEROUT TX, Baud, (char)
    eePntr = eePntr + 1
  NEXT

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

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

UMP3_Stop:
  SEROUT TX, Baud, ("PC S", 13)
  RETURN

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

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

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

UMP3_Wait:
  GOSUB UMP3_Status
  IF char = "P" THEN UMP3_Wait
    RETURN


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

' File names are stored on 8-byte boundaries -- this is very important for
' correct program operation.  This strategy uses a little more EE space but
' is easier to update and maintain

Song_List:
  EEPROM $00, ("tree")                          ' mp3 = 0
  EEPROM $08, ("tomb")                          ' mp3 = 1
Jon McPhalen
EFX-TEK Hollywood Office

Specter

AWESOME!!!  I'll let you know how it goes!  If you recommend using separate supplies, then that's what I'll do!  Ill let you know what happens witht he VM...
Thanks again!