Relays for dummies

Hi Bart,
I would just ground all three wires at ONE end of the cable.
It looks like you are powering the optocoupler from the RPi, so that might be the most convenient end to find a good ground pin.

1 Like

Hi folks,

My hardware has arrived from Ali, so wife "advised" me kindly to get started with it :wink:
But I'm abit afraid of damaging my (rather expensive) garage door opener PCB, so would like to be very sure that I don't make any mistakes ...

Too me it looks like the pin 5 and pin 1 are directly connected (via the diodes), so which means a short-circuit. But probably there is something wrong in my thinking ...

So question is do I need to put something in between (like resistor ...)?
@Paul-Reed has been so kind yesterday to visualize my question:

image

Anybody has any advise ?

1 Like

Do you measure a voltage between PIN1 and PIN5?

Which optocouplers do you use?

How does your door controller activate? By short PIN10 with PIN1 or something else?

Hey Andrei (@iungo),
The drawings from Paul and the links to both optocoupler types are above in this post. I need to measure of voltage of 23,4 V on pin 5 and 6 of my garage door openers. By combining both measurements in my Node-RED flow, I should be able to determine the current status of the door (see curve in this post).
Bart

You do not need 220R resistor.

At first, try to test modules. For MRI-3.3D48:

Disconnect power from your raspberry.

Please, use good convenient connector wires. Don't short 3.3v raspberry pin with 5V, or you will destroy your raspberry!!!

  1. Connect red wire to the A1 terminal and black wire to the A2 terminal.
  2. Connect the black wire to your raspi gnd pin(PIN6).
  3. Connect the red wire to your raspi 3.3v pin(PIN1).
  4. Connect power to your raspberry. The led on MRI-3.3D48 must light on.
  5. Connect the yellow wire between the MRI-3.3D48 (+) terminal and raspberry pi 5v (PIN2)
  6. Measure voltage between (PIN6 raspberry) and terminal A MRI-3.3D48, when led I on you will see 5V on the multimeter, after disconnecting the wire from A1 terminal, the multimeter must show 0V.
    (if you don't have a multimeter, use led and 1k resistor instead)

I think you DON'T need the pulldown resistor (0 terminal) at your project. I think your door controller has pulldown inside.

In addition, I can't figure out how your door controller work, because don't have any user manual for it, therefore don't know door controller pinout and pins control voltage.

For MRI-24D4:

Just connect door controller PIN5 to A1 MRI-24D4and door controller PIN1 to A2 MRI-24D4.

When the door open/close you must see led light on/off

This connection is absolutely safe if the voltage between PIN1 and PIN5 < 30V

If it work, connect + terminal MRI-24D4 to raspberry pi 3v3 (PIN1) and A terminal to raspi GPIO (input)pin, configure your GPIO input as pull-down .

Enjoy)

@iungo - Andrey, having read your earlier post and visited www.ioton.ru I can see that you have experience in hardware development, so thanks for commenting.

I can see in your first post above that you have described a way to test the function of the MRI-3.3D48 without attaching it to the door controller, by using the Raspberry Pi 3.3V & 5V power lines.

Is your opinion that the MRI-24D48 has an internal series resistor or other current limiting circuitry, so that the internal LEDs are not damaged when +24V is applied to A1?

Paul

As I can see on in the description on Ali for MRI-24D48:

Disclaimer: I didn't developed this device, therefore I can trust only datasheet on Ali, which says

Input Voltage 24VDC +/-20% (description from ali)

So, max input voltage is: 24 + 24/10020 = 24V+4.8V = 28.8V .

I have simple understaning how the optocouplers works, typically, optocouplers led has max current around 10-20ma, but I see only 7ma in the description.
Input Current 7mA (description from ali)

So, I think this optocoupler it will work from 9V to 36 VDC w/o any problems.

Yes, IOTON is my project, you can also look:




It's all mine)

2 Likes

Evening Andrei (@iungo),
Really appreciate you spending time on my little project ...

About these 6 steps to test the MRI-3.3D48. Is it just to test whether the optocoupler is working correctly, or can I deduce extra information from this test?

So do I understand correctly that both drawings from Paul shoud be correct, without need for extra components?

That is so true ...
On page 15 of the manual there is some description of the 10-pins connector. Not sure if that gives you extra information ...

I'm impressed!

Now you've posted the schematic for the door controller, the ground for the door status indicator should be PIN2 and not PIN1.

I wish you had posted this earlier, because I'm now wondering if the electrical path through the opto-isolator will replace the FCA/FCC microswitches and give a false indication if the door is open or closed. This will need to be tested.

pin2

scheme

---About these 6 steps to test the MRI-3.3D48. Is it just to test whether the optocoupler is working correctly, or can I deduce extra information from this test?---

I advised those steps because before connecting any device to the system it will be good to test it separately. I always did it for any new device, not because I'm dumb(I think), but because of my experience).

--So do I understand correctly that both drawings from Paul shoud be correct, without need for extra components?--

For MRI-24D48 it's not correct schematic.
For open signalization you need to connect A1 to PIN3(+24V), A2 to pin FCA(PIN5).
For close signalization you need to connect A1 to PIN3(+24V), A2 to pin FCC(PIN6).

For MRI-3.3D48:
I don't understand how your door work now. Please, explain what you are doing to open and close it. What buttons you are pressing for door opening and for closing and in which sequence.

Also, as I see in the manual by your link, the OPEN button grounding PIN10 of your door controller, but MRI-3.3D48 is a positive voltage interrupter. I think you will need an additional relay for your system.

Hi Bart,
glad to hear the parts have arrived. :+1:

What I understand from the schematic is that pin5 and pin 6 (J2 terminal) are used as opening/closing limit-switch contact,
depends of cams on the motor/gearbox shaft (Fig.11,part "D").

This doesnt mean that they cannot be used to detect the position of the door, according to the diagram from post # 9.

Qquestions:

  • are security devices connected (pin7/8)?
  • are pin5/6 connected to pin2 (jumper)?

For protection, I can see that there is an accessory fuse (500mA for max.load 300mA) so no additional fuse is needed.

Attach a series resistor to protect the Raspberry/Garage electronic.

For a GPIO on a Raspberry 390ohm (8,5mA @ 3.3V) or more, I really don't know what mean 7mA on the opto element (min, max, recommended, ...).

On the garage side, again,from the "datasheet" (opto element input working voltage = 19-28V), so if put 470ohm / 510ohm,
the opto element should have enough current / voltage, while in the case of a breakdown (short circuit) the current would be limited to some 50mA .

It's the current on nominal input voltage, (3.3v) I think.

It's not necessary, but not a bad idea. Yes, it will work with 470ohm resistor. The voltage on the input will be 21.1v and consumed current 6.15ma. I think it will work stable.

@Paul-Reed: Sorry for that! Wasn't aware that it was so important ...

This is not good for my self esteem :wink:
Ok, I have reopened the case and this is how the electrician has wired it:

image

On the top left you see a grey cable with a blue and brown wire, which go to the manual switch that I use currently to open/close the garage door manually. The blue wire is connected to pin 1 and the brown wire to pin 2. Don't know where the other (thinner) cables are used for: I was only interested in the manual switch, since I wanted to have a relay switch in parallel with it ...

:joy: Your devices prove that you are not dumb, so I will surely run your tests !!!

@iungo: I have only one push button for each garage door: the button returns to its default position immediately when I release it, so it generates a pulse. I press it once to open the door. Some time afterwards I press it once again to close the door. So 1 pulse to open the door and another pulse to close the door (like in the above diagrams).

@markost: Ali still doesn't deliver the next day :wink:

There is only the garage door opener, that is located in the middle of the door. But there are no external sensors. It is just the opener. But it detects somehow (internal sensors?) that the door is entirely open/closed or when an object is blocking the movement (for safety).

Will need to check that tommorrow ...

Ok good to know !

Can I conclude that opening/closing of the door could be measured like this:

image

Have told my wife that I have mobilized half of the planet for my garage project :roll_eyes:

Yes I agree that this would be the best solution, as it would not interfere with the way that the door controller currently works. Good call.

Pin 10 is normally pulled high by a pull-up in the door controller, but if it is momentarily pulled low (by grounding it with a push button), the falling edge triggers the device logic to 'open the door if it is closed' OR 'close the door if it is open'.
See post #1 in this thread.
So having PIN 10 connected to the collector of the MRI-3.3D48 will enable it to be pulled low through the emitter to PIN1 (ground), when the MRI-3.3D48 is saturated.
Node-RED will be programmed to energise the MRI-3.3D48 for a set time - 100ms?? just enough to trigger the falling edge.
Why do you think that this would not work?
I have asked @BartButenaers to measure the current flow through pins 10 & 1, to ensure that it does not exceed the 100mA permitted (I would think that it would be OK and much lower that 100mA).

schematic

For open/close state (plus optional serial resistor):

1 Like

@markost
Your first amendment - using pins 5 & 2, was what I suggested above. But having thought in more detail since I posted, I can see that it may indicate a false status because of the current flow between Pin 5 & Pin 2, sending Pin 5 low.
@iungo's solution does not have that issue, and is a better solution IMO.

Your second amendment... is pretty much what @iungo has suggested, as both pins 5 & 6 are identical in operation.

The outputs on both of your amendments would work OK, I guess it comes down to personal preference.

Dear Paul and Bart,

I can explain, why I recommend using NO relay in parallel to "open" button.

When I'm working on any project I always try to follow the next principle:
Reliability is more important than functionality.

I think a relay is the most reliable solution. NO relay has open default state. And if raspberry pi power will disappear it stay open.

So I recommend using MRI-3.3D48 to control NO relay.

Paul, remember, some raspberry GPIOs has a Pull-Up on boot. It is no way to configure it. Aware those GPIOs.
You can find the info about GPIOs onboot state here:
https://elinux.org/RPi_BCM2835_GPIOs

Like Qay Yuli Sezar)

But the opto-isolator is also NO as default, just the same as a NO relay. Unless an energising voltage is applied to Pin A1, it will remain in it's default state of NO, and certainly be the case if the Raspberry Pi's power should disappear.

But that would also be the same result, because if the opto-isolator was energised, then the mechanical NO relay would then also be energised, so adding the NO relay would not give an added benefit.
Also consider what effect points-bounce from a mechanical relay would have on the door controller. Just using the opto-isolator would ensure a good clean switch from one state to another.

Yes, thanks, I was mindful of that, but there are IO pins available that do not pull-up on boot, and those could safely be used.

A think absolutely zero bounce effect. I think all door controller inputs have internal debounce circuit (or programming implementation). It can't work with the mechanical buttons w/o it.

2 Likes