0
\$\begingroup\$

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.

[![

schematic

simulate this circuit – Schematic created using CircuitLab

]3]3 [enter image description here]4

\$\endgroup\$
  • 2
    \$\begingroup\$ It's more likely that the transistor is dead. Have you tried a different transistor? \$\endgroup\$ – dirac16 Oct 20 '17 at 19:22
  • \$\begingroup\$ 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. \$\endgroup\$ – Transistor Oct 20 '17 at 19:55
  • \$\begingroup\$ 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? \$\endgroup\$ – jonk Oct 20 '17 at 20:04
  • \$\begingroup\$ 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. \$\endgroup\$ – mguima Oct 20 '17 at 20:20
  • \$\begingroup\$ 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"). \$\endgroup\$ – mguima Oct 20 '17 at 20:26
4
\$\begingroup\$

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:

enter image description here

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

\$\endgroup\$
3
\$\begingroup\$

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

enter image description here

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.

\$\endgroup\$
  • \$\begingroup\$ 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. \$\endgroup\$ – Chad Richardson Oct 20 '17 at 19:42
2
\$\begingroup\$

From what I see on your breadboard it's likely that the transistor is dead and allows about 2.5mA current to flow.

You said that Vce=7.6V. This together with the fact that the forward voltage drop of the red led is 2V, the voltage drop across the 1k resistor will be about 2.5V. Therefore 2.5/1k=2.5mA current is flowing into the collector. But in normal situation this corresponds to a 0.7V drop across the base-emitter junction. So the transistor is probably dead.

\$\endgroup\$
  • \$\begingroup\$ Thanks. I only have 2 at the moment, and they were both doing the same thing. Was hoping one would work. More arriving tomorrow so I can try again. \$\endgroup\$ – Chad Richardson Oct 20 '17 at 19:50

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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