# Flip Switch with transistor and push button

Sorry if this is a duplicate, I don't know the actual term for what this is called.

I am trying to create a circuit where the push button will switch the current from Red LED to Blue LED on right. Currently the blue LED lights up but Red one doesn't go off. I know I am missing something small which is apparently big enough.

What am I missing?

Resistors:
LEDs: 200 ohm
Transistor Base: 1K

Working Voltage: 5V
Transistor: Generic NPN

Simulation of the circuit below

• You have connected the red LED directly to the power. How could it be affected by the rest of your cicruit? Commented Aug 31, 2015 at 9:33
• you need SPDT switch between the collector transistor and the two leds. Commented Aug 31, 2015 at 9:34
• @codo I want something logical rather then mechanical also that has a small footprint like the transistors. Commented Aug 31, 2015 at 9:41
• @WoutervanOoijen I know but the current follows the path of least resistance so shouldn't it take the transistor route instead. Im working on that principle. Commented Aug 31, 2015 at 9:42
• what i'm seeing here is switch that can put on/off the LED D2, D1 is still working independently from the switch Commented Aug 31, 2015 at 10:13

Your idea 'current follows the path of least resistance' is an approximation, and it holds only when there is a limited amount of current. In your case you use a lab power supply, which is a constant voltage source, which will supply all the current you ask from it. Hence both the transistor and the red LED parts get current.

A way to switch the other LED of when you press the switch is show below.

simulate this circuit – Schematic created using CircuitLab

The principle is that with the switch open, Q1 gets a base current via R1 and D1, so it conducts, and current flows through R2, D2, Q1, so D2 lights up. But the base current is too small for D1 to light up.

When you close the switch, Q1 gets no base current, and the current through D1 is large enough to light it up.

• Can I apply this to switch input on ICs rated 5V? Commented Aug 31, 2015 at 10:46
• Yes, but use 5V supply, and it might be bettre to leave out the LEDs, or bridge them with a 22k resistor, to make sure that the high level is close to 5V. Commented Aug 31, 2015 at 10:51
• Place say 2K2 across D1 if it still glows dimly while S1 is open and D2 is lit Commented Aug 13, 2016 at 0:19