# Current limiting with optocoupler

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.

• What problem are you actually trying to solve? What is the OPA548 driving and why does it need the current limit controlled dynamically? – The Photon May 8 '18 at 16:08
• And do the OPA548 circuit and the controlling circuit share a ground? – The Photon May 8 '18 at 16:15
• OPA548 are parts of the H-bridge and current limit is just a protection which I want to adjust depending on load requirements. It's not "dynamic" in normal sense, it simply has to be changed relatively fast but not very often. The controlling circuit and power stage used to share ground, but with optocoupler they don't have to anymore, which I fully intend to exploit – Maple May 8 '18 at 16:52
• An op-amp driving an H-bridge is an "unconventional" choice. – The Photon May 8 '18 at 17:13
• It's relevant because you're probably presenting us with an X-Y Problem. Even if you think the solution to X is Y, we would rather help you solve X the best way possible. – The Photon May 8 '18 at 17:28

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.

1. 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:

• $V_{BE}$ drift error: using a current mirror invariably implies the addition of a temperature drift to the reflected current $I_{Lim}$, due to its offset voltage temperature drift: $$\frac{\mathrm{d}V_{os}}{\mathrm{dT}}=\frac{\mathrm{d}\left|V_{BE_{T_1}}-V_{BE_{T_2}}\right|}{\mathrm{dT}}\tag{1}\label{1}$$ This term, even if being small in many cases, is present: it implies a temperature depending variation of the difference between collector currents $I_d$ and $I_{Lim}$, even if $V_{BE_{T_1}}=V_{BE_{T_2}}$. It has to be minimized, therefore you cannot use two 2N3904 since their junction temperature could be very different rising the value of \eqref{1}: you should use a monolithic BJT matched pair like LM194, MAT01 etc. which are optimized from this (and many other) points of view.
• Uncertainty in the reflected current $I_{Lim}$ due to low level transistor current gain $\beta$ limitations at low current level: basic circuit theory says that, for the standard current mirror as the one made of the $T_1$ and $T_2$ BJTs, the following formula for currents holds $$I_d=I_{Lim}\left(1+\frac{2}{\beta}\right)\tag{2}\label{2}$$ This means that the difference between $I_d$ and $I_{Lim}$ is of the order of $\beta/2$. For currents of the mA order, \eqref{2} is not really a limitation: however, when your collector current drops below 10µA, you cannot use the 2N3904 as its current gain is not guaranteed at such low levels, and you can easily get $\beta\approx 30$. Again, you should use a monolithic BJT matched pair.
• 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.

2. Direct photodiode driver circuit: this circuits has several advantages and offers only one drawback. Its main advantages are the following ones

• Low drift of transfer current: this choice inherits all the IL300 drift/precision characteristics. Its excellent behavior under these aspects is mainly due to the fact that it is a negative feedback system.
• Simplicity and economicity: it requires only the IL300.

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

• It is not influenced by gain variations of J1. The (low frequency) common gate current gain $\alpha$ for every field effect devices is practically 1, thus there is not any special requirement on J1. The only current ouput error is due to the $I_{GS}$ leakage current, which however is in the pA range: and if you choose a MOSFET instead of a JFET device (I used this one in the schematic since Circuit Lab does not offer the depletion mode MOSFET symbol), the behavior of the leakage current respect to temperature and voltage variations is even better.
• It is a negative feedback circuit. Temperature drift of J1 parameters are automatically compensated by the high source impedance, the D1 output impedance.
• It is fully characterized as an electronic circuit: the high impedance of D1 is loaded by the low source input impedance of J1. Then the output impedance at J1 drain can be estimated with reasonable precision, and this is true for all its other circuit characteristics.
• Thanks for detailed answer! I was rather hoping first circuit would work because a) I hate overblown for no reason schematics and b) the space is rather limited. Couple questions though. The datasheet suggests simple resistor in kΩ range for applications with fixed limit, so maybe D1 impedance is not that important? Would it be beneficial to use OP Amp with wider input (OPA547 requires 0~20μA for same limit range) and optocoupler with smaller forward gain (0.007 for LOC110)? – Maple Sep 10 '18 at 18:38
• @Maple: the output impedance of D1 is not important at all if you need "only" to set a temperature stable precise current limit. Nor a wider range for current programming pin nor a lower forward gain optocoupler will be particularly beneficial: photodiodes used in the current generator mode are notoriously extremely linear at the lowest intensity of incident light, i.e. at low current output, so widening the input/output range of the optocoupler will be useful only if you must use a low performance OPAMP as the feedback element at the input but require a fine regulation of the current limit. – Daniele Tampieri Sep 10 '18 at 21:19
• Excellent. So, I was worrying for nothing.. The only reason I came up with current mirror was because all characteristics in datasheet are given for 1~10mA input current, and many diagrams have scales beginning at 0.1mA. I did not know that photodiodes are linear at lower currents. Last question: wouldn't use of LEDs/photodiodes at so low currents make them more susceptible to noise? – Maple Sep 10 '18 at 21:45
• @Maple: this is sure. However, as in low photocurrent detection, the key method to reduce/eliminate noise problems is to follow proper layout rules, the following ones. a) Use a ground plane (mandatory). This accounts for most if not all problems, and in your case with low frequency signals, you even don't have to worry of frequency response. b) Keep the OPA548 and the servo feedback OPAMP as close as possible to the IL300. This will avoid/reduce induced voltage on the signal loop. c) Last and somewhat optional, put around the signal track as much ground connected copper fills as you can. – Daniele Tampieri Sep 11 '18 at 5:47
• @Maple: If you follow the best practices for low noise circuit, you should succeed in making a low noise board, avoiding all noise problem. I want to stress the importance of the ground plane: I used it also in wired prototypes of Wideband RF amplifiers (above 100MHz) and for low level photocurrent amplification (safety lifter barriers) and I have not had any problem in reaching an almost theory-like performance. – Daniele Tampieri Sep 11 '18 at 5:54

These circuits are typically used like this: The reason why I show this circuit is so it is understood (mainly for other readers) what goes on the other side of the optocoupler which is important and not defined in the question (at the time of writing). The feedback of the LED and opamp with the photodiode linearizes the photodiodes response. (No exponentials). The only problem with this is the photodiodes are not matched exactly, so there is a factor K to account for the mismatch which can be though of like a gain.

With the equation being:

$$\frac{V_{ISOAN}}{V_{DAC}}= K\frac{R_{11}}{R_{17}}$$

The relationship of the photodiode currents is this:

$$K = \frac{I_{PD2}}{I_{PD1}}$$

If we drop the transimpedance amplifier on the side with pins 6 and 5 of IL300 the equation changes to this:

$$V_{DAC}=\frac{I_{PD2}{R_1}}{K}$$ So you don't need a current mirror, but you do need to make sure you adjust for k. The gotcha with K is it ranges from 0.56 to 1.65 and is dependent on the part number. It can also range up to ~15% per a part, so if you need more accuracy on setting the current limit, then an analog optocoupler may not be the best. From the datasheet: It might also be worth looking into a scheme like this (with a digital isolator) if you can find the right DAC (or DAC with current mirror). And you wouldn't need to worry about gain accuracy. • I was going to use servo feedback on fig 3 in this app note because it has better input impedance than photovoltaic configuration. Had the same idea on digital isolation but scratched it. The DAC I have at hand has SPI interface, isolating that adds too much complexity to circuit, not to mention additional SS pin. The OP Amp is bin F. Great point on adjusting for it, thanks! The gain linearity ±0.25% is OK by me, but it is specified for 1~10mA IF, which was main concern and a reason for this question. Don't know how it will behave at 0~0.6mA – Maple Sep 10 '18 at 18:21
• If your DAC input is 5V and your gain resistor is 400k and you use a "Bin A" part then your current will be 6.96uA on the 'low end' of the bin (0.557) and 7.95uA on the high end (0.636). If I remember right, the pin can be tied to -V so it's probably not a big deal if you over drive the photodiode current. The real gotcha is if the K gain tolerance will be OK for your application. – Voltage Spike Sep 10 '18 at 18:32
• You may also want to read this: meta.stackexchange.com/questions/126180/… I did take some time to answer this question, so take that into consideration and upvote. With no op amp you won't have to worry about voltage offsets (which can cause issues at that low of signal) for a low of current. – Voltage Spike Sep 10 '18 at 18:33
• My apologies for not up-voting right away. The stereotype of Canadians being polite is rather misleading. We do say (or type) "thank you" and "sorry" on reflex, but often consider it was sufficient and do not go beyond that – Maple Sep 10 '18 at 19:05
• @Maple Canada's great I spent a few years up there in western canada, I don't even care if people upvote my questions, but I think there is not enough upvoting and it benefits everyone if people would just take the time, so I try and promote it and be slightly generous with upvotes – Voltage Spike Sep 10 '18 at 19:24