atmega328PB reset itself or stuck

Hi guys,

I am new here, but I have a long Go in what electronics means and I always hardcore google to find answers for my problems but I finally hit a wall and decide to ask you.

I have design a PCB that has to control some CONTACTORS to turn on the 3 phase AC motors that will spin the water pumps to irrigate the grass.
The problem with this PCB is that the uC reset itself when a contactor engage or disengage (more often then you will want in any APPLICATION)
How I said before... I am new here because I hate to stress people with my problems ...so I google it...and google...

After a lot of research, I have added a Snubber Circuit across each relay to suppress the sparks across the contacts of the relay...and it works...some how...now we drastically reduce the "resets" to a few ..once in a while, which isn't that bad... So I was thinking that ok...is done...no more resets... but how wrong I was.

This time we tried to use this bord in an industrial vacuum cleaner in a big encloser. The encloser (1.75m tall and 0.8m width).
Also inside we have:
*3 phase ac circuit breaker,
*3 phase 24 V AC contactor

  • the bord.
    I have simplified the schematic of the system to set focus on the problem. Here is the schematics:

easyeda.com/george.zanfir/the-problem

For the rest of the applications where the bord is like ...10-15 meters away from motors, EVERYTHING ..works PERFECTLY, not a single reboot or stupid errors...
But now when we press the button the contactor click...and BOOM reset...sometimes you have to press like 10-20 times for one start(if you are lucky)...
IN the left-down corner there are two ways which I used to power the board....with transformer and full bridge rectifier ... or with an isolated (commercial ) power supply (also the contactor was changed from AC to DC with the according to the power supply)...

The "urgent" solution that I found (because my client was nervous) was to connect across each ac wire in the contactor, a capacitor of 2.2uF...AND IT WORKS ...but ...THIS is not a solution....because the old board that we simply bought from the store (but was not what we need...so as engineers we build our own ) works and take care of all those....but ours...simply reset or sometimes something stupid...like not reading the buttons, the LCD crash, etc.

If you have time to have a look I tried to make the schematic simple and self-explanatory to not lose your time to understand, only in debug the problem...

In a highly electrically-noisy industrial environment you have to apply all the techniques of interference-prevention, full shielding for all boards and cables and connectors, snubbing, protection circuits on every input and output, opto-coupling between modules, the works basically.

Hi, thank you for your response. Could you tell me how I should apply all of those tehnics?