Using a relay (the neverending story)
Moderators: grovkillen, Stuntteam, TD-er
Re: Using a relay (the neverending story)
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, 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
Re: Using a relay (the neverending story)
relay's I hate them
Located in Belgium, Bruges. Working on a full DIY domoticz setup with ESPEasy.
Re: Using a relay (the neverending story)
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
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
Shardan
- grovkillen
- Core team member
- Posts: 3621
- Joined: 19 Jan 2017, 12:56
- Location: Hudiksvall, Sweden
- Contact:
Re: Using a relay (the neverending story)
+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
ESP Easy Webdumper [easy screendumping of your units]
ESP Easy Netscan [find units]
Official shop: https://firstbyte.shop/
Sponsor ESP Easy, we need you
Re: Using a relay (the neverending story)
i agree , ssr downright suck when trying to switch DC
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
Re: Using a relay (the neverending story)
Yes and no.
There are specialized SSR that work with DC too.... youll find them with searching for high price...
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
There are specialized SSR that work with DC too.... youll find them with searching for high price...
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
Shardan
Re: Using a relay (the neverending story)
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.
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
Re: Using a relay (the neverending story)
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
Re: Using a relay (the neverending story)
Shardan wrote: ↑24 Nov 2017, 11:14Definitely. 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
Re: Using a relay (the neverending story)
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
https://www.letscontrolit.com/wiki/inde ... cal_Relays
Let me know if that helps guys.
Regards
Shardan
Regards
Shardan
Shardan
Re: Using a relay (the neverending story)
I use relay board with JVcc , separate rail for relay.
Regards,
PS. Ref: ESP8266 GPIO Behaviour at Boot
Regards,
PS. Ref: ESP8266 GPIO Behaviour at Boot
Re: Using a relay (the neverending story)
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.
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
Shardan
Re: Using a relay (the neverending story)
That's i always use expanders to activate the relay.
This type of relay(quality) shouldn't be use on main.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.
Regards,
Re: Using a relay (the neverending story)
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.
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.
Re: Using a relay (the neverending story)
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 i2cDeNB3rt 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.
Domoticz on Raspi 2 -- 14 ESP units (hacked Sonoff,NodeMCUs, Wemos, self-built units) running with RC140- Mega 2.0.0 dev8
Re: Using a relay (the neverending story)
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.
- grovkillen
- Core team member
- Posts: 3621
- Joined: 19 Jan 2017, 12:56
- Location: Hudiksvall, Sweden
- Contact:
Re: Using a relay (the neverending story)
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
ESP Easy Webdumper [easy screendumping of your units]
ESP Easy Netscan [find units]
Official shop: https://firstbyte.shop/
Sponsor ESP Easy, we need you
Re: Using a relay (the neverending story)
I've tested a PCF8574 with the usual 8ch relay board with optocouplers.
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
Shardan
Who is online
Users browsing this forum: Google [Bot] and 57 guests