Controlling 30A Relay using ESP8266

Is this schematic safe?

I tried using 220ohm resistor instead of LED2 but the ESP8266 was not booting and some buzzing sound was coming from the relay.

The LED is wrong. A current-limiting resistor in series with the base is correct.

GPIO0 is programmed as in input, right?

Do you have a load connected to the relay? If your load really requires 30A your 5V power supply may not be holding-up.

Try it without a load (or a "light" LED & resistor load).

Try disconnecting the base-resistor from GPIO2 and connect it to +5V (or +3.3V) to check if the relay and LED1 come on.

Also double-check that 220 Ohm resistor. Do you have a multimeter?

What's the current rating for the relay coil? A 2N2222 may not be "big" enough. (That would cause the relay to fail and the transistor might burn-up, but the microcontroller should still boot as long as there is an appropriate current-limiting resistor on the output.)

And, how to you know it's not booting?

GPIO0 has a fixed pull-up, as the pin is used in the boot process. Pulling it low during boot sets the device to program mode.

GPIO2 must be pulled up during boot - its internal pull-up is enabled during boot. Your base pull-down resistor may cause a problem here preventing the device to boot.

GPIO2 must be pulled up during boot - its internal pull-up is enabled during boot. Your base pull-down resistor may cause a problem here preventing the device to boot.

I've never used an ESP8266 and I was not aware of that. The solution would be to use a different free-unused I/O pin.

The ESP8266 has quite some of those quirks, making it indeed harder to work with than an Arduino, where most pins are equivalent.

As long as you keep the restrictions in mind those two pins are perfectly usable. Controlling an NPN transistor or N-MOSFET is unfortunately not a good idea with those two, and I've had problems with various sensors connected to those pins.

GPIO15 has a fixed pull-down for the boot process (not broken out in the ESP01), and is therefore ideal for use with a MOSFET.

On the ESP01 the other two available GPIO are 1 and 3, better known as TX and RX respectively. Those can be used as regular GPIO pins. GPIO2 is the TX of Serial1 and can be used for debugging. Just make sure that whatever is connected to TX and RX doesn't affect the programming.

wvmarle:
GPIO0 has a fixed pull-up, as the pin is used in the boot process. Pulling it low during boot sets the device to program mode.

GPIO2 must be pulled up during boot - its internal pull-up is enabled during boot. Your base pull-down resistor may cause a problem here preventing the device to boot.

the esp866 doesn't have this pull-ups. it is a boot configuration. with it is set in what mode the bootloader works.
the board must provide this configuration.
io 2 must not be LOW for normal boot. the datasheet says it can float.

esp-01 doesn't pull-up io 0 and io 2. esp-01S and other esp8266 boards do pull-up io 0. Some of them have pull-up on io 2 too.

If GPIO0 doesn't have a pull-up on the module you will have to provide this externally, or you won't be able to boot it properly. Pulling it low enables program mode.

GPIO2 can be left floating because the built-in pull-up will be activated on boot, so you don't need an external pull-up.

I have a simple momentairy switch on the gpio pin to boot, and then after the boot i release the switch. Turning on and off a ledstrip via a transistor via wifi this way, working for a couple of months now.

Hi,
SORRY;
Can you please redraw this schematic with ALL the wires connected.
At the moment its a SEARCH-A-WORD puzzle.


It is such a low component count circuit, you should be able to show the interconnections.

If you wish someone to check the signal flow of your project, it would be nice to show the wires that do it.
The schematic is the best way to convey your project, so please spend the time in drawing it.

Thanks...Tom... :slight_smile: