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?
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.