MIDI Line Driver over Cat5

GroupDIY Audio Forum

Help Support GroupDIY Audio Forum:

This site may earn a commission from merchant affiliate links, including eBay, Amazon, and others.

alauth

Member
Joined
Mar 25, 2024
Messages
7
Location
France
Hello everyone !

My first time posting a thread here, hope I won't break any rule ! (don't hesitate to tell me :) )


I play in a band and we use MIDI to control our pedalboards. My goal is to create a solution to run MIDI over more than the 15m limit.

I saw this schematic about building a MIDI Line Driver over Cat 5 : https://www.edn.com/send-midi-signals-over-long-distances/

So I recreated the schematic in EasyEDA and worked on the PCB to make it work.


Four questions :

- Do you think I did anything wrong in my PCB or in my schematic ?

- On the schematic, I don't really understand the role of R3. Is it some kind of biasing of the signal between the 4N25 optocoupler and the input from the 74LS07 ?

- LED receive and send are supposed to show MIDI Data activity but I don't understand the setup with the +5V input on one side of the LED and the 74LS07 on the other side, could someone explain this to me ? (or point me to the right direction to understand this by myself ?)

- On the original schematic, there's C4, a 100nF cap between +5V and Ground, I thought it was just for stability improvement but with my power supply design, I think I don't need it anymore, am I right ?


My questions are probably quite basic but I'm learning all by myself so obvious things are sometimes not that obvious for me :D


Have a nice day everyone, thanks !

Arthur
 

Attachments

  • PCB_PCB_MIDI-Line-Driver-A-Type_2_2024-10-06 Bottom.pdf
    123 KB
  • PCB_PCB_MIDI-Line-Driver-A-Type_2_2024-10-06 Top.pdf
    130.5 KB
  • Schematic_MIDI-Line-Driver-A-Type_2024-10-06.pdf
    62.8 KB
Agree, MIDI works with almost anything you throw at it

Technically it's just a simple 31KHz serial data stream, optically isolated, no handshake. Very far from today's near-GHz and handshake -based USBprotokols - these require an answer from the other end within a handful of nS, making length matter a lot.

I've used din/xlr converters to get through a 75m stage/mixer cable
 
Last edited:
I'll test that ! Thank you guys for your answer :)

But I'm still interested in knowing if what I designed is right, if you guys have time to have a look at my schematic and PCB :D
 
As already stated, MIDI is low speed, opto-coupleted current loop, asynchronous, which make it a strong signal.

Design seem ok, which is just a buffer and a sym Tx/Rx IC.
I suppose it could be doubled to offer 4 lines on a single cable which to me is the only benefit of this.

But I'm not sure about the 5V within the CAT5 line ?!? is that to offer supply from one side only ? then I'll be concerned about that more than the signal for long distance, current is low but cable is thin, voltage drop may be calculated for long length ?

For really long distance and network abilities, RTPmidi is an option...
 
I don't know what is the overall consumption... 60mA for the status LEDs, about 2x50mA for line TxRx (not sure about it in datasheet)+ buffer ?
So saying 200mA...for 30m, AWG24 @ 25°C...voltage drop is 514mV

You should double check the math, and see how will behave IC with that in real life.
Knowing that Line Tx and Rx -recommanded operating condition- give Vcc min @4.75V... possible issue...

Now if you have extra wire/pair available on the CAT5 you can lower that, with 2 pair for 5V you get 1/4, about 125mV

Another questioning is the shared 0V and shield with your single -GND- label/net ? some may have answer about it.

The initial MIDI current loop wont suffer from this, as everybody say before just test with a quality mic cable before jumping on a design that request extra stage box, power supply, more connector junction, and time to build...
 
Maybe I could send the +9V down the Cat5 instead of the +5V ? This way, each unit would have regulated +5V but I'd only need one 9V power supply ?

And I could use two different lines from the Ca5 for the power supply.

Would it be a good improvement ?
 
I don't really understand the role of R3.

According to the optocoupler symbol pin 5 is just the collector of a transistor. When the transistor is biased on current can flow from pin 5 to pin 4, but that current comes from somewhere. When the transistor is biased off only a miniscule current will flow, but without a source of current nothing would change on that pin. The connection to the power supply through R3 causes the voltage at pin 5 to be very close to the same as the power supply voltage when the transistor is off, and close to 0V when the transistor is on.

I don't understand the setup with the +5V input on one side of the LED and the 74LS07 on the other side

An LED will light when current flows through the LED. The voltage across the LED will be close to constant when that occurs, varying with the chemical composition. Around 1.4V for a typical red LED. In general, TTL devices are capable of sinking more current than they can source (i.e. they can keep the output low with more current flowing into the device to the 0V/gnd connection, while attempting to provide the same amount of current from the power supply through the output will cause the output voltage to drop. Because of that it is common to connect the power supply to the anode of the LED, and drive low with the TTL device to turn on the LED (in which current flows from the power supply, through the LED, through the TTL output, to 0V connection and from there back to the power supply, completing the circuit). When the TTL device drives high the output is not quite all the way to the power supply voltage, but it is close enough that the LED no longer conducts and so turns off.

In this specific circuit the 74LS07 is not a typical TTL logic device, however. It is an open-collector device, with the same style of output shown in the optocoupler symbol. Because of that a 74LS07 device can never drive the output to high voltage, it can either be high impedance, in which case almost no current flows through the device and the voltage is defined by other circuitry connected to the output, or it is low impedance, sinking current to keep the output low until the current limit is reached, at which point the output voltage will rise (and potentially damage the device).

On the original schematic, there's C4, a 100nF cap between +5V and Ground, I thought it was just for stability improvement but with my power supply design, I think I don't need it anymore, am I right ?

It is always good practice to place a small capacitor physically near each device. Even with a perfect power supply the connections from the power supply to each device has resistance and inductance, and the current used by the device will cause a voltage drop across that impedance (i.e. resistance plus inductive reactance). I would put more than 0.1uF at the line drivers, 1uF would probably be a good choice, right at the device power pin and directly to the 0V plane.

I believe there is a mistake in the original EDN article. The 74LS07 is an open collector output, i.e. it cannot drive the output high, only pull the output low.
I do not see any way that the connection from U1.1 output to U4 input pin 2 can ever go to logic high. That connection needs a pull-up resistor (1K like R3 would be fine).

The design also has no termination resistance on the receiver. The EDN article claims distances of over 100m possible, but I would like to see the waveforms at each end, because I suspect they do not look good with no source or receiver termination. I would expect the reciever to have a 100 Ohm resistor between the + and - input pins to match the twisted pair characteristic impedance.
It is also good practice to add ESD suppression at the line connector, although I know a lot of people just rely on the device clamping diodes, but at least series resistance at the input pins to limit ESD current should be used.

Maybe I could send the +9V down the Cat5 instead of the +5V ?

That would provide much better power quality at the far end. Also run the power return connection on the other side of the same pair for lower inductance. So if you keep your current power connection on pin 5 put return on pin 4. With the return currently on the shield pin you are forced to use shielded cable, even though it isn't really needed, and forces you to tie shield to circuit power return at that point with no flexibility.

And just to emphasize, pin 9 is the shield connection. You show it connected to the "GND" net which you are also using for the 0V power reference everywhere. It is bad practice to have a shield connected only and directly to your internal reference plane, because any external noise picked up on the cable is injected directly into your circuit. A shielding connection surrounds a circuit to protect from electrostatic noise, and you should have a controlled connection point or points to tie the circuit reference voltage to the shield at a point which does not induce noise into the circuitry. That could be at the connector shield pin, but could be elsewhere depending on physical layout.

Speaking of shield pins, note that MIDI pin 2 should be the chassis connection. The MIDI spec uses different symbols to indicate that the shield connection and the circuit reference/"circuit ground" connection are different, but the language is not as clear as it could be.
 
Wow, that's a huge and incredibly detailed answer, thank you so much !

I'll rework my schematic and PCB trying to understand everything you said and i'll be back with a V2, hoping I'll get it right !
 
Ok, so here's what I've done and I hope I've understood everything :)

- I added C5 and C6 between +5V and GND to help stabilize U4 and U5. On the PCB, they are placed right to the power supply pin of the ICs.

- I added a termination resistor of 100Ohm (R9) between the receiving pins of U5

- I added a pullup resistor (R8) at the input of U4 (not sure I did this right...)

- I've put the power supply travelling through the Cat5 cable on pins 4 and 5, using +9V.


The last thing I don't really understand is what I should do with 0V, shield, chassis connection and how all these are connected. I think I understand the idea behind what you said Ccaudle, but I don't really know what to do.

Should I have two different paths, one would be for what I call GND (which is my 0V reference voltage connected to my copper plane on the bottom of the PCB) and I should have a "chassis" connection that would connect the metal enclosure, shield from the Cat5 cable and Pin 2 of the MIDI Output ? Should I connect these two paths but only at a specific point ?

I'm not very good in the "ground" domain, it's still quite mystic to me...

Thank you for the great help ! :)
 

Attachments

  • PCB_PCB_MIDI-Line-Driver-A-Type_2_2024-10-09 Bottom.pdf
    231.7 KB
  • PCB_PCB_MIDI-Line-Driver-A-Type_2_2024-10-09 Top.pdf
    139.6 KB
  • Schematic_MIDI-Line-Driver-A-Type_2024-10-09.pdf
    77.1 KB
I hope I've understood everything
Yeah, looks good.

I'm not very good in the "ground" domain

That is why I don't really like the term, and try to use specific terms related to the function in the circuit.

The first use is easy, because it actually involves the ground: a long copper rod is pounded into the dirt where the AC power enters a building, and is connected to the protective earth wiring. The literal connection to physical earth ground is primarily for lightning protection.
The secondary use of that protective earth wiring is to connect one side of the power connection to that earth connection so that it has a defined voltage relative to the ground and conductive water and gas piping that is often routed through the ground. The protective earth wiring then is connected to metallic chassis of any AC powered equipment which does not have at least two levels of insulation from the power line in case of wiring faults which causes contact between an AC power wire and the metal chassis. The idea being that enough current can flow through that connection to trip the fuse quickly enough that a user will not be electrocuted by touching the chassis.

Does not apply to this design because AC power does not directly enter the chassis.

The second and very common use of the term ground refers to the signal and power supply return paths in a circuit. The signal and power supply may use the same return path, but not always, so it is best to think in terms of current circuits (i.e. where the current flows in loops) and really think critically about what connections might be sensitive to the voltage caused by that current flow (because any current flowing through an impedance generates a voltage proportional to both the impedance and the value of the current).
Because of a combination of telegraph circuits in the 1800's using the literal earth as a return path, and because most designs will have a connection from the power supply return to the chassis at some point, the term "ground" became used as a common term for the connection used as the power supply 0V reference and the power supply return path within the circuit, even though it might not have any actual connection to the physical dirt (e.g. in a battery powered device with no external wires, or a device inside a car or airplane).

An electrostatic shield is a conductive enclosure which surrounds circuitry to divert electric fields (but typically not magnetic fields) around the circuitry. Any place that a shielded conductor penetrates that enclosure, the cable shield must connect to the enclosure to avoid becoming an antenna for interference inside the enclosure. Any single-ended (as opposed to differential) signals use the cable shield as one of the signal conductors, and the input or output circuitry is almost always using the power supply 0V connection as the signal reference, the power supply 0V and the shield connections have to get tied together.
Even fully differential signalling will tie the power supply return node to the chassis at one point so that voltage variations of the chassis with respect to the circuitry are not capacitively coupled into the circuit. You do not want multiple connections from the circuit to the chassis or cable shields though, because that gives a chance for any currents flowing on those shields to flow through your circuitry as well, which would mean that instead of protecting the circuit from noise, the shields are now injecting noise directly into the circuit.

Noted instructor Bill Whitlock participates here as "MisterCMRR" and has provided a link to a presentation he gave several years ago to the Indiana chapter of the Audio Engineering Society. It goes into much more depth than any single posting could, and has illustrations to explain the concepts as well:

Bill Whitlock AES presentation on grounding and interfacing
 
One layout point I just noticed is that the footprints you used for C5 and C6 are very large. You can get 100uF capacitors in that footprint, for high frequency bypass 1uF capacitors you would typically use a package like the attached picture (for through hole; surface mount equivalent would just be a small rectangle). That is a 50V 1uF ceramic capacitor. You can fit it directly beside the power pin, which will give the lowest resistance and inductance connection.
Also, electrolytic capacitors have relatively high inductance compared to small package capacitors, so when using an additional small capacitor for high frequency stability, the smaller capacitor should be closer to where it is useful. In this particular case that would mean putting the 0.1uF or 1uF ceramic capacitor directly next to the regulator, and moving the electrolytic farther away. Most LM7805 type regulators are pretty low bandwidth and so don't need a low inductance cap specifically for stability purposes, so in this particular circuit it probably doesn't hurt or help, just something to be aware of for cases where it does matter (like bypassing digital devices).

1728510636514.jpeg
 
Back
Top