Recently I asked a question about optocoupler: Shematics: optocoupler controls a transistor and doesn't work as expected

I have one more question related to the topic. PWM input comes from the microcontroller Atmega88 and there are Q5/Q7 to drive optocoupler. As far as I see the two schematics below are identical. Output is used to open power transistor that charge or not the battery.

What schematics should I use and what advantages and disadvantages of them? Thank you

The first schematics:


The second schematics:



Thank you for all the comments, I'll try to explain the question more clearly:

1) PWM frequency is 10kHz, I may select any other PWM frequency because it's coming from the MCU

2) Full part name of the optocoupler than I use TLP181YE, there is no such part in Multisim

3) What I try to achieve:

  • I try to have OUTPUT (on the right) that connects to the base of power transistor FJD3076 (not presented)

  • The transistor FJD3076 controls the current that charges battery.

  • The intention is to gradually increase/decrease base current of FJD3076 using OUTPUT so I want TLP181YE output to change gradually (no PWM here)

  • PWM comes from MCU and after R21/C2 (R14/C1) there is a constant voltage (I may control it using PWM) that controls Q7 (Q5) and therefore TLP181YE and therefore FJD3076


Based on very useful replies from Andy, Russell and Vovanium (Vladimir I guess) and experiments:

  • there is definitely a problem with trying to pass analogue signals through the optocoupler

  • I get rid of C2 and PWM altogether, I'm charging the battery with constant voltage, current limitation isn't presented in the schematics. Instead of PWM I will have steady 0 or 3.3V

  • regarding the positioning of the transistor, I stick with the first schematics

I'll experiment with the board more and be back with the final results.

  • \$\begingroup\$ Is the PWM a 5V signal or 3V3 ? \$\endgroup\$
    – alexan_e
    Apr 4, 2014 at 10:30
  • \$\begingroup\$ I'm using PWM 3.3V, schematics in the linked question is a bit different \$\endgroup\$
    – Konstantin
    Apr 4, 2014 at 10:32
  • 1
    \$\begingroup\$ What is that 1uF capacitor doing on the base of the transistor? In combination with R21 (or R14) that's going to slow things down a lot. \$\endgroup\$
    – gwideman
    Apr 4, 2014 at 12:40
  • 1
    \$\begingroup\$ PWM forcontrol is fine if applied after the coupler. What sort of battery are you applying constant voltage to? IF the supply is current limied (as you say it will be) then this will in most chemistries have the effect of CC charging at current limit until the battery reaches the CV limit and then CV charging. This is acceptable in most chemistries that you will meet. For LiIon/Poly CV = 4.2V or a bit less. CC is C/1 usually (can vary with SOME manufacturers). Lead acid rate varies with type and desired lifetime ie C/1 is usually too high unless you can monitor and control gassing. \$\endgroup\$
    – Russell McMahon
    Apr 7, 2014 at 12:26
  • 1
    \$\begingroup\$ ... CV for LA depends on whether you are using for deep discharge or standby operation and also somewhat on plate type. NimH is OK at C/1 as long as you can detect the -ve dV inflection at full charge or monitor cell temperature - both delta-Temp and Temp absolute are goodish indicators of full charge point. NimH can use C/1 up to 1.45V/cell and then terminate BUT that V varies a little with manufacturer and capacity and also with temperature. | All chemistries care about temperature not being too high - Tmax varies with type. | LiFePO4 is best for temp and also allows CV / CI charging. \$\endgroup\$
    – Russell McMahon
    Apr 7, 2014 at 12:29

3 Answers 3


In example 1, with a 3.3V PWM signal, the emitter of the transistor will only attain about 2.7V peak and this means the LED peak current (PWM = 1) is about 5mA.

Bear in mind I've assumed the volt drop across the LED is 1.7 volts.

In example 2, the emitter is grounded therefore you can probably turn the transistor on to about 100 mV saturation. This means the peak voltage produced across the 200 ohm and LED is about 3.2 volts and this drives about 7.5 mA through the LED.

  • \$\begingroup\$ thank you for the reply. So both schematics are essentially the same and by changing the 200 ohm resistor we may make them produce the same current. As a result, you don't see any advantage of one schematics over the other? \$\endgroup\$
    – Konstantin
    Apr 4, 2014 at 12:23
  • \$\begingroup\$ If you pushed the high speed operation of the two circuits, circuit 1 would perform a little bit better because it has no gain. Circuit 2 will have parasitic components of capacitance across base-collector and this can slow down things a tad. \$\endgroup\$
    – Andy aka
    Apr 4, 2014 at 12:36
  • \$\begingroup\$ Oh sorry.. that was for the OP. I'll move it. \$\endgroup\$
    – gwideman
    Apr 4, 2014 at 12:40
  • 1
    \$\begingroup\$ Well, it could be But default Arduino PWM is 490 or 980Hz or so, and the RC time constant with that 1uF cap is 4.7ms. Partly affected by impedance looking into the transistor base, but nonetheless, this doesn't look like a deliberately designed feature. \$\endgroup\$
    – gwideman
    Apr 4, 2014 at 12:46
  • 1
    \$\begingroup\$ Why not filter after the opto. Then at least you don't have the analogue going thru the opto. \$\endgroup\$
    – Andy aka
    Apr 4, 2014 at 17:36

First chematics have better accuracy, because if have voltage gain very near to 1, then, photodiode current is defined by that voltage and R17.

Second schematics is bad on driving transistor. Transistor have very low case-emitter resistance, so it cannot be driven with constant voltage. In this condition you'll see pulses on output rather than constant voltage. It needs current source (at least put resistor between transistor and capacitor here). But then its current transfer ratio rely on transistor hFE, which is very unstable, so you will not able to get adequate transfer characteristics on this circuit.

On the other hand, first schematic have narrower range of controlling voltage (and thus PWM range): you need voltage at least Vled+Vbe for LED to light. If you want to use full PWM range you'll need to use something more close to second one that first.

...But after all any effort to better transistor cascade will be sacificed by unstable current transfer characterstic of optocoupler.

  • \$\begingroup\$ Thank you for your reply, I decided to go with a different solution (without PWM). I updated my question \$\endgroup\$
    – Konstantin
    Apr 7, 2014 at 7:43

You should state what you are trying to achieve. References to other questions are OK for background but people must not have to look at other questions to work out what the question is.

  • If you want output that provides pulsed output matching the PWM signal then you must not use C1.

  • If you want signal out when PWM > some duty cycle then C1 may be needed BUT neither cct is not what you want.

The two circuits are NOT equivalent. There are important major differences. They MAY produce similar results in some cases but it is not possible to be sure if this is true without a clear idea of the actual question.

With both circuits R21 or R14 form a low pass filter with C1. This rounds the PWM pulses or worse. Why this is thought useful may be locked in the mind of the original designer. Above about 1 kHz you may get little or no output.
Where did you get the circuit from?
Why is C1 included?

CCT1 and CCT2 are conceptually quite different.

CCT1 is a current source feed of opto with
Iopto ~~~= (VPWM- Vbe - Voptodiode) / R17
with C1 adding complications.

CCT2 uses Q5 as a switch so
Iopto ~~~(V9 - Vsat - Voptodiode)/R13.

Note that in the 1st case Vpwm sets I and in 2nd case Vsupply does.
The results MAY be similar in some cases and not in others.

TLP52 data sheet here http://www.futurlec.com/Datasheet/LED/TLP521.pdf
The current trasnfer ratio = Iout/Iin varies immensely with variant - from 50% to 600%.

In both cases the very low value of the resistor in the transistor collector or emitter along with the 10k Ohm in the output circuit "saves" you and both circuits MAY be similar in performance. In this case the output will probably track low frequency PWM for duty cycles above a certain % and produce variably munged pulsings at lower duty cycles. How munged and at what duty cycles will depend on actual CTR. Removing C1 or making it MUCH smaller or using very very low frequency PWM will produce output that follows the PWM across most of the PWM range.

The values above for "low frequency" "certain" "variably" "lower" "very very low" etc depend on the actual question and actual expectations. Clearly saying what you would like to happen & what PWM frequency is used and what the opto coupler full part code is will allow better answers.


This is related to the edited question as at 5 April 2014.

Optocoupler datasheet here: http://www.semicon.toshiba.co.jp/info/docget.jsp?pid=TLP181&lang=en&type=datasheet

CTR (Iout/Iin) for the ... YE part is in 50% to 150% range.
Say about 100% or 1:1.

Either circuit will potentially work OK BUT at10 kHz the opto coupler LED sees essentially DC and turns on partially. While this will potentially achieve the required result it is poorly controlled and it is not possible to design the circuit with any degree of certainty. Variations in opto coupler parameters across a 3:1 possible range (50% - 150% CTR) will give widely varying results.

To get a much more controlled result remove c1, transfer PWM as a digital signal and filter it to controlled DC on the output side. Showing the complete actual output circuit will allow comments to be made on how well the output can be controlled "open loop".

  • \$\begingroup\$ Thank you for your answer. I updated the question, regarding the points you mentioned \$\endgroup\$
    – Konstantin
    Apr 4, 2014 at 14:42
  • \$\begingroup\$ thank you for the update, got the point. I decided to remove C1/C2 and PWM altogether and go with constant voltage charger + current limiting. I'll be back with the result when I finish with my board \$\endgroup\$
    – Konstantin
    Apr 7, 2014 at 7:41

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.