Electrical Engineering Stack Exchange is a question and answer site for electronics and electrical engineering professionals, students, and enthusiasts. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I would like to control the output of two LEDs with a single pushbutton. When the button is open, D2 should be off and D3 should be on; when the button is closed, D2 should be on and D3 should be off. I would like to achieve this effect using only BJTs.

The following circuit worked as intended in an EveryCircuit simulation:


simulate this circuit – Schematic created using CircuitLab

However, I'm almost certain that this is not optimal; for example, I have a feeling that a solution can be achieved without requiring D1.

Can anyone point me to a better solution?

share|improve this question
up vote 8 down vote accepted

Try this: -


simulate this circuit – Schematic created using CircuitLab

When Q1 is activated Q2 is disabled. When Q1 is deactivated by removing the input from the left of R4, R3 will acquire enough current thru D1 and R1 to turn on Q2 and activate D2.

Both LEDs can share the same current limiting resistor too but maybe I might put a resistor across D1 just to leak enough current into the base of Q2. This or use two LED current limiters - the jury is out on this - depends on supply rails to a certain extent.

share|improve this answer
And Q1 deactivates Q2 by dropping Q2's Vbe below 0.7V, so don't try this with a Darlington as Q1. – Ignacio Vazquez-Abrams Jul 13 '14 at 18:49
worked fine, thanks! and much simpler, as I suspected. – Duoran Jul 13 '14 at 21:43

Slightly simpler (and inspired by Andy's accepted answer)


simulate this circuit – Schematic created using CircuitLab

share|improve this answer

This is just to share my view point. I am not sure whether this will work, just posting it as answer for public scrutiny to improve my understanding. enter image description here

share|improve this answer
For Russell McMahon, please have a look. – AKR Jul 14 '14 at 6:57
At best D2 will never light. At worst D1 will never turn off. – Ignacio Vazquez-Abrams Jul 14 '14 at 7:15
Using MOSFET instead of TRANSISTOR Q1 will remove the worst and best cases? – AKR Jul 14 '14 at 7:18
That won't fix D1. But a diode in the right place will. – Ignacio Vazquez-Abrams Jul 14 '14 at 7:22

Simple circuit that alternates between Red and Green LEDs with only a single switch & resistor:


simulate this circuit – Schematic created using CircuitLab

Switch SW1 can be replaced by either a bipolar transistor or MOSFET.

How this works is very simple: A modern Green LED has a forward voltage drop of about 3.2V. A Red LED has a forward voltage drop of about 1.7V. When the Red LED is connected in parallel with the Green LED, it diverts all of the current to the Red LED and the Green LED goes out.

share|improve this answer
You can use the same technique with two identical LEDs by putting a silicon diode in series with the one directly connected to R1. – Kevin White Mar 28 '15 at 0:08
Yep. I have several products in production using exactly these techniques. – Dwayne Reid Mar 28 '15 at 0:24

Just for fun :-).
I'll add comment to this in due course if necessary.
But, for now:

  • Does it work?

  • How does it work?

  • R2 is optional. What does it do and what happens if it is omitted?


simulate this circuit – Schematic created using CircuitLab

Resistor values nominal and may need adjusting.
Value of R4 will affect LED drive and also "something else".
Ratio of R4:R2 not critical but relevant.

LEDs are up to you - ones shown are super marvellous through hole - you'd run them lower than this if using the original Vdd - but only need half the current you'd use with most others.

Transistor is my favourite "jellybean" - use what suits.
SMD version is BC817.

share|improve this answer
My comment is not related to your answer, just wanted to know your viewpoint on my logic of implementation.I was trying to implement the op using open drain logic of Transistor, with the switch at the gate of the transistor. But not sure whether it will work or not. – AKR Jul 14 '14 at 6:33
@AKR I don't see an answer from you - can you show us a circuit. I'm not sure from what you say what it is you have in mind. – Russell McMahon Jul 14 '14 at 6:44
Interestingly - I didn't look in any detail at prior solutions when I posted the above - just noted that they had two transistors so drew up something that works with one. BUT skeleton's of Andy's and Spehro's circuits can be seen in mine. In the latter short out Q3 - and have the same issue that I added R2 to address. In the former, replace Q1 with a switch. And again an extra resistor may be needed to address the issue caused by simplification. – Russell McMahon Jul 14 '14 at 6:49
@Russell: Clever. :) LTspice circuit list: dropbox.com/s/6p1cf9jh6cxyt1g/LED%20switch.asc – EM Fields Jul 14 '14 at 7:01

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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