Electronic – Relay does not turn ON

esp8266pnprelaytransistors

I am having trouble turning ON a relay from the ESP8266 output pin.
I have wired the relay as shown in the picture below. The only change is that the transistor is BC556. Other specs of components are:
Relay 5V , running this on 5V power supply. Here are some more facts:
– I have wired the exact same circuit on the bread board and it works perfect.
– I am using GPIO2 as the output PIN and apart from driving this relay , it also has a pull up resistor of 10K connected to GPIO2.
– The relay works fine sometimes but many times it either does not work or is very slow in reacting. For eg. when my output tuns LOW, it soemtimes takes several seconds to turn ON the relay.
– I measured the voltage across the transistor Vce = 1.1 V which means the voltage across the relay pins is 3.9V. I thought this is the reason why the relay is not able to trigger but then I have exact measurements on my breadboard circuit and it works fine. I even tried switching the relays but I get the same result.
– From BC556 datasheets it says saturation Vce is .09 – .25V but I get 1.1 voltage drop Is this normal? I tried BC 557 with the same result. I even varied the base resistor to decrease it till 100 ohms but the Vce improve by 0.1 V only.
Any suggestion on what should I do to troubleshoot this further would be helpful. Thanks

enter image description here

Best Answer

One thing that limits what you can do is that the ESP chip is 3.3V and your supply is 5V so you cannot use just a PNP transistor to do what you want. Here is one way to accomplish the task without changing the logic (low = on).

schematic

simulate this circuit – Schematic created using CircuitLab

Your circuit has two problems - the voltage across the relay coil will only go between about 4.3V and 1.1V- neither fully on nor fully off. That is because it is an emitter follower and has a 0.6~0.7V offset and it cannot amplify the 3.3V coming from the ESP chip.

The 1.1V is particularly dangerous since it is a grey zone of relay operation and some relays may stay pulled in (depending on temperature, whether they have been tapped, etc.) and some may drop out. The 4.3 means you are not getting full voltage on the coil so it might not pull in at very high temperatures. With the circuit above, the relay voltage will go from about 4.9V to 0V, as it should.