News:

SMF for DIYStompboxes.com!

Main Menu

MIDI router question

Started by mr_doyle, December 29, 2008, 06:51:23 AM

Previous topic - Next topic

mr_doyle

Hi everybody,

i have to build a midi router that selects one of 4 inputs: say, MIDI OUT from 4 synthesizers plugged in, a rotary switch to send one of them to the MIDI IN of an expander.

Now, do you think that an analog switch would be fine? I'm wondering if should i break grounds also, or if i could get them wired all the time without fearing of any ground loop.

Thank in advance,
D.

flo

An analog switch will work fine. All grounds can be connected to each other so you only have to switch the signal, not the ground.

mr_doyle


Processaurus

From what I know about midi electronics you would want to switch the grounds as well as the +5 and the data wires, as midi spec goes to great length to avoid ground loops by opto isolating all midi inputs.  The ground on midi cables is only connected on one side (pin 2 of the midi out jack) to act as a shield.  Pretty cool system to avoid hum and buzzes when dorks are connecting up all their gear willy nilly!

http://www.midi.org/about-midi/electrical.shtml

flo

I think that's why we "dorks" can connect the grounds in this midi-router.

Processaurus

I'll try to explain it a little better, we dorks  :icon_wink: (c'mon, we know what CC's and midi feedback loops are) wouldn't want to ground our devices together unnecessarily through the midi cables, if they get grounded together at all it should be with the audio cables only.  Grounding them together with the midi cables may well not cause any hum in some setups, but in others it definitely would.

An example I can think of is if Mr Doyle is playing a show with someone, they have 2 different synthesizers plugged into 2 respective amps (that each have 3 prong power cords), plugged into two outlets on opposite sides of a stage, which happen to be on different circuits in the venue electrical wiring, no buzz, but then they plug their midi cords into this router.  Bzzzzz! The difference in potential between the two ground circuits in the house comes from the 1st outlet's ground up the AC plug to the amp, up the audio cable to the synth, down the midi cable to the badly designed router, up the midi cable to the other synth, down the audio cable to the amp, down the ac cord to the outlet ground.  Current flows from one outlet ground to the other, through their gear and cables. If the grounds weren't connected at the midi router there would be no ground loop.

By switching the ground with the +5 and data (you'll need a 3p4t rotary switch to do that rather than a 2p4t) you extend the shield to the midi cable going to your expander (not sure what an expander is?), excellent, but you can leave the other 3 unused inputs' grounds on the router floating, which is fine.  The chassis of the router would be connected to the pin 2 ground connection on the output (the one going to the expander, as even though the expander doesn't connect the cable ground to anything, the synthesizer connected through the router to the expander does connect the ground).



pjwhite

A MIDI connection is a current loop.  There is no "ground" connection on a MIDI input jack.  The ground connection on a MIDI output jack connects to the cable shield, which has no connection on the receiving end.
Here is a section of a schematic of a typical MIDI device showing the MIDI input and output sections.

Notice that there is no ground connection to either pin 4 or 5 on the input or output jacks.

Here is a schematic of a circuit like what you want.  You will need a two-pole switch.  This one uses a five position switch to provide for an "all off" position, though you could easily use a four position switch instead.


(This schematic is also available as a pdf here: http://www.electrongate.com/projects/stomp/MIDISW.pdf)

Processaurus

On your schematic the chassis and the shield on the midi out jack, though connected together, have no path to earth and are floating, and rather than helping keep noise out of the data cable will increase it, by being an antenna.  Like if you had an xlr cable with the shield disconnected at both ends, it'd be a noisy cable. By switching the ground with the +5 and data, you electrically recreate a long midi cable from the midi out of the synth to the midi in of the expander.  Your schematic does that, but the shield is broken and left floating halfway through the cable, if that makes sense.

flo

@Processaurus:
I think your reasoning about shielding and ground-loops makes a lot of sense.
So, for a passive MIDI router, you suggest the shield of each MIDI-IN should be connected to pin 2 the MIDI-IN connector and one of them is connected via the 3p4t to pin 2 of the MIDI-OUT?

For an active MIDI router, I assume that having it all setup as stated in http://www.midi.org/about-midi/electrical.shtml with proper opto-isolators etc would be preferred?
Must the shield of the MIDI-OUT (pin 2) then be connected to the ground of the MIDI-router box? That is a bit unclea ro to me as the electrical MIDI specification uses separate symbols for ground and earth.

Processaurus

Quote from: flo on January 06, 2009, 04:07:38 PM
@Processaurus:
I think your reasoning about shielding and ground-loops makes a lot of sense.
So, for a passive MIDI router, you suggest the shield of each MIDI-IN should be connected to pin 2 the MIDI-IN connector and one of them is connected via the 3p4t to pin 2 of the MIDI-OUT?

Totally!

Quote from: flo on January 06, 2009, 04:07:38 PM
For an active MIDI router, I assume that having it all setup as stated in http://www.midi.org/about-midi/electrical.shtml with proper opto-isolators etc would be preferred?
Must the shield of the MIDI-OUT (pin 2) then be connected to the ground of the MIDI-router box? That is a bit unclea ro to me as the electrical MIDI specification uses separate symbols for ground and earth.


Yes, the opto isolator method in the standard midi spec would be way to go in an active/buffered switcher (in which case you'd want to leave the pin 2 ground of all the MIDI IN's disconnected, and you'd hook pin 2 of the MIDI OUT to the chassis ground, and the device gets grounded in some fashion by the power supply.

pjwhite

Processaurus -- You are right about the floating ground.  I was going to make a note about this, but it slipped my mind.
You could either do away with the ground connection on the output and keep the output cable very short (this would be my preferred solution), or choose one of the input jacks and connect the shield pin through to the output shield pin.

Processaurus

Quote from: pjwhite on January 06, 2009, 11:23:10 PM
or choose one of the input jacks and connect the shield pin through to the output shield pin.

Not idiot proof (you'd always want to use jack w/ the connected ground) but that's an interesting solution.  I'd personally still lean toward the 3p4t ground switching way and never have to worry about it, but if the switch wasn't handy and a 2p4t was, sure.  The "all off" setting is a handy idea too, for a 5th position on the switch.

flo

Thanks, this all was very interesting.  :)