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

Re: induction problem gpio relay load

Wed Oct 18, 2017 4:05 pm

Grenello wrote:
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.
It's not a matter of turning on or off the relay itself. afaik all those relay boards have the embedded diode for this part of the problem.
The real problem it turning on or off the load itself.
If you have feedback turning off the load, you need (NEED) to put a proper capacitor accross relay connectors (load side!)

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

Re: induction problem gpio relay load

Wed Oct 18, 2017 5:20 pm

Tune an old-fashioned AM radio to a frequency between 530 and 1600 kHz where there is no station. Put it near the relay board. Does it output a click (or a 'splat') when the relay turns off the load?
Quis custodiet ipsos custodes?

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

Re: induction problem gpio relay load

Fri Oct 20, 2017 5:17 am

Thank you for your responses.

I will locate an AM radio and do that test a bit later today.

Could you suggest a cap value for the load side - Its a 24v DC circuit running to a solenoid for garden sprinklers.

Please find picture of circuit attached for info and also for any suggestions for improvement.

FYI, bread board holds circuit for momentary switches - RC circuit and Inverted Schmidt trigger to remove switch bounce.

Thank you. I feel I am getting close to a solution for a problem that has plagued me for over a year!
Relay.jpg
Relay.jpg (116.25 KiB) Viewed 2491 times
MB.jpg
MB.jpg (103.47 KiB) Viewed 2491 times

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

Re: induction problem gpio relay load

Fri Oct 20, 2017 11:29 am

You are not helping yourself by having that ribbon cable on the GPIO header routed over the relay board.
Quis custodiet ipsos custodes?

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

Re: induction problem gpio relay load

Fri Oct 20, 2017 11:47 am

drgeoff wrote:
Fri Oct 20, 2017 11:29 am
You are not helping yourself by having that ribbon cable on the GPIO header routed over the relay board.
:lol: :lol:

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

Re: induction problem gpio relay load

Fri Oct 20, 2017 1:04 pm

Since the soleniods are running on DC, you can also use a reverse parallel diode across the soleniod. Mount it as close to the soleniod as possible. Try this before putting a capacitor across the relay contacts.

Diode: 1N4001 should do, others in that series also suitable.
Capacitor: Try 0.1μF or 0.47μF (my guesstimate), ensure they are at least 50V types.
Location: 345th cell on the right of the 210th row of L2 cache

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

Fri Oct 20, 2017 4:51 pm

Forgive me for being dense, but it appears to me that the power to the solenoids (black and white wires, left hand side of thr Relay.jpg picture) is coming directly from a transformer.
If so, then it's AC, not DC.

Maybe you could tidy up the wiring round the breadboard, as well as moving the ribbon away from the relays. Cotton thread can be useful for tying wires together.

Other than that, my first impression was that it was remarkably tidy - far better than many rats' nests you see.

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

Re: induction problem gpio relay load

Fri Oct 20, 2017 7:36 pm

Burngate wrote:
Fri Oct 20, 2017 4:51 pm
Forgive me for being dense, but it appears to me that the power to the solenoids (black and white wires, left hand side of thr Relay.jpg picture) is coming directly from a transformer.
If so, then it's AC, not DC.
Hmm, I didn't notice that.
It would be well to check -- do not use diodes across solenoids fed with AC!
If it is AC you need to be very careful, since a capacitor effectively lets AC through. I don't know a good solution, possibly a pair of inverse series Zener diodes acroos the solenoid coil to clamp the EMF a little above the peak supply voltage.
If the solenoids will work with DC, you may be able to rectify the AC supply and add a smoothing capacitor, switch the DC through the relay contacts and use diodes across the solenoids.
Location: 345th cell on the right of the 210th row of L2 cache

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

Re: induction problem gpio relay load

Fri Oct 20, 2017 7:43 pm

davidcoton wrote:
Fri Oct 20, 2017 7:36 pm
Burngate wrote:
Fri Oct 20, 2017 4:51 pm
Forgive me for being dense, but it appears to me that the power to the solenoids (black and white wires, left hand side of thr Relay.jpg picture) is coming directly from a transformer.
If so, then it's AC, not DC.
Hmm, I didn't notice that.
It would be well to check -- do not use diodes across solenoids fed with AC!
If it is AC you need to be very careful, since a capacitor effectively lets AC through. I don't know a good solution, possibly a pair of inverse series Zener diodes acroos the solenoid coil to clamp the EMF a little above the peak supply voltage.
If the solenoids will work with DC, you may be able to rectify the AC supply and add a smoothing capacitor, switch the DC through the relay contacts and use diodes across the solenoids.
You need quite a big (in the electrical sense) capacitor to let much current through at mains frequency. At 60 Hz a 0.47uF capacitor has a reactance of 5.6k. At 24 volts that means less than 5 mA.
Quis custodiet ipsos custodes?

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

Re: induction problem gpio relay load

Fri Oct 20, 2017 8:40 pm

Thanks, drgeoff. With that calculation my original capacitor recommendation for DC will also work for AC. The same could also be used across the solenoid coil. The voltage rating is even more important with AC than DC, since the AC peak is 1.4 times the normally quoted RMS value. Note that protection across the coil is more effective at suppressing interference, a capacitor across the relay contacts is mainly intended to prolong contact life by suppressing arcing but still leaves a large current loop to radiate interference.
Location: 345th cell on the right of the 210th row of L2 cache

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

Re: induction problem gpio relay load

Sat Oct 21, 2017 5:36 am

:o I feel so stupid. I put it in so long ago that I forgot it was 24v AC. Sorry for leading you astray.

The problem still remains and this probably complicates the solution as mentioned above. Given my limited electronics skill and experience I don’t want to guess, so again your continued help in solving this is appreciated.

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

Sat Oct 21, 2017 5:35 pm

Grenello wrote:
Sat Oct 21, 2017 5:36 am
:o I feel so stupid. I put it in so long ago that I forgot ...
Many years ago, I built my HiFi system. Over the years, I've altered it, added stuff, changed bits ...
Each time I come to it, I've forgotten what I did last time. So I go looking for the paperwork ... can't find it ... tear it apart to draw a new set of diagrams ... "why on earth did I do that last time - it makes no sense!" ... "oh, yes, of course" ... days later, "Now what was it I was going to do? I'm sure it would have been a good idea, if only I could remember!"
So if you're stupid, you're in good company.

Is there a reason for the network bits to be under the relay outputs? Could you swap them with the 24v transformer, so that everything to do with the Pi is away from the high-current stuff? Or at least move it to the left-hand side of the panel?

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

Re: induction problem gpio relay load

Thu Oct 26, 2017 5:17 am

Just an update to my problem.

I tried putting in a snubber circuit but nearly burnt my house down as the resistor got so hot and burnt out - I think I wasn't using the right type of resistor. So I've abandoned that plan for now, but plan on returning to it later.

I purchased a 5v Solid State Relay and replaced the contact relay with this. Bingo! Everything worked brilliantly; My switch debounce circuits worked, I was able to remove all the "sleep" commands in the code, and the interrupts fired every time. The only challenge was to lift the 3.3v from the RPi to the 4.2V needed to fire the relays. I built a set of switches using an optocoupler and some resistors which worked really well (It took me a while to trust the maths used to calculate the low side R). I also tried a PNP / NPN switch which also worked well. Both expensive and finicky solutions. For the long terms I plan on putting in a level shifter.

So now that the solution is working well, the next plan is to tidy up the board, move some components around as per advice in this forum, and then watch my garden grow!

Final picture to be posted here once the job is done over the weekend.

Thanks to everyone for their help and input.

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

Re: induction problem gpio relay load

Tue May 22, 2018 1:02 am

Hello,

I noticed the relay board you use does not have an optoisolator chip. That chip keeps the relay circuit separate from the driver circuit.
Buy a board that has the 4-pin opto chip. You're probably getting feedback from the relay circuit into the driver circuit.

Return to “Troubleshooting”