Using a relay (the neverending story)

Moderators: grovkillen, Stuntteam, TD-er

Post Reply
Message
Author
johnnybee
New user
Posts: 4
Joined: 12 Nov 2017, 14:25

Re: Using a relay (the neverending story)

#11 Post by johnnybee » 16 Nov 2017, 09:27

Chaca, i get it!:-)

Shardan, you was right! I needed just two diodes in line and now it's switching as it should!:-) I'm happy!
Thank you very much for your help!

And I make the test also. It's switch on when IN1 is on gnd.

Greetings
Thomas

Shardan
Normal user
Posts: 1156
Joined: 03 Sep 2016, 23:27
Location: Bielefeld / Germany

Re: Using a relay (the neverending story)

#12 Post by Shardan » 16 Nov 2017, 18:35

you're welcome :)
Regards
Shardan

DeNB3rt
Normal user
Posts: 120
Joined: 15 Dec 2015, 14:07

Re: Using a relay (the neverending story)

#13 Post by DeNB3rt » 21 Nov 2017, 09:55

relay's I hate them ;)
Located in Belgium, Bruges. Working on a full DIY domoticz setup with ESPEasy.

Shardan
Normal user
Posts: 1156
Joined: 03 Sep 2016, 23:27
Location: Bielefeld / Germany

Re: Using a relay (the neverending story)

#14 Post by Shardan » 22 Nov 2017, 14:54

The biggest problem: there is no "standard" relay board.

Every relay board has another schematic.
Basically they all work. As soon as different voltages come up things get complex.
The ESP runs on 3.3V, relays run on 5..12 V usually.
Is the input part of the relay board (transistor, opto coupler...) connected to GND or
to the voltage of the relays? The later won't run without problems.

Oh and btw: The "security feature" of opto couplers is a nuisance in most cases.
Most people drive the opto couplers from the same power supply they use for the relays.
So the isolation the opto provides between input and output does not exist - it is done away by the wires of the power supply.
Second - a relay is a nice isolating device (if you chose some quality ones of course).
So what is the isolation of the opto coupler for?

Maybe we should revamp the "Relay" part in the wiki and put up some explanation what works or not and why.

(And no: Solid State Relays are not better always....)

Regards
Shardan
Last edited by Shardan on 22 Nov 2017, 19:49, edited 1 time in total.
Regards
Shardan

User avatar
grovkillen
Core team member
Posts: 3621
Joined: 19 Jan 2017, 12:56
Location: Hudiksvall, Sweden
Contact:

Re: Using a relay (the neverending story)

#15 Post by grovkillen » 22 Nov 2017, 18:28

+1
ESP Easy Flasher [flash tool and wifi setup at flash time]
ESP Easy Webdumper [easy screendumping of your units]
ESP Easy Netscan [find units]
Official shop: https://firstbyte.shop/
Sponsor ESP Easy, we need you :idea: :idea: :idea:

User avatar
toffel969
Normal user
Posts: 469
Joined: 03 Jan 2017, 10:58
Location: Germany

Re: Using a relay (the neverending story)

#16 Post by toffel969 » 23 Nov 2017, 00:21

grovkillen wrote: 22 Nov 2017, 18:28+1
:D
i agree , ssr downright suck when trying to switch DC :lol:

with AC they do have their advantages(switching at zero current, no arc, no wear), but downsides like leakage current (important when using low power LED) and heat generation must be considered in their application as well as their most common failure mode (they short out). all depends on what you are trying to achieve, for example sodium lamp ballast is very unreliable with traditional relays, the contacts often start sticking (even when using 30A rated relay, with a 400w ballast) no probs with ssr.
on the other hand, when trying to switch a 6w LED, there is the problem of flickering when switched off due to leakage current with ssr, a tradional relay is the much netter choice
Domoticz on Raspi 2 -- 14 ESP units (hacked Sonoff,NodeMCUs, Wemos, self-built units) running with RC140- Mega 2.0.0 dev8

Shardan
Normal user
Posts: 1156
Joined: 03 Sep 2016, 23:27
Location: Bielefeld / Germany

Re: Using a relay (the neverending story)

#17 Post by Shardan » 23 Nov 2017, 13:22

Yes and no.
There are specialized SSR that work with DC too.... youll find them with searching for high price... :twisted:

With AC it depends on what you want to switch.
They are nice with resitive load - but what is really pure resitive these days? Inductivities, coils, valves, motors and such can execute an SSR within seconds.

I've just tested something very simple: A solenoid valve of about 5 watt power consumption with a standard "3 EUR AliExpress SSR".
Valve: https://de.aliexpress.com/item/co2-diy- ... eLevelAB=1

Relay: https://de.aliexpress.com/item/4pcs-lot ... eLevelAB=1

The SSR is made for 5A, says > 1000 watt on mains voltage.

I've just made it switch 5 sec on, 5 sec off. It took some on/off's and the valve was opened permanently, the relay shorted.

The induced voltage in the valve's coil even from this small gas valve killed the triac in the SSR.

I'm testing this for a pH control based on ESPEasy. I'm not too surprised about the destroyed relay, i expected that.
I'll have to repeat the test with a resistor/capacitor combination and / or a varistor to make switching reliable.

Murphy's law is valid as usual: Behind every problem you solve two others wait to appear.....

Regards
Shardan
Regards
Shardan

User avatar
toffel969
Normal user
Posts: 469
Joined: 03 Jan 2017, 10:58
Location: Germany

Re: Using a relay (the neverending story)

#18 Post by toffel969 » 24 Nov 2017, 08:08

One needs to be very careful when sourcing SSR. There are lots of fakes and parts with underdimensioned components, f.e. : https://www.youtube.com/watch?v=DxEhxjvifyY http://www.instructables.com/id/The-inn ... OTEK-SSRs/

My experience with ebay/Ali is equally bad. That's why I pointed out the pollin relays in the wiki.

These two work directly on an ESP GPIO and I can confirm their reliabilty, also when switching inductive loads like solenoids, motors, ballasts, though I never went even close to their rated currents. Particularly the solenoid is an application where I changed 3 mechanical relays in 3 months (sticking contacts) before changing to SSR.
https://www.pollin.de/p/solid-state-rel ... 0-v-340633
https://www.pollin.de/p/solid-state-rel ... 0-v-340470

I haven't tried these ones:
https://www.pollin.de/p/solid-state-rel ... 0-v-340625 but chances are, they work reliebly as well.

I feel like its worth spending a bit of extra money on the 230VAC components.
Domoticz on Raspi 2 -- 14 ESP units (hacked Sonoff,NodeMCUs, Wemos, self-built units) running with RC140- Mega 2.0.0 dev8

Shardan
Normal user
Posts: 1156
Joined: 03 Sep 2016, 23:27
Location: Bielefeld / Germany

Re: Using a relay (the neverending story)

#19 Post by Shardan » 24 Nov 2017, 11:14

toffel969 wrote: 24 Nov 2017, 08:08
I feel like its worth spending a bit of extra money on the 230VAC components.
Definitely. I'm testing around to see where the line between best price and cheap garbage is crossed.
Up to now the "Mager GJ-5-L" seems to work, testing the "Hoymk D3805HK" atm.
Sortet out a lot meantime, simply they are garbage.

Anyways, even really expensive, high quality ones get killed under inductive load.
The voltage peak can reach > 1000V, that's dangerous for every triac.
I've tested this with cheap SSR's, i've tested with expensife ones (Carlo Gavazzi, Comus, finder, Sharp).
With inductive load they all die sooner or later. Some are marked "snubberless" - anyways they die too.

Those relays with built-in "snubber" circuit are a game of luck. A snubber is a resistor/capacitor combination
that should "arrest" high voltage peaks. In theory that works - if the capacitor is tuned to the inductive load the ssr switches.
The capacitor and the inductive load build a resonant circuit to lead off the peaks. As the relay manufacturer doesn't lnow
what we want to switch, dimensioning might be good or bad.

Atm the best way to protect the ssr seems to be a varistor with 250..300 VAC.
I'll test that the next days with several SSRs.

For mechanical relays i'm using the Fuujitsu/Takamisawa JS-12 MN KT (12V) or JS-5 MN KT (5V).
They have some distance between low voltage and mains voltage so with some effort on PCB design
it's possible to avoid milling out gaps.
Regards
Shardan

Shardan
Normal user
Posts: 1156
Joined: 03 Sep 2016, 23:27
Location: Bielefeld / Germany

Re: Using a relay (the neverending story)

#20 Post by Shardan » 24 Nov 2017, 11:15

Shardan wrote: 24 Nov 2017, 11:14
toffel969 wrote: 24 Nov 2017, 08:08
I feel like its worth spending a bit of extra money on the 230VAC components.
Definitely. I'm testing around to see where the line between best price and cheap garbage is crossed.
Up to now the "Mager GJ-5-L" seems to work, testing the "Hoymk D3805HK" atm.
Sortet out others over time, simply they are garbage.

Anyways, even really expensive, high quality ones get killed under inductive load.
The voltage peak can reach > 1000V, that's dangerous for every triac.
I've tested this with cheap SSR's, i've tested with expensife ones (Carlo Gavazzi, Comus, finder, Sharp).
With inductive load they all die sooner or later. Some are marked "snubberless" - anyways they die too.

Those relays with built-in "snubber" circuit are a game of luck. A snubber is a resistor/capacitor combination
that should "arrest" high voltage peaks. In theory that works - if the capacitor is tuned to the inductive load the ssr switches.
The capacitor and the inductive load build a resonant circuit to lead off the peaks. As the relay manufacturer doesn't lnow
what we want to switch, dimensioning might be good or bad.

Atm the best way to protect the ssr seems to be a varistor with 250..300 VAC.
I'll test that the next days with several SSRs.

For mechanical relays i'm using the Fuujitsu/Takamisawa JS-12 MN KT (12V) or JS-5 MN KT (5V).
They have some distance between low voltage and mains voltage so with some effort on PCB design
it's possible to avoid milling out gaps.
Regards
Shardan

Shardan
Normal user
Posts: 1156
Joined: 03 Sep 2016, 23:27
Location: Bielefeld / Germany

Re: Using a relay (the neverending story)

#21 Post by Shardan » 30 Nov 2017, 21:09

As promised i uploaded some descriptions to the wiki.

https://www.letscontrolit.com/wiki/inde ... cal_Relays

Let me know if that helps guys.

Regards
Shardan
Regards
Shardan

danmero
Normal user
Posts: 64
Joined: 11 May 2017, 01:19

Re: Using a relay (the neverending story)

#22 Post by danmero » 01 Dec 2017, 17:24

I use relay board with JVcc , separate rail for relay.

relay_jvcc.jpg
relay_jvcc.jpg (66.06 KiB) Viewed 18587 times

Regards,

PS. Ref: ESP8266 GPIO Behaviour at Boot

Shardan
Normal user
Posts: 1156
Joined: 03 Sep 2016, 23:27
Location: Bielefeld / Germany

Re: Using a relay (the neverending story)

#23 Post by Shardan » 01 Dec 2017, 20:38

Nice analysis, good job.

The different behaviour of the GPIOs is somewhat easy to explain.
The ESP8266 is a kind of a jack of all trade device. Due to that nearly all GPIO's are hardwired internally to more then one function.
D0 (GPIO16) is internally used for deep sleep wake up. D5...D8 can be used as GPIO or additional SPI bus.
D3 (GPIO 0) is used to set flash mode at start up, D4 (GPIO 2) can be used to switch into other start modes, starting from a SD-card for example.
And so on.

So at boot these GPIO's will show some different behavior, that's just normal.

On top there is another point that has some effect on the GPIO pins.
The pins can be set to internal "weak" pull resistors at startup. This is usually done by the sketch you run.
As this is done at boot up time / starttime of the sketch this leads to some signals on the GPIOs too on startup.

Anyways the relay board you use is one of the "problem boards" switching on "low" signal".

All in all the conclusion is that boot time is not stable on GPIO's but that's a normal behaviour.
Even big CPU's like the ones in a PC do that. They use a line driver that is inhibited at startup to suppress such signals if necessary.

Last but not least - that relay board is not suitable for mains voltage at least in the EU.
The copper to copper distance between mains voltage and the low voltage circuit is far too low and the board has no millings to keep leak current off
as it is requiered by EU policies.

Regards
Shardan.
Regards
Shardan

danmero
Normal user
Posts: 64
Joined: 11 May 2017, 01:19

Re: Using a relay (the neverending story)

#24 Post by danmero » 02 Dec 2017, 01:07

Shardan wrote: 01 Dec 2017, 20:38 Anyways the relay board you use is one of the "problem boards" switching on "low" signal".
That's i always use expanders to activate the relay.
Shardan wrote: 01 Dec 2017, 20:38 Last but not least - that relay board is not suitable for mains voltage at least in the EU.
The copper to copper distance between mains voltage and the low voltage circuit is far too low and the board has no millings to keep leak current off
as it is requiered by EU policies.
This type of relay(quality) shouldn't be use on main.

Regards,

DeNB3rt
Normal user
Posts: 120
Joined: 15 Dec 2015, 14:07

Re: Using a relay (the neverending story)

#25 Post by DeNB3rt » 11 Dec 2017, 11:15

If you use an extender like the PCF8574 (https://www.letscontrolit.com/wiki/index.php/PCF8574)
a relay should not be doing crazy things anymore?
It states that the PCF8574 keeps the GPIO states at ESP8266 reboot.
Located in Belgium, Bruges. Working on a full DIY domoticz setup with ESPEasy.

User avatar
toffel969
Normal user
Posts: 469
Joined: 03 Jan 2017, 10:58
Location: Germany

Re: Using a relay (the neverending story)

#26 Post by toffel969 » 11 Dec 2017, 15:21

DeNB3rt wrote: 11 Dec 2017, 11:15 If you use an extender like the PCF8574 (https://www.letscontrolit.com/wiki/index.php/PCF8574)
a relay should not be doing crazy things anymore?
It states that the PCF8574 keeps the GPIO states at ESP8266 reboot.
I made that statement, it's true, I tried. You can reboot/reset the esp, gpio of pcf keep their state until they receive new instructions via i2c
Domoticz on Raspi 2 -- 14 ESP units (hacked Sonoff,NodeMCUs, Wemos, self-built units) running with RC140- Mega 2.0.0 dev8

DeNB3rt
Normal user
Posts: 120
Joined: 15 Dec 2015, 14:07

Re: Using a relay (the neverending story)

#27 Post by DeNB3rt » 13 Dec 2017, 11:31

toffel969 wrote: 11 Dec 2017, 15:21 I made that statement, it's true, I tried. You can reboot/reset the esp, gpio of pcf keep their state until they receive new instructions via i2c
that's just great! Could that chip drive an relay board with opto?
Located in Belgium, Bruges. Working on a full DIY domoticz setup with ESPEasy.

User avatar
grovkillen
Core team member
Posts: 3621
Joined: 19 Jan 2017, 12:56
Location: Hudiksvall, Sweden
Contact:

Re: Using a relay (the neverending story)

#28 Post by grovkillen » 13 Dec 2017, 11:42

Should not be a problem.
ESP Easy Flasher [flash tool and wifi setup at flash time]
ESP Easy Webdumper [easy screendumping of your units]
ESP Easy Netscan [find units]
Official shop: https://firstbyte.shop/
Sponsor ESP Easy, we need you :idea: :idea: :idea:

Shardan
Normal user
Posts: 1156
Joined: 03 Sep 2016, 23:27
Location: Bielefeld / Germany

Re: Using a relay (the neverending story)

#29 Post by Shardan » 13 Dec 2017, 14:43

DeNB3rt wrote: 13 Dec 2017, 11:31
toffel969 wrote: 11 Dec 2017, 15:21 I made that statement, it's true, I tried. You can reboot/reset the esp, gpio of pcf keep their state until they receive new instructions via i2c
that's just great! Could that chip drive an relay board with opto?
I've tested a PCF8574 with the usual 8ch relay board with optocouplers.
Image
Remember, if you use same power supply for relay and ESP/PCF, the opto couplers are useless as GND and VCC are connected and "bridge" the isolation of the optos.

Regards
Shardan
Regards
Shardan

Post Reply

Who is online

Users browsing this forum: Google [Bot] and 57 guests