Relay module effecting Arduino

Dear All,
I have a problem I am stuck with it for over a month.

I have an Arduino mega connected to 4channel relay module as suggested in the diagram below.

I am connected RTC and lcd screen to arduino as well.

I am using 2 separate power adapters one for arduino and one for relays.

JD-VCC jumper is removed so relays should be isolated from arduino.

Relays are connected to 4 x 220v alarm bells. Run for 3 seconds every 45 minutes.

Problem:
Sometime when the alarm turn off, the LCD screen shows weard charactor AND THE ARDUINO STOP WORKING. It seems to be spark problem from the relays but my connection is correct and everything is isolated.

After reset the arduino everything will work fine until another bell.

I hope someone can help me.
Thank you

OptoRelay4X_Wiring.png

1 Like

Shouldn't the Arduino and relay module have common GND connection ? Otherwise there will be no common point of reference as to output levels of the Arduino pins

UKHeliBob
Thanks for replay.
But they does not have common GND.

The GND are NOT connected between them at all.
This is why I am confused.

Edit
Even I checked GND with avometer. They are not connected

The GND are NOT connected between them at all.

Whilst I freely admit that I know little or nothing about relay modules I don't see how it could work without a common GND connection.

Someone will no doubt be along to explain it soon.

It was connected before.
But I faced this problem since day one, I google it and most posts suggested to separate the power supply and use jd-vcc.
And remove the GND between them.
It helped but not all the time.

To explain how it is working without the GND between them. The relay module has optocoupler which needs vcc and ground only.
The vcc is connected to arduino and GND is the output pin from arduino. See attachment file.

Greetings,

Newbie here as well I am only speaking up because I had similar problems with relays.

Looking at the picture of the relay PCB it uses the same ground for both the Optocoupler and the transistors, right? So you will need to connect the ground to the Arduino else the 5v from the Arduino is not referenced to the same delta voltage. Which means the noise could get worse as the two grounds float.

If i were to redesign that board to completely isolate. I would have a jumper for GND as well so the opto-coupler is completely isolating the circuits power and ground rails.

I really imagine the VCC jumper and optocouplers are just there because the standard UNO voltage regulator the AMS1117 chip really cant pull that much so 4 relays plus other gadgets can over load it pretty quickly so its to get more power not to isolate noise.

Grumpy Mike Cook's guide to noise helped me ton on my spindle. (De-coupling)

I would connect the grounds and a filter cap between the GND and VCC (Arduino) the filter caps helped me a ton I even didn't have a optocoupler and separate power rail for the relay.

Also if you have any buttons that are using the internal pull-up resistors they could be triggering from the noise causing weird results to your code.

Relay ground should NOT be connected to Arduino ground.
Sharing grounds or JD/VCC will defeat opto isolation.
Ground is not functional here, because the opto LEDs are connected between IN and VCC.

ammaralroz:
Sometime when the alarm turn off, the LCD screen shows weard charactor AND THE ARDUINO STOP WORKING. It seems to be spark problem from the relays but my connection is correct and everything is isolated.

Common problem when you switch inductive loads.
You need snubber circuits across the relay contacts (or across the loads).

Also make sure the mains wiring does not run close to the Arduino wiring.
Leo..

Hi,
If you remove the alarm bells, does the problem occur?

Have you got the 220Vac wiring and alarm bells AWAY from the controller and its wiring?

Thanks.. Tom.. :slight_smile:

UKHeliBob:
Shouldn't the Arduino and relay module have common GND connection?

Absolutely not.
OptoRelay4X_Wiring.png

UKHeliBob:
Otherwise there will be no common point of reference as to output levels of the Arduino pins

Did you not see the connection to the 5 V "VCC" as a "common point of reference"?

UKHeliBob:
Whilst I freely admit that I know little or nothing about relay modules I don't see how it could work without a common GND connection.

Someone will no doubt be along to explain it soon.

Happily!

Here is the schematic:

Note that ground has nothing whatsoever to do with the input side of the opto-coupler.

Interesting.
First Thank you all for your replays.

LucidWolf:

I really imagine the VCC jumper and optocouplers are just there because the standard UNO voltage regulator the AMS1117 chip really cant pull that much so 4 relays plus other gadgets can over load it pretty quickly so its to get more power not to isolate noise.

Yes, it is true, also because some relays are 9v/12v so the board designed to work for all kind of relays voltage with same relays size nad number of relays pin.

filter cap

Do you mean something like "snubber circuits"?

Also if you have any buttons that are using the internal pull-up resistors they could be triggering from the noise causing weird results to your code.

I have switch using internal pull-up resister.

Wawa:

Common problem when you switch inductive loads.
You need snubber circuits across the relay contacts (or across the loads).

I will read more about it until I can get the component and know how to connect them.

TomGeorge:

If you remove the alarm bells, does the problem occur?

No, it will work fine.

Have you got the 220Vac wiring and alarm bells AWAY from the controller and its wiring?

the alarm bells are far away.
the relays are next to the arduino.
220Vac cables are not crossing arduino at all.

Paul__B

Yes separate the ground and put another power supply reduced the problem but does not eliminate it.

My next step tomorrow from your suggestion and from another post.
I will move all 220VAC wires and the relays to another box.
I will make sure both boxes are grounded.
I will connect diode to relays input as well as relays (maybe useless step but I will test it.)

If it didn't work I will:
add filter caps or nubber circuits.
And connect Ferrite.

I will keep you posted
Thank you so much

Dear All

My next step tomorrow from your suggestion and from another post.
I will move all 220VAC wires and the relays to another box.
I will make sure both boxes are grounded.
I will connect diode to relays input as well as relays (maybe useless step but I will test it.)

I did it all. Nothing helped.
But when I added ferrite it didn't hang for 3 alarms. I will monitor the problem tomorrow to double check.

I will add order and add nubber circuits as suggested, it should be on the load side???

Greetings,

Sorry didn't see the schematic. Thought i saw a fat trace from IN4 Led to GND and though it was using ground. But that was very wrong and i apologize.

I am following because I haven't found that successful thread on these forums for someone complaining about relays and A/C without it just being the power supply or the board. I did find a few old ones but my Google-Fu might be the issue. Hoping to live vicariously through you before my next project.

Did you buy the relay kit from a reputable source? I saw you checked for current leaks and isolation. The cheapo ones i have put traces all around the "high" relay switched side which is asking for EMF and safety issues if I used it for AC.

Probably not A/C safe based on trace width/seperation but i think its for learning... speaking of learning.
I have learned to trust nothing from the usual discount sources. Most of my issues are because i am buying inferior product and getting an electronics lesson out of it as the QA department... Out of the 3 relay kits I bought only 1 worked without much issue. When I checked them with my multi meter various parts were not working. I am only switching DC (scary non-isolated DC ~ 15v) but DC. But that required a lot of filtering for some reason.

Quote
filter cap
Do you mean something like "snubber circuits"?

I guess but without the resistor? A filter capacitor for like in this guide.
De-coupling
I just remember way back in physics class when we used a capacitor to filter they called it a filter cap.

I would expect you would want it as close to the Arduino as you can based on the guide and it makes sense to me since you want the filter as close as can be since traces and wires are probably little antennas.
If you add caps to the signal lines there will be a slight delay since you will be charging/uncharging the capacitor before the signal can go high but for switching a relay (slow) it shouldn't be an issue even if you double it up more than a typical signal one. See Protection

I am only switching non-isolated DC current and even then:
1.) I needed a (100pF) capacitor on the signal line near the Arduino to stop the RF interference from the relay and all the noisy things that line is picking up being around inside my box. (Guess my wire is an EM antenna.)
2.) I put a capacitor on the relay board between the Vcc and Gnd to deal with voltage drops since my little Nano is powering the relay and its probably surging the AMS1117. (I was well within specs... but my nano doesn't have an output cap on the regulator.)
3.) I also added a smaller cap across my replaced diode (surface one seemed faulty) (THT 1N4001) since they say a little cap can help give the diode time to turn on and soak the initial fly-back current from the relay if its a slow rectifying diode. I was going to add another cap at my board but i powered it up and it worked so I carefully backed away and let it do its thing.

Note: All of these terms are very new to me so I am probably using them wrong as well. Or i just added capacitors to where i didn't so they are just decorations. Without good fundamentals and no signal understanding (no scope) I am probably just decorating. :o

But it looks pretty to me and it started working. :wink:

I also read that for AC you need a properly rated MOV to help ease the disconnect.
Maybe someone could recommend a good 220V one.

This was from the 1 success i saw about 9 years ago.

There might be more successes but they don't respond or I am terrible at searching.

Sorry for the book worth of text but I want to see you succeed and tell me what you did so I can bundle it into my own relay board... for it to not work for me. :smiley:

Not sure what all the fuss is about.
If you switch inductive loads with electronics, then you need to take care of the kickback when you switch it off.
A simple diode across the load won't work for AC, so a snubber circuit (mains rated capacitor with safety resistor in series) must be used. A MOV (VDR) rated for your mains voltage could also work.
I guess it works best close to the source of the problem (across the load), but across the switch also works.
Leo..

Wawa:
I guess it works best close to the source of the problem (across the load), but across the switch also works.

Common misunderstanding there!

The source of the problem is not the load.

The problem - the transient - is generated by the switch. Ergo, that is the appropriate place to deal with it.

The only thing that helped a little is Ferrite, but I still have the problem.

Did you buy the relay kit from a reputable source?

I use this one which is commonly use.

Probably not A/C safe based on trace width/seperation but i think its for learning... speaking of learning.
I have learned to trust nothing from the usual discount sources. Most of my issues are because i am buying inferior product and getting an electronics lesson out of it as the QA department... Out of the 3 relay kits I bought only 1 worked without much issue.

I believe it is safer for AC to use this type of relays

I agree with you, but most of my resources from the internet so it is not easy to make sure about the quality until I receive the item which takes 30-40 days :cry: :cry: :cry: :cry:

Also, I don't have scope as well.

Sorry for the book worth of text but I want to see you succeed and tell me what you did so I can bundle it into my own relay board... for it to not work for me. :smiley:

I appreciate that, and I will post the answer here.

so a snubber circuit (mains rated capacitor with safety resistor in series)

I believe you are right that is why I have ordered 8 pcs and I am waitting for delivery.
I think this is the best solution. and a little expiraments won't hurt.

I know it is more expense, but maybe an SSR will overcome the problem.

I have been switching a 240V 10 Amp AC load through an SSR. The ProMini is right next to it and it not affected.

Here is one on the bay:-

https://www.ebay.co.uk/itm/New-Solid-State-Relay-Module-SSR-25DA-25A-250V-3-32V-DC-Input-24-380VAC-Output/291959302108?ssPageName=STRK%3AMEBIDX%3AIT&_trksid=p2057872.m2749.l2649

Steve

Dear All
Solution:
snubber circuit

It is working fine now. Little noise in some alarms but at least it is working.
I post the solution for anyone need it in the future and for all people helped me

Thank you all

2 Likes