Electrical – How to make the LM339 IC source current on its output pins instead of sinking current

comparatorintegrated-circuitldrledtransistors

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 ?

Thanks.

Best Answer

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