liorillusion
Posts: 12
Joined: Mon Oct 24, 2016 10:49 pm

induction problem gpio relay load

Mon Mar 06, 2017 4:39 pm

hello.that's my first post here i will be happy to get some help. im working on controller to control air valve. leds and electromagnets im using raspberry pi 3 and 8 relay board and 4 relay board so the total is 12 relay. i have 8 inputs in this rpi but i have a problem. when im launching my code with the relays its working good. but when im conecting the relay to output of 12V + or - to activate led or air valve or electro magnet the pi getting inputs and the code crash. when nothing conecting to the relay output the pi working good! i try to use 5V 10amp power supply to the relay board and same problem. i try to connect the relay board to the pi 5v and same problem... im using 12v 27amp power supply for the output of the relays and this is not my first time im working with this relays on pi or arduino.... thanks for the help :) im going crazy with that!!!

*edit. the problem is induction when i have load on the relay*

Image
Last edited by liorillusion on Tue Mar 07, 2017 2:23 pm, edited 2 times in total.

SurferTim
Posts: 1800
Joined: Sat Sep 14, 2013 9:27 am
Location: Miramar Beach, Florida

Re: raspberry pi 3 air valve relay

Mon Mar 06, 2017 4:51 pm

Post a link to the relay boards.


SurferTim
Posts: 1800
Joined: Sat Sep 14, 2013 9:27 am
Location: Miramar Beach, Florida

Re: raspberry pi 3 air valve relay

Mon Mar 06, 2017 5:08 pm

That is a 5v device. The RPi is 3.3v. Here is a link to the schematic to connect them.
https://docs.google.com/file/d/0B5-HND9 ... VyODA/edit

liorillusion
Posts: 12
Joined: Mon Oct 24, 2016 10:49 pm

Re: raspberry pi 3 air valve relay

Mon Mar 06, 2017 5:10 pm

SurferTim wrote:That is a 5v device. The RPi is 3.3v. Here is a link to the schematic to connect them.
https://docs.google.com/file/d/0B5-HND9 ... VyODA/edit
i did it... same problem....

SurferTim
Posts: 1800
Joined: Sat Sep 14, 2013 9:27 am
Location: Miramar Beach, Florida

Re: raspberry pi 3 air valve relay

Mon Mar 06, 2017 5:25 pm

Did you try removing the jumper?

User avatar
Burngate
Posts: 6371
Joined: Thu Sep 29, 2011 4:34 pm
Location: Berkshire UK Tralfamadore
Contact: Website

Re: raspberry pi 3 air valve relay

Mon Mar 06, 2017 5:26 pm

liorillusion wrote:.... when im launching my code with the relays its working good. but when im conecting the relay to output of 12V + or - to activate led or air valve or electro magnet the pi getting inputs and the code crash. when nothing conecting to the relay output the pi working good!
The relay should isolate the control side from the output side.

If something on the output side is affecting the Pi, then you've possibly wired it wrongly.

liorillusion
Posts: 12
Joined: Mon Oct 24, 2016 10:49 pm

Re: raspberry pi 3 air valve relay

Mon Mar 06, 2017 5:26 pm

SurferTim wrote:Did you try removing the jumper?
yes. same...
again. relay working great also with 3.3v but when i connect any 12v to relay output no and c im getting input in my pi.

liorillusion
Posts: 12
Joined: Mon Oct 24, 2016 10:49 pm

Re: raspberry pi 3 air valve relay

Mon Mar 06, 2017 5:27 pm

Burngate wrote:
liorillusion wrote:.... when im launching my code with the relays its working good. but when im conecting the relay to output of 12V + or - to activate led or air valve or electro magnet the pi getting inputs and the code crash. when nothing conecting to the relay output the pi working good!
The relay should isolate the control side from the output side.

If something on the output side is affecting the Pi, then you've possibly wired it wrongly.
the wires are good.

SurferTim
Posts: 1800
Joined: Sat Sep 14, 2013 9:27 am
Location: Miramar Beach, Florida

Re: raspberry pi 3 air valve relay

Mon Mar 06, 2017 5:29 pm

If you are trying 3.3v on the relay optoisolators, do not connect the relay board ground to the RPi ground. Only 3,3v. The digital pins are the ground. HIGH is off, LOW is on.

edit: It's been a while since I tried this with a 3.3v board (Arduino Due), but I believe you must remove the jumper.

User avatar
Burngate
Posts: 6371
Joined: Thu Sep 29, 2011 4:34 pm
Location: Berkshire UK Tralfamadore
Contact: Website

Re: raspberry pi 3 air valve relay

Mon Mar 06, 2017 5:37 pm

liorillusion wrote:
Burngate wrote:
liorillusion wrote:.... when im launching my code with the relays its working good. but when im conecting the relay to output of 12V + or - to activate led or air valve or electro magnet the pi getting inputs and the code crash. when nothing conecting to the relay output the pi working good!
The relay should isolate the control side from the output side.

If something on the output side is affecting the Pi, then you've possibly wired it wrongly.
the wires are good.
liorillusion wrote:
SurferTim wrote:Did you try removing the jumper?
yes. same...
again. relay working great also with 3.3v but when i connect any 12v to relay output no and c im getting input in my pi.
Then your wiring is very suspect
There is no way for whatever's connected to the NO & C of the relay to affect the Pi.
Post a picture to imgur or similar of your setup.

liorillusion
Posts: 12
Joined: Mon Oct 24, 2016 10:49 pm

Re: raspberry pi 3 air valve relay

Mon Mar 06, 2017 5:57 pm

the wires are good.[/quote]
liorillusion wrote:
SurferTim wrote:Did you try removing the jumper?
yes. same...
again. relay working great also with 3.3v but when i connect any 12v to relay output no and c im getting input in my pi.
Then your wiring is very suspect
There is no way for whatever's connected to the NO & C of the relay to affect the Pi.
Post a picture to imgur or similar of your setup.[/quote]

http://imgur.com/a/cMJD6

User avatar
Burngate
Posts: 6371
Joined: Thu Sep 29, 2011 4:34 pm
Location: Berkshire UK Tralfamadore
Contact: Website

Re: raspberry pi 3 air valve relay

Mon Mar 06, 2017 6:19 pm

On a first look, there appears to be a stray black wire going from near the Pi to over by the output side of the relay board. What's that doing?

Also, the Pi's GPIO header isn't connected in the photo, so I can't say much about it.

SurferTim
Posts: 1800
Joined: Sat Sep 14, 2013 9:27 am
Location: Miramar Beach, Florida

Re: raspberry pi 3 air valve relay

Mon Mar 06, 2017 6:36 pm

If you are getting some type of input/voltage from the relays, then you are not isolating the RPi from the relays. This is where an o-scope comes in really handy.

liorillusion
Posts: 12
Joined: Mon Oct 24, 2016 10:49 pm

Re: raspberry pi 3 air valve relay

Mon Mar 06, 2017 6:38 pm

wires connected to the gpio. and about the black wire is not there anymore....
if i will use arduino to activate the relays. its will work? and i will connect it to the pi

SurferTim
Posts: 1800
Joined: Sat Sep 14, 2013 9:27 am
Location: Miramar Beach, Florida

Re: raspberry pi 3 air valve relay

Mon Mar 06, 2017 6:50 pm

liorillusion wrote:wires connected to the gpio. and about the black wire is not there anymore....
if i will use arduino to activate the relays. its will work? and i will connect it to the pi
Seems like a duplication there. You still need to convert the Arduino's 5v digital lines to 3.3v for the RPi.

If yu are using 3.3v on the relay board optoisolators, you need connect only 3.3v to VCC and the digital pins to IN1 to IN8. As I recall, remove the jumper. The relays will require a separate 5v supply on the control coils. edit: Connect 5v coil supply to JD-VCC.

liorillusion
Posts: 12
Joined: Mon Oct 24, 2016 10:49 pm

Re: raspberry pi 3 air valve relay

Mon Mar 06, 2017 7:17 pm

SurferTim wrote:
liorillusion wrote:wires connected to the gpio. and about the black wire is not there anymore....
if i will use arduino to activate the relays. its will work? and i will connect it to the pi
Seems like a duplication there. You still need to convert the Arduino's 5v digital lines to 3.3v for the RPi.

If yu are using 3.3v on the relay board optoisolators, you need connect only 3.3v to VCC and the digital pins to IN1 to IN8. As I recall, remove the jumper. The relays will require a separate 5v supply on the control coils. edit: Connect 5v coil supply to JD-VCC.
i did it before. and smae problem ahha its crazy me. no why to use resistor or diode on the input or output? (on the pi)


liorillusion
Posts: 12
Joined: Mon Oct 24, 2016 10:49 pm

Re: raspberry pi 3 air valve relay

Tue Mar 07, 2017 2:21 pm

the problem is induction... any one knows how to fix it?

LloydPi3
Posts: 22
Joined: Fri Mar 25, 2016 1:53 am

Re: induction problem gpio relay load

Wed Mar 08, 2017 3:19 am

Usually for inductive kicks you put a diode across the coil. See https://www.coilgun.info/theoryinductor ... ckback.htm

User avatar
Burngate
Posts: 6371
Joined: Thu Sep 29, 2011 4:34 pm
Location: Berkshire UK Tralfamadore
Contact: Website

Re: induction problem gpio relay load

Wed Mar 08, 2017 9:38 am

I've had a longer look at your picture.
(Just as an aside, it's a lot neater than many of the rat's nests one comes across. I find I have greater confidence in the capability of someone who produces tidy work, despite knowing that the two don't necessarily go hand in hand!)

The 24v supply does seem to be isolated from the Pi's supply, and the GPIO wiring seems to be kept well away from the switched wiring, so I can't see a way for the one to affect the other.
The only weak point (if it is one) is the 5v feeding the relay coils. Are you taking that from the Pi? I suppose it's possible that, when a relay is switched on, the current surge could affect the Pi's power if the Pi's supply is on edge.

It's possible that the inductive load of the valves could be causing interference to radiate across to the Pi. However, that should only happen when a valve is switched off, not on.
At switch-on, the current rises slowly, but at switch-off, the current falls quickly, creating a quite large voltage to appear across the relay contacts (and maybe arcing).
Since it's DC, you could try putting a capacitor across the relay contacts. I've no idea about the size of capacitor - that will depend on the inductance of the valve. A diode to suppress the spike would have to be placed across the valve, not easy with the way you've wired them (though it may be possible to put one inside the valve, if there isn't one already there)

If you're convinced that it's the magnetic field from the valves that's causing the problem, mu-metal or permalloy shielding could be an answer (though I've never had much luck with the stuff - it seems more trouble than it's worth. YMMV)

One thing you could try:
With the Pi just idling, use a pair of needle-nosed pliers to short across the relay contacts.
That will switch a valve on, without any associated software input, and without the relay coil being activated.
If it really is the valve current causing the problem, the Pi should crash.

User avatar
aTao
Posts: 1094
Joined: Wed Dec 12, 2012 10:41 am
Location: Howlin Eigg

Re: induction problem gpio relay load

Wed Mar 08, 2017 11:58 am

liorillusion wrote:hello.that's my first post here i will be happy to get some help. im working on controller to control air valve. leds and electromagnets im using raspberry pi 3 and 8 relay board and 4 relay board so the total is 12 relay. i have 8 inputs in this rpi but i have a problem. when im launching my code with the relays its working good. but when im conecting the relay to output of 12V + or - to activate led or air valve or electro magnet the pi getting inputs and the code crash. when nothing conecting to the relay output the pi working good! i try to use 5V 10amp power supply to the relay board and same problem. i try to connect the relay board to the pi 5v and same problem... im using 12v 27amp power supply for the output of the relays and this is not my first time im working with this relays on pi or arduino.... thanks for the help :) im going crazy with that!!!

*edit. the problem is induction when i have load on the relay*

OK, things to try:
use lamps instead of normal loads
power the loads from 12V battery
disconnect RPi to relay, run the code, use jumper wires to control the relays.

You might be suffering from the sensitivity of the RPi inputs, try enabling pull up or pull down resistors on your inputs.
>)))'><'(((<

Grenello
Posts: 5
Joined: Wed Jun 01, 2016 3:03 pm

Re: induction problem gpio relay load

Tue Oct 17, 2017 8:56 pm

Hi

Did you solve this problem? I am experiencing exactly the same thing.

I have tried to isolate the relay board from the RPI using both NPN / PNP switch and also with optocouplers. Nothings seems to work.

Everytime I send a "LOW" to the relay board, all the other GPIO pins get feedback and seem to go HIGH, triggering a whole bunch of functions relating to momentary switches (which are not pressed). When I disconnect the GPIO pins at the relay, everything works well.

The relays are driving 24V solenoids which are some distance from the RPi.

Let me know if you found an answer or can assist.

Massi
Posts: 1691
Joined: Fri May 02, 2014 1:52 pm
Location: Italy

Re: induction problem gpio relay load

Wed Oct 18, 2017 7:46 am

i don't know if this can be useful for the specific problem, but driving inductive loads has always the problem of "feedback"
in my case i'm driving a much lighter load (a simple 12V water pump), but i still have a problem.

but in my case the problem is shown only when i turn off the power to the load, not when i power the load.
Solution? a capacitor (that you should size properly) accross the relay pins (load side)

but again, i did not have this problem when powering the load, only when turning off the power.

Grenello
Posts: 5
Joined: Wed Jun 01, 2016 3:03 pm

Re: induction problem gpio relay load

Wed Oct 18, 2017 2:03 pm

Yes, you are quite right. After turning OFF the relay (GPIO from HIGH to LOW), I get massive feedback on a number of INPUT pins that are listening for momentary switches - its as if I have hit all 4 switches at once - all 4 interrupts get triggered as a result.

Not being an electronic engineer, I am running into the limitations of my abilities here.

I am managing problem through code in the interrupt call backs, but I would love to solve the problem at the hardware level.

Any advice will be greatly appreciated.

Return to “Troubleshooting”