I know that the LM339 Comparator IC has a current sinking output. I made a small night lamp with the help of a LDR and an LM339 comparator IC. It worked properly.

The LDR connected to the inverting input (pin 4) of the IC and a reference voltage was supplied at the non-inverting input (pin 5) from Vcc through a resistor. This way the comparator compares the value of the LDR with the reference voltage and sets the output accordingly.

But, then I wanted to replace the LED with a transistor since I wanted to do more than just toggle LEDs. I tried to implement the transistor in my circuit like this, but it still does not work: enter image description here

I just implemented a part of it (not the switches and all. I have my LDR in place of that) in my own circuit which uses an LDR. Its taken from an answer on another thread. That entire answer can be found here: https://electronics.stackexchange.com/a/283533/127782

I realize that in order to turn on the transistor I need a current source from the output pins of the LM339. How would I achieve that ? If that's not possible, or I have misunderstood something, can you just tell me how to operate the transistor in this circuit ?


  • \$\begingroup\$ I had updated the answer in the previous question, added a potential divider to the V-, hope it now works as expected, use a PNP transistor at output stage to source current to load \$\endgroup\$
    – Raj
    Feb 5, 2017 at 7:51
  • 1
    \$\begingroup\$ To turn on an LED as shown the comparator is not needed (unless this is a learning exercise). |. Remove 10k, U1, 4.7k. | Connect the 10k from switch right side to Q1 base. If available a 100k from base to ground may sometimes be useful. Not usually needed. \$\endgroup\$
    – Russell McMahon
    Feb 5, 2017 at 12:01
  • 1
    \$\begingroup\$ You've got a current source, the 4.7k resistor, that should be plenty to saturate the transistor when the 339 is not sinking current. That circuit should work unless you've connected it incorrectly, with a logic inversion of course! \$\endgroup\$
    – Neil_UK
    Feb 5, 2017 at 12:41
  • \$\begingroup\$ What does "to no avail" mean? \$\endgroup\$ Feb 5, 2017 at 20:58
  • \$\begingroup\$ I have updated the question @BruceAbbott. By no avail I meant it did not function. \$\endgroup\$ Feb 6, 2017 at 13:52

1 Answer 1


modified circuit to use PNP transistor

pnp circuit

If open circuit condition is making issue (when the output is not sinking), use the 4.7k pull up as in your circuit

updated the circuit based on the comment by @Paul Elliott

  • \$\begingroup\$ It would be good practice to add a large resistor (100K or so) between Q1 base and emitter, to make sure that leakage current doesn't keep the transistor from turning completely off. \$\endgroup\$ Feb 5, 2017 at 16:45
  • \$\begingroup\$ updated the circuit including 100K \$\endgroup\$
    – Raj
    Feb 5, 2017 at 16:57

Your Answer

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

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