Shop OBEX P1 Docs P2 Docs Learn Events
Getting my robot to sing with the uMP3 — Parallax Forums

Getting my robot to sing with the uMP3

TnadzTnadz Posts: 14
edited 2007-03-01 02:52 in BASIC Stamp
Hello. I'm working on a robot that "dances" around and plays music. To play the music I'm hooking up the uMP3 module by RogueRobotics. I've been following the data sheets and using this tutorial (http://www.parallax.com/dl/docs/cols/nv/vol6/col/nv128.pdf). I've got everything going well so far, but I can't make the module play using the BS2. I tried simply running the program that Jon Williams used (Column 128 the Data Sheet on http://www.parallax.com/html_pages/downloads/nvcolumns/Nuts_Volts_Downloads_V6.asp the BS2 uMP3 Music Player file) and then replacing the songs he had with the ones I have. But nothing comes out.

Essentially I want to Have my robot see if anyone is around using a ping sensor, then have it Start the music, move it's motors in random motions so it "dances", and blink a bunch of LEDs which I have arrayed using a darlington transistor. Then if someone comes within view of the Ping sensor, the music stops, the motors and LEDs shut off and then it sits and monitors to see if the person has left yet. I haven't yet decided how I want to work the music tracks. I'll most likely have it pause whatever track it's on and then resume it as soon as it dances again. And then it would just continue through its playlist without shuffling. So I guess my question is, how can I modify the sample code for the "CD Shuffle" by Jon Williams to work with my robot? I'm running the most current version of everything and my stamp is a BS2 with v2.5 programming. I'll be more than happy to answer any questions you have about my work. Thanks

Comments

  • Mike GreenMike Green Posts: 23,101
    edited 2007-02-28 21:44
    Can you describe what you have been able to do with the uMP3 so far? How have you connected it? Of the 3 demo BS2 programs associated with the article, which have worked? What happened with the ones that didn't? [noparse][[/noparse]be specific]

    After you replaced the songs he had with your own, were you able to get your songs to play manually (connected to a PC)? What's the firmware version of the uMP3?

    It's been a year or so since I've played with the uMP3 using both a BS2 and a BS1 (Prop-1) and Jon's demo programs worked fine for me.
  • TnadzTnadz Posts: 14
    edited 2007-02-28 22:16
    So far I have only been able to play MP3's straight from the terminal. None of the BS2 programs have worked so far although I'm working on trying to do a reworked version of uMP3 Music Player.BS2. All of them loaded ok but I couldn't get any music to play. I tried to get it to return a debug response and it seems to be going through the program alright. The songs I played did work when triggered through the Hyper Terminal. The firmware is 110.12. Right now, I'm cutting out most of the complex list setup that he has and replace it with a counter that can be checked with a SELECT CASE. Hopefully this will work things out. I'll throw that code up just as soon as I'm done with it. Thanks again for the quick response.
  • Mike GreenMike Green Posts: 23,101
    edited 2007-02-28 22:43
    I would strongly suggest that you take a command/response sequence that worked manually and just implement that using the BS2. You do want to at least check for part of the response from the MP3 and put out something on the DEBUG display indicating what happened. The issue is that you don't know whether the communications is working. If you use a simple exchange that worked manually and it doesn't work with the Stamp, then you've got a communications problem that you have to solve before you can move on to fancy programmed control.
  • TnadzTnadz Posts: 14
    edited 2007-02-28 22:43
    Ok, so here is my chop job of Jon William's original program: uMP3 Music Player.BS2. My version also doesn't work. I think it has something to do with how I have stuff setup. Specifically with some of the declarations in the beginning. like TX PIN 15/14
    and

    '
    [noparse][[/noparse] Constants ]

    #SELECT $STAMP
    #CASE BS2, BS2E, BS2PE
    T9600 CON 84
    #ENDSELECT

    SevenBit CON $2000
    Inverted CON $4000
    Open CON $8000
    Baud CON Open | T9600

    But I could be wrong. I just don't think the BS2 is communicating with the player properly. I did check my connections to make sure it isn't that and they are quite alright. And just so you know the wiring here it is:
    R - P15
    T - P14
    G - Vss
    G - Vss
    + - Vdd
  • Mike GreenMike Green Posts: 23,101
    edited 2007-02-28 22:52
    Why are you using Open mode? That might be the problem. Open mode requires that you have a pull up resistor (4.7K to 10K usually) to +5V. Its not normally used for simple serial connections. Try just using "Baud CON T9600".
  • TnadzTnadz Posts: 14
    edited 2007-02-28 22:59
    Ok, well I changed the open but it still doesn't work. I tried running several DEBUG char at points just to see what happens, but for whatever reason, it doesn't seem to want to go through my Cases, even when I declare char = "S". Is it caps sensitive? Hmmm. Also here is the update I did for the code. Oh and ignore that Stop statement; It still doesn't work even if the Stop isn't there. I've don a little work with this and it seems to be locking up when it gets to
    SERIN RX, Baud, [noparse][[/noparse]char, DEC pos, DEC loopNum]
    which is in the play section.

    Post Edited (Tnadz) : 2/28/2007 11:10:55 PM GMT
  • Mike GreenMike Green Posts: 23,101
    edited 2007-02-28 23:44
    If you have a spare TTL to USB adapter, I'd suggest you use it with HyperTerm to monitor first the transmit line from the Stamp to the uMP3, then the receive line from the uMP3 to the Stamp. Clearly your program is hanging up on the first real SERIN. It sounds like you'v connected things properly. The pieces work separately. Since the demo programs don't work, I suspect there's something in how you connect the Stamp to the uMP3 that's a problem. You really need to get the demo programs working. They're tested and work for Jon and myself. If you can't get one of them to work, you're not likely to get far with your program so I'd focus on getting them to work. You could try different I/O pins on the Stamp
  • TnadzTnadz Posts: 14
    edited 2007-03-01 00:19
    I GOT IT! I took out the DEC in the SERIN and it worked beautifully! I guess it was already in DEC format and didn't need it in there. Hopefully that's the case. PS thanks for taking the time to work with me.
  • Mike GreenMike Green Posts: 23,101
    edited 2007-03-01 01:10
    Check to make sure. The DEC makes the Stamp interpret the incoming characters as a decimal number, terminated by a non-digit which then gets discarded. That actually fits the format of the response "X<sp>NN<sp>NN<cr>".
  • TnadzTnadz Posts: 14
    edited 2007-03-01 02:52
    Yeah I don't know why it didn't like the DEC because I read about what you just mentioned and it seems like it would be just fine. But it worked the opposite way in that it ended up waiting endlessly for a decimal when I used the DEC instead of not using it. I have no clue why but I guess whatever works.
Sign In or Register to comment.