Relays does not activate, despite ESPHOME and HA seem OK... SOLVED

Hi everyone.

I try to run a simple relay board on D1-mini and despite all seems OK on the ESPHOME and HA side, relays do not activate.

From HA, I see the IN LED getting ON/OFF but no action on the relay is performed.
On this page (https://blog.quindorian.org/2019/05/home-assistant-simple-relays-with-esphome.htm), I see no wiring diagram, but assume I have wired it right:

YAML Code is basic:

And action from Home Assistant lids the relay board on IN1, IN2 and IN3 , but nothing happens on the relays:

What can be wrong ?
I see a yellow jumper on the left side of the Relay board: what is this for ?

I assume I use a good 5VDC power charger…

Any help would be greatly appreciated…

Thanks in advance.

EDIT: Mistery solved: you need to power the VCC on the yellow jumper side to activate the relays !!!..

They are 12V coil relays. They need a 12V power supply to operate.

You may be able to trigger them with less (3.3V from your ESP board) as they have optocoupler drivers but the relay coils still need 12V to function reliably.

The solution was to power Vcc on the relay board ! 5VDC was sufficient.

Hijacking this one…

I have this (https://grobotronics.com/relay-module-2-channel-12v.html?sl=en) relay, 2 channel.

I wired everything from a separate 5v power source. All grounds come together. I use an ESP32 that also is connected to the ground from the board, but powered using the USB-port (for now).

When I switch the relay, the LED’s go on/off as expected for each switch I use in HA. But only one relay really switches (I can hear it clicking). The other one doesn’t switch, but the light does go on/off.

What am I missing?

Again, you have purchased 12V relays. You need to supply 12v for the relays to trigger reliably.

It even says this in the notes section on the page you linked to:

  • Working voltage 12V → Requires an external power supply to opperate the relays.

This is not correct: you can power it through 5VDC only but you need to wire the JD-VCC pin as well !

What I said is absolutely true.

12V relays require 12V for reliable operation.

Why the hell do you think they call them 12V relays?

You just got lucky that your 12V relay coils do activate with 5V at the current temperature and current age of the relays. There is no guarantee they will continue to work.

You are under driving them and this is not in any way recommended by the manufacturer or anyone who actually knows anything about relays.

According to the manufacturer the minimum voltage the 12V relay coil should be driven at is 9V:

Ok… I’m lost.

Tried the suggestion of @Dominicd and connected the JD_VCC to the 5v line. No change. I am only able to switch 1 relay, while both LED’s turn on/off when I switch them.

Also tried the suggestion of @tom_l and connected the relay to 12v. Then both relays power NO as soon as I connect power. But, I cannot switch any of them off using the ESP. I do see the LED’s blink a little, but they do not turn off when I switch them (seems like I overpower them).

I can make the ‘dysfunctional’ relay switch momentarily by reconnecting the jumper btw when using 5v.

Here’s the link to the actual switch I use (sorry @tom_l, the one before was one that ‘looks just like it’. I’m not the expert).

https://a.aliexpress.com/_EzvDjF1

You are connecting it wrong way. Your aliexpress link gives 10 different variations, try to illustrate the one you have.

1 Like

Quick sketch.

Brown = gnd
Red = VCC
Blue = data

  • ESP32 is powered by USB
  • Relay is powered via the buck converter at 5V
  • Remove the buck converter to power at 12v

I have the 12V 2Way channel switch.

ESPHome code:

switch:
  - platform: gpio
    name: "Watervalve open"
    pin: 22
    id: watervalveopen
    icon: mdi:pipe-valve
 #   interlock: [watervalveclose]
  - platform: gpio
    name: "Watervalve close"
    pin: 23
    id: watervalveclose
    icon: mdi:pipe-valve
 #   interlock: [watervalveopen]

Your buck converter output is shorted out.

0491810546c290b335abcdb9dd2bed661f02aeae

sketching mistake. Fixed in the inital post now.

If you have that module in photo (with Jd pin), your wiring diagram doesn’t match it.
Those modules are tricky to wire, so you could describe your real wiring.
Note also that the relay is closing with LOW input (sinking).

I know, I couldn’t find the exact module in easyeda. Other than the the wiring is similar.

Make a photo?

You may have damaged your ESP board by leaving that link in.

Regarding the 12V connection: It must be to the Vcc pin that is not connected to the Vcc pin that is connected to 3.3V after the link is removed. I’m guessing that it is the JD-Vcc pin but am not 100% sure. It could be the Vcc pin next to it. Check this before connecting the 12V.

Correct,
JD-VCC is for powering relay coil, 12V in this case (are we sure?). VCC next to it is interconnected to other VCC on the right.

The whole jumper hassle makes sense when you power 5V relay from 5V microcontroller. But in case of 12V relay, what’s the point of that jumper? I doubt that optocoupler would be happy with 12V and your esp trying to sink that with gpio even less…

Yes. The relays are labelled 12V.

Ok, so if wired like in photo above, it should work (if not broken). Pulling int pin to low(GND) should action the relay.