Use this forum to chat about hardware specific topics for the ESP8266 (peripherals, memory, clocks, JTAG, programming)

User avatar
By sean_intez
#63721 Hi Folks

In my project I have connected a relay to GPIO13. I set gpio13 to low when I initialize the gpio. however, since that pin has internal pull up, the relay briefly operates when esp8266 starts.
I asked this question before and someone suggested me to use gpio 4 or 5 since they don't have internal pull up. He was right and I could solve the issue. However now in my new project I need to work with gpio13 and I am looking for a way to disable the pull up resistor permanently.

I tried to use external pull down resistor ranging from 12ohm to 30k but none of them worked.


I would greatly appreciate if someone helps me
User avatar
By rudy
#63727 As far as I know, you can't disable them.

The best option is to have a circuit that will turn on the relay with a port output low. High being off. And you can do this with a PNP transistor stage followed by a NPN stage to drive the relay. I looked on the internet for a schematic that shows this but I couldn't find a good one. The best I could come up with is the following.

Image

What you want is the emitter (arrow) of Q1 connected to the 3.3 volt supply of the ESP. Pin 1 of J1 is connected to the port pin with the internal pull up. The collector of Q1 (connected to R2 is used to provide the high for the NPN transistor (Q2) that is driving the relay.

The Q2 portion in the picture is a bit odd. You don't need D1 and RZ. I could put up a proper schematic when I get home tonight.
User avatar
By sean_intez
#63738
rudy wrote:As far as I know, you can't disable them.

The best option is to have a circuit that will turn on the relay with a port output low. High being off. And you can do this with a PNP transistor stage followed by a NPN stage to drive the relay. I looked on the internet for a schematic that shows this but I couldn't find a good one. The best I could come up with is the following.

Image

What you want is the emitter (arrow) of Q1 connected to the 3.3 volt supply of the ESP. Pin 1 of J1 is connected to the port pin with the internal pull up. The collector of Q1 (connected to R2 is used to provide the high for the NPN transistor (Q2) that is driving the relay.

The Q2 portion in the picture is a bit odd. You don't need D1 and RZ. I could put up a proper schematic when I get home tonight.

Using PNP transistor instead of NPN was my other option but that also has its own disadvantages. If esp8266 fails for any reason and shuts down, the relay gets energized and activates the high voltage circuit which is very dangerous.