Advice for using generic 5V relays



  • I would like to hook my Omega 2+ to a relay module (not the official relay expansion). I've tested that I can hook the board up to the 5V pin on my omega dock and ground the relay pins to make them trigger, but using the 3.3V pin is not sufficient to trigger the relay. I'm presuming though that connecting the relay pins directly to the omega's GPIO pins would be a bad idea, because I'd assume when I take them to ground to trigger the relay it would send 5V to the pin and potentially damage the board. What steps should I take to protect the pins from over voltage? I could use a 3.3V <-> 5V logic converter, but this seems like overkill for the project. Maybe instead I should use an NPN transistor that connects the relay pin to ground when triggered by the omega? I could also probably insert a couple of resistors to form a voltage divider. Or am I just being overly cautious? Thanks for the advice.



  • Hi Jeff,
    Here one I used with a RasPi. Same voltages etc, just different pin numbers.
    Don't connect the relay directly to the GPIO as back EMF will probably destroy the GPIO port.
    I should add a reverse diode across the relay to protect the transistor.

    Cheers Andy

    0_1502769195339_Relay2.jpg



  • To get the full benefit from the opt-isolator, you shouldn't have any electrical connection from the relay side to the logic side, ie, don't take your power from the Omega pins or the supply running it.

    It's not that there aren't workable ways of doing that, but if you do so, you might as well not use the optoisolator, and just have a simple transistor.



  • @Chris-Stratton @Andy-Burgess Thank you both for your replies.

    @Chris-Stratton Can you please elaborate on your comment about powering the relay externally? Do you simply mean that the power that is being triggered by the relays should be separately powered (it will be in my case, it's coming from an AC power supply) or that the 5V into the relay board should not come directly from the omega?



  • @Jeff-Larkin No, to get the benefit of driving the relay through an optoisolator, the relay coils themselves must have a power supply with no connection to the Omega2.

    If you power the relays from the same supply as the Omega2, you've basically defeated the optoisolators. It can still with careful engineering be made to work, but you're not getting the isolation benefit of having those parts.



  • @Chris-Stratton Alright, I'm glad I asked. Guess I'll be redesigning the circuit a bit to accommodate this. Thanks for the information.



  • For connecting multiple relays consider ULN2803A - it's an array of 8 transistors in a $1 chip.



  • @Michal-Rok Thanks. I was thinking that an array of transistors to ground each relay pin might be the simplest way for me to ensure I don't overload the pins and this would fit the bill nicely.


Log in to reply
 

Looks like your connection to Onion Community was lost, please wait while we try to reconnect.