Trouble with electrical spikes shutting off the chip. Atmega and ATTINY.

I am looking for an electrical filter that will consume the voltage spikes of AC. Have several motors, and contactors that stop and start. I need clean AC power, then I can clea up the DC power. How do I clean up the AC power? I am more interested in the components that I would need to clean up the power, control the voltage spikes from the AC contactors and the motors magnetic fields colappsing.

Check out this website :

Do you know that the spikes are getting in through the AC power, as opposed to picking up EMI? Ie, does the problem still occur when the electronics are kept in a grounded metal box?

Also - do you have proper decoupling caps (0.1uf ceramic cap between vcc and ground, right next to the chip, one per Vcc/AVcc pin if the chip has multiple power pins? These are necessary for reliable operation in general (though designs that omit them sometimes work in some conditions, leading to people frequently thinking they're unneeded - and this is why they're missing from so many tutorials), but are even more important when EMI or noise on the power rails is an issue.