# What is the correct way to measure voltage with an optocoupler?

I'm using an optocoupler to measure a voltage, I'm making a current loop to control the current through the LED, so I'm using three op-amps: one to measure the voltage, one to set up a current offset because at very low currents the CTR is far from linear and finally a third one to make the actual current loop.

I measure the voltage with a uC in the points marked and get this characteristic

The saturation starts at a quite low current for the LED, about 5mA. The results I get playing with the operation point aren't bad - the right scale is for the error, both scales in volts.

But I wonder if its a better way to to this, for example I'm not using the base of the transistor externally, would be that a better option than the current offset? Would that increase the linear region?

Edit

Kevin White, do you mean doing this:

That's definitely a simpler solution and it allows to avoid the math for calculating the voltage through the op-amp transfer function and the linear regression.

• Anyhow, this is my goto document for better (in various ways) linear optocoupler circuits: avagotech.com/docs/5954-8430E As for power supplies, the non-linearities are accounted for when designing the control loop (if I recall correctly) so it doesn't need to be very linear. You may want to ask that as a more focused question, e.g. "how do SMPS designs deal with optocoupler non-linearities?". The latter is dealt with in vishay.com/docs/83711/appn55.pdf (didn't yet read) Commented Oct 5, 2015 at 2:09
• The option of using voltage/frequency and frequency/voltage to take advantage of the digital optocouplers sounds like a good idea. Commented Oct 5, 2015 at 2:26
• Yes in more expensive designs, but SPMSes don't do that. After looking at it more detail, the last (vishay) document I indicated is actually pretty far from standard SMPS designs. You'll want to read one of Christophe Basso's books for that. The calculations that makes a simple TL431+opto SMPS possible are rather complex. Commented Oct 5, 2015 at 2:39
• Actually, I had to dig a 3rd article to get the gist of it: "By creating the error signal on the secondary side rather than trying to transfer a signal to the primary that is proportional to the output voltage, the effects of the optocoupler’s nonlinearity and high gain variation can be minimized." (This was really worthy of its own EE.SE question...) Commented Oct 5, 2015 at 3:37
• Yes, the way you have shown should give significant improvement over a single optocoupler. I used that arrangement successfully before the devices like the IL300 were available. Commented Oct 5, 2015 at 4:00