ESP32 Powering Issue

This might sound like a silly question but I’m brain dead now. So basically my power changes the input power phase of my house. I am super new to home assistant and esphome.

Here is the link to the ESP32 I am using, and its datasheet.

The relay I am using is HW316, 3 channel active low
Also, I am using a 5v AMS1117 regulator

Now the issue I am facing is when I connect power to the GND pin of my ESP all my relays turn on and they stay on no matter what. I don’t even need to plug in the VIN.

But if I use the USB port it works fine, though I have to connect the VIN 5V to have enough voltage to control stuff, it won’t work on USB alone.

There is no GND besides the VIN, while there are 3 more GND on the board, I tried them all.

Power to GND??? GND is negative wire. I think there should be a VCC on relays that is positive wire and V3V on ESP (but no more than 3.6V to power your ESP as per your link) and that is positive wire. Check your wiring of positive and negative.

Or I will need to see your relay close up

Schematic, please. Not a Fritzing picture, just draw your wiring diagram on a piece of paper and scan it. A schematic would tell us more about your setup than any picture of description ever could.

All of the ground pins on the ESP board are the same. The ground on the ESP and all of the external components should be connected together.

Yes, without a schematic you can’t tell where the problem is.
It should work if you supply VIN +5V and GND( - ) from an external source and power other 5V peripherals from the same pins. As mentioned, you can use any GND, they are linked together on the board.


https://www.circuito.io/app?components=9442,360217,442979

So this is what the schematic looks like.

So basically when the ESP32 GND is connected to POWER GND, all the relay connects. But if I disconnect the GND it works perfectly.

Remove power using micro USB

Then the ESP turns off.

If you have a 5V voltage regulator on a non-soldering field, it does not work properly. What is the voltage of the external source?
With the micro USB disconnected, you must measure the 5V voltage on the VIN pin against GND

Imagine that the relays are supplied with 5V from an external source and from the same supply you bring +5V to VIN esp and GND (- sources)

That is not a schematic. It’s a pretty picture of how things are wired together. Sort of like the instructions for building a Lego kit. It tells an engineer absolutely nothing and most people won’t take the time to trace the connections in your picture when a schematic would tell everything at a glance.

Well, I’m not an engineer and I did not build the whole ESP package or the relay package. I bought those modules and that’s how I wired them up. If it’s not good enough for you then you can just go, you don’t have to waste your time. Thank you.

As I mentioned, I am using a 5v AMS1117 regulator to convert the 12v source to 5v to power everything. I am doing what you are telling me, +source to VIN pin of relay and ESP, and -source to GND of relay and ESP. But that’s the problem when I connect the -source to the GND of ESP, everything goes haywire.

You don’t want to power the ESP board with both USB and VIN. Try powering just the ESP board with VIN and GND from your regulator. If that doesn’t work, that’s where your problem is. :wink:

I assume you don’t have a micro USB connected as esp32 power supply?
If so it’s wrong, you can’t power VIN and USB at the same time(two different sources).
If you have the micro USB disconnected and you claim that the esp32 turns off, then you do not have power from the 5V regulator on the esp32’s VIN. The 5V regulator just doesn’t work for you

Did you measure the voltage on VIN against GND with the micro USB disconnected?

I’m not trying to but the ESP won’t work with the VIN and GND, when I do that all the relays turn up, they just stay switched on (connected) and I have no control. The regulator is giving enough power to keep everything running. But I will try a different regulator.

Scenario 1: VIN and GND as the power source, the relays all go into an active state and I have no control, ESP boot error.

Scenario 2: USB as power, relays won’t activate but the LEDs show they received the signal (not enough power), ESP boots perfectly.

Scenario 3: USB and VIN connected, but no GND, relays activate on control, ESP boots perfectly.

I have not but I will do it now and inform you of the measured voltage.

I would proceed step by step:
1 connect the 5V regulator to the 12V source (measure the output of the regulator if there is 5V)
2 Connect 5V to nodemcu32 VIN - GND (only the board itself if it starts up and connects to wifi)
3 Connect the power supply (5V) from VIN and GND to one module relay + control GPIO (test if it works)
4 Connect the other module relays one by one
5 Connect the power relays one by one
If something fails at some point, measure the voltage and find out what happened at that moment. Do not use micro USB power during the test.

@aquiveal as per my original post.

If you power ESP with USB it will deliver the correct voltage to the esp being around 3V (this could be why the ESP works when you use USB). If you power it with 5V then you are over your requirements to ESP as per your first links you provided. see below.


1/ If your relays require 5V to operate then can you supply the power Directly (not through ESP) and control the relays via the ESP and then use USB to power the ESP?
2/ If you would like to use 1 power source can you also convert the 12V to 3.3V to power ESP on "3V3?

Removed (strike out) 1 & 2 as below pepe59 post. I then study your wiring diagram and new post below.

You are not quite right

1 option
1 možnost
2 option
2 možnost
3 option
3 možnost
Always use only one power option!
I usually use option 2 because I have a lot of esp modules connected to the solar battery

Hi pepe59

Ok… lets use option 2 :grinning: as that is how it is drawn in his wiring diagram. Thanks pepe59 :+1:

Now looking again at his wiring diagram… 5V power is going directly to the relays. We need to check the jumper cap on the relay. I believe it should be removed (remove jumper cap) and rather than connecting 5V to Vcc on the relay it should be connected to JDVCC with jumper cap removed.

I just can’t see the relays in his photo… can @aquiveal take a clear photo of the relays… thanks

If I don’t consider the 5V regulator:
on the bottom edge of the non-soldering field I see +5V on one bus and GND on the other. From the +5V bus, there is a power wire for the esp32 and at the same time for the relay. The esp32 and relay are connected from the GND bus and I don’t see anything wrong with that, as long as we stick to the fact that the GNDs are all connected to each other (I assume they are).