polarbeared
Posts: 20
Joined: Sun May 29, 2016 7:52 am

Closing a circuit using 12 volt relay

Sun May 29, 2016 8:04 am

Hi everyone, I'm very new to electronics, and I realise this is a question that's been asked a lot, but I still have no idea.

I was at Jaycar electronics today and I mistakingly purchased an 8 channel relay board which switches at 12 volts.
I have 12v DC external power supplies available (those ones you plug into the wall). Before I attempt to wire this thing up and damage a university loaned RPi2 I have 3 questions;

1. Is this even possible? – supplying 12 volts to a relay externally and somehow controlling the switch on an off with GPIOs?
2. Are relays highly resistive? I understand that you can put up-to 250v through this thing, and I was really just wanting to close a contact on a remote control…
3. If you think I should return it, what should I get instead? I'm trying to close possibly 5 different contacts on a remote control. Not anything too big.


The manual for the device I bought:
http://goo.gl/ygf5XL

Would this be a solution? Why does it need a 9v battery?
http://electronics.stackexchange.com/qu ... transistor
Last edited by polarbeared on Sun May 29, 2016 11:56 pm, edited 1 time in total.

jimjulian
Posts: 54
Joined: Mon Apr 04, 2016 12:09 am

Re: Closing a circuit using 12 volt relay

Sun May 29, 2016 3:19 pm

Hello,

First : your 'manual' is not a manual, but a datasheet.

Second : Your second link is dead.

Third : If you don't know anything about electronics, you're in over your head.

Fourth : If you don't have a volt-ohm meter, you don't know anything about electronics.

Hope this helps.

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

Re: Closing a circuit using 12 volt relay

Sun May 29, 2016 4:31 pm

You need 12V to energise the relay coils, you need 5V to activate the opto couplers that switch the relays on or off. The most important thing is to pull that jumper between Vcc and JD-Vcc off the pins or you risk feeding your RPi 12V (which WILL let the magic smoke out and WILL cost you £35 for a new RPi).

It's not really a device that's suitable for use with a RPi, it would work better with an Arduino or driving it with a MCP23017 (running at 5V). You could drive an Arduino or an MCP23017 from your RPi.

If I were you I'd send it back for a refund and get an alternative that runs at 3.3V.
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.

polarbeared
Posts: 20
Joined: Sun May 29, 2016 7:52 am

Re: Closing a circuit using 12 volt relay

Sun May 29, 2016 11:38 pm

What a venomous reply. Seriously, you'd think I went and asked on an advanced forum for electronics.

I also wouldn't be picking apart newbies considering some of your own dead obvious posts:

"Hello,

I'm a beginner and am a little bewildered by the interface options for the Raspberry Pi 3B.
Doesn't it accept a simple laptop as input/output device?

Thank you,
Jim"
jimjulian wrote:
First : your 'manual' is not a manual, but a data sheet.
Sorry, data sheet. There is no manual.
jimjulian wrote:
Second : Your second link is dead.
Thanks.
jimjulian wrote:
Third : If you don't know anything about electronics, you're in over your head.
I was being modest. I know enough about electronics to get through this assignment. I'm not in an electrical engineering course, so I included all of the "I know nothing" for hopes that I could get an easily explained guide.
jimjulian wrote:
Fourth : If you don't have a volt-ohm meter, you don't know anything about electronics.
My favourite. How did you deduce that I didn't own a volt-ohm meter? I've owned two volt-ohm meters in my life, no idea where they are now.
jimjulian wrote: Hope this helps.
I'm sure.

polarbeared
Posts: 20
Joined: Sun May 29, 2016 7:52 am

Re: Closing a circuit using 12 volt relay

Sun May 29, 2016 11:48 pm

DougieLawson wrote:You need 12V to energise the relay coils, you need 5V to activate the opto couplers that switch the relays on or off. The most important thing is to pull that jumper between Vcc and JD-Vcc off the pins or you risk feeding your RPi 12V (which WILL let the magic smoke out and WILL cost you £35 for a new RPi).

It's not really a device that's suitable for use with a RPi, it would work better with an Arduino or driving it with a MCP23017 (running at 5V). You could drive an Arduino or an MCP23017 from your RPi.

If I were you I'd send it back for a refund and get an alternative that runs at 3.3V.

Hi DougieLawson,

Thanks. The board doesn't seem to have a pin for JD-VCC. It'd be easier if it did. It has a VCC, GND, 1-8 IN, COM and GND (with a jumper between both).

http://www.forward.com.au/pfod/HomeAuto ... index.html
I was reading on this page that they think the isolation is mostly illusory, but I don't know if that applies here.
"Removing the jumper lets you have isolated supplies, one for the the Arduino and another completely separate one for the relays. Separate supplies provides some extra protection against mains volts getting back into the microprocessor. But this extra protection is mostly illusory. The pcb tracks on the back of the board are quiet close and nothing will protect you against a lightning strike on the power line outside your house."
Seeing as the 'logic' component is 5v, I'm guessing it's not possible, because although I can power the coils independently with 12v, I can't get a Pi to output 5v from a GPIO pin. I've seen a lot of people online who are supposedly doing something with it though… maybe I was wrong.


Do relays provide too much resistance for me to pass a very small current through its contacts? Like a remote controller?

polarbeared
Posts: 20
Joined: Sun May 29, 2016 7:52 am

Re: Closing a circuit using 12 volt relay

Mon May 30, 2016 12:00 am

I was thinking of exchanging them for optocouplers.

As per my first post, I found this diagram: http://electronics.stackexchange.com/qu ... transistor

I understand it, I think, but I don't know why they've included a 9v battery (ignoring the OP who posted the unmodified idea).

https://www.circuitlab.com/editor/#?id=sd9d8x

Also, the micro controller component just goes out from a GPIO pin to GND on the Pi?

stderr
Posts: 2178
Joined: Sat Dec 01, 2012 11:29 pm

Re: Closing a circuit using 12 volt relay

Mon May 30, 2016 12:08 am

polarbeared wrote: I've owned two volt-ohm meters in my life, no idea where they are now.
Now might be a good time to either find one of them or get another one, perhaps, if you are in the US, at Harbor Freight, which often gives them away for free, although you may need several to feel a reasonable certainty that they are actually displaying usably correct values.

boyoh
Posts: 1415
Joined: Fri Nov 23, 2012 3:30 pm
Location: Selby. North Yorkshire .UK

Re: Closing a circuit using 12 volt relay

Mon May 30, 2016 12:24 am

polarbeared wrote:Hi everyone, I'm very new to electronics, and I realise this is a question that's been asked a lot, but I still have no idea.

I was at Jaycar electronics today and I mistakingly purchased an 8 channel relay board which switches at 12 volts.
I have 12v DC external power supplies available (those ones you plug into the wall). Before I attempt to wire this thing up and damage a university loaned RPi2 I have 3 questions;

1. Is this even possible? – supplying 12 volts to a relay externally and somehow controlling the switch on an off with GPIOs?
2. Are relays highly resistive? I understand that you can put up-to 250v through this thing, and I was really just wanting to close a contact on a remote control…
3. If you think I should return it, what should I get instead? I'm trying to close possibly 5 different contacts on a remote control. Not anything too big.


The manual for the device I bought:
http://goo.gl/ygf5XL

Would this be a solution? Why does it need a 9v battery?
http://electronics.stackexchange.com/qu ... transistor
More detail on the remote contacts you tend to switch using relay contacts
Take in mind that relay contact have a bad habit of bouncing, Your remote
will see these as repetitive pushes. Look into using solid state ( Transistor
BoyOh ( Selby, North Yorkshire.UK)
Some Times Right Some Times Wrong

polarbeared
Posts: 20
Joined: Sun May 29, 2016 7:52 am

Re: Closing a circuit using 12 volt relay

Mon May 30, 2016 12:44 am

boyoh wrote: More detail on the remote contacts you tend to switch using relay contacts
Take in mind that relay contact have a bad habit of bouncing, Your remote
will see these as repetitive pushes. Look into using solid state ( Transistor
I'm just shorting a very small coin battery operated circuit switch. I don't think I'll be using a relay now, so I guess an optocoupler.

pksato
Posts: 295
Joined: Fri Aug 03, 2012 5:25 pm
Location: Brazil

Re: Closing a circuit using 12 volt relay

Mon May 30, 2016 1:37 pm

Hi,
This module is not same as very popular sainsmart and clones.
And photo on datasheet and pinout description not match.
Before connect this relay board to raspberry pi, make some testing experiments. Yon need:
3V battery (two AA or AAA);
5V PSU;
12V PSU;
Some indicating device (light bulb, led) to connect on relay contacts. If use ac mains, be careful.
3V battery and 5V PSU need to have separate wires and a single connector, to put on header pins.
Connect 12V PSU to relay board, GND to 0V and 12V to VCC.
Connect 5V PSU GND to board GND (same point of 12V).
Use one of relay as switch do indicating device.
Power all PSU.
Now, touch correspondent pin of relay with 5V wire.
Relay can be activated.
If relay not activated, swap 5V + and -, connect 5V to VCC, and use - to test pin.
If relay activated with out swapping.
Replace 5V psu with 3V battery, and repeat test.
If works with 3V, it can be used direct to raspberry pi GPIO pins.

If need to swap 5V connection, need a extra circuit to use this relay with raspberry pi. ULN2803 chip can be used.

You want to "replace" some remote control button with relays. Have some more small alternatives, but, need more electronics knowledge. Instead of relay, these devices can be uses, a transistor (bipolar or *fet), I.C. like 4066, direct correct logic level injection.

Candyjet
Posts: 56
Joined: Sun Jan 10, 2016 3:45 pm

Re: Closing a circuit using 12 volt relay

Mon May 30, 2016 3:02 pm

This may be of use to you. I was also struggling with relays, eventually solved with optocoupler. At the end of the post there is a photo of how I got it to work
viewtopic.php?f=37&t=126105&p=924683#p924683

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

Re: Closing a circuit using 12 volt relay

Mon May 30, 2016 5:59 pm

polarbeared wrote:
Seeing as the 'logic' component is 5v, I'm guessing it's not possible, because although I can power the coils independently with 12v, I can't get a Pi to output 5v from a GPIO pin. I've seen a lot of people online who are supposedly doing something with it though… maybe I was wrong.


Do relays provide too much resistance for me to pass a very small current through its contacts? Like a remote controller?
You can't drive 5V electronics from 3.3V GPIO pins that are rated at 16mA. You'd need to switch something at 3.3V that can then switch the relays at 5V. That's either going to be a collection of transistors, an I2C MCP23017 or opto-couplers.

For my relay projects I like using MCP23017s, if things go wrong you'll let the magic smoke out of a chip that costs a quid rather than a computer that costs thirty-five quid.
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.

polarbeared
Posts: 20
Joined: Sun May 29, 2016 7:52 am

Re: Closing a circuit using 12 volt relay

Tue May 31, 2016 12:52 pm

Hey pksato, thank-you very much – there's quite a lot in your reply. I ended up returning the unopened relays to the store and switched them for optocouplers. I would have tested them with 3v if I wasn't afraid to waste $20, but because they were unopened I exchanged them.

Candy jet, also thank-you, I actually started getting really anxious that the project wasn't going to be done in time so I posted in stack exchange.

http://electronics.stackexchange.com/qu ... -and-a-pi/

I had basically already figured out that I wasn't going to use a relay, and actually settled on the exact optocoupler you mentioned – the 4N25.

Basically for completeness, I used a 150 ohm resistor on the led side and connected the emitter and collector to the remote leaving the base pin hanging.

Wish I had found your thread earlier..

Thanks everyone!

polarbeared
Posts: 20
Joined: Sun May 29, 2016 7:52 am

Re: Closing a circuit using 12 volt relay

Tue May 31, 2016 12:57 pm

Candyjet wrote:This may be of use to you. I was also struggling with relays, eventually solved with optocoupler. At the end of the post there is a photo of how I got it to work
viewtopic.php?f=37&t=126105&p=924683#p924683

You basically went through the exact same learning process as I did...

Return to “Beginners”