Relays for dummies

Same here, but a few thoughts might be better late than never.

For future reference, a very similar approach would be to use a Sonoff SV flashed with the Tasmota firmware. Just like ESP Easy, Tasmota would give you WiFi, MQTT, and GPIO. The Sonoff can be powered from 24 VDC, which I assume you could steal from the door opener. Its relay can be isolated from the input by removing a couple of resistors, and some GPIO lines are available to sense the state of the door.

BTW, I would be cautious about driving those relays directly from the Pi. It's not clear which coil configuration you have, but the lowest voltage rating is 5 V, and driving that from a 3.3 V GPIO pin may draw more current than the Pi would like.

That's a nice bit of hardware. I have mounted a couple of Pi's on din rails using these:
https://www.amazon.com/gp/product/B01EYT8TZU/ref=ppx_yo_dt_b_search_asin_title?ie=UTF8&psc=1
Sort of pricey, but convenient.

1 Like

Have you considered not using mechanical relays at all?
I've just found these, which have a opto-isolated input with choices of 3.3V (output from Pi) & 24V (output from garage door).
The output stage is a LR7843 Power Mosfet which can operate up to 30V and handles more current than you'll need (Spec). (You would not get the stated spec maximum current loading though because there is no heatsink on the board!)

The advantage in using a solid state device instead of a mechanical relay is that you will not need any debouncing circuitry/software to handle the transients at both ends....

EDIT - Also see this opto-isolator board which as a twin unit could handle both 24V outputs from the garage door, and via it's opto-isolator safely provide the 3.3V inputs into the Pi.

  • Lots of options!
1 Like

I suspect he was referring to what is done with power-over-ethernet. This provides extra current capability that, together with higher voltage, can deliver a lot of power. If you are using the line for signaling rather than power, you don't need to do this.

Yes, but be careful about grounding. You have a long wire run and possibly grounds to two different mains circuits, both invitations to ground loops. I would avoid making any connections to unused wires.

1 Like

The SSR "relay" is much faster than the EMR relay (100µS vs 5-15mS => 100X faster).
Why is that better for debouncing?

Some links to SSR vs EMR:

* link 1

* link 2

* link 3

I never said it was better for debouncing...
With a solid state device there is no points bounce, because there are no contact points to bounce! - it's either activated or deactivated.
If you monitor with a scope what happens when relay points close, you'd see that for a short time thereafter the contact points will 'bounce' until they settle. This results in the status changing rapidly which will be picked up by the RaspPi input and unless it's mitigated, can cause problems with the flow.
The same applies with the garage door module, how will that respond if it receives a signal like the scope print below? Hopefully they will have included a debounce circuit to deal with it.

contacts

Yes I have bought the same ones, but after I received them they didn't fit into my closet. My closet just doesn't have enough depth for those :face_with_symbols_over_mouth:

Very interesting, but not very sure if I understand it correctly. Could you please explain it a bit in more detail? Or a quick sketch is highly appreciated !

Just for completeness, if somebody wants to build something alike: on the top din-rail of my closet (where the external wires arrive), I have mounted a series of these din-rail wire terminal blocks from Ali:

image

This works very well! On one side you have the external wires (coming from my garage door openers), and on the other side the wires go to my relays. This is not expensive and is a very decent solution to connect e.g. very stiff inflexibel wires to thin wires going to your electronics. And the external wires are fixed, so your electronic boards don't jump and down when the external wires are moved a bit ...

Again a very good point! But since the current manual switch works well, I assume that the door opener hardware will deal with it correctly ...

Oh my god. Good that you ask !!
Now I remember that I had bought some extra stuff from Ali last year. Oeps, should have mentioned this from the start. Damn ...
Somebody had advised me to buy these din-rail optocouplers from Ali:

image

On the above link you can find a table with links to all available models. Here a screenshot of the table:

image

It is all coming back now. At the time being I wasn't sure anymore how to use these ones in my setup, to control the doors and to read the current door status. So if anybody has still some energy left to have a look how I could solve it with such devices, he would become my hero of the day !!!

I agree with most....
SSR also have t_on time but it is very small....

This scope diagram is impossible with EMRelay (to fast), even if it is 10-20X that time, so door will not open/close.

I didn't check what will be if use SSR.

Sometimes EMRelay is better option...

The Wikipedia article is pretty good.

Basically, in this situation you should not ground anything coming from the garage door controller when it reaches the electrical closet. You probably should also keep pins 1 and 6 on the door controller separate unless you are certain that they are directly connected internally. Finally, this advice is over-kill. With such high voltages and slow signals, you are not likely to run into any trouble.

1 Like

@BartButenaers - Just to be clear... is it a requirement that all control components are contained in the 'official electricity cabinet' in the garage?

I agree with @markost that it would be much better where possible to use 24V in the lines to/from the garage, but it's more difficult to do so if all components are contained in the 'electricity cabinet', as both ends operate at different voltages. (if that makes sense!)

It would be much simpler and more reliable to port the 4 x garage 24V feeds in the 35mts of cable, and have the control components in a project box, next to the Rasp Pi....

Morning Paul (@Paul-Reed),
well it is not an official requirement from our country. I just like to have everything nicely together. It is my central electronics 'mancave', where I want to control ALL consumer electronic 'gadgets' of my entire house. Don't want a closet in the garage, containing only garage door specific electronics...

But it seems I have been unclear somewhere in this discussion, because the central closet is not in the garage. I will summarize everything I learned so far. This is my setup:

  1. The garage door opener is already installed, I only need to add some inline fuses. Indeed when somebody accidently cuts the long wires, and don't want to destroy my opener's pcb module.
  2. The 35 meter cable transports the 24 VDC signals from the garage port opener. So from a noise perspective I assume this is ok. I mean at least much better than running the 3,3 VDC Raspberry signals along the long distance ...
  3. Now we arrive in the mancave :wink:. The central closet contains only my hobby stuff. This is all DC voltage, so no 230 Volt AC stuff! The advantage is that this way there is no official electricity inspection required (at least in Belgium!). The latter one is very convenient since I will change it continuously during the remaining of my life (ps. my wife doesn't know this yet :rofl:). And I don't want an inspection every time … My separate other AC related closet doesn't change frequently and has been inspected.
  4. The wire is nicely fixed with the wire terminal blocks.
  5. Then the relays/optocouplers combination make sure my Raspberry GPIO pins get the 3,3 VDC voltage level and that they are protected correctly. Don't want to blow up my Raspberry in case of short-circuits or other damage …

For step 5 it is now not clear for me if I can use the din-rail stuff I have ordered in the past: i.e. the green optocouplers and the blue Finder relays, or a combination of both perhaps?

Thanks again !!!!!!!!!!!!

Aah, that makes life easier!
In that case, you could probably use one of these to control the door, and two of these to report the door status.
We could really do with the detailed spec sheet for them, just to look in a bit more detail.

I should get chance to have a further look this evening and try and draft up a circuit (unless @markost get's chance in the meantime).

Looks very promising already! After this, I will need to have a look at my todo list. If I'm not mistaken, I promised you a couple of things in the past. Oeps, forgotten :innocent:

Bart (@BartButenaers)

Your hardware posts generate so much useful information and Paul's (@Paul-Reed) links to hardware-I-may-need are great too :slight_smile:

4 Likes

Here is a draft for discussion which uses a MRI-3.3D48 (to control the door) and 2 x MRI-24D48's (to signal the door status. One for PIN 5 and one for PIN 6).

The immediate concern that springs to mind is that the output side of the module's claims to operate down to 3V, and you will only just have that from the Pi, so it should work but without a spec sheet it can't be guaranteed. Same with the front end too.
If this was a problem, there are ways around it such as stepping the voltage with a Level Shifter.

Also, could you please check what current is being drawn when controlling the door (through PIN 1 & 10), I'm assuming it's nominal. Also what voltage is present on pins 5 & 6 when it's reporting status (either 0V or 24V?).
The Ras Pi I/O PIN should be pulled low (internal resistor) in the Door Controller, to keep the opto deactivated until of course the flow changes it's status.


Very nice drawing! I thought a lot more discrete components would be required. If this should work, then it would be a very simple and neat solution …

So if the 3V from the site is correct, there is no problem I assume since it should be able to deliver the 3,3V that the RPI needs. Or do you mean something else?

I have holidays in about a week from now. Will then do some homework and update this discussion …

It is either 0V or 23,3V.

1 Like

The Pi GPIO inputs depend more upon the rising or falling edge of the input than the actual voltage, so even changing from 0V to 2V would constitute a HIGH. The Pi receiving the voltage is not the problem it's the opto-isolator, whose detailed electrical characteristics are unknown.

If that is an issue, we can use a 5V feed from the Pi instead of 3V, and then use a Level Shifter to drop the voltage back to the Pi's I/O pin to a safe 3.3V.

1 Like

If you already have Raspberry PI2 or PI3 and need a reliable scalable solution you can do it like this.

In this configuration, you will have:

4 universal isolated inputs (3-12VDC, 12-28VDC or DRY contact)
4 isolated outputs 24VDC up to 6A per channel
4 NO/NC relays 6A 30VDC, 6A 240VAC

Redundant power and hardware WATCHDOG.

You will need 12U din rail to place it.

if you you have a wifi network you should look for "shelly pro 4 relay" (4 relays in one box). All you need to switch with Node-red's HTTP request is "http://10.0.0.65/relay/0?turn=on" or "http://10.0.0.65/relay/0?turn=off". It is very easy and straight forward. You have to put in your own net address!!
https://shelly.cloud/

That is a very expensive unit!