0
\$\begingroup\$

In my previous question MIDI Both as Input or Output the advice was to use a CD4053 to make a SPDT switch (multiples). However, I was thinking how it could be done with transistors. Not that I want to 'implement' this, but just out of curiosity if I understand the principle behind it.

I made a schema (sorry for my handwriting and no app used):

enter image description here

Actually only the upper part (above the orange/white line is of importance).

The idea is to have one single MIDI connector (pins 4 and 5 are used, 3 always to GND).

To select between MIDI In or Out:

  • Signal from Arduino for MIDI In (enabled, HIGH) or MIDI Out (Enabled, LOW)
  • When HIGH, the first and third resistor (from left to right) are getting voltage on their base, meaning a circuit is made from pin 4 and 5 from the MIDI connector, to the pin 4, MIDI In 'functionality' and pin 5, MIDI In 'functionality' (depicted as the round MIDI In circles)
  • Because of the inverter, the second and fourth (from left to right) the transistors will not have voltage on their base, so will not do anything.
  • When LOW, the first and third transistors will have no power on their base, while the second and third have.

Would this circuitry work? I know a CD4053 will be much easier, but it's just for trying in the future where I might need only one SPDT and a CD4053 is too much.

\$\endgroup\$
  • 1
    \$\begingroup\$ I didn't read or follow your earlier question. But I'm wondering. Are you forgoing galvanic isolation? \$\endgroup\$ – jonk May 22 '17 at 4:02
  • 1
    \$\begingroup\$ An NPN transistor is switched on only if a current flows from base to emitter, which means that the base must have a voltage 0.7V above that of the emitter, and that the current must be able to flow somewhere. Please look up how PNP transistors work, and why those are used as a high-side switch. And as jink said, you would not want to have a direct connection to your circuit on the 'wrong' side of the optocoupler. \$\endgroup\$ – CL. May 22 '17 at 8:01
  • 1
    \$\begingroup\$ There are some significant problems to attend, if you are going to keep isolation while at the same time arranging for a single jack to be both OUT and IN under program control. In effect, "galvanic connection from A to B" means "there exists a path for electrons from A to B, and back again." Under no circumstances is the chassis or circuit ground of one device to be connected to the chassis or circuit ground of another. This basically means you are allowed optical (opto), magnetic (transformer), or electric fields (capacitor) only. But cable shield ties to OUT chassis, and not IN chassis. \$\endgroup\$ – jonk May 22 '17 at 17:46
  • 1
    \$\begingroup\$ @MichelKeijzers Just focus on the cable, itself, for a moment. That's easier to think about than all the rest. The cable shield is supposed to be tied to ground or a driven virtual ground at the transmitter (OUT) side. But it is NOT supposed to be connected in any way at the receiver (IN) side. How exactly would you achieve that through opto? I think you need to consider relays. Not even the prior-suggested analog switches are acceptable, I'd say. \$\endgroup\$ – jonk May 22 '17 at 20:19
  • 1
    \$\begingroup\$ @MichelKeijzers 5V and 12V coil, DPDT reed relays are fairly cheap (about 50 cents each) and small. The DIN connector alone is probably bigger. I thought about simple circuits where I didn't care about isolation and it's doable but uses a few parts -- but you don't get the isolation. If there are other devices you know about that implement what you seek without relays, then you should open them up and see what they do. My bet is that they give up the isolation. (Would not surprise me.) And perhaps you can accept that, too. I wouldn't. I'd just do it right and not look back. \$\endgroup\$ – jonk May 22 '17 at 20:43

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.