The cheapest kind have phototransistors. Below is a basic circuit diagram using one of these types (4N25):

The output of this circuit simply follows the input:

Note the slight curving of the square wave output. All opto-isolators will only work up to a certain frequency. Some are much faster than others. Make sure that the opto-isolator you use is fast enough for the signals you are putting through it - more details in section 4. The reason the rise time is slower than the fall time of the output waveform is that the rising edge is due to the 4k7 pull-up resistor, which has to discharge the capacitance in the opto transistor. If this needs to be speeded up, the 4k7 resistor value can be reduced, at the expense of using more current when the output is low.

When the LED is driven with a current of 10mA or so, it shines onto the phototransistor, which then starts to conduct (turn on). This takes the output voltage low. However much electrical noise is on one side, it can never be transmitted over to the other side. We may use an opto-isolator to send PWM signals from the low-power electronics side to the MOSFET drivers on the high-power side, and we may use them to transmit information from the high- power side back to the low-power side.

To complete the isolation of the low and high power sides, each must be powered by a completely separate battery. The high power side will be powered by the main 12v or 24v battery. The low-power side can be powered by a much smaller battery, maybe 6v.

- The first few graphs on power dissipation are not really of any great interest to us. They are more useful for people designing low-power consumption circuits.
- Fig 7: The Current Transfer Ratio vs. Forward Current is a useful graph. This shows how the CTR varies wildly. In our design, we will start with a required collector current for the output phototransistor. From that, we can calculate how much forward current is required in the LED to produce it using this graph. For example, if we required 10mA of collector current, then we must follow the line of this graph until the forward current times the CTR is 10mA. This occurs at about If=6mA / CTR=180%.
- Figure 9 shows how the CTR will be affected as the electronics get hot, which they are bound to do as the motors and MOSFETs start dissipating power. It shows at 100 degrees the CTR has derated to about 60%, so we should re-estimate our required LED forward current based on this. Assume the % values for CTR in figure 7 are only 60% of what they are shown, then we need about If = 10mA, to get a collector current of If x CTR x 60% = 10mA x 180% x 60%.
- Fig 6: Forward Current vs. Forward Voltage. This is the LED diode curve. We now know we need 10mA of forward current, and from this graph we can see that the LED will drop about 1.1 volts at 50 degrees C. If we power this LED from the output of a CMOS device (0 to 5 volts), then we can calculate the series resistor required: R = (5-Vf)/If = (5-1.1)/10mA = 390 Ohms.
- Figure 8 allows us see the collector-emitter voltage that will be present when the output phototransistor is turned on. Follow the If = 10mA line until it crosses the 10mA Ic of the vertical axis. The Vce(on) is about 1 volt. This is the voltage we will have at the output when the light is on. We can now calculate the load resistor, Rl, that we require from the collector to battery positive, Vb. This is Rl = (Vb-Vceon)/Ic = (12-1)/10mA = 1.1k.
- Figure 11 shows how much current will flow through the phototransistor when the LED is off. Worst case, when hot, is about 10 microAmps. With this current, the output voltage will be Vo = Ic(off) x Rl = 0.00001 x 1100 = 0.01V. This is how much lower than Vb the output will be, i.e. 12 - 0.01 = 11.99V. This is the output voltage with no light input.
- Figure 12 allows us to see how fast a signal the opto-isolator can cope with given the conditions that we have now laid down. The load resistor is 1.1k, follow the tr and tf lines to get tr=25, and tf=20 microseconds. Now the fastest signal will be when the output rises as soon as it has fallen, and falls as soon as it has risen. A complete cycle takes 20+25=45 microseconds. This is the minimum time that one pulse can take. For the PWM signal, it is the thinnest pulse. If you want the PWM signal to increase in steps of, say, 5%, so there are 20 discrete speed settings, then one 5% slot will be 45 microseconds, so the complete frequency will be 20 slots worth, or 900 microseconds, which is a frequency of 1.1kHz.

The PWM signals are generated elsewhere in your circuit of course, so you may already have decided what frequency they will be. This frequency, together with the number of discrete speed steps that you have, determines how fast the opto-isolator must be. The diagram below show a PWM signal with 12 discrete speed steps, with a 1/12 level signal (signal A). This means the signal is high for one twelfth of the time:

The number of speed steps may be greater. Most microcontrollers with PWM outputs use an 8-bit register, giving 256 discrete speed steps.

The frequency of this PWM signal is the reciprocal of its total time
period, t_{p}. F_{pwm} = 1/t_{p}. However, any
circuit that transmits this must be able to respond to the single pulse.
To respond to this, it must be able to respond to a frequency rather higher
than F_{pwm}, that shown in orange in signal B. The frequency of
this signal is

The 16 in the equation comes from the number of discrete steps, so in
general, we can say that if we want *n* discrete steps, the opto-isolaator
must be able to handle a frequency of

Most opto-isolator datasheets quote the rise and fall tmes of the opto-isolator outputs rather than a maxmum frequency. How can we use these values? The diagram below shows a more realistic signal from an opto-isolator.

In this diagram, the rise and fall times are shown equal, but they are often not - especially with open-collector or open-drain type optos where an external pull-up resistor controls the rise time. It can be seen from this and the previous equations that

Therefore, if we are given an opto with defined rise and fall times, we can work out:

The maximum frequency for *n* discrete speed steps:

The maximum number of speed steps for a PWM frequency of F_{PWM}:

*Example*

__Question__

The Hewlett Packard (Agilent) HCPL-3120 optocoupler has the following parameters:

t_{r} = t_{f} = 0.1μs

Given that the PWM frequency has been set at 25kHz to be above audible range, what is the greatest number of discrete speed steps that can be attained.

__Answer__

Using the equation

n = 400. Therefore n 8-bit PWM register with 256 discrete steps would work fine.

Note that even if we drove this optocoupler with more than 400 steps,
all that would happen is that there would be no measurable difference between
a setting of, say, 650, and 651, and if a 1024 discrete step PWM signal
was set to a level 1/1024 (signal high for one 1024^{th} of the
time), then the opto would not respond, and the effective level would be
zero.

The three segments during which the signal is high are not necessarily next to each other. This signal will generate a smoother resultant speed in the motor than if all three pulses were next to each other. Some PWM generators may generate a signal like this, some may have all three pulses next to each other, in which case the required response time of the optocoupler need not be so high.

Avago (hermetic)

Sharp

Toshiba