Post History
Some optos are really slow. What off time is yours specified for? Your circuit could be better. The transistor is turned on thru 1 kΩ, but off thru 11 kΩ. You are also giving it way more base c...
Answer
#1: Initial revision
Some optos are really slow. What off time is yours specified for? Your circuit could be better. The transistor is turned on thru 1 kΩ, but off thru 11 kΩ. You are also giving it way more base current than needed, slowing turn-off. Move R318 to the other side of R317 and adjust both values. Do some actual calculations. With a 10 kΩ pullup to 3.3 V on the collector of Q301, the transistor needs to pass only 330 µA. 1/10 of that is plenty to keep a 3904 in saturation, so 33 µA into the base when the opto is on. Let's decide that R318 (which is now directly between base and ground) should be 2 kΩ for reasonably fast turnoff. At 750 mV on the base, that would draw 375 µA. To provide some margin, let's make sure everything works even if the B-E drop is 800 mV. R318 would now draw 400 µA. Plus the current needed to turn on the transistor, 433 µA needs to come thru the opto when it is on. You didn't provide a link to the opto datasheet, so I'll pick 300 mV as the maximum guaranteed on-voltage of the opto. With 800 mV on the base and the 3.3 V supply, that leaves 2.2 V across R317. (2.2 V)/(433 µA) = 5.08 kΩ, so 4.7 kΩ it is. So in summary, move R318 to be directly on the base of Q301, change it to 2 kΩ, and change R317 to 4.7 kΩ. I think you'll see a significant decrease in off-time that way. Again, all this assumes the opto is fast enough to support your desired switch-off time in the first place. Since you didn't provide a link to a datasheet, I'll leave it for you to check.