After wrestling with for 2 days now i've officially burned out on getting this to work. I ran the ump3 on my prop-1 last year and now i'm trying to hook it to my new prop-2.
I bought the usb2ser adapter last year and configured the ump3 to a baud of 2400......i'm going to go out on a limb here and assume that the prop-2 needs to be on 9600 baud.
here's my biggest problem.....i can't find my usb2ser adapter. I have my basic 1 adapter i can't find the one for my ump3
Does the prop-2 need the ump3 set to factory default? Perhaps i can get it to default without the adapter.
Perhaps there is another forum person out there that i can ship this ump3 to that would put it to the appropriate settings for me........hint, hint
Can you verify what baud the prop-2 requires before i dig in deeper?
By the way, Parallax is out of stock of the usb2ser adapters......just my luck
The only Parallax adapter that we know to work with the uMP3 is the USB2SER; it has the correct signals of the correct polarity and the correct position on the header. When Parallax has them back in stock you may want to order another.
The good new is that you can use the uMP3 at 2400 baud with the Prop-2. It would be nice if you could use 9600, but it's not a requirement and in most applications you won't know the difference.
Here's my Prop-2 demo for the uMP3 -- note how I was able to change the uMP3Baud setting to T2400 -- there you go!
' =========================================================================
'
' 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 | T2400 ' 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
Thank you Jesus I found my usb2ser adapter.......buried in all the halloween crap!
I will try the code you added and see how it all works out.
I pulled the chip out of my prop-1 that i had clipped the pins off of and put it into th prop-2. Do you have to do that on the prop-2?
I figure it's something really small.
Well know that you've found your USB2SER, set that dude up for 9600 baud so that you can get the commands to and fro as quickly as possible.
Yes, you need to clip the ULN pins for the uMP3 as well -- for both the TX and RX pins.
Lets make this simple. I just want to use the prop-1 to make a call out to the ump3 to play one specific .mp3 file. i will use additional commands, pauses and such to "delay" the program while the .mp3 plays. Once over, just end.
All the examples i find talk about a lottery or random playing. A quick and dirty program for playing one song (possibly named "Oz"). I don't particularly need responses from the ump3. I will assume all is well.
I've attached a copy of the UMP3 config and last years program that ran on the Prop-1
Also....does the i/0 control settings on the ump3 need to be 7 bit or 8 switch to talk to the prop-2?
***********************************
Here is my program from the Prop-1:=========================================================================
' -----[ Program Description ]---------------------------------------------
' -----[ Revision History ]------------------------------------------------
' -----[ I/O Definitions ]-------------------------------------------------
SYMBOL Sio = 7 ' SETUP = out; no ULN
SYMBOL PIR = PIN6 ' SETUP = DN
SYMBOL TX = 5
SYMBOL RX = 4
' -----[ Constants ]-------------------------------------------------------
SYMBOL Baud = OT2400
SYMBOL Yes = 1
SYMBOL No = 0
SYMBOL IsOn = 1
SYMBOL IsOff = 0
' -----[ Variables ]-------------------------------------------------------
SYMBOL dc16 = W0
SYMBOL dc16Lo = B0
SYMBOL dc16Hi = B1
SYMBOL timer = B2
SYMBOL theMP3 = B3
SYMBOL eePntr = B4
SYMBOL char = B5
' -----[ Initialization ]--------------------------------------------------
Reset:
PINS = %00000000
DIRS = %00000000
dc16 = %0000000000000000
GOSUB Set_DC16
PAUSE 30000
' -----[ Program Code ]----------------------------------------------------
Main:
PAUSE 1000
IF PIN6 = 0 THEN main
dc16 = %0000000010000000
GOSUB Set_DC16
theMP3 = 0 ' bells
GOSUB Play_MP3
PAUSE 40000
dc16 = %0000000010000001 ' open lid, blacklight
PAUSE 3000
theMP3 = 1 ' ozzy
GOSUB play_mp3
GOSUB Set_DC16
PAUSE 18000
Prop_Up:
dc16 = %0000000001000011 ' raise prop strobe on
GOSUB Set_DC16
PAUSE 14000
dc16 = %0000000001000111 ' turn prop strobe on
GOSUB Set_DC16
PAUSE 4000
dc16 = %0000000010000111 ' strobe off blacklight on
GOSUB Set_DC16
PAUSE 3000
Skull_Show:
HIGH 1
HIGH 2
PAUSE 15000
LOW 2
PAUSE 15000
HIGH 2
PAUSE 15000
LOW 2
PAUSE 10000
LOW 1
Prop_Down:
theMP3 = 2 ' organ
GOSUB play_mp3
dc16 = %0000000001000011 ' turn prop straight strobe on
GOSUB Set_DC16
PAUSE 10000
dc16 = %0000000001000001 ' lay prop down blacklight on
GOSUB Set_DC16
PAUSE 20000
Close_Lid:
dc16 = %0000000010000000 ' close lid blacklight on
GOSUB Set_DC16
theMP3 = 3 ' halloween
GOSUB play_mp3
PAUSE 50000
PAUSE 50000
PAUSE 25000
GOTO reset
' -----[ Subroutines ]-----------------------------------------------------
Set_DC16:
SEROUT Sio, Baud, ("!DC16", %11, "S", dc16Lo, dc16Hi)
RETURN
' -------------------------------------------------------------------------
' Put file # to play in "theMP3"
' -- add starting location(s) of file names manually
Play_MP3:
LOOKUP theMP3, (0, 2, 5, 7), 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
RETURN
' -------------------------------------------------------------------------
' -----[ User Data ]-------------------------------------------------------
Audio_Files:
EEPROM ("b", 0) ' file #0 Bells.mp3
EEPROM ("Oz", 0) ' file #1 Ozzy.mp3
EEPROM ("O", 0) ' File #2 Organ.mp3
EEPROM ("H", 0) ' file #3 halloween movie
Okay, here's the simplest Prop-1 / uMP3 program you could have.
Cautions:
1) The initial delay must be long enough to let the uMP3 initialize
--this is based on SD card size and format (FAT or FAT32)
2) If you send a play command while another file is playing it will kill the first
-- use PAUSE or other delay strategies as required to prevent overlap
The switch input monitoring has no effect on serial commands.
' =========================================================================
'
' File...... uMP3_EZ.BS1
' Purpose...
' Author.... Jon Williams, EFX-TEK
' Copyright (c) 2008 EFX-TEK
' Some Rights Reserved
' -- see http://creativecommons.org/licenses/by/3.0/
' E-mail.... jwilliams@efx-tek.com
' Started...
' Updated... 12 SEP 2008
'
' {$STAMP BS1}
' {$PBASIC 1.0}
'
' =========================================================================
' -----[ Program Description ]---------------------------------------------
' -----[ Revision History ]------------------------------------------------
' -----[ I/O Definitions ]-------------------------------------------------
SYMBOL TX = 7 ' SETUP = out; no ULN
SYMBOL Trigger = PIN5
' -----[ Constants ]-------------------------------------------------------
SYMBOL IsOn = 1 ' for active-high in/out
SYMBOL IsOff = 0
SYMBOL Baud = OT2400
' -----[ Variables ]-------------------------------------------------------
SYMBOL timer = B2
' -----[ Initialization ]--------------------------------------------------
Reset:
PINS = %00000000 ' clear all outputs
DIRS = %00000000
PAUSE 6000 ' for 1 Gig SD card
' -----[ Program Code ]----------------------------------------------------
Main:
timer = 0 ' reset timer
Check_Trigger:
PAUSE 5 ' loop pad
timer = timer + 5 * Trigger ' update timer
IF timer < 100 THEN Check_Trigger ' wait for 0.1 sec input
SEROUT TX, Baud, ("PC F /firefly.mp3", 13)
PAUSE 55000
' let sound finish before new play command
END
' -----[ Subroutines ]-----------------------------------------------------
' -----[ User Data ]-------------------------------------------------------
Sorry for any confusion Johnny....i need a simple program for a prop-2
I sent a copy of last years prop-1 to show how i got it to work last year and the logic of how i run the program.
I'm in the process of rewriting the prop-1 into a prop-2 program. I won't have to use the DC-16 since this prop-2 has multiple outputs. This new unit will be sweet as soon as i get the ump3 to work.
Sorry for the confusion man.......
You said Prop-1, dang it!!! ;D Actually, after testing the Prop-1 version I ported it to the Prop-2... just in case.
' =========================================================================
'
' File...... uMP3_EZ.BS2
' Purpose...
' Author.... Jon Williams, EFX-TEK
' Copyright (c) 2008 EFX-TEK
' Some Rights Reserved
' -- see http://creativecommons.org/licenses/by/3.0/
' E-mail.... jwilliams@efx-tek.com
' Started...
' Updated... 12 SEP 2008
'
' {$STAMP BS2}
' {$PBASIC 2.5}
'
' =========================================================================
' -----[ Program Description ]---------------------------------------------
' -----[ Revision History ]------------------------------------------------
' -----[ I/O Definitions ]-------------------------------------------------
TX PIN 15 ' SETUP = out; no ULN
Trigger PIN 13
' -----[ Constants ]-------------------------------------------------------
IsOn CON 1 ' for active-high in/out
IsOff CON 0
T2400 CON 396
T9600 CON 84
T38K4 CON 6
Open CON $8000
Baud CON Open + T9600
' -----[ Variables ]-------------------------------------------------------
timer VAR Byte
' -----[ Initialization ]--------------------------------------------------
Reset:
OUTS = $0000 ' clear all outputs
DIRS = $0000
PAUSE 6000 ' for 1 Gig SD card
' -----[ Program Code ]----------------------------------------------------
Main:
timer = 0 ' reset timer
DO WHILE (timer < 100)
PAUSE 5 ' loop pad
timer = timer + 5 * Trigger ' update timer
LOOP
SEROUT TX, Baud, ["PC F /firefly.mp3", CR]
PAUSE 55000
GOTO Main
' -----[ Subroutines ]-----------------------------------------------------
' -----[ User Data ]-------------------------------------------------------
;D The spine tingling sound of Ozzy Osbourne fills the air as my ump3 comes to life through the infinite and devine wisdom of JohnnyMac and his poetic programming ;D
You Da Man Johnny
I've already gotten the prop-2 to control my servos. That was a relatively easy configuration. With it I will have moving eyes and turning head. The added memory space of the Prop-2 will give me plenty of space to increase the complexity of the show this year.
Pat yourself on the back for me for a job well done.
I will be going to the Transworld convention this coming spring in Chicago again. Vegas was too far this year. I will be sure to look you up if you are there.
"May your life be blessed with infinite wealth"
Be sure to show us a Video of it working! We all need some motivation! ;)
There's no h in my name, Spoohky! ;D I'm glad everything is working... but I just broke my arm patting myself on the back! :P
The TW Haunt Show is actually going to be in St. Louis, not Chicago. See you there -- and thanks for the "wealth" wish; living in Hollywood can be pricey.
Hi Jon and all,
I've been using the uMP3 with two I/O's (RX, TX) on a Prop1 with good results. I currently have a situation where I have only one available I/O left on a Prop1 and would like to use the uMP3. I was happy to see this post with your example of a program using only the TX used. Unfortunately, I can't seem to get this to work. Any thoughts or modifications I need to do to the uMP3. I have the sio 7 plugged into the RX pin on the uMP3.
Thanks! ???
This is a bit of a thread hijack and we don't allow that (sorry, one of the few rules we have). Please ask your question its own thread.