Page 1 of 1

12V Relay Setup

Posted: Thu Jun 28, 2018 3:01 pm
by canoodle
hello All,
similar question: while GND is ("Ground" (-)) it took me a while to figure out what VCC (+) and COM (+) means?

apparently both need (+)5V, which can be provided by Raspberry Pi 2 Model B v1.1 with the pins that have black and red wire.

i am not sure if this is the correct way to do it – it works! 🙂

in the below schematics only two relays are connected:
  • Relay1 is orange-wired to GPIO 18
  • Relay4 is blue-wired to GPIO 23
Image

do i have to put resistors (4.7kOhm or 470Ohm?) between the GPIOs and the relay card? (have read that somewhere)

Re: 12V Relay Setup

Posted: Thu Jun 28, 2018 3:27 pm
by Z80 Refugee
We cannot possibly answer that question without more information about the relay card: specifically, what is its circuit diagram?

You need to understand that although the RPi has a 5V supply available on the GPIO connector, the GPIO input/output pins themselves are not compatible with 5V systems (regardless of whether it seems to work).

Beginners Guide to Wiring Things to the GPIO

Re: 12V Relay Setup

Posted: Thu Jun 28, 2018 8:39 pm
by davidcoton
canoodle wrote:
Thu Jun 28, 2018 3:01 pm
similar question: while GND is ("Ground" (-)) it took me a while to figure out what VCC (+) and COM (+) means?
Welcome to the forums.
Although your question appears similar, it is actually very different from the topic "12V relay setup". Your board has 5V relays, not 12V.
It would be better to start a new topic (I will ask the mods to move your question and the replies).
To provide a proper answer, we need more details of the relay board. Can you post a link to the specification (sometimes provided by the reseller)?

Re: 12V Relay Setup

Posted: Fri Jun 29, 2018 12:10 am
by canoodle
the relay card used is: https://www.pollin.de/p/relaiskarte-day ... nal-810273

datasheet of the card (in German): https://www.pollin.de/productdownloads/D810273B.PDF

datasheet of the relay SRD-05VDC-SL-C: http://www.circuitbasics.com/wp-content ... asheet.pdf

find the circuit diagram schematics of the relay here:

Image

Re: 12V Relay Setup

Posted: Fri Jun 29, 2018 8:55 am
by pcmanbob
So your relay card may work as you have it wired.

You are providing 5v to the common pin and connecting a gpio to the IN pin so current can flow from the common through the resistor and the 2 LED's to ground when the GPIO pin is set to low ( this is why these relay boards are called active low ) so the opto isolator is switched on and so is the relay

So when the GPIO pin is set to high a much smaller current is flowing from the common pin to the GPIO this may not be enough to activate the
opto isolator and hence the relay, but under some conditions this current flow my be sufficient to keep the opto isolator switched on and hence the relay switch on.

personally I don't like this set up because you have a 5v supply connected to the GPIO should any component in the circuit fail you could apply greater than 3v to the GPIO pin.

if you want to be sure of the relay card operating correctly and protect the GPIO from any chance of 5v being connected to it use a simple 2n2222 transistor and a 470 Ω resistor to do the switching of the IN pin to ground.

If you intend to use all 8 relays would be simpler to use a ULN2083A between the GPIO and the relay board, just a single chip, with 8 inputs, 8 outputs and a ground to be connected.

Re: 12V Relay Setup

Posted: Fri Jun 29, 2018 9:05 am
by Z80 Refugee
I agree. 3.3V is not sufficient to run two LEDs in series, and 5V on COM with the IN line going directly to a GPIO line could be lethal to the RPi.

Use a buffer circuit as explained here: Beginners Guide to Wiring Things to the GPIO.

Re: 12V Relay Setup

Posted: Fri Jun 29, 2018 10:24 am
by gordon77
Personally l would short out the input leds (eg d1) and put a suitable resistor across the input resistors (eg R1) to allow com to be 3.3v.
This would mean soldering the pcb and loosing any warranty.

Re: 12V Relay Setup

Posted: Fri Jun 29, 2018 11:18 am
by Z80 Refugee
Yes, that's what I would do too, but we don't know what the OP's level of experience is.

Re: 12V Relay Setup

Posted: Fri Jun 29, 2018 12:44 pm
by texy
davidcoton wrote:
Thu Jun 28, 2018 8:39 pm
canoodle wrote:
Thu Jun 28, 2018 3:01 pm
similar question: while GND is ("Ground" (-)) it took me a while to figure out what VCC (+) and COM (+) means?
Welcome to the forums.
Although your question appears similar, it is actually very different from the topic "12V relay setup". Your board has 5V relays, not 12V.
It would be better to start a new topic (I will ask the mods to move your question and the replies).
To provide a proper answer, we need more details of the relay board. Can you post a link to the specification (sometimes provided by the reseller)?
Topic split into new thread.
Texy

Re: 12V Relay Setup

Posted: Fri Jun 29, 2018 2:56 pm
by drgeoff
gordon77 wrote:
Fri Jun 29, 2018 10:24 am
Personally l would short out the input leds (eg d1) and put a suitable resistor across the input resistors (eg R1) to allow com to be 3.3v.
This would mean soldering the pcb and loosing any warranty.
Shorting out the LEDs and connecting COM to 3.3 volts should be enough. The voltage
drop across the LED is close enough to the difference between 3.3 and 5.

Re: 12V Relay Setup

Posted: Fri Jun 29, 2018 3:51 pm
by gordon77
drgeoff wrote:
Fri Jun 29, 2018 2:56 pm
gordon77 wrote:
Fri Jun 29, 2018 10:24 am
Personally l would short out the input leds (eg d1) and put a suitable resistor across the input resistors (eg R1) to allow com to be 3.3v.
This would mean soldering the pcb and loosing any warranty.
Shorting out the LEDs and connecting COM to 3.3 volts should be enough. The voltage
drop across the LED is close enough to the difference between 3.3 and 5.
:D

Even simpler then...

Re: 12V Relay Setup

Posted: Sat Jun 30, 2018 11:49 am
by canoodle
Wow! Thanks to your replies! i am more of a software-guy X-D

so electronics is not my strong topic.

the relay card was recommended to me by https://pollin.de

so i should connect COM to the 3.3V pin1?

but that is occupied with the realtime clock X-D

can you provide me with a picture of how it should be? (a good example of "how to wire relay card xyz to raspberry pi model B"

thanks!

Image


may peace and the source be with your!

Re: 12V Relay Setup

Posted: Sat Jun 30, 2018 1:16 pm
by Z80 Refugee
canoodle wrote:
Sat Jun 30, 2018 11:49 am
the relay card was recommended to me by https://pollin.de
I don't care who recommended it to you - the relay card (as supplied) is not compatible with the RPi so the recommendation is lousy. If you are unwilling to modify it, you need a relay card compatible with the 3.3V logic of an RPi, or to use some adapter electronics between the GPIO lines and the relay card inputs.

Modified (ie by shorting out the LEDs in the input circuit), you can run it compatibly by connecting the COM pin to 3.3V. It's irrelevant that you have fitted something else to obscure access to the pin, you have to work around that.

My article "Beginners Guide to Wiring Things to the GPIO" explains exactly what you can and cannot do when connecting things to the RPi, otherwise you should expect things not to work properly (at best), or not work at all, or damage the RPi.

As a general comment: using an opto-isolator on the drive to a relay coil is overkill. Relays are, by their very nature, isolated already.

I'm not sure why you nicked my diagram for your post, it serves no purpose and you certainly shouldn't have used it without crediting where it came from.