I will ensure you from the start that I have more than 6 months of googling and tweaking this problem in order to find a fix, but in the end, I have to ask for help.
The system:
I have designed a PCB from scratch to control 3Phase AC pumps for the irrigation systems. Do not think of something complicated with 3phase speed control and things like that no...is very basic but has created me so many problems.
How it works:
Atmega328 activates a relay which closes the circuit of 24V AC for a CONTACTOR, and this contactor closes the 3phase circuit and starts the motor at full speed... and this how must be. In total are 8 relays and 8 contactors (1 is the 3phase ac, the rest of them are high-pressure solenoids)
the circuit: [Simplified]
The problem:
At first, the chip gets reset itself by any turn-on of any contactor from the circuit, and I had added snubber circuits everywhere and also on the contactors and seams this problem is solved like 90 % (some times get reset...but not every time...and I had code if it got to start again. so not big of a deal.
The clip is working on Internal 8mhz crystal (because I was afraid of higher frequencies that might get noticed more easily but I don't know at this point)
The new problem:
The system starts the timer is on the screen (LCD 2004 i2c) and some times randomly ....it FREEZE...the chip freeze with all his ports "Active" means...that my pump it will run all the night until morning where I had to manually reset the board....in order to "revive the chip"...
I have refactored the code in a way to have only a timer and that's it (no menu, nothing...the chip still gets randomly) ....the noise from this motor I think is the cause...but I have a bord made by someone with an Arduino pro mini......a relay and screen and NEVER got this problem (and I have 2 years since I am using that bord....) and it didn't have all my "high noise filters" and still works ... Maybe is from atmega328PB... maybe code...
I really don't know...
Thank you for your time, George.