Why does this transistor circuit light the LED?

I'm trying to drive a 5v relay from an esp8266-12e via one of its digital outs (3.3v). However it doesn't produce enough current to trigger the relay. So I read how to do that from here and here.

I'm using a PN2222a transistor with an LED on a bread board to try this out, but it is not working as expected. Since the base in the NPN transistor doesn't have any power applied to it, I'd expect that the circuit would be open and the LED would not light. But it is lighting as seen in the pic. What am I missing (likely a lot)? Shouldn't it only light if I apply + voltage to the base?

If I test the transistor, assuming, the left most pin is the emmiter (e) (-) and then next is the base (B) and finally the collector (C), I am getting Veb = 7v and Vce = 7.6v.

[![

simulate this circuit – Schematic created using CircuitLab

]3]3 []4

• It's more likely that the transistor is dead. Have you tried a different transistor? – dirac16 Oct 20 '17 at 19:22
• Good photo. Note that your base resistor is only connected to the base so the other end will not necessarily be 0 V but rather whatever the base voltage is. – Transistor Oct 20 '17 at 19:55
• Are you still wanting an explanation for the LED being on, on your protoboard there? Or are you looking for a circuit to activate a 12 V relay from a 3.3 V I/O pin on the ESP8266? I can't tell. (You provide two links you read and I'm not sure if this means you feel you can implement them, or if you are just curious now about an odd behavior unrelated to those links.) What's the real question, exactly? – jonk Oct 20 '17 at 20:04
• The 1 ohm resistor isn't connected to anything and that's the reason why the led lighst up. Connect the base to ground using a 10K resistor. By the way, 1 ohm is almost nothing, it will fry your ESP8266 output. When you connect to ESP8266, use a higher resistance, about 4K7. – mguima Oct 20 '17 at 20:20
• As a rough general rule for begginers, never use resistors less then 4k7 in digital signals. The exception to this rule is if you know very exactly what and why you're doing this. (The load resistor for the led isn't "digital signal"). – mguima Oct 20 '17 at 20:26

Shouldn't it only light if I apply + voltage to the base?

No. If the base is disconnected (or the 1K resistor attached to the base is disconnected), is it still possible that the led lights up, even if there's no base current, due to leakage current in the transistor die, or due to the digital output from the eps8266-12 not being exactly at 0V.

You must connect a resistor (about 10k) from the base to 0V, this will "polarize" the base, and will stop the transistor conduction when there's no voltage applied to the 1K resistor.

Also, you're connecting the led incorrectly. The led connect the 12V directly to the transistor's collector, this is wrong. If the transistor conducts (if there is base current), the led will fry. You should put a load resistor (about 470 ohms) in series with the led. This is my suggestion of improvement to your circuit:

Since English is not my home language, I ask for any suggestions to improve the text and thank you in advance.

You are missing a current limiting resistor for the LED for a start. If the transistor turns on your LED will be destroyed.

Figure 1. A typical NPN LED (or relay) switch can be used to switch a higher current or higher voltage (or both) load. Note the conventional orientation of the schematic with positive to the top and negative to the bottom, reading from left to right. Source: Driving LEDs from higher voltage..

I'm using a PN2222a transistor with an LED on a bread board to try this out, but it is not working as expected. Since the base in the NPN transistor doesn't have any power applied to it, I'd expect that the circuit would be open and the LED would not light. But it is lighting as seen in the pic. What am I missing (likely a lot)? Shouldn't it only light if I apply + voltage to the base?

Your understanding is correct. You must have something else wrong. Post a photo of your setup.

If I test the transistor, assuming, the left most pin is the emmiter (e) (-) and then next is the base (B) and finally the collector (C), I am getting Veb = 7v and Vce = 7.6v.

It sounds as though you have a pinout error, a wiring error or a dud transistor.

• Sorry, a couple of errors in my post. a.)I originally uploaded a picture, but somehow it got lost after editing the diagram. It is there now. b.) my schematic is wrong, I actually do have a resistor in the emitter side. Sounds like a bad transistor. – Chad Richardson Oct 20 '17 at 19:42