# how to reduce turn-off delay time of PNP transistor

I am having tough time while driving PNP transistor with optocoupler to generate 1KHZ PWM signal. my circuit consists of micro controller which will generate 1KHZ pwm signal which will go to base of PNP transistor(Q2) and the collector terminal of PNP transistor(Q2) will go to optocoupler input. and the optocoupler collector terminal is going to base of PNP transistor(Q1). the collector terminal of PNP transistor(Q1) is going to microcontroller pin. when i probe at micro pin or Q1 transistor collector the turn off time i am seeing 400ms. because of this i am getting error in PWM signal measurement which is 1KHZ.

output of R4 is connected to micro controller in the below circuit but not grounded like below

• Ok, but why are you doing it this way? Is there a reason you arent just driving the optocoupler directly from the IC? Also i think your text has some errors, is your IC really going to the base of Q1 or did you mean Q2? Sep 7 '20 at 6:23
• As @JeffreyPhillipsFreeman already mentioned, it seems that the question description does match the drawing (Probably Q1 and Q2 were swapped). The delay you see is probably due to the floating base of Q1 when the Optocopler is turned off. Add a resistor between the base and emitter of Q1. Note: Unless really necessary, this circuit can be greatly simplified Sep 7 '20 at 6:34
• @JeffreyPhillipsFreeman sorry i have swapped Q1 & Q2. i have edited the question now. i have to do this way because of my other requirement. the optocoupler i am using here is SFH610A-1X006. and the Q1 is 2SA1774.
– TMR
Sep 7 '20 at 6:50
• @vtolentino thanks i will try that option of adding the resistor between base and emitor.sorry i have swapped Q1 & Q2. i have edited the question now. the optocoupler i am using here is SFH610A-1X006. and the Q1 is 2SA1774. the signal for base of Q2 is coming from micro controller.
– TMR
Sep 7 '20 at 6:52
• well the circuit on the righthand side is still nonsense, so wouldnt expect that to do anything useful.. does Q1 even serve a purpose there. As for driving U1 with a transistor, I'm not really sure why you would do that, its a olid state relay so they dont need much power to trigger them so what purpose does Q2 even serve? Nothing about this circuit makes much sense to me to be honest and I dont know what your end goal is or why your trying to do things the way you are at all. Sep 7 '20 at 6:55

Your circuit is slow because of the way you are using the optoisolator.

Because of the gain of the transistor, the effective load at turn-off is more than 1M$$\\Omega\$$, so you can extrapolate the curves to see what kind of trouble that causes.

So reduce the load resistance to something like 1K and your error will be greatly reduced.

Here is your circuit, changed about as little as makes sense, which behaves much better:

I've increased the optoisolator LED drive current (to about 4x the load current to account for the minimum 50% CTR, aging and temperature), and increased the load current to speed up the response.

• i think it serves my purpose. thanks for the answer. what do you mean by load(1Mohm) while turn-off ? how it is reduced to 1K ?? can you explain it briefly
– TMR
Sep 7 '20 at 8:05
• 1M since the gain of the transistor is more than 100, it can energize your 10K load with very little current. The load on the optoisolator in my circuit is the 680 ohm resistor in series with a diode drop with 470 ohms across it. So in the 1K range, more or less. Sep 7 '20 at 8:10
• i tried as you mentioned. it improved my Q1 base to emiter waveform. but when i probe at the output which is collector of Q1, it still the same.
– TMR
Sep 7 '20 at 9:42
• What all is connected to the collector of Q1? Are you adding an RC filter, perchance? Sep 7 '20 at 9:51
• Q1 collector is connected to R4(as shown in circuit) and the R4 other end connected to micro controller.
– TMR
Sep 7 '20 at 10:21

First, try a simple push pull stage instead of one single pnp transistor

Without the simulation shows a problem similar to your findings, but with the pushpull, it looks much better

There are further tricks for fast turn of, but I daubt you will need that...

• thanks the circuit looks great. but i want to know the reason behind that large turn off time in my circuit. did you simulate my circuit ?
– TMR
Sep 7 '20 at 7:10
• I support the comment above. The OP could easily google for "optocoupler circuit" and get dozens of examples that work. That doesn't help them understand why their circuit won't. Sep 7 '20 at 8:26
• the answer is simple parasteric capacitance... you need to annihilate the energy stored in the Opto and your transistor. the push pull configuration does both - the energy stored in the transistor doesn't realy matter, because in the turn off is dominated by the other transistor, and the diode is short circuit which effectively turns it off Sep 7 '20 at 8:29
• Also the circuit of the OP does not realy make sense on the secondary side of the opto,.. there is a kind of hysteresis build into that, because the when the transistor is turned on, the voltage at R4 will rise, which will also increase the voltage at the base and such start closing the transistor again. Sep 7 '20 at 8:37

Opto's are very slow on the output, the photo-transistor needs a large area to pick up photons, and there is not much current per photon. So you get a lot of miller capacitance that needs charging. The simplest solution is a cascode that maintains the Vce of the opto constant . The LED side of the photocoupler is very fast (the LED generates photons from electrons instantly (within nano-seconds). The schematic shown doesn't pull the output voltage all the way to ground, but you could swap Q2 for PNP and flip the circuit around. The cascode circuit below should get you to 100kHz.

You can also keep the Vce of the phototransistor at 9.5v by using the current mirror approach below (the two transistor mirror can be obtained as one device with 4 leads) This will be slower than the cascode , probably get 10kHz.

simulate this circuit – Schematic created using CircuitLab

Another variant would see the opto replacing one side of a current mirror.

If you need to get fairly accurate PWM conversion , for example to generate a floating 0-10v analog voltage to drive a motor controller, then you drive a pair of optos in push-pull like in the schematic below, n.b. the arduino needs to operate off 5v or you won't light up the leds. The basic push-pull doesn't operate the phototransistors at a fixed voltage, so won't be as fast as possible, if you want more speed, then use cascode/current mirror topology as in my earlier answer.

simulate this circuit – Schematic created using CircuitLab