Drive a bicolor led using 2 transistors

To drive a bicolor LED i use 1 NPN transistor, 1 PNP transistor and couple of resistors.
The circuit is powered using a 5V stabilised power source.
I need to drive a bicolor led using a push button. The LED will be green when no button is pressed and will become red when the button is pressed. I used 2N3904 and 2N3906 but any equivalent can be used.

You can see a small schematic for my test:

schematics prototype gren led on prototype red led on

 

How this work:

– The NPN transistor lights the red LED when the button is pressed and the base of the transistor is connected to +5V using a 1K resistor.
– The PNP transistor lights the red LED when the button is not pressed but the base of the transistor is connected to ground using a 100K resistor.

In this test i am using 2 different leds because i run out of bicolor leds.

This was just a test to see how i can drive a bicolor led from a microcontroller using only 1 output pin. Of course the values in the schematics are not ideal but i will try to improve the circuit in the future and maybe add some calculations.

Leave a Reply

Your email address will not be published. Required fields are marked *