Building the sanitizer using the 12v DC motor / Solenoid Valve, input voltage to Motor / Solenoid Valve and MCU is from the same circuit.
Whenever MCU - digital pin D7 triggered, max load is used by the Solenoid Valve / motor and MCU is going into off state, please suggest how to proceed?
Another drawing error: relay coil should connect to 12V, and the diode is reversed.
To fix the problem you might try a diode between 12V and C11/7805 junction. Feed the relay and solenoid direct from the 12V.
Of course, there may be errors in the drawing. However, if the drawing is correct, and D7 is an output that idles low, MCU should run. Setting it high creates a short to ground, which could be what shuts the MCU down.
At this point, the TS needs to submit an accurate schematic.
It was my mistake, Schematic was completely wrong, below find the updated Schematic. The issue is, power to MCU and Solenoid Valve / 12 V DC Motor is from the same source, whenever the D7 is High, Solenoid Valve / 12 V DC Motor starts and MCU goes on offline state.