Electronic – How to float the output of an optocoupler when needed

opto-isolator

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?

circuit

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.

Best Answer

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 ;-)