And a regulator for your logic/analog/digital circuits. Do not connect anything directly on +12V. Instead use lower Vcc for analog or digital about 8-9 Volts and 5 or 3.3 for the controller. So a regulator with large enough capacitors will almost eliminate your problems along with the other suggestions by Al and erice1984.

I once (and more inexperienced in electronics) had a major problem with C-MOS used as an alarm in my dad's car. Every time the alarm was triggered, the horn was generating so much electrcal noise that reset all circuits. A 7808 saved the alarm from the trash.

Ioannis