Just to add to what others said.
1. lot of decoupling caps. on the chips, on the relays, power entry points on the PCB.
2. don't forget snubber diodes on the relays (and decoupling caps)
3. Use a regulated power supply.
4. Is your project in a case? Is the case grounded? I had a project randomly freezing usually after being left alone, and then I go fiddle with the rotary encoder. Grounding the case fixed the random lockups.
I get random freezes, when i switch a relay that is turning on a 230Volt pump.
Crash could be caused voltage spikes, ESD, and the like.
I would look into adding power line suppression capacitors, I think your pump is generating lots of spikes/noise during turn on. http://www.okaya.com/products/noise-surge/capacitors/capacitors-faq
What are the common uses for these capacitors?
The most common use for X & Y capacitors is in EMI/RFI filtering applications where they are directly connected to the AC Power line. These types of capacitors may also be used to suppress electrical noise generated by motors, inverters and electronic ballasts. They are also used in solid state relay snubbers and spark quenchers for suppression of inductive transients.