# Inverting a push button

I have a push button that by default is in 'ON' state and a LED attached to it. I want the LED to light up when the button is pushed down, instead of being on by default.

As far as I understood I need to use NPN transistor as a switch to accomplish this, but I still don't understand how.

Is there a way to make the transistor work inversely? For it to be in an 'OPEN' state - The LED is not glowing when electricity is applied to the base, and when I push the button, (base receives no electricity, but the gate opens)? Thank you.

I am assuming you have a schematic like below: simulate this circuit – Schematic created using CircuitLab

In this case, when the switch is not pressed, the circuit is completed and the diode lights up. When you press the switch, SW1 opens and the LED turns off.

Yes, an inverting setup is the most common type of NPN single stage amplifier. It is called 'common-emitter'.

To reverse this using an NPN, you can do the following: simulate this circuit The common-emitter configuration for an NPN BJT works by amplifying base->emitter current to collector->base current. The NPN BJT consists of a base->emitter diode. When this is turned on (the voltage across it is greater than about .6V), any current injected into the base will be amplified by the 'beta' of the transistor, typically ~100.

So for our circuit, when the switch is disconnected, the entire V1 is across the resistor R2 and the base->emitter diode of the NPN. This turns the diode on, to 0.7V. The rest of the voltage goes across the resistor R2. This creates a current, due to Ohm's law, of $I = V/R = (V1-0.7)/(R1)$.

Let's assume V1 = 5V and R2 = 10k as in the circuit above. $I_b = (5-0.7)/(10000) = 4.3/10000 = .00043A = 0.43mA.$

When the NC (normally-closed) switch is not pressed, there is voltage division between R2/R3. Voltage at the base is (500/10500)*V1; this is so low that Q1 is off and the LED gets no current. However, when you press the switch, the lower branch of the voltage divider is cut off and now you have the ~threshold voltage (about 0.7 V) at the base of the BJT. This leaves (V1 - 0.7V)/R2 current flowing into the base to be amplified through the LED.

For an NPN, it will typically amplify the base current by 'beta' unless it cannot anymore. One common reason for this is that the collector->emitter voltage becomes too low. This is called saturation, and the potential difference between collector and emitter when saturation occurs is called the 'saturation voltage'. It is typically 0.2V.

This is important because the NPN common emitter amplifier is often 'driven into saturation'. This means you give it more base current than it can amplify, which will force the circuit into a very predictable state. This is easy to used in design. In our example, assume the saturation voltage is 0.2V. Also, LEDs usually have a forward voltage of about 2.2V.
If this is the case:

$V1 = V_{R1} + V_{LED} + V_{sat} = 5V = V_{R1} + 2.2V + 0.2V => V_{R1} = 3.6V => I_{R1} = I_{LED} = 3.6V / R1 =~ 16.3mA$

You can verify this is in saturation, because the base current of 0.43mA is only amplified ~37.7x (instead of normally much higher, ~100). 16.2mA is a reasonable amount to drive an LED with as well.

Switch Edits below: I would guess you have the DPST switch shown below. In this case you probably don't even need a transistor to get the desired switch action. You just need to figure out which part of the switch is normally connected and which is normally unconnected. You really only need these 2 terminals. See example circuit below: simulate this circuit

Now when the switch is not pressed, the LED gets no current. When you push the switch it turns on. But, you might have fun with the NPN.

• R3 serves no purpose here... – Passerby Apr 9 '16 at 19:56
• It keeps the BJT weakly conducting so that the response time is quicker ... just kidding that was my mistake. – jbord39 Apr 9 '16 at 19:58
• @jbord39 Thank you very much for the detailed answer! Might be a stupid question, but my push button contains 4 legs, so 4 wires are connected to it, while in schematics there are two. Why is this so? – user3578847 Apr 9 '16 at 20:05
• @user3578847 You're welcome. I added information regarding the switch in original answer. – jbord39 Apr 9 '16 at 20:14
• @jboard39 I definitely want to do it the NPN way, trying to understand it, still very confusing but that you very much. When I search for 'common-emitter npn' I don't get much results, is there another name for this so I can find it on youtube? thanks – user3578847 Apr 9 '16 at 20:15

Just for the sake of showing that there are always some unexpected solutions...

You don't really need any additional component, it can also be done like this: simulate this circuit – Schematic created using CircuitLab

Just make sure to dimension R1 so that it can stand the whole supply across it.

Just as a note, one disadvantage of this circuit is that power is consumed even with the LED off, not a nice thing. So in general, in any design besides hobby use I would take the MOSFET approach. But if you are just doing a quick build in the lab, it can be a quick solution. simulate this circuit – Schematic created using CircuitLab

When SW1 is pushed it opens the circuit causing the 10K to drive the gate of M1 to Vdd turning on your diode. When SW1 is not pushed, it stays closed and pulls gate of M1 to ground.

• Thank you very much for the answer. I started to learn electronics yesterday and this problem has been killing me for the last 5 hours – user3578847 Apr 9 '16 at 19:41
• The current through the LED isnt being limited – SoreDakeNoKoto Apr 10 '16 at 0:51
• Yeah. I doubt 10 ohms is enough though; thats a collector current of about 300mA if Vdd is 5V – SoreDakeNoKoto Apr 10 '16 at 1:20
• @TisteAndii Really depends on the LED and Vdd. – horta Apr 10 '16 at 3:47