Computer controlled relays buggy when lights are plugged in

Thread Starter

mxabeles

Joined Apr 25, 2009
229
Howdy all! New year, new glitches :) All is well, tis life. I have x2 8 relay modules hooked up to an Arduino Mega. I'm using MaxMSP software to control the board. The relay modules have their own separate 5v supply.

The issue: I can strobe a relay very quickly for over 3 minutes without a light attached to the relay. Once I attach a light (120 V 20W T5 LED tubes) to the relay, the communication stops after 20 seconds, and then maybe comes back to life after 30 seconds. The relay contacts close at logic level low, and Ive noticed the lights are always on when stuck. I've been working with relays, Arduino and MaxMSP for well over a decade and this one is just a head scratcher.

I thought that powering the Arduino from a wall wart and then plugging into USB might help, but doesn't seem to. I'll keep sniffing around, meanwhile any help would be greatly appreciated.
 

DickCappels

Joined Aug 21, 2008
8,714
The diagram should help. Where is the logic low? Is there voltage across the relay's coil when it is stuck? Sometimes relay contacts get damaged or just plain worn out and need to be replaced.

If there is no voltage across the coil and the contacts are stuck closed until tapped or banged on replacing the relay is probably indicated.
 

Ya’akov

Joined Jan 27, 2019
5,683
As @DickCappels said, there is a good chance the relay(s) are sticking. Without more information and forced to guess at a cause, I would say the contacts are welding on, but not enough to hold against the spring indefinitely. I certainly concur with his suggestions .of testing to see if there is voltage across the relay’s coil when it is suck on, and trying some percussive maintenance, that is judiciously tapping on the relay with something like the handle of a small screwdriver (it is generally best to keep the force involved below the breaking point of the housing and circuit board, which, at some levels of frustration is easy to overestimate.)
 

Thread Starter

mxabeles

Joined Apr 25, 2009
229
Thank you all so much. Will post connection diagram later, running to dentist at the moment. You are all rockstars!
 

ElectricSpidey

Joined Dec 2, 2017
2,146
My first thought was contact welding, but the OP said "the communication stops after 20 seconds" so I had to assume they were checking the output from the uC.

At that point I decided not to post any suggestions because I have tried to help others with these kinds of issues with no luck.
 

Thread Starter

mxabeles

Joined Apr 25, 2009
229
here is the birdseye view of how everything is connects (the arduino will be in a separate enclosure from the relay outlet box, connected by dsub 25 pin cable)16ch_sch2.jpeg
 

Thread Starter

mxabeles

Joined Apr 25, 2009
229
here are photos of the project. Arduino has yet to be contained. Maybe one issue is the hair brained attempt at shielding data lines in the relay box? The leads from the DSUB have been wrapped in aluminum tape and then wrapped again in electrical tape.
 

Attachments

Thread Starter

mxabeles

Joined Apr 25, 2009
229
some final notes for now: I have made this project, working just fine - with a single 8x 5v relay board back in 2019 (I did not do any shielding, had arduino lying in same small box as nest of 120v cabling). Secondly, when a light sticks with this setup, other lights are working alongside. I feel if the reset of the Arduino was tripped by EMI, every single light would stick, not just an errant light in the array. Lastly, I have tested the relays under hard strobing with no lights attached and there is no timing issue or sticking. Wouldn't this mean that the relays are not the issue?

I will do some tests in the meantime - uploading blink code to arduino and testing the circuit without MaxMSP software, testing MaxMSP software without relays and just LED. Isolating the issue, hopefully.

Part of me has the mind to rip all the modules out and just role my own "module" using x2 ULN2803 transistor arrays w/ x16 solitary relays. The outlets will be connected to relay's N.O. contact, and I will know that entire in & out of circuit. Hopefully I don't have to go that length . . .

Again, thanks for all your help.
 
Last edited:
Is your Arduino ground tied to the relay board ground? If I understand things correctly you are using separate power supplies for each. Your schematic does not show the grounds tied together. It has caused frustration here a few times.
 

Thread Starter

mxabeles

Joined Apr 25, 2009
229
Is your Arduino ground tied to the relay board ground? If I understand things correctly you are using separate power supplies for each. Your schematic does not show the grounds tied together. It has caused frustration here a few times.
Hey there, thanks for the reply. It is not - but it was previously when things were acting up. It seems to make little difference either way, although I find it odd that this circuit does not require Arduino GND to be tied to circuit.
 
Hey there, thanks for the reply. It is not - but it was previously when things were acting up. It seems to make little difference either way, although I find it odd that this circuit does not require Arduino GND to be tied to circuit.
I had a similar problem with a PIC that turns on and off an old ATX power supply that runs a PI and gets used as a bench power supply. It wouldn't reset, but every time I turned on or off my work lights it caused enough of a something to make the PIC turn off the supply. The lights are even on a separate branch off my breaker box which really had me confused.
The. PIC runs off the constant USB power. Luckily I could just change a counter and make it work. Hopefully you find an answer.
 

Thread Starter

mxabeles

Joined Apr 25, 2009
229
I had a similar problem with a PIC that turns on and off an old ATX power supply that runs a PI and gets used as a bench power supply. It wouldn't reset, but every time I turned on or off my work lights it caused enough of a something to make the PIC turn off the supply. The lights are even on a separate branch off my breaker box which really had me confused.
The. PIC runs off the constant USB power. Luckily I could just change a counter and make it work. Hopefully you find an answer.
thanks, geekoftheweek. I'm gonna run tests over the weekend and report back. Since the circuit itself is so plain and simple (I have to drudge up zero components lol), one factor will be the wires chosen - very thin gauge store bought female<>male jumpers have been known to be [not good]. replacing those and soldering directing to male pins on relay module with industry standard 20 gauge hookup wire might just save the day. We'll see...

Moderator's note rough language removed and [not good] substituted.
 

drjohsmith

Joined Dec 13, 2021
401
thanks, geekoftheweek. I'm gonna run tests over the weekend and report back. Since the circuit itself is so plain and simple (I have to drudge up zero components lol), one factor will be the wires chosen - very thin gauge store bought female<>male jumpers have been known to be [not good]. replacing those and soldering directing to male pins on relay module with industry standard 20 gauge hookup wire might just save the day. We'll see...

Moderator's note rough language removed and [not good] substituted.

A few things,
if your switching the contacts "fast"
what is the life of the contacts / relay ?

The relay board,
does it have isolated digital inputs ? Opto ? or is it direct digital

Either way
the digital output of the Arduino, needs a ground return,
so there needs to be a ground between the Arduino and the relay board.
if its not an actual wire, then your grounding via the wall wart / USB ground !
current has to flow out of the Arduino, through the relay control , an back to the Arduino,


Check is the arduino mega able to provide the current the relay board needs ?

My bet is its ground current flow, voltage spikes caused by the load switching,
and depending when this happens , depends what the arduno code is happy or not,

When you have no current it seems to work,
try a smaller load, see if this works , it might give you a clue
 

Thread Starter

mxabeles

Joined Apr 25, 2009
229
A few things,
if your switching the contacts "fast"
what is the life of the contacts / relay ?

The relay board,
does it have isolated digital inputs ? Opto ? or is it direct digital

Either way
the digital output of the Arduino, needs a ground return,
so there needs to be a ground between the Arduino and the relay board.
if its not an actual wire, then your grounding via the wall wart / USB ground !
current has to flow out of the Arduino, through the relay control , an back to the Arduino,


Check is the arduino mega able to provide the current the relay board needs ?

My bet is its ground current flow, voltage spikes caused by the load switching,
and depending when this happens , depends what the arduno code is happy or not,

When you have no current it seems to work,
try a smaller load, see if this works , it might give you a clue
Thanks so much, Dr. John. I think I do need to rewire it without all the messy homebrew shielding? Because I did the same project with only one relay module and I've never run into this problem - and the 120v loads I was switching were of higher wattage!
 

Thread Starter

mxabeles

Joined Apr 25, 2009
229
Hello all . . . update: I tested strobing lights on/off at 25ms for 2>min using a blink sketch w/ Arduino IDE. Unfortunately in a way, there was no issue. I will try again today, but what this means is that it's possibly a glitch with how MaxMSP is communicating over serial to the Arduino. Again, new problem for me as I've been using this methodology for over a decade - but, we shall see.
 
Top