Sporadic connection loss to relay when activated

Hello all!
I have a strange issue that’s really been bugging me with my 4ch relay.
The relay is controlling 3 solenoid valves for my drip irrigation system. It’s working but, every time I use the buttons on my Lovelace frontend it sporadically looses connection to the switch. The buttons become greyed out and I can’t stop the solenoid for a period of time. It’s worrying me because the setup is on a terrace balcony with people downstairs and I am scared of a water spill if I can’t stop the solenoid.

Of course I can stop the pump but still.

Commons linked together with one side of all the solenoids all 3 “neg” wires together to a jumper that goes in COM 1 then jumpers to com 2 and 3 and the other side is in the NO of ch 1,2 &3.

Can anyone help me with this?

Thanks

Eh, how can we know ? You don’t give any information at all.
What integration are you using ? How is it setup ? What hardware ?

i had written a second post with all the technical info, but i guess i forgot to press send or something so here I go again:

here is the esphome config with only the relay part shown

esphome:
  name: relay4ch_01
  platform: ESP32
  board: nodemcu-32s
.......
...
..
switch:
  - platform: gpio
    pin: 25
    inverted: false
    name: "relay1"
    id: valve1
  - platform: gpio
    pin: 26
    inverted: false
    name: "relay2"
    id: valve2
  - platform: gpio
    pin: 27
    inverted: false
    name: "relay3"
    id: valve3

i used a vertical stack card with a custom banner card to control it from my lovelace
here is a picture:

here’s the lovelace code:

type: custom:banner-card
heading: Zones
entities:
  - entity: light.led1_relay
    name: Zone 01
    icon: mdi:sprinkler
  - entity: light.led2_relay
    icon: mdi:sprinkler
    name: Zone 02
  - entity: light.led3_relay
    icon: mdi:sprinkler
    name: Zone 03
  - entity: switch.relay1
    icon: mdi:sprinkler
    name: relay Zone 01
  - entity: switch.relay2
    icon: mdi:sprinkler
    name: relay Zone 02
  - entity: switch.relay3
    icon: mdi:sprinkler
    name: relay Zone 03
style: |
  ha-card
  .heading {
        font-size: 25px;
        font-weight: bold;
        text-align: center;
        letter-spacing: '-0.01em';
  }
  ha-card {
      font-size: 1em;
      border-radius: 5px;
      color: rgb(255,255,255,);
      #border: solid 2px rgba(100,100,100,0.3);
      box-shadow: none !important;
      overflow: hidden;
      width: 100%;
      margin: 0 auto;
      padding-top: 0px;
      text-shadow: "1px 1px 2px black, 0 0 25px pink, 0 0 5px darkpink"
    }

if anyone could help i would greatly appreciate.

/LeFab

can anyone look into this and help me please? I have tried to get info but haven’t found much on the web

Educated guess here, but the problem could very well be the EMF created by the solenoid coil when it is disengaged. When power is cut, the magnetic field collapses which induces a voltage back into the coil. Could be a big spike, and even though it appears you are using the relays in an isolated configuration, the fact that there are unprotected connections directly to the MCU pins around could be crashing the processor.

Put a reverse biased diode across each solenoid coil. 1N4007 is my go to for these things.

1 Like

I doubt it since i put a flyback diode for that.
Oh wait!? I should pou one for each solenoid, between the relay and the solenoid?

I have one that is between the relay and the 12v psu.

I was instructed to do that, maybe the person was wrong…
So the diode should be between the pos and neg of the solenoid?

is this picture ok? Without the fuse because i dont have one…!

See More from Aaron Cake via Home Assistant Community

A real schematic would be much better. A fuse where you indicate would only protect the battery.

From your pictures ( a schematic would have already answered this) it looks like you are powering the relay coil from the NodeMCU. This won’t work.

dodnt you read the post?
its powered by 12v psu.
and it is working already, its just dropping out sometimes it bugs me as i dont understand why!?

when you sai between the solenoid coils what do you mean exactly, the two prongs? sorry im really new to electrical stuff…

Yes- don’t you read my reply?
“From your pictures…”

This is almost always an insufficient power supply. But I can’t tell from your pictures how you have things connected.

Place the diodes at the solenoids as close as possible.

I was saying this because the first set of pictures are MY setup! but the picture where i’m asking is this okay was not my setup it was following the previous answer i posted this picture to have visual confirmation if this was the right way.

thats why your answer made no sense to me.

sorry about the confusion here are the pictures from my PSU and how it is plugged

Your pictures are of practically no use. I still can’t see how the relay coils are powered. Something that a proper schematic would show immediately.

Just get a pencil and paper and draw a schematic.

i dont know how to do that. i dont have all the knowlege you have i am seeking help. if you dont want to, you dont have to… just at least suggest something i can provide or do to help you help me, dont just repeat yourself i do not know how to do schematics

the positive wire from the 24v brand new psu is pluged in the common with jumpers for the two other ones and one of the legs of each solenoid is pluged into the NC the other legs from the solenoids are all plugges to the negative wire of the psu.

that is the way i have it plugged.

Guys- a little help here? The OP still doesn’t get it.
None of your pictures show how the coil of the relays is powered. A schematic would show that. Your descriptions do not.

I’ve had problems with those type of relay boards on several occasions. At least for me the problem of relays randomly clicking or not working was because the boards that have terminals for breadboard wires don’t make good contact, any bump will cause them to bounce around. I use the ones with screw terminals now and rarely have a problem.

solution for me was to put the diodes really close to the solenoids between it’s “neg” and “pos”

2 Likes

Please mark my post as the solution in case someone else has this issue.

Already did :wink: