# How to float the output of an optocoupler when needed?

I want to have an opto-isolated output which can be driven high, low or left floating. I thought of the following circuit but I'm quite new to electronics so I don't know whether it makes sense. Do you think something like this could work?

When EN from the input side is high, IC2 is supposed to drive the output high or low. When EN is low, IC2's output should be floating.

As I understand it, when the transistor in IC2 is conducting, the OUT pin goes low. When it's not conducting, it floats. So, by itself, the optocoupler can drive the output only to ground or leave it floating. I want to drive it high also, am I understanding something terribly wrong?

Edit: Sorry my original question wasn't so clear about what I want to do with this circuit. I want to have multiple copies of the input/output circuit, preferably controlled with just one enable/disable circuit.

Also, I'd like to use a high speed device since one of the outputs will be a serial link and I don't know how to find a fast standard-type optocoupler.

-

You could connect a buffer like SN74LVC1G240 instead of the transistor to control the output of IC2.

The output of IC1 goes to the Output Enable input of the buffer. The output of IC2 goes to the A input of the buffer.

When the EN is high, the output of IC1 is low, enabling the buffer output. When the EN is low, the output of IC1 is high, disabing the buffer output (floating).

I think this should work, but please double-check before ordering parts ;-)

-
I think this is the best solution, but if I went this way I would probably also switch to an optocoupler with totem-pole outputs instead of 6N137. FOD0721 seems to have similar speed specs and would eliminate external pull-up components. –  The Photon Jan 2 at 17:42
I agree. Now I'm planning to use 74xx244 to buffer multiple input lines. I have one last question, would I need to connect series resistors to its inputs to limit current or do these 74xx devices already do it by themselves? –  dodo Jan 2 at 17:59
Sorry for the late reply! No, you do not need a series resistor on the inputs. But remember, always check the datasheet for any device you use, it usually covers the typical usage scenarios. –  HenningNT Jan 7 at 8:23

Why not connect the outputs to form a push-pull driver (then there is no need for a load resistor). One opto input can be the inverse of the other and when you want to tri-state the output, disable the drive to both input LEDs.

You'll get a superior switching characteristic too because the rise time for the opto's output is typically 50ns whereas the fall time is typically 12ns.

-
@dodo Yes this would be a problem with the device you are wanting to use - I didn't recognize that the 6N137 needs a regular supply on it's output stage - I just saw it as a photo transistor output. I don't think my answer will work with that device but it should be ok with standard type BUT, the problem you face is getting a standard part with the speed of the device you specified. –  Andy aka Jan 2 at 13:26
And what will happen if both optocouplers turn on simultaneously? –  alexan_e Jan 2 at 13:52
@alexan_e What would happen if both transistors in a push-pull audio amp turned on together? We ensure that this doesn't happen because things will fry. With regular phototransistor outputs, the current is reasonably determined by the input diode current and the CTR so I don't see this as a problem. The problem is this circuit won't work with the OP's choice of 6N137. –  Andy aka Jan 2 at 14:17
I'm just wondering why you haven't used a resistor between the transistor outputs, would it have any disadvantages? –  alexan_e Jan 2 at 14:24
@Andyaka - I would highly discourage the stacking of the two opto coupler outputs as you show in the your answer. You should add some means of current limiting. Depending on the forward current of the diodes and the CTR is not a reliable way to limit the shoot through current that can occur when both couplers are ON. First off in a digital switching application the couplers are driven hard to get good output saturation and operational speed of the coupler. Secondly the CTR specs are typically much to broad to be used as a viable design constraint. –  Michael Karas Jan 2 at 14:40

I think a circuit like this would work

IN1 controls the pullup resistor and IN2 controls the low side switch that grounds the output.

IN1=ON , IN2 = ON output LOW
IN1=OFF , IN2 = ON output LOW
IN1=ON , IN2 = OFF output HIGH
IN1=OFF , IN2 = OFF output FLOAT

-