Logic to Logic Isolation

I am planning to use an Arduino as a MIDI Interface between my computer and various guitar effect pedals.

Regarding audio ground isolation, I am considering two options

use an usb isolator btw pc and arduino and connect the arduino pins directly to the pulled up stompbox signals
(shared ground btw arduino and stompbox)

2
use transistors btw arduino pins and stompbox terminals

I incline for the second option but I have some concerns about delays and I am not sure which transistors I should go for (optocouplers, etc)

Real MIDI hardware is isolated - are you using USB serial instead of MIDI interface?

I'm using the Arduino Pro Micro as a MIDI device.

It is not isolated. When connected to the PC, it mentains a ground loop through the audio signal and into the amplifier where it hums badly.

Are you suggesting an alternative to the arduino pro micro?

Transistors don't provide isolation. Opto-isolators, transistors, and relays can give you complete electrical isolation. In the case of MIDI (data) an opto-isolator would be the choice.

I don't know if a "USB isolator" has an isolated ground... I would think not (unless it has it's own power supply) because USB is supposed to supply/transfer power and lot of USB devices would fail without a power & ground connection and it would be a violation of the USB standards.

orinocopaul:
I’m using the Arduino Pro Micro as a MIDI device.

No, MIDI devices are by definition isolated. Its a pseudo-MIDI device using USB?

It is not isolated. When connected to the PC, it mentains a ground loop through the audio signal and into the amplifier where it hums badly.

Are you suggesting an alternative to the arduino pro micro?

In that case you will need isolation somewhere - probably the most logical way is to make the Arduino into
a true MIDI device and get a USB<->MIDI converter. The Arduino will also need an isolated power supply.

You could just isolate the link to the pedal(s), but that might be trickier if analog signals are involved.

Yes. I would isolate the link to the pedals. All I have to do is send pulled up 3.3 V digital signals to the ground of the stompbox.

This means I could even give up the usb isolator (which indeed has its own power supply).

Relays are out of questions. because of their delay.
I would go for an opto-isolator like the TLP222G but I have concerns about their delay as well. Do they have a speed rating or is it negligible?

According to the TLP222G datasheet, a current of IF = 5 mA applied to the LED will result in a turn-on time of tON = 300 μs. However, if I got it right, according to this graph, a higher LED current (meaning a lower LED resistor) will lower the turn-on time below 100 μs.

The Toshiba TLP222G falls into the category of photorelays. I did however noticed there are other types of optocouplers out there (e.g. high speed relays).

In my application it should briefly send a 3.3 V digital signal to ground. Latency is important. Not sure if I chose the right one.

DST_TLP222G-TDE_EN_4458-478511.pdf (173 KB)

According to some internet sources, optocouplers generally fall under these four categories

photo transistor
photo darlington
photo SCR
photo TRIAC

Which one of these optocouplers would provide a zero latency response when driving the 3.3 V logic of a separate audio device?

Which one of these optocouplers would provide a zero latency response when driving the 3.3 V logic of a separate audio device?

You can NEVER have zero latency with anything, but it will be short enough so you can’t tell the difference. Only a transistor output opto is suitable.

orinocopaul:
According to some internet sources, optocouplers generally fall under these four categories

photo transistor
photo darlington
photo SCR
photo TRIAC

Which one of these optocouplers would provide a zero latency response when driving the 3.3 V logic of a separate audio device?

The fifth category is a logic level opto coupler, which are specifically designed for passing high speed
logic signals. (There are also opto-couplers using LDRs, they actually are slow)

What are these signals for on the stompbox? Just on/off for effects? Or some protocol?

No protocol. Just On/Off signals for various effect functions such as looping start/stop/record.

The high speed is needed for precise triggering when synchronizing with other devices or looping. Other than that, there is no further communication btw. devices. Should I however consider one of these high speed communication photocouplers?

High speed is a relatively term. In electronics these signals do not need to be high speed. You can’t tell the diferance between a one microsecond delay and a one millisecond delay but one is a thousand times longer than the other.

You are hung up on this point and it doesn’t matter.

A bigger worry would be using multiple effects peddles on the same ground and power supply. Earth lift resistors often interfere with that.

orinocopaul:
The high speed is needed for precise triggering when synchronizing with other devices or looping

In electronics terms this is ultra low speed! Human time perception is a few milliseconds or so,
fast electronics is measured in nanoseconds or even picoseconds, many orders of magnitude above human
perception. Even lowly microcontrollers can run at multi-MHz rates.

Its best to always use numbers, not adjuectives, if you want to avoid confusion. Say "millisecond resolution"
not "high speed", or "latency below 3ms", then everyone knows what you mean.

Lots of values in electronics vary over a dozen or more orders of magnitude, such as frequency,
time, resistance, capacitance, voltage, current, charge, ... One persons "large" is anothers "tiny".

grumpy mike. indeed I was a bit hung up on the latency issue. but I took it as a way to narrow down my optocoupler options. the different types and the variations are just overwhelimng for me.

(and you are right! multiple effects sharing the same ground are quite an issue but I'm using batteries right now)

MarkT. thanks for the comprehensive feedback! it's great to have an overview and learn how to associate milliseconds with MHz etc

based on your feedback, I will

use TLP222G optocouplers
(I have some at home)

or

get some logic-level optocouplers
(after studying some more datasheets)

Additionally, I found out that within the daw software, it is possible to setup a MIDI offset value, meaning I could do a latency test to measure and automatically compensate the latency of the arduino/midi device.

meaning I could do a latency test to measure and automatically compensate the latency of the arduino/midi device

How would that work? Surly to compensate for latency you would have to know ahead of an event it was going to happen. To the best of my knowledge this would involve circuits with ESP.

I would make three tracks inside audacity or any other daw.

First is a sine wave.
Second is MIDI track with two triggers.

The sine wave goes out into one muted pedal, then back into the pc where it is recorded into the third track (only when unmuted by the midi triggers from the second track)

I zoom in and measure the distance between the second nd the third track. That is my latency.

Now I put it inside the MIDI OFFSET option (usually measured in 0.00 ms) with a negative value. That's it!

From now on track two will be triggered let's say 3.45 ms earlier, taking the MIDI latency (arduino + opto) into consideration.

Is it possible to change the topic name from Audio Isolation to Logic to Logic Isolation? Would be more precise.

Is it possible to change the topic name

Yes click on quick edit at the foot of the post.

Ah not real time then, that explains it.

The best in my opinion would be to make the stop-box a true midi device using 6n138 opto-couplers midi input & thru and a 7414 schmitt-trigger on the output as was the original midi specification. And connect that either to a USB-MIDI device or to an Arduino acting as a USB-MIDI device again with a 6n138 on the input.
If you can power your stomp-box from USB (without external power) but are experiencing interference and noise then you should be looking at mechanically shielding your device.
Midi is really quite slooow. at 30500 kbps and most commands requiring 3 bytes (note-on, note off) latency will always be an issue. regarding sync, Midi sync send a sync command (1 byte) 24 times per beat and the receiving core makes it's own bpm out of that. Midi timecode is very tricky to program so i won't even get into that.
The speed of Midi communication was defined so low to allow for lengthy cables without twisted pairs, and the receiving opto-couplers to counteract interference and ground loops. The benefit for us, Arduino users, turn out to be that it is not very difficult to make MIDI-adders and ports, since SoftwareSerial supports that BAUD rate.