1

I currently have this relay, and it is a 5V relay (for the control circuit).

Seeing as how our GPIO pins are rated at 3V3, I connected constant 3V3 power to Vcc and a GPIO pin to In1 to actually control the relay. This works well, but seeing as how this relay expects 5V to control it, I'm worried that 3V3 could be an issue of under-powering the relay (possibly causes unexpected disconnects from the magnet?).

With that being said, there doesn't seem to be any 3V3 relay modules out in the wild.

Are my concerns valid?

Steve Robillard
  • 34,687
  • 17
  • 103
  • 109
Thomas Stringer
  • 183
  • 1
  • 2
  • 7

2 Answers2

3

You are correct that 3.3 volts is unlikely to be enough to reliably activate the relay. You could use a uln2803 and a separate 5 volt power supply to control the relay. Something like this should work

enter image description here

Steve Robillard
  • 34,687
  • 17
  • 103
  • 109
  • So what that does is provide 5V for Vcc and 5V for In1? Is that correct? And thanks for your answer! – Thomas Stringer May 16 '16 at 14:15
  • Exactly, but the uln2803 (darlington) also provides reverse EMF protection, which your relay board does not seem to have. – Steve Robillard May 16 '16 at 14:18
  • Since we already have 5V constant coming from the RPi, why not just have a transformer from a GPIO pin converting 3V3 to 5V and then wouldn't that be problem solved? Why the need for a separate 5V power supply when RPi already can supply 5V? – Thomas Stringer May 16 '16 at 14:18
  • @ThomasStringer The Pi can't always supply enough current and in this case the relay board does not appear to use optoisolators and so does not provide any reverse EMF protection. – Steve Robillard May 16 '16 at 14:21
  • I wonder why this does seem to work as-is though. I guess it's enough power given the current conditions, but maybe things like temperature could cause a different experience and lack of switching? – Thomas Stringer May 16 '16 at 14:27
  • @ThomasStringer It may work, but is not guaranteed and as you point out it may fail as you add USB devices like an HDD or WiFI dongle. – Steve Robillard May 16 '16 at 14:30
  • I see, so basically causing other load on the RPi that might take away current from the 3V3 pin and GPIO pin. That a good summary? – Thomas Stringer May 16 '16 at 14:49
  • 1
    @ThomasStringer Yeah, current is not unlimited. – Steve Robillard May 16 '16 at 14:50
  • (Sorry for the billion basic questions) Why don't relays have current ratings then? This relay says it is a 5V relay, but why no mention of min current required? – Thomas Stringer May 16 '16 at 14:53
  • 1
    @ThomasStringer I am sure it has some spec for minimum activation current, it may not be printed on the relay but is included in the datasheet. – Steve Robillard May 16 '16 at 14:54
  • @ThomasStringer talk about timing I jus got the adafruit daily email which included this" Most microcontroller pins can only supply about 20mA before burning up. This isn’t enough for most relay coils, even if you have a 5V relay. Use a transistor to amplify the current and keep your microcontroller safe." – Steve Robillard May 16 '16 at 15:06
  • Ha! That's awesome :-) Timing is something I can be good at. So you bring up an interesting point. So the relay itself will pull too much current, and that could cause the GPIO or RPi itself to get destroyed? And another question, is the ULN2803 a little overkill for this given scenario for a single relay? Looks like a lot of unused pins on the transistor. – Thomas Stringer May 16 '16 at 15:11
  • 1
    Yes, you could replace the darlington with a single transistor, and resistors, but I prefer the ULN2803 for exapnsion, price and ease of use. Yes, drawing to much current can damage the pin and/or the Pi. – Steve Robillard May 16 '16 at 15:17
-1

All you have to do is (1) connect 5v from the Pi to Vcc of the relay board. (2) connect ground from the Pi to Gnd of the relay board. (3) connect one of the many GPIO pins from the Pi to In1 of the relay board. Control this pin via a script you write on the Pi .

The relay requires 5v and ground to energize and 3v3 to control it.

Garnett Haines
  • 315
  • 1
  • 2
  • 4
  • 1
    "The relay requires 5v and ground to energize and 3v3 to control it." That's not the behavior I'm seeing. In my testing/experience, Vcc needs to equal In1 in voltage. – Thomas Stringer May 16 '16 at 16:07
  • 1
    There's no indication that relay uses a 3.3v control. Especially since it is being marketed for Arduino AVR. There are 3.3V control relays, but I think these usually have a ULN darlington array IC (such as the one Steve is talking about) onboard. They are fairly large (1+ cm long) and easy to notice. They are also very cheap to buy in a DIP package. – goldilocks May 16 '16 at 16:10
  • Your solution does not provide any back EMF protection to the Pin or the Pi. – Steve Robillard May 16 '16 at 16:24
  • @SteveRobillard is it me, or does this seem like a wrongly-labeled relay with 3V3 capabilities? http://www.amazon.com/4-Channel-Optic-Isolated-Trigger-Arduino-Raspberry/dp/B00WJXJ27I/ref=sr_1_1?ie=UTF8&qid=1463415940&sr=8-1&keywords=3.3v+relay+module – Thomas Stringer May 16 '16 at 16:26
  • @goldilocks it actually doesn't seem like there are many options for a 3V3 control relay module: http://www.amazon.com/s/ref=nb_sb_noss_2?url=search-alias%3Daps&field-keywords=3.3v+relay+module&rh=i%3Aaps%2Ck%3A3.3v+relay+module – Thomas Stringer May 16 '16 at 16:27
  • @Steve Robillard .The board has an diode across the coil for back EMF protection. – Garnett Haines May 16 '16 at 16:28
  • I don't think it's wrongly labelled -- I'm no electronics expert, BTW, so I was not claiming transistors are the only way to do this. The description on that one is that the opto-isolator which triggers the 5V relay can be powered separately and work on 3.3V. WRT availability of the ones I was talking about, here's an example: http://www.amazon.com/Daughter-Boards-RELAY-4-ULN2804-ADAPTER/dp/B00HKIMCU6/ref=sr_1_1?ie=UTF8&qid=1463416377&sr=8-1&keywords=relay+ULN – goldilocks May 16 '16 at 16:37
  • Note it doesn't refer to 3.3V, only that it uses 12V relays with a ULN adapter. The ULN will accept whatever control voltage it is provided with (dunno what the limits are); it then has a separate output voltage which can be much higher (in this case, it would need a 12V supply for that). The ULN IC is the chip on the left side in the pic. – goldilocks May 16 '16 at 16:38
  • https://en.wikipedia.org/wiki/ULN2003A – goldilocks May 16 '16 at 16:43