EMI resets atmega on switching ON relay with inductive load like a 230v fan I am making an automation device. I am using an atmega8a to control 6 relays. The setup is standard, 220v load, 5v dc coil, flyback diode and an NPN transistor to trigger with atmega pin. The problem is when I turn ON the relay, there is 10-20 MHz noise on the DC side and the atmega restarts. Switching OFF relays doesn't create a problem. i am guessing this is happening because of EMI. Is there a way i can protect my atmega from this and not have it restart everytime I start a relay.
The SMPS is 5v 2A
I have star tracks from SMPS
Is there a way to solve this?
Update: Had to switch from atmega chip to arduino nano. That seems to be working fine.
This can also be a power shortage as there will be a drop when the relays turn on, depending on you psu it might not respond quick enough, so you get a brown out. I added a bit 4700uF cap on the psu power line to the arduino.