Shop OBEX P1 Docs P2 Docs Learn Events
stamp to midi connection — Parallax Forums

stamp to midi connection

Lars JepsenLars Jepsen Posts: 9
edited 2005-04-07 22:59 in Learn with BlocklyProp
Hi everybody,

I'm new to Basic Stamp and was wondering if someone could help me figure out how to connect the stamp to a midi keyboard.

I’ve followed the instructions mentioned in the nuts and volts tutorial by soldering a female 5-pin DIN socket to a cable with 220 Ohm resistors. I’ve tested the cable and everything seems to be fine. I’ve also downloaded Jon’s mystery song and modified the baud rate (60) to match my Stamp SX module connected to a Board of Education.I’ve connected the I/O cable to pin 15, the voltage to the VDD and the ground to the VSS. However, I’m still not receiving any music from my keyboard.

I’m not sure what I’m doing wrong and would appreciate if anyone has any advice on how to send output from the stamp to the midi.

Thanks in advance for any help.

Post Edited (Lars Jepsen) : 4/6/2005 7:21:24 PM GMT
500 x 456 - 190K
321 x 187 - 6K

Comments

  • Jon WilliamsJon Williams Posts: 6,491
    edited 2005-04-06 14:29
    The new forum mantra seems to be: Post your code.· That should be followed with: Double- and triple-check your connections.

    That said, the attached template may be helpful.· I use it for all my projects and as I have·bit of an interest in MIDI, I have included the correct values for the MIDI baud rate.· In my opinion, embedding numeric values (instead of named constants) into instructions like SEROUT et. al. is bad form and makes programs difficult to debug.

    BTW: Since the contest is long over, the "mystery song" is the X-Files TV show theme.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Jon Williams
    Applications Engineer, Parallax
    Dallas, TX· USA


    Post Edited (Jon Williams) : 4/6/2005 2:35:46 PM GMT
  • steve_bsteve_b Posts: 1,563
    edited 2005-04-06 17:55
    Was there a contest?? Wasn't aware....

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    ·

    Steve
    http://ca.geocities.com/steve.brady@rogers.com/index.html
    "Inside each and every one of us is our one, true authentic swing. Something we was born with. Something that's ours and ours alone. Something that can't be learned... something that's got to be remembered."
  • Jon WilliamsJon Williams Posts: 6,491
    edited 2005-04-06 18:37
    In my article I offered a shiny new BS2p to the first person to identify the "mystery song." Offer closed.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Jon Williams
    Applications Engineer, Parallax
    Dallas, TX· USA
  • Lars JepsenLars Jepsen Posts: 9
    edited 2005-04-06 19:19
    Hi Jon,
    Thanks for the quick reply. I used the same code that you wrote for the mystery song that should be stored in the eeprom but changed the MidiBaud to $8000 + 60. I’ve also run tests with a multimetre on the female 5-pin din cable too make sure that the resistors and connection work. I’d like to know if the setup for the wiring I used in the picture I attached is correct because I can’t get any output from the stamp to the midi. Is my setup wrong?
  • Jon WilliamsJon Williams Posts: 6,491
    edited 2005-04-06 19:40
    I don't remember the reason for using an Open baudmode in my program (that worked -- I tested it with two different keyboards), but maybe that's giving you troubles. Get rid of the $8000 part in the baud constant (this makes it "open" and will change it to a driven connection).

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Jon Williams
    Applications Engineer, Parallax
    Dallas, TX· USA
  • Lars JepsenLars Jepsen Posts: 9
    edited 2005-04-07 13:13
    I’ve tried modifying the baudrate code to MidiBaud CON 60. However I still can’t get any sound from the keyboard. I’ve hooked up the stamp to 3 different keyboards and still haven’t got any results…. I’ve also tested Pin 15 with an Oscilloscope, which shows me that there is a signal being sent. Recently I tested a code which should send a middle note C from a stamp2 sx, however I still can’t get any results. I’ve tested the midi cables and they work…. I’m not sure why I can’t play any music… Is my stamp sx defective?
  • Jon WilliamsJon Williams Posts: 6,491
    edited 2005-04-07 13:49
    If you're getting signal on P15 then I would suspect the cable adapter·-- build another just to make sure that you got it right (people swear up and down that their connections are good only to find a broken wire sometime later -- it happens to all of us). You must also make sure that your Note-On command is set to the same channel as your keyboard. Check your keyboard settings for MIDI channel and match that up in the code (the MIDI tester program from my article is useful for testing).

    I actually went into the closet and dragged out my RadioShack MIDI keyboard and connected it per your schematic and ran your COUT.BSX program -- it works.· As a way perhaps to assist I wrote the attached program which will play C to each MIDI channel.· I suggest you connect your Stamp to one keyboard, and if you have cables, connect the other keyboards in a chain.· Run this program and hopefully you'll get some action.· If not, I think that you've got wiring issues (I know I keep bring that up, but it's the problem 98% of the time).· FWIW, my cheapie keyboard plays a piano note on channels 0 - 3, and a steel drum on channel 9.· All other channels are silent.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Jon Williams
    Applications Engineer, Parallax
    Dallas, TX· USA


    Post Edited (Jon Williams) : 4/7/2005 2:52:51 PM GMT
  • Lars JepsenLars Jepsen Posts: 9
    edited 2005-04-07 21:49
    Hi Jon,
    Thanks a million for all your help and support. You were right with regards to the problems being associated with the cable wiring. I had originally soldered the wires according to figure 94.1 shown in the nuts and volts article. The code you uploaded showed a different schematic requiring that I reverse the position of the I/O and voltage wires. That seemed to solve the problem. Everything works now and I’m currently listening to your mystery song! smile.gif Once again, thank you for your patience and help in solving this problem.

    Post Edited (Lars Jepsen) : 4/7/2005 9:52:37 PM GMT
    404 x 274 - 13K
  • Jon WilliamsJon Williams Posts: 6,491
    edited 2005-04-07 22:59
    I'm glad it's working -- sometimes we plug wires in backwards. I believe the schematics are correct: pin 5 gets the serial data, pin 4 is pulled up to +5v. I've been researching various MIDI circuits (for an SX/B project) and have found that seems to be the way things are done.

    Here's one of my references: http://www.borg.com/~jglatt/hardware/pc_intfc.htm

    You will sometimes see the connections reversed in schematics involving small microcontrollers. I think the reason is that some of them are not able to send data in True mode (idle state of serial line is +5) -- since the MIDI connection is a current loop they can make it work in Inverted mode (idle state of serial pin is Vss) by reversing the connections.

    Or maybe I'm reversed -- anyway, have fun. As for me, I'm working on a couple MIDI projects: a "sniffer" that will listen to the MIDI data and tell you what's happening (on an LCD), then a general-purpose output device that will respond to Note-On commands (and Note-Off or Note-On with Velocity of 0). The latter idea may become a product for our EFX line as that kind of device is useful for triggering props and FX from a MIDI program (like Cubase). Both project use the SX micro and I'm writing the code in SX/B (BASIC compiler for the SX) with buffered serial input for the MIDI stream.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Jon Williams
    Applications Engineer, Parallax
    Dallas, TX· USA
Sign In or Register to comment.