AndrewPiB
Posts: 11
Joined: Sun Dec 25, 2016 5:01 pm

Inductive Load on a Relay

Sat Jan 14, 2017 5:30 pm

Hi All,

Over Christmas I made my first Pi project and thank you for the advice then. I made a switch and relay circuit so I could control my garden water feature and lighting. This weekend I have moved from the workbench to garden and suddenly my circuit which was working perfectly is no longer working.

Problem 1.

I am using 4 relays.
Relay 1 - Water Feature Motor
Relay 2 - Wall lights (compact fluorescent - 2 pin and ballast therefore inductive)
Relay 3 - Decking lighting (compact fluorescent - 2 pin and ballast therefore inductive)
Relay 4 - Feature lights (LED's)

I am using 5 scene switches.
Switch 1 - Water feature on/off
Switch 2 - Wall lights on/off
Switch 3 - Wall and Decking lights on/off
Switch 4 - All lights on/off
Switch 5 - Everything off

When I use switches 1, 4 or 5 then everything works as programmed.

When I use switches 2 or 3 then I sometimes get the effect I desire and other times I do not. I thought I had read somewhere on here or the web about using some suppression on the load side of the relay to calm down the inductive load but for the life of me I cannot now find that. I have tried swapping the LED and Inductive loads to different relays and the problem is always on the inductive load relays. When I hit switch 3 I immediately get both the wall and decking relay on but then one or the other or both then switch off.

Below is a picture of my bench set up where the led's became relays via the Kuman 8 channel relay board. https://www.amazon.co.uk/Kuman-Channel- ... nnel+relay

Image


Problem 2.

The switching seems fine when I use locals leads to the Pi at the box of tricks in my garden. However once I use the 20m's of CAT5 from the Pi to the switch in the kitchen I get all sort of false triggers. This I think I can sort with some external pull up resistors rather than the internal ones I am using at the moment and so I will sort that after I have sorted the inductive load problem.

Any help appreciated.

Andrew

User avatar
Gert van Loo
Posts: 2487
Joined: Tue Aug 02, 2011 7:27 am
Contact: Website

Re: Inductive Load on a Relay

Sat Jan 14, 2017 5:54 pm

I saw a question very close to that and with the same type of relay board.
Have a look here viewtopic.php?f=42&t=170821#p1094996 for where some problems are with that board.
Mainly it is not suited to be driven by 3.3 Volts and best is to modify it.

mfa298
Posts: 1387
Joined: Tue Apr 22, 2014 11:18 am

Re: Inductive Load on a Relay

Sun Jan 15, 2017 12:38 am

With the relays there are a few potential problems,
  1. Are the relays (and hopefully their drivers) designed to work with the Pi's 3v3 logic level (lots are designed to be switched by a 5v logic level)
  2. Do the relay modules have suitably fly back diodes to protect from back emf from the relay coil
For the long leads you may also find some of whats in viewtopic.php?uid=107620&f=28&t=163934&start=0#p1059136 useful reading. There's a potential for doing harm to your pi with switches on the end of long bits of wire.

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

Re: Inductive Load on a Relay

Sun Jan 15, 2017 1:51 am

mfa298 wrote:With the relays there are a few potential problems,
  1. Are the relays (and hopefully their drivers) designed to work with the Pi's 3v3 logic level (lots are designed to be switched by a 5v logic level)
  2. Do the relay modules have suitably fly back diodes to protect from back emf from the relay coil
For the long leads you may also find some of whats in viewtopic.php?uid=107620&f=28&t=163934&start=0#p1059136 useful reading. There's a potential for doing harm to your pi with switches on the end of long bits of wire.
Most relay boards are designed around 5V logic. Usually not a problem to drive 5V logic with 3V3 logic.
All relay board that I have seen have a built in diode protection for the coils.
The OP is concerned about protecting the load circuits.
Unless specified otherwise my response is based on the latest and fully updated RPiOS Buster w/ Desktop OS.

mfa298
Posts: 1387
Joined: Tue Apr 22, 2014 11:18 am

Re: Inductive Load on a Relay

Sun Jan 15, 2017 8:38 am

klricks wrote:
mfa298 wrote:With the relays there are a few potential problems,
  1. Are the relays (and hopefully their drivers) designed to work with the Pi's 3v3 logic level (lots are designed to be switched by a 5v logic level)
  2. Do the relay modules have suitably fly back diodes to protect from back emf from the relay coil
Most relay boards are designed around 5V logic. Usually not a problem to drive 5V logic with 3V3 logic.
All relay board that I have seen have a built in diode protection for the coils.
3v3 driving a relay board expecting 5v is going to be potentially on the edge of working. At that point various factors may make a working system stop working, including ambient temperature, resistance/inductance/capacitance in the connection between pi and relay board (an effect of how the board is connected to the pi - in particular cable length)

AndrewPiB
Posts: 11
Joined: Sun Dec 25, 2016 5:01 pm

Re: Inductive Load on a Relay

Sun Jan 15, 2017 11:24 am

Thanks Everyone,

I think the relays are 5v but my understanding (clearly not as good as it should be), is that the 5V from the Pi to the relay board deals with the coil and the 3.3V from the Pi GPIO is just essentially sending a signal to the circuit. Maybe I am wrong and in fact the 5V is simply powering the relay board and each 3.3V GPIO is actually operating it's respective relay coil. If the latter is the case then I can understand how the 3.3V GPIO (after powering the indicator LED) would not be enough to operate the relay reliably. Would somebody be able to confirm what the 5V and 3.3V actually do? The odd thing is that when I switch scene 4 and ask for all relays to come on, they do. So at maximum power demand from the Pi the relays do operate.

With regards the inductive loads then I am simply going to remove them. The lights are some 10 years old and were from Louis Poulsen, they have wire wound ballasts, 2 pin lampholders and 26W Compact Fluorescent Lamps. I will remove the ballast and put and ES holder in there with an LED lamp. That should solve that one.

I will go and sort the LED's first but then I guess I will need to read up on the link for switches with long wires. I installed the CAT5 and power myself to the garden and at the time I ran them in separate ducts, there are a few places where the wires do cross or come close to each other as they arrive at their respective Fused Connection Units or Scene Select switch.

Thank you

Andrew

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

Re: Inductive Load on a Relay

Sun Jan 15, 2017 12:01 pm

What makes you think a motor isnt an inductive load?
What makes you think an LED light isnt an inductive load?

Please try your circuit with LEDs switched by the relays (not in place of), first on the work bench, then on the wires to the garden.
>)))'><'(((<

AndrewPiB
Posts: 11
Joined: Sun Dec 25, 2016 5:01 pm

Re: Inductive Load on a Relay

Sun Jan 15, 2017 1:07 pm

The water feature motor is indeed an inductive load but is not causing an issue. It switches on and off in any sequence I try with the other lamps and always works. Therefore I can only deduce that the start up circuitry, pf correction and mains filtering on the water feature motor are very good.

The CFL lamps are inductive and worse still the one I have are very old wire wound ballasts using 2 pin G24D lamps. With this in mind the load is inductive, dirty and draws a high starting current.

New LED lamps in comparison to old CFL's are tame as far as electrical circuits are concerned. They operate using electronic drivers and not wire wound and therefore will be far less of a problem. This is backed up by the fact that the lights I already have which are LED cause no issues.

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

Re: Inductive Load on a Relay

Sun Jan 15, 2017 1:52 pm

AndrewPiB wrote:The water feature motor is indeed an inductive load but is not causing an issue. It switches on and off in any sequence I try with the other lamps and always works. Therefore I can only deduce that the start up circuitry, pf correction and mains filtering on the water feature motor are very good.

The CFL lamps are inductive and worse still the one I have are very old wire wound ballasts using 2 pin G24D lamps. With this in mind the load is inductive, dirty and draws a high starting current.

New LED lamps in comparison to old CFL's are tame as far as electrical circuits are concerned. They operate using electronic drivers and not wire wound and therefore will be far less of a problem. This is backed up by the fact that the lights I already have which are LED cause no issues.
OK, good.

You see the problem I have is envisaging a method for the contact side of a relay to affect the coil side. By design and nature it really shouldnt happen. So, a test of the actual relay state, I think, is in order.
If there were spare contacts then I would use those as a tally indicator. If there arent spare contacts then its down to how happy you are with mains and multimeters... If you are confident round mains 'lectrickery (probably are given this thread so far) then check what the relays are doing. If you dont want to prod a live terminal, then wire low wattage lamps (at the relays) in parallel with your garden loads.

My (wild guess) bets are:
The relays work fine, your lamps dont like the supply/switching/cable run.
The relays are only just pulling in and some (vague) somehow an inductive load can push the contacts apart.
>)))'><'(((<

AndrewPiB
Posts: 11
Joined: Sun Dec 25, 2016 5:01 pm

Re: Inductive Load on a Relay

Sun Jan 15, 2017 2:47 pm

Thanks aTao,

I will try the spare relays and I am happy to prod away at live terminals with my multimeter.

Andrew

AndrewPiB
Posts: 11
Joined: Sun Dec 25, 2016 5:01 pm

Re: Inductive Load on a Relay

Sun Jul 16, 2017 5:41 pm

It's been a while but I got around to having a look at this issue again this weekend. First of all I took the pi and relays to the garage, connected a load of CFL lamps to the various relays to try and recreate the problem I was having. Alas I could not recreate the problem. On the plus side that meant that the inductive loads were not causing the relays to bounce or disengage. So what next.....

Well, I took the pi and relays back to the garden and wired everything up again and all was fine until I connected the remote switch in the kitchen. The switch is a 5 button momentary type connected by a Cat 5 cable. So local switching was fine but long distance switching was not. I had read up about using a bounce time bit of code so the pi only sees say the first rise of the switch press and I was about to do that. However I started seeing other posts talk about physical pull-up resistors instead of relying on the internal ones. So, to avoid any more code I quickly plugged some pullup resistors into the circuit and VIOLA !!!

So, I use the internal pull-up resistors in my code for the 5 switches, but I also have 5 No. 10K physical external pull-up resistors which are connected between the 3.3v (pin 1 on my Pi3 ModelB) and each GPIO and switch.

I will write all this up properly soon as it could save someone else a headache.

mfa298
Posts: 1387
Joined: Tue Apr 22, 2014 11:18 am

Re: Inductive Load on a Relay

Wed Jul 19, 2017 9:42 am

AndrewPiB wrote:Well, I took the pi and relays back to the garden and wired everything up again and all was fine until I connected the remote switch in the kitchen. The switch is a 5 button momentary type connected by a Cat 5 cable. So local switching was fine but long distance switching was not. I had read up about using a bounce time bit of code so the pi only sees say the first rise of the switch press and I was about to do that. However I started seeing other posts talk about physical pull-up resistors instead of relying on the internal ones. So, to avoid any more code I quickly plugged some pullup resistors into the circuit and VIOLA !!!
you may also want to have a read through of https://www.raspberrypi.org/forums/view ... 8&t=163934

tl;dr with a longer cable there's a real possibility of damaging the pi's gpio pins.

Return to “Beginners”