The GND are NOT connected between them at all.
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.
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
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.
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.
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.
Common problem when you switch inductive loads.You need snubber circuits across the relay contacts (or across the loads).
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?
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.)
Quotefilter capDo you mean something like "snubber circuits"?
I guess it works best close to the source of the problem (across the load), but across the switch also works.
Did you buy the relay kit from a reputable source?
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.
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.
so a snubber circuit (mains rated capacitor with safety resistor in series)