Building NOT gate with transistor -- output remains always high
If SW is closed, then ... no current flows through R1 and LED1.
Not quite. Current always flows through R1, but when the transistor is switched on, all of the current flows through it, and since the collector voltage is now less than the LED's forward drop, no current flows through the LED.
When you inserted LED2 in the emitter lead of the transistor, you made it impossible for the transistor to pull its collector low enough to "short out" LED3. The emitter voltage is now equal to the forward drop of LED2, and the collector voltage is a few hundred mV above that.
If you take out LED2 and connect the emitter to ground again, the circuit will work as expected.
Part 1:
If SW is open, then current flows like this: +6V -> R1 -> LED1 -> GND.
Correct.
If SW is closed, then current flows like this: +6V -> SW -> R2 -> B->E -> GND (In other words, no current flows through R1 and LED1).
Not quite right. Feeding current into the base will turn on the transistor. Current will flow through R1 but will be shunted around the LED through the transistor. If you turn on the transistor "hard enough" (enough base current) the collector-emitter voltage will drop to about 0.2 V and that's not enough to cause the LED to conduct significantly.
The problem is (I think) with your LED2. In the original tutorial, there is no LED in series with the transistor, which makes the circuit works like this:
- When SW is open, Q1 does not conduct, LED1 has to conduct as there is no other path.
- When SW is closed, Q1 starts to conduct and acts like a diode, and has a forward voltage of 0.2V. Your LED has a forward voltage of 1~3V(depending on the color). When two diode are in parallel and have different forward voltage, ONLY THE ONE WITH LOWER FORWARD VOLTAGE WILL CONDUCT, because the voltage change is not instaneous, but rises over time(although very quickly). When it gets to 0.2V, Q1 starts to conduct, which would maintain the voltage diff across Q1 at 0.2V, which means LED1 will never conduct.
Now, you've added a LED2 in series with Q1, which makes their combined forward voltage(yes diode in series gets combined) HIGHER THAN LED1, which means electrons will always go through LED1 regardless of Q1.
Here's how it works:
- SW is open, Q1 is not conducting. LED1 is the only path.
- SW is closed, Q1 can conduct, but the LED2 has the same Vf as LED1, which means LED2+Q1>LED1. So, when voltage rises to the Vf of LED1, (let's say 3V), LED1 starts to conduct, but it's not yet enough for Q1 and LED2 to conduct. As LED1 is conducting, it maintains the voltage difference at 3V, which means Q1 and LED2 will never be on.
TL;DR Remove LED2 and try again.