canoodle
Posts: 3
Joined: Thu Jun 28, 2018 2:50 pm

12V Relay Setup

Thu Jun 28, 2018 3:01 pm

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)
Last edited by canoodle on Thu Jun 28, 2018 11:39 pm, edited 1 time in total.

User avatar
Z80 Refugee
Posts: 358
Joined: Sun Feb 09, 2014 1:53 pm

Re: 12V Relay Setup

Thu Jun 28, 2018 3:27 pm

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
Military and Automotive Electronics Design Engineer (retired)

For the best service: make your thread title properly descriptive, and put all relevant details in the first post (including links - don't make us search)!

User avatar
davidcoton
Posts: 3944
Joined: Mon Sep 01, 2014 2:37 pm
Location: Cambridge, UK

Re: 12V Relay Setup

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)?
Signature retired

canoodle
Posts: 3
Joined: Thu Jun 28, 2018 2:50 pm

Re: 12V Relay Setup

Fri Jun 29, 2018 12:10 am

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

pcmanbob
Posts: 6420
Joined: Fri May 31, 2013 9:28 pm
Location: Mansfield UK

Re: 12V Relay Setup

Fri Jun 29, 2018 8:55 am

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.
Last edited by pcmanbob on Fri Jun 29, 2018 9:42 am, edited 1 time in total.
We want information… information… information........................no information no help
The use of crystal balls & mind reading are not supported

User avatar
Z80 Refugee
Posts: 358
Joined: Sun Feb 09, 2014 1:53 pm

Re: 12V Relay Setup

Fri Jun 29, 2018 9:05 am

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.
Military and Automotive Electronics Design Engineer (retired)

For the best service: make your thread title properly descriptive, and put all relevant details in the first post (including links - don't make us search)!

gordon77
Posts: 4072
Joined: Sun Aug 05, 2012 3:12 pm

Re: 12V Relay Setup

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.

User avatar
Z80 Refugee
Posts: 358
Joined: Sun Feb 09, 2014 1:53 pm

Re: 12V Relay Setup

Fri Jun 29, 2018 11:18 am

Yes, that's what I would do too, but we don't know what the OP's level of experience is.
Military and Automotive Electronics Design Engineer (retired)

For the best service: make your thread title properly descriptive, and put all relevant details in the first post (including links - don't make us search)!

texy
Forum Moderator
Forum Moderator
Posts: 5155
Joined: Sat Mar 03, 2012 10:59 am
Location: Berkshire, England

Re: 12V Relay Setup

Fri Jun 29, 2018 12:44 pm

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
Various male/female 40- and 26-way GPIO header for sale here ( IDEAL FOR YOUR PiZero ):
https://www.raspberrypi.org/forums/viewtopic.php?f=93&t=147682#p971555

drgeoff
Posts: 9606
Joined: Wed Jan 25, 2012 6:39 pm

Re: 12V Relay Setup

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.

gordon77
Posts: 4072
Joined: Sun Aug 05, 2012 3:12 pm

Re: 12V Relay Setup

Fri Jun 29, 2018 3:51 pm

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...

canoodle
Posts: 3
Joined: Thu Jun 28, 2018 2:50 pm

Re: 12V Relay Setup

Sat Jun 30, 2018 11:49 am

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!

User avatar
Z80 Refugee
Posts: 358
Joined: Sun Feb 09, 2014 1:53 pm

Re: 12V Relay Setup

Sat Jun 30, 2018 1:16 pm

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.
Military and Automotive Electronics Design Engineer (retired)

For the best service: make your thread title properly descriptive, and put all relevant details in the first post (including links - don't make us search)!

Return to “Beginners”