# Position of current limiting resistor

I am designing a digital output circuit.

I got confused about the position of the current limiting resistor of the transistor.

I would like know where it should be. (After or before the pull up resistor.)

• I used the similar scheme for case an analog input signal. It works as comparator. Just from voltage divider output should be under 0.5V then optotransistor opened. If input digital, it is not necessary. – user263983 Nov 27 '20 at 13:54
• @user263983 the input is digital from STM32 – walid24 Nov 28 '20 at 15:59
• Doesn't R110 already limit the current? What does R109 actually do? Why did you decide to add it? – user253751 Nov 28 '20 at 19:07

In your circuit, U23 is not a source of current into the Q25 base; it works by shunting base current away from the transistor. The base current is supplied solely by R110, so it's value should be calculated to deliver the current required to saturate the transistor.

In fact, R109 should be removed because it hurts the circuit. When U23 is on, R109 and R110 form a voltage divider, so the Q25 base voltage never is below (0.46 V + U23 Vcesat). This is not low enough to guarantee that Q25 turns completely off. Assuming Q25 has a nominal gain of 100, it takes only 50 uA of base current to drive it into light saturation.

• any other note about the circuit – walid24 Nov 27 '20 at 13:13
• Not without knowing more about the system. Depending on what Dout2 does, you might be able to eliminate Q25 and drive Dout2 directly with U23. – AnalogKid Nov 27 '20 at 14:08

It makes no sense on either before or after the pull-up and can be removed.

That circuit will not work as expected. Resistor R109 and R110 makes voltage divider and Vbase of Q25 never lower whan 0.7 V. So Q25 is on all time. You may put R109 after R110, it will work, but not really nessesary.

• "open" suggests "off" in EE terminology. I think you should say "closed", as it suggests "on" like in case of switches :) – Mitu Raj Nov 27 '20 at 14:17
• @ Mitu Raj Thanks – user263983 Nov 27 '20 at 17:59
• Sure... but that was already explained before you posted this. Not much use in duplicating pre-existing answers. – Chris Stratton Nov 27 '20 at 18:15
• Quit repeating earlier, better, and more complete answers for a few internet points. – TomServo Nov 28 '20 at 2:05
• As well, the opto is not really adding anything to the circuit. According to the schematic, the gnd is the same both sides of the opto - thus no galvanic isolation. Maybe there's a mistaken belief that the opto provides some 'protection'? – Kartman Nov 28 '20 at 3:24