-->
Page 1 of 2

Problem driving transistors from ESP-01

PostPosted: Sat Nov 26, 2022 11:39 am
by Chris_Hopper
I’m using an ESP 8266 to control a pair of relays. The relays are switched by transistors, with 4k7 base resistors to the ESP outputs and with the transistor emitters connected to 0V. For convenience I’ve prototyped this using a D1-mini board (using an ESP8266MOD) and it works nicely. Now I’ve connected the ESP-01 (using an ESP8266EX) that I want to use because is plugs onto the relay board, and things are different!

Firstly the transistors pull GPIO0 and GPIO2 low, so the ESP-01 doesn’t boot. I’ve overcome that by fitting 3k3 pullups from the GPIO pins to 3.3V. Like this I can communicate with the ESP-01 over WiFi, so it’s definitely running. However, the GPIOs fail to drive. They sit at 2.2V, no matter whether I drive them high or low. I’ve removed the ESP-01 and shorted each GPIO connection on the relay PCB to 0V through an ammeter, and 1mA flows as expected. If I short from 3.3V to the GPIO connection 0.51mA flows, which also seems reasonable, so I know the circuit is connected properly. And anyway, it works with the D1-mini board like this.

The data says the GPIOs can drive 12mA. It’s not clear from the data whether it can sink as much current as it can source but there are plenty of example circuits around using 3k3 pullups so I’d have thought it could sink a reasonable current.

I have two ESP-01 boards and two ESP-01S boards, and they all behave the same. I’m not aware of having done anything that would have damaged the outputs, and when I disconnect the relay board I can measure 0V and 3.3V on the GPIO pins as I exercise them, so the devices don’t seem to be broken. Obviously I've configured the GPIOs as outputs for this to work.

Has anyone else run into a problem like this? Are the outputs on the ESP8266EX different to the ESP8266MOD? Is there any different configuration required for the differnet parts - if they are different?

Re: Problem driving transistors from ESP-01

PostPosted: Sat Feb 25, 2023 8:30 pm
by oswe
npn transistors ? try pnp ...

Re: Problem driving transistors from ESP-01

PostPosted: Sun May 07, 2023 12:02 am
by esp8266_dude
You configuring something wrong.
I'm using GPIO0 successfully as an outputs in my ESP8266-01 boards.

Re: Problem driving transistors from ESP-01

PostPosted: Mon May 08, 2023 3:02 am
by rooppoorali
ESP8266EX and ESP8266MOD are both variants of the ESP8266 chip, so they should have similar output capabilities.

It's possible that the GPIO pins on your ESP-01 boards have been damaged, or that there is some issue with the connection between the ESP-01 and the relay board. One thing you could try is to connect a small LED and resistor (e.g. 1kΩ) to one of the GPIO pins and ground, to see if you can get it to light up when you set the pin to high. If that works, it would suggest that the problem is with the relay board or the transistor circuit.

Another thing to consider is that the ESP-01 has a different pinout than the D1-mini, so you may need to adjust your connections accordingly. Make sure that you're connecting to the correct GPIO pins on the ESP-01 board.

By the eay, if you ever wonder which esp module to choose for which application, this write-up may help you.

https://www.theengineeringprojects.com/ ... jects.html