USB Host Midi while sending

Hello,

TL;DR: I’m looking for help in attaching my Due to my keyboard’s ‘to host’ usb, such that I can send midi note information from the Due to the Keyboard.

I have built myself a midi pedal board, that I would like to hook up to my Yamaha Genos keyboard via USB. When I started the project, I thought that that would be simpler. I think I was wrong about that. But anyway, I have successfully written a sketch that sends the notes to the Genos – when hooked up through my computer, that is. If I plug it in directly, nothing happens. Even when I supply external power to the Due, there is no response to the notes from the Genos. If this were just for home use, I wouldn’t bother, but I provide music for my Church (when not restricted by COVID), and it is not feasible to bring the computer with me.

I suspect that it is because both the Due and the Genos are acting as ‘devices’, and that one needs to have a ‘host’. I have read somewhere that the Due can act as a Host mode for one device. (As opposed to multiple devices through a USB hub.) Can anyone provide any tutorials/starting points/suggestions as to how I would go about this. Please let me know if you need any other information.

Thank you!

Adam Parker

PS. As an alternative, can anyone tell me if the Sparkfun Midi Shield is compatible with the Due? I’m concerned about the 3.3v limit the Due requires. Maybe it would be better to reprogram for the Shield, and use the regular 5-pin midi rather than bother with the USB Midi.

If the Genos has a 5-pin MiDi input, and you want your Due (or any other board for that matter) to send MiDi to it, you don’t need a shield for that. That the DUE is a 3.3v board does complicate things a little (not much) since MiDi is a 5v protocol. But with just TTL chip (7400 series HC or HCT, specification is 74xx14, but really the schmitt trigger is not required for a true digital signal) and 5v power you can manage easily enough, you will also need 2x 220R resistors. If you want to add an input port to your board you will need a few more parts.

Thank you for your response, @Deva_Rishi. If I understand you correctly, you are suggesting that it would be better to make my own Midi output, rather than using the Midi Shield. But I’m confused as to why I would require another chip? Couldn’t I just use the Midi specification for 3.3v directly?

See bottom of page 2.

I guess I’ll just have to be patient. I could get the Midi shield in quicker than I can the resistors and midi connector. The latter, ordered through Amazon, will take almost a month to reach me. And I still have hopes that I can do this via the Programming, through USB. I’ve done some programming in the past. This is the first time I’ve tackled electronics and welding.

Thanks again,

Adam Parker

You would need 5v Logic levels. A MiDi output on a 5-pin Din plug has 1 pin connected through a 220R resistor to 5v+ and 1 pin through a 220R resistor to a data pin, that can sink 5v. True, you could probably connect to a 3.3v data pin, since at the other end there is another 220R resistor and an opto-coupler, and the 3.3v loigic HIGH probably doesn’t provide enough current to light up the opto-coupler, but the current (if any) would be reverse on the output pin, which you don’t want.
You may get away with just 5v and the resistors (they are not optional) But any electronic ‘parts’ shop will have 7400 series chips available. Basically if you can buy resistors, you can buy the chip.
The problem with using the resistor values specified for 3.3v is that they do not provide a safe circuit in case of a short, whereas the 5v specification does. (This was part of the plan the manufactures agreed upon way back then.) Of course the chip if placed in a socket also serves as ‘fuse’ , something so cheap you can simply replace it.

I know at times small towns don’t have a parts shop, though usually any town over 10 thou population does have. And even Mouser can do better than that.

But will it have the 3.3v resistors or use the 5v or well anyway, it will be hard to know upfront.

Thank you for the help, @Deva_Rishi. I still don’t get it, though.

If I’m reading the specs right, for the Midi output I’m attaching 3.3v line through a 33 ohm resistor. (Then through a 220 ohm resistor at the input end) and back to the data pin via a 10 ohm resistor. Since it powers an opto-isolator, there is no other power coming from the receiving port.

If I were using an Uno, or other 5v board, the setup would be the same, except that I would be using 5v, through 2 220 ohm resistors (plus the one on the input side.) So, where is the short protection?

As for driving the opto-isolator, I thought that it would be okay, since the specs call for an opto-isolator with a forward voltage of 1.9v with 5 mA. 3.3v with 263 ohm of resistance (33 + 10 + 220) gives that 5 mA. 5v with 660 ohm of resistance (220 x3) does the same.

As for getting the parts, I’m sure that the nearest town of >10,000 population (Ottawa, ON, Canada) would have an electronic parts store. That’s 1 hour and 15 minutes from home, just to reach the near side of Ottawa. With the current COVID situation, it’s not a journey to take lightly, since Ottawa is currently one of our hot spots. Not to mention that all store are curbside pick up only, so no browsing to find the parts I need.

As for mouser.ca, I wouldn’t be happy having to pay 20 dollars for shipping on less than 5 dollars worth of parts. Free shipping doesn’t kick in until you reach $100.00.

I am now utterly discouraged about completing this project. Despite the time and effort I have so far wasted on it, I think I will put it on the shelf, and forget about it.

Adam

440R at 5v approaches 12mA maximum current.
43R at 3.3v is more than 76mA. The 5-pin Din plugs are double male. Anyway, the 3.3v spec is not the original spec, but an adaption of that. When the big synth guys conferred about this, one of the important things was that devices could not break due to faulty cables or careless use.

If you find a store that may stock the parts you need, you could of course just give them a call, see what they have, and considering the current situation, if they maybe could just stick them in an envelop for you.

You could still order the shield and find out if it works when it gets there. I just told you what i would do.
One thing to remember, Don’t give up.