# Computing stuff tied to the physical world

## Optocoupler current transfer

In Hardware on Oct 11, 2012 at 00:01

The past few days were about generating a linear ramp, in the form of a triangular wave, and as you saw, it was quite easy to generate – despite the lack of a function generator.

The result was a voltage alternating between about 0.6V and 3.0V in a linear fashion. Here’s why…

I want to see how the MCT62 optocoupler passes a signal through it. More specifically, how a linearly increasing voltage would come out. Let’s look at that chip schematic again:

So the idea is to apply that linear ramp through a current-limiting resistor into the opto’s LED. Then we put the photo-transistor in a simple 5V circuit, with again a current limiting resistor between collector and 5V – like this:

From left to right:

• apply a triangle wave to the LED, which varies from 0.6 to 3.0V
• there’s a 1 kΩ rsistor in series, so the maximum current will stay well under 3 mA
• the phototransistor is hooked up as a normal DC amplifier
• there’s another 1 kΩ pullup, so this too cannot draw more than 5 mA current

Prediction:

• when the LED is off, the output will stay at 5V, i.e. transistor stays off
• until the input rises above the 1.2V threshold of the (IR) LED, not much happens
• as the voltage rises linearly, so will the current through the LED
• depending on the transfer function the transistor current will rise accordingly
• and as a consequence, the output voltage will drop

So if that behavior is linear, then the output voltage should drop linearly. Let’s have a look:

• the YELLOW line is the triangle wave, as generated earlier
• the PURPLE line is the voltage over the leftmost resistor
• the BLUE line is the voltage on the transistor’s collector output
• the RED line is the derivative of the BLUE line
• the zero origin for all these lines in the image is at two divisions from the bottom

First of all, the purple line indeed rises slowly once we start rising above 1.0V, and it stays roughly 1.2V under the input signal (yellow line).

The blue line is the interesting one: it takes a bit of input current (i.e. LED light) for the transistor to start conducting, but once it does, the output voltage drops indeed. Once we’re above 2.0V, the blue line becomes quite linear. As indicated by the fact that the red line is fairly flat between horizontal divisions 5 and 7.

So in this range (and probably quite a bit above), we have a linear transfer from input current to output current. Or voltage … it’s all the same with resistors.

In terms of current, we can use the purple line: it’s flat with a diode current between 0.7 and 1.7 mA (and probably beyond).

The output voltage only drops to just over 2V, so the phototransistor is still far from reaching saturation (“conducting all out”).

So what’s the point of all this, eh?

Well, one thing this illustrates is that you can get a pretty clean signal across such an optocoupler, as long as you stay in the linear range of it all. There is no real speed limitation, so even audio signals could be sent across reasonably well – without making any electrical connection, just a little light beam!

It’s not hard to imagine how this could be done with discrete components even, sending the light to a glass fiber over a longer distance.

You can call it wireless signal transmission, albeit of a different type: optical!

1. Can I colour that scope trace in? It looks like a Swiss mountain scene!

2. Perhaps d/dx(CH2/CH3) is a better measure for transfer ratio?

At least smoother to help TankSlappa keep his crayon inside the line ;-)

3. In a circuits class I took, they suggested adding a second optocoupler (ideally in the same package for matching), as an element inside a feedback loop to get a more linear and stable-vs-temperature overall transfer function. Basically you have an opamp that says, “what voltage (current) do I have to generate, so that the output from my local optocoupler is the same as the output from the “real” optocoupler (being used for isolation)?

4. We use this method for monitoring systems inside an EMC chamber, an led at one end of a fibre and a photo diode at the other. Used for digital monitoring, CAN and analogue, audio.

5. I may be missing something obvious here, but why did you not just use the 2D component testing facilities of the scope to test this? Why all the trouble to generate a linear ramp with analog parts?

Or another option: why not use the PWM output of an Arduino/Jeenode with a suitably sized capacitor, or a real DAC chip?

• The component tester can’t drive one part of the circuit and measure another – it’s just a sine wave voltage, and it measures its own current changes.

Yes, PWM or DAC would have worked as well. But I wanted to solve this with an analog circuit. Note also that an op-am might be necessary either way, to provide enough current to drive the LED. It’s probably the same amount of work and complexity either way.