piNet
Posts: 9
Joined: Wed Apr 26, 2017 5:31 pm

Relay board basics

Wed Apr 26, 2017 6:16 pm

Hi

I have a board that i would like to use to switch on/off some lights using my Pi
It is described as a 12v 250v opto coupled relay board with hi low trigger.
The opto coupled part I understand isolates the 2 circuits.

on the relay side I have (per relay, this is no1):
Com1
NO1
NC1

I assume as its a light and I would want it off when relay is not activated I would just wire through NormClosed and COMmon and leave the NormOpen pole alone/unwired?

The input has DC- DC+ (which I assume is a 12v input)
it also then has for each relay
IN1-
IN1+
I am unsure how these are used/powered/signalled? few relay boards I have used in the past had only 1 input to activate so i am assuming I can choose between the - or + and this is the high/low trigger? what is the difference?

Does this need to be 12v aswell? Im assuming this isnt something that can go straight onto the PI gpio like some of the low powered relays can?

Greatful for any advice, even if its just a link!

User avatar
rpdom
Posts: 15004
Joined: Sun May 06, 2012 5:17 am
Location: Chelmsford, Essex, UK

Re: Relay board basics

Wed Apr 26, 2017 7:51 pm

[quote="piNet"I assume as its a light and I would want it off when relay is not activated I would just wire through NormClosed and COMmon and leave the NormOpen pole alone/unwired?[/quote]
That would leave the light on when the relay is not activated and turn it on when it is activated.

Normally Closed means "Connected to Common when the relay IS NOT energised"
Normally Open means "Connected to Common when the relay IS energised"
The input has DC- DC+ (which I assume is a 12v input)
it also then has for each relay
IN1-
IN1+
I am unsure how these are used/powered/signalled? few relay boards I have used in the past had only 1 input to activate so i am assuming I can choose between the - or + and this is the high/low trigger? what is the difference?

Does this need to be 12v aswell? Im assuming this isnt something that can go straight onto the PI gpio like some of the low powered relays can?

Greatful for any advice, even if its just a link!
It may help if you could provide a link to details of that particular relay board.

piNet
Posts: 9
Joined: Wed Apr 26, 2017 5:31 pm

Re: Relay board basics

Wed Apr 26, 2017 10:39 pm

Thanks for the reply
attached is a part of a pic, showing the top of the board there are three more relays underneath (restricted on pic size)
each have a in[N]+ and -

this is the blurb that was with it:-
Features:
4-channel, DC 12V 30A relay module.
Output capacity: within DC 30V 30A or AC 250V 30A.
Using optocoupler isolation, strong anti-jamming capability and stable performance.
The module can be set high or low trigger.
To ensure stability, uses industrial grade PCB board and 9.5mm barrier terminals.
All interfaces can be connected directly via terminal wiring leads, very convenient.

Module Interface Description:
1. DC +: DC power supply positive;
2. DC -: DC power supply module negative;
3. IN: Signal input terminal(support High/Low Level switch freely);
4. Normally open (NO): Relay normally open;
5. Common terminal (COM): Relay common;
6. Normally closed terminal (NC): relay normally closed terminal;

Specifications:
Type: 4-Channel
Relay Voltage: DC 12V
Output Capacity: within DC 30V 30A or AC 250V 30A
Quiescent Current: 5mA
Trigger Current: 5mA
Module Size: 128 * 68 * 20mm
Module Weight: 177g
Attachments
Untitled.gif
Untitled.gif (63.8 KiB) Viewed 3350 times

klricks
Posts: 6549
Joined: Sat Jan 12, 2013 3:01 am
Location: Grants Pass, OR, USA
Contact: Website

Re: Relay board basics

Thu Apr 27, 2017 12:03 am

Regarding the trigger inputs:

Most relay boards are 'ACTIVE LOW' which means:
Setting the GPIO (IN) LOW or 0V will turn the relay ON and setting the GPIO HIGH or 3V3 will turn the relay OFF.

Some relay boards are 'ACTIVE HIGH' which means:
Setting the GPIO (IN) LOW or 0V will turn the relay OFF and setting the GPIO HIGH or 3V3 will turn the relay ON.

Your board appears to have both options.
The IN- would be used for ACTIVE LOW
-OR-
The IN+ would be used for ACTIVE HIGH

It is your preference as to which input type you use.
It is simple to program either type.
Unless specified otherwise my response is based on the latest and fully updated Raspbian Buster w/ Desktop OS.

piNet
Posts: 9
Joined: Wed Apr 26, 2017 5:31 pm

Re: Relay board basics

Thu Apr 27, 2017 3:01 am

As this is a 12v relay board, would the input/trigger need to be 0/12v low/high?

From a Pi gpio that is only 3.3v would I then run a second set of relays or just use a step up convertor?
or would 3.3v be enough to hold it high (I guess this depends on the board?)

klricks
Posts: 6549
Joined: Sat Jan 12, 2013 3:01 am
Location: Grants Pass, OR, USA
Contact: Website

Re: Relay board basics

Thu Apr 27, 2017 3:41 am

piNet wrote:As this is a 12v relay board, would the input/trigger need to be 0/12v low/high?
No. The 12V refers to the voltage required to operate the relay coils. You can get relay boards with different voltage ratings 5, 6, 12, 24V etc. The RPi can power many 5V relay boards through the 5V GPIO pins. Any other voltage will require a separate power supply to match the relay coil rating.

piNet wrote:From a Pi gpio that is only 3.3v would I then run a second set of relays or just use a step up convertor?
or would 3.3v be enough to hold it high (I guess this depends on the board?)
Almost all relay boards use 5V TTL logic levels for the input triggers. However in many cases the 3V3 TTL logic will work with 5V logic. So the RPi should be OK. If not then a level translator circuit can be used.
Unless specified otherwise my response is based on the latest and fully updated Raspbian Buster w/ Desktop OS.

piNet
Posts: 9
Joined: Wed Apr 26, 2017 5:31 pm

Re: Relay board basics

Thu Apr 27, 2017 6:53 pm

Thanks Kl

so wiring up as below should be ok, whatever the GPIO pin the green line goes to I would set high when I want to activate the light attached to relay 1. is there anything i need to put inline for the in to make sure power doesnt go back towards the PI gpio ?
I undertsand the 250v is isolated from the 12v circuit, but the 12v circuit is attached to the pi somehow? or does the relay board take care of that?
board.png
board.png (23.92 KiB) Viewed 3263 times
I have another question, I would like to power this via 250v, I have various ac-dc dc-dc and buck converters, but am wondering how best to wire them up.

250v to 250v }
250v to 12v DC } Wired in parallel
250v to 5v DC }
or
250v to 250v }
250v to 12v DC } Wired in parallel with a 12v DC-5v DC stepdown in series with the 12v DC board

pic might make it clearer.
psu.png
psu.png (12.86 KiB) Viewed 3263 times
Im thinking that as AC sockets are wired in parallel anyway, running this all off one outlet in a box with the buck convertors isnt too much of an issue? would there be any sort of interference or problems doing this? (other than making sure not to overload the sockets amp rating as i assume this could affect stability to the psu boards and thus PI)

Thank you for your help so far

klricks
Posts: 6549
Joined: Sat Jan 12, 2013 3:01 am
Location: Grants Pass, OR, USA
Contact: Website

Re: Relay board basics

Thu Apr 27, 2017 7:03 pm

You are missing the ground connection from RPi to relay board.
Unless specified otherwise my response is based on the latest and fully updated Raspbian Buster w/ Desktop OS.

piNet
Posts: 9
Joined: Wed Apr 26, 2017 5:31 pm

Re: Relay board basics

Thu Apr 27, 2017 7:56 pm

So that would be Pi ground to the in[N]- or to the ground of the relay coils 12v input?
I think im confused with the option of having high and low triggering and the two inputs for each relay.

klricks
Posts: 6549
Joined: Sat Jan 12, 2013 3:01 am
Location: Grants Pass, OR, USA
Contact: Website

Re: Relay board basics

Thu Apr 27, 2017 9:48 pm

piNet wrote:So that would be Pi ground to the in[N]- or to the ground of the relay coils 12v input?
I think im confused with the option of having high and low triggering and the two inputs for each relay.
Most relay boards have GND connection near the inputs.
You did not yet give a link to the relay board specifications/ sellers web site
OR give brand and model number if you can't find a link.

Take a high quality photo and put on an image sharing site such as imgur.com then post a link here.
Do not use the forum attach tool it's useless.
Unless specified otherwise my response is based on the latest and fully updated Raspbian Buster w/ Desktop OS.

piNet
Posts: 9
Joined: Wed Apr 26, 2017 5:31 pm

Re: Relay board basics

Thu Apr 27, 2017 10:15 pm

Hi klricks

This seems to be the same board on ebay
http://www.ebay.co.uk/itm/152478451919

User avatar
DougieLawson
Posts: 35811
Joined: Sun Jun 16, 2013 11:19 pm
Location: Basingstoke, UK
Contact: Website Twitter

Re: Relay board basics

Fri Apr 28, 2017 7:52 pm

piNet wrote:Hi klricks

This seems to be the same board on ebay
http://www.ebay.co.uk/itm/152478451919
The biggest problem with that item is that it needs a 12V supply to energise the coil. So you're going to need an external power supply and to ensure that your GPIO and Raspberry's 3V3 and 5V supplies aren't at risk from meeting 12V (they'll say hello until the magic smoke emerges but they won't be friends).
Note: Having anything humorous in your signature is completely banned on this forum. Wear a tin-foil hat and you'll get a ban.

Any DMs sent on Twitter will be answered next month.

This is a doctor free zone.

klricks
Posts: 6549
Joined: Sat Jan 12, 2013 3:01 am
Location: Grants Pass, OR, USA
Contact: Website

Re: Relay board basics

Fri Apr 28, 2017 9:40 pm

piNet wrote:Hi klricks

This seems to be the same board on ebay
http://www.ebay.co.uk/itm/152478451919
Did any documents come with the board such as a schematic and user manual?
The DC- appears to be attached to the main ground plane on the board so that would most likely be where you would attach the ground from the RPi board.
Unless specified otherwise my response is based on the latest and fully updated Raspbian Buster w/ Desktop OS.

piNet
Posts: 9
Joined: Wed Apr 26, 2017 5:31 pm

Re: Relay board basics

Sat Apr 29, 2017 8:29 pm

DougieLawson wrote:
The biggest problem with that item is that it needs a 12V supply to energise the coil. So you're going to need an external power supply and to ensure that your GPIO and Raspberry's 3V3 and 5V supplies aren't at risk from meeting 12V (they'll say hello until the magic smoke emerges but they won't be friends).

What would be best to protect from that? diode on gpio pins?


klricks wrote:
Did any documents come with the board such as a schematic and user manual?
The DC- appears to be attached to the main ground plane on the board so that would most likely be where you would attach the ground from the RPi board.
Mine hasnt arrived yet, its due any day, ill see if there is any documentation, the last ones I received were quite different as they were lower voltage but didnt come with any paperwork (but was much simpler layout) so easy to work out.

As this is AC voltage im being extra precautious and trying to get things figured before i can start fiddling with it

User avatar
DougieLawson
Posts: 35811
Joined: Sun Jun 16, 2013 11:19 pm
Location: Basingstoke, UK
Contact: Website Twitter

Re: Relay board basics

Sat Apr 29, 2017 9:03 pm

To switch a 12V load you'll need to use an NPN transistor or an n-channel MOSFET (or an opto-isolator).
Note: Having anything humorous in your signature is completely banned on this forum. Wear a tin-foil hat and you'll get a ban.

Any DMs sent on Twitter will be answered next month.

This is a doctor free zone.

yaheath
Posts: 15
Joined: Tue Mar 28, 2017 9:58 pm

Re: Relay board basics

Wed May 03, 2017 4:44 am

That relay board (looking at the eBay listing) has optocouplers. From the pictures, it looks like there's a couple resistors, a diode, and a transistor of some type next to each of the relays. So that board already has switching circuitry for the relay coils. The inputs INx+/INx- almost certainly connect to the LED sides of the optocouplers (probably through a series resistor -- there's a row of resistors next to the row of four-pin devices that are probably the optocouplers).

The blurb says trigger current is 5ma. Well within what the gpio pin can source. You should be able to connect a gpio directly to the IN+ and connect IN- to the Pi's GND and it will work. Assuming of course you also have the 12vdc connected to power the relay coils.

rwdozier
Posts: 1
Joined: Fri May 04, 2018 12:03 am

Re: Relay board basics

Fri May 04, 2018 12:10 am

Ok, so which is it? Transistor needed or not with an optocoupler using an RPi 3 B+.

Return to “Automation, sensing and robotics”