Update: I've removed all irrelevant information and simplified the question.
The OPA548 operational amplifier provides adjustable current limit that can be controlled digitally with a current-out DAC. Below is a circuit from the datasheet. I've calculated that Iset current 0~6.7µA will give me desired output range 0~100mA.
However, OPA548 is powered by isolated ±25V DC-DC. So, I would like to isolate current limit control too, using IL300 optocoupler.
Question Can I simply connect photodiode to control pin like this:
Or do I need something more complicated, like current mirror:
As I understand it, the first option corresponds to input range about 0.56 mA at forward gain K2 = 0.012. This is just a fraction of the optocoupler's normal operational range 10 mA.
I think the formula for resistors in second option is Ilim = Id * R1 / R2, which means it can be adjusted to better use operational range.
Best Answer
I think the best circuit for your purposes is the first one (o a slight modification of it I'll propose below): below I analyze the pros and cons of each one of them.
Current mirror circuit: this circuits has many drawbacks and offers only one advantage. The main drawbacks are
Increased current errors and temperature drift of the set current. The BJT current mirror invariably adds at least two errors:
Increased circuit cost: in order to minimize the problems caused by the circuit/physical problems expressed by \eqref{1} and \eqref{2}, you should use a monolithic BJT matched pair as already said. These devices can cost several Dollars/Euros, etc..
The main advantage in using a BJT current mirror in this application is that, by using it, you can drive the OPAMP current programming pin with a circuit which is fully characterized from the electrical point of view, so you can reasonably predict its behavior by applying the ordinary circuit analysis techniques. The IL300 photodiodes are not througly characterized in their circuit behavior: for example their output resistance when used in current mode is not known.
Direct photodiode driver circuit: this circuits has several advantages and offers only one drawback. Its main advantages are the following ones
The main drawback of this circuit is that the IL300 is not fully characterized as an electronic component, as recalled in the description of the current mirror circuit above. However, this last problem can be solved by using a common gate JFET/MOSFET amplifier as shown in the picture below:
simulate this circuit – Schematic created using CircuitLab
This circuit has all the advantages of the two solutions analyzed above, with the only minor drawbacks that it will cost a little more of the direct photodiode driver circuit. As a matter of fact, this circuit