Optocoupler design - why does this circuit work?
A few notes:

CTR is only rarely a guaranteed value that you can use for accurate linear isolated measurements. In the case of the TLP621-4, the datasheet only guarantees that it's somewhere between 50% and 600%. I'm not sure where your 120% number came from. Even the graph on page 8 doesn't show 120% at 5 mA, and it has multiple very different lines from different sample devices besides.

That CTR curve (page 8) also shows CTRs down to 300 μA, so I'm not sure what datasheet you're looking at but it's not the one on the page you linked to.

This optocoupler is specifically marketed, and thus probably designed, as a solid-state relay, only intended to be used as a switch and not as an amplifier or analog isolator.

You won't be able to achieve a \$V_{CE}\$ of zero, as the output transistor still has a \$V_{CE,sat}\$ like any bipolar transistor. This doesn't matter, however, because there's a fair margin on what most logic chips and microcontroller inputs will accept as a logical high. It should say in the datasheet what that is, likely labelled as \$V_{IH}\$ (for voltage, input high).

What value you use for the output resistance also shouldn't matter, as long as it's high enough to allow the transistor to fully saturate, and low enough to reliably act as a pull-down on the logic input. When the transistor is saturated, CTR goes out the window, just like how β is useless in a standard BJT in saturation.


The way I would design this circuit is to have the LED run at a reasonable middle-of-the-range current, to ensure that the output transistor saturates regardless of what the CTR is. Since they guarantee the CTR to be at least 50% with a forward current of 5 mA, that's the condition I'd design for: 5 mA input, and 2.5 mA output. So choose your input resistor to give 5 mA through the LED.
Then, you need to select your output resistor. You are guaranteed that the output current will be at least 2.5 mA if you have no resistance in there at all. But we don't want that--we want to ensure that the transistor is saturated. So we use a resistance that, in combination with the transistor's \$V_{CE,sat}\$ (max 0.4 volts according to the datasheet), results in, let's say 2 mA current on the output.
Now, regardless of what the device's actual CTR is, you'll see an output current of approximately 2 mA through the resistor, and an output voltage of between 2.9 and 3.3 volts (depending on what the device's actual \$V_{CE,sat}\$ is). This is a voltage high enough for any 3.3 volt logic input I've ever worked with (and many, if not most, 5 V logic inputs too) to read it as a reliable high.

To answer your questions in the comments:

If the saturation voltage is a fixed value, then how does increasing (or decreasing) the resistor value not have an influence on \$V_O\$? Does the collector current compensate for the change in resistance, or am I missing something?

Yes, the collector current will reduce. One (oversimplified!) way to think of it is that (for complicated reasons relating to the way transistors work), it's not possible for there to be current through the transistor with \$V_{CE} &lt; V_{CE,sat}\$.
Another intuition is to think of it this way: With the transistor powered from a 3.3 volt supply, with a 1 kΩ resistor in series with it, could that transistor possibly drive 10 mA through that resistor? That would make 10 volts across the resistor--but you only have 3.3 volts to work with! Clearly, it can't drive that much current, even if the CTR or β says that it should--this is when the transistor saturates.

Perhaps a follow-up question - what design condition drives the phototransistor into saturation in the first place? In other words, what are the design parameters to ensure that the phototransistor is in saturation?

An easy way to do it is as follows:

Either in a real circuit or in simulation (including manual circuit-solving as simulation, here), connect the collector to your supply voltage, and the emitter to ground. No resistors or anything.
Apply your designed current through the optocoupler's LED.
Measure or compute the current through the transistor.
Figure out a resistance that would produce that same current given that same supply voltage across it.

That resistance is (slightly higher than; we didn't account for saturation voltage) the minimum resistance required such that your transistor is in saturation. If you use a larger resistance, you will have less current, but still the same output voltage. If you choose a lower resistance, you will have the same current, and a lower output voltage.