0
\$\begingroup\$

I'm making a circuit for driving Relays, LED's from push button and few other functionalities from ESP12E module. for which I'm using simple Transistor driving circuits as shown in image.

In this I'm using ESP12E's GPIO01(TX) for driving relay & GPIO02 for driving 2 Blue LED's through transistor(BC847) from push button's input signal at GPIO03(RX)(PULLUP configuration), as all other GPIO's are being used in other IO operations.

I made and tested the circuit.

But when 'powered ON', the ESP12E doesn't go in RUN mode and the GPIO02 keeps both LED's 'ON'. I've tried keeping initial state of GPIO01 both 'HIGH' & 'LOW' but same thing happens.

So I checked tested that if I don't connect GPIO02 to transistor for driving LED's and I connect +3.3v to GPIO01(TX) at the time of powering it 'ON', then ESP12E goes into RUN mode and works fine. But it doesn't work directly as in circuit, I have to make it high at power ON externally!

Also about GPIO01 & 02 is that 'Boot fails if pulled LOW'. so is the circuit making these pins LOW at boot? if so should I use PNP transistors instead of NPN transistors(with respective PNP circuitry)?

or is there any rectification needed in circuit or something can be done from software side? enter image description here

\$\endgroup\$
9
  • \$\begingroup\$ "so is the circuit making these pins LOW at boot?" Depends on what is supposed to be pulling them up. High value internal pull-ups will form a divider with the base resistors. \$\endgroup\$ Aug 3, 2021 at 16:07
  • \$\begingroup\$ just connect your LEDs from GPIO2 to GND, no transistor. The blue LED's forward voltage will be high enough to prevent the ESP from seeing it as a logic low, and if you're only asking for a few ma anyway, there's plenty of current from the GPIO to light the LEDs. also, GPIO1 doesn't matter. \$\endgroup\$
    – dandavis
    Aug 3, 2021 at 19:06
  • \$\begingroup\$ Use a bss138 or 2N7002 instead of the BC847. The mosfet gate will not present a load. \$\endgroup\$
    – Kartman
    Aug 3, 2021 at 22:07
  • \$\begingroup\$ @dandavis I had used transistor in-between just to keep LED's bright and if needed can add more LED's! But yes I will operate 2 LED's directly from GPIO02. And what doesn't matter about GPIO01? \$\endgroup\$ Aug 3, 2021 at 22:40
  • \$\begingroup\$ @Kartman I was also thinking of using MOSFET to control relay, But as transistors are making the pin 'LOW' causing issue, if I use Mosfet BSS138 or 2N7002, will it too make GPIO01 pin LOW in same circuit configuration? \$\endgroup\$ Aug 3, 2021 at 22:47

1 Answer 1

1
\$\begingroup\$

The ESP IO pin has an internal pull-up between 30k to 100k ohms.

So it will only weakly pull the GPIO pins high.

The transistor will set the base voltage to about 0.5 to 0.7 volts.

Therefore, even with the 1k resistor in series between the IO pin and the base, the voltage at the IO pin is well within limits of being read as logic 0.

So unfortunately, the transistors pull the IO pins low and prevent booting.

There's nothing you can do in software about it. These pins really need to float high with the internal pull-ups as they are strap pins that configure how the ESP will boot.

\$\endgroup\$
10
  • \$\begingroup\$ Nothing he can do in software, but the existing circuit can be made to work simply by increasing R14 and R20. \$\endgroup\$
    – Ben Voigt
    Aug 3, 2021 at 22:06
  • \$\begingroup\$ @Justme I'm using ESP12E, are values you mentioned same for ESP12E as well? I searched but didn't found exact internal pull-up resistor values of ESP12E! And how can I float GPIO01 high(or should I somehow make it externally high) and still control relay from it? \$\endgroup\$ Aug 3, 2021 at 22:51
  • \$\begingroup\$ @saurabhkandalkar I also did not find values for ESP12E, but isn't ESP12E just a device/module which contains an ESP8266EX so whatever ESP8266EX has should apply? \$\endgroup\$
    – Justme
    Aug 3, 2021 at 22:54
  • \$\begingroup\$ @BenVoigt What should I increase? values of R14 and R20? \$\endgroup\$ Aug 3, 2021 at 22:55
  • \$\begingroup\$ This is not solvable by increasing base resistors. You need to assume the pin has up to 100k pull-up and voltage must be above 2.475V to be within specs. Which means there is only 8.25 microamps available or it is out of specs. It allows only an external load of 300k to ground. The transistor surely needs more base current so it would not work. \$\endgroup\$
    – Justme
    Aug 3, 2021 at 23:14

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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