Forum Rule: Always post complete source code & details to reproduce any issue!
Results 1 to 7 of 7

Thread: Connecting Teensy USB Midi device to other device with Type B connector

  1. #1

    Connecting Teensy USB Midi device to other device with Type B connector

    First post to PJRC forum, and wow this is an active community! Terrific!

    I am using a Teensy 2.0 as a MIDI to CV device, so I can use my iPad or computer to drive multiple CV inputs on my analog synthesizer. It has been working great (couldn't have been easier with Teensy's usbMIDI commands), and there are some great sequencer iPad apps out there I can now use to drive my synth. Cool!

    I would like to connect it to my keyboard as well, which has a USB MIDI output. However, it has a female USB Type B port. Since the Teensy USB input is also Type B, and standard cables are Type A to Type B, I have a problem.

    I don't need power. I'm already driving the Teensy with a separate power source, and have cut the 5V pads apart on the bottom of the device.

    My question: Can I simply buy a USB B to A adapter, and plug the Teensy into the keyboard? Will the Teensy then receive MIDI messages from the keyboard? Or are there any other pitfalls I might want to know about.

  2. #2
    Senior Member PaulStoffregen's Avatar
    Join Date
    Nov 2012
    Posts
    18,320
    You need Teensy 3.6 and this cable. Sorry, none of the other Teensy models before 3.6 have this 2nd USB port.

    Hopefully this picture will be worth 1,000 words to explain how it works.



    For the code, click File > Examples > USBHost_t36 > Test. That should give you a pretty good idea of how it'll receive the incoming MIDI messages from your keyboard.

  3. #3
    Wow, a reply from the man himself, within the hour! Thanks Paul! Yes, that does look like it would do the job. And I like how the cable has mounting holes so it can be installed in a case.

    So I assume the answer to my question "Can I simply buy a USB B to A adapter, and plug the Teensy into the keyboard?" is no. My knowledge of USB is next to nothing, which is why I am leery of trying it before I do my homework first. Is this because one of the two MIDI devices needs to act as the "host"? Or am I reading too much into your answer?

    As it turns out, last night I just sent a set of gerber files off for PCB manufacture so I can get my midi to cv converter off of my breadboard and start putting it to use. It works really well with the iPad. I have a different one I am using with my keyboard, so I'm not stuck. It would be nice if there were an easy way to use this design with my keyboard though.

    I need to pick up one of those Teensy 3.6s now, and start playing with it! I used the 2.0 because of its native 5V support, and honestly 8-bit was sufficient for this project. But the 3.6 looks like a really capable board.

    Thanks Paul!

  4. #4
    Senior Member
    Join Date
    Nov 2012
    Location
    Boston, MA, USA
    Posts
    1,103
    Quote Originally Posted by elkayem View Post
    So I assume the answer to my question "Can I simply buy a USB B to A adapter, and plug the Teensy into the keyboard?" is no. My knowledge of USB is next to nothing, which is why I am leery of trying it before I do my homework first. Is this because one of the two MIDI devices needs to act as the "host"? Or am I reading too much into your answer?
    Yes exactly, it is about USB Host which is very different to USB device (more complicated). All of the Teensies have USB device capability, only Teensy 3.6 has USB Host as well.

  5. #5
    Quote Originally Posted by Nantonos View Post
    Yes exactly, it is about USB Host which is very different to USB device (more complicated). All of the Teensies have USB device capability, only Teensy 3.6 has USB Host as well.
    Thanks, that clears it up for me! Time for me to start educating myself about USB protocol. Also, time to pick up a Teensy 3.6!

  6. #6
    Senior Member PaulStoffregen's Avatar
    Join Date
    Nov 2012
    Posts
    18,320
    Quote Originally Posted by elkayem View Post
    Time for me to start educating myself about USB protocol.
    Here's a copy of the USB 2.0 spec.

    https://www.pjrc.com/teensy/beta/usb20.pdf

    This is a huge PDF, but the essential background info is in chapter 4, which is a short and fairly easy read. USB has a lot of specific terminology. If you can just get the key concepts from chapter 4, you'll be doing pretty well.

  7. #7
    Thanks Paul, exactly what I need! Some light holiday reading...

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •