D1 Mini triggering all relays when 2 are on

Hi!
I am trying to use a 4 relay board with a d1 Mini.

I can trigger all relays individually but when trigger 2, all relays open. If I set all to in in HA, all relays go off. I’ve tried to change the relay board with the same result.

Here is my setup

And here the image of 2 relays to on in HA with all 4 triggered on the board.

Do you guys have any pointers as to why it’s behaving this way?

Many thanks!
Rob

If you are lazy to post your yaml and logs properly, you have low changes of support…

Thanks for pointing that out. Didn’t have a computer near me at the time.

Here is the yaml:

esphome:
  name: ventilmaster4thousand

esp8266:
  board: d1_mini

# Enable logging
logger:

# Enable Home Assistant API
api:
  encryption:
    key: "xxx"

ota:
  - platform: esphome
    password: "xxx"

wifi:
  ssid: !secret wifi_ssid
  password: !secret wifi_password

  # Enable fallback hotspot (captive portal) in case wifi connection fails
  ap:
    ssid: "Ventilmaster4Thousand"
    password: "XXX"

captive_portal:

switch:
  - platform: gpio
    name: Ventil 1
    pin: D8
  - platform: gpio
    name: Ventil 2
    pin: D5
  - platform: gpio
    name: Ventil 3
    pin: D2
  - platform: gpio
    name: Ventil 4
    pin: D3

And here are the logs when triggering the relays (when sending turn on ventil 2, it turns on all relays on the board, but not in HA)

[21:01:28][D][switch:012]: 'Ventil 1' Turning ON.
[21:01:28][D][switch:055]: 'Ventil 1': Sending state ON
[21:01:29][D][switch:012]: 'Ventil 2' Turning ON.
[21:01:29][D][switch:055]: 'Ventil 2': Sending state ON
[21:01:29][D][switch:012]: 'Ventil 3' Turning ON.
[21:01:29][D][switch:055]: 'Ventil 3': Sending state ON
[21:01:30][D][switch:012]: 'Ventil 4' Turning ON.
[21:01:30][D][switch:055]: 'Ventil 4': Sending state ON
[21:01:30][D][switch:016]: 'Ventil 4' Turning OFF.
[21:01:30][D][switch:055]: 'Ventil 4': Sending state OFF
[21:01:31][D][switch:016]: 'Ventil 3' Turning OFF.
[21:01:31][D][switch:055]: 'Ventil 3': Sending state OFF
[21:01:32][D][switch:016]: 'Ventil 2' Turning OFF.
[21:01:32][D][switch:055]: 'Ventil 2': Sending state OFF
[21:01:32][D][switch:016]: 'Ventil 1' Turning OFF.
[21:01:32][D][switch:055]: 'Ventil 1': Sending state OFF

I see nothing wrong here. Maybe you have something wrong in HA setup or wiring.
Anyway notice that most relay boards trigger relay when you write pin LOW.

How are you powering the relay board?

SCHEMATIC. Otherwise we are just guessing.

Hi!
It’s powered with a 12v power source. It’s a 12v relay board like this one

How much power can the 12V source supply?

Have you tied the grounds together?

The 12V source can support up to 24W. Yes, all grounds are wired together if by grounds you mean the negative poles. Here is an attempt at showing how its wired.

I’ve tried moving to other pins on the D1, without any luck. I’ve tried a 2-relay board with almost the same result, one output triggering 2 relays.

Ok, that should be enough for more than 60 relay coils (360mW each).

Set all the relay jumpers to high trigger. Then trigger manually with jumper wire from esp 3.3v pin to in1…in4. If it works correctly, your problem is in HA

What is the trigger voltage of the relay board?
Can you trigger it with 5 volt or perhaps even 12 volt?
I would want to try and isolate the board from ESP.
So if you can trigger it with the stepdown board (also what stepdown is this? Does it have enough power?) or perhaps directly from 12 volt.
That way we can see if it’s ESP, stepdown or relayboard that is broken.

This wiring diagram doesn’t look correct. You have your trigger signal as one wire all linked to a pin. There should be a (one) wire from the ESP32 pin # to the relay. You have pins 8, 5, 2 & 3 one wire should come from one of those pins to a relay. Each relay should have a separate wire to a pin # on your ESP32. Are you sure you have wired it correctly?

Blacky :smiley:

You are perfectly right. But then I have doubts OP is having fun with us…:joy:

Ha! Thanks, yeah, the wiring “diagram” isn’t showing the reality. Of course each pin of the ESP is wired to In1, In2, In3, In4 individually. I can trigger all relays individually from HA. It’s when I open 2 or more when it’s going haywire.

I am suspecting a ground issue. And will rewire those tonight.

Thanks for all the help!

Then take note of your jumpers to.

Blacky :smiley:

Turns out one of the groundings were broken. Now everything works. Thanks for all the help!

1 Like