sorry for mistake this is my diagram (#22)
Now let us make it a bit better.
(1) As it was pointed out, you may like increasing the 1K (in series with the 12V LED) to save current. Now it is about 10mA. For 2K2, it will be about 4.5 mA... and so on. But this is not important.
(2) If your 12V is rather fixed and 7805 needs at most 7V to give 5V, we have 5V in excess that will heat the regulator. I use to add a resistor (Rs) between the regulator input and the supply 12V. To know the value of Rs, we need to know the maximum current (Is_max) that the regulator should supply (at 5V).
Rs (Kohm) =< ( 12V - 7V ) / ( Is_max + 5mA)
Ps_max = ( 12V - 7V ) * ( Is_max + 5mA)
In this case Rs will let 7805 dissipate less power.
And in case there is a short at the regulator input or output or it is defective, the highest current limited by Rs would be:
Is_short (mA) = 12V / Rs (Kohm)
Ps_short / Ps_max = [ 12V / ( 12V - 7V ) ] ^ 2 = 5.76 times
From the ratio 5.76, the resistor could be chosen to work fine for Ps_max and to burn for 5.76*Ps_max hence acting like a fuse to protect mainly the PCB tracks.
(3) Now it is important adding a capacitor (Cp) between ground (DC minus) and the node joining Rs and 7805 input. Its value should be relatively low to insure a fast rising at the 5V output which is necessary to reset properly the MCU at boot.
A typical value for Rs * Cp is 0.01 second (it is just a starting point since it is not critical).
(4) To ensure the stability of the regulator, I usually add at its output (and ground) two capacitors:
C1 = 100nF (low grade as ceramic is ok)
C2 = 2.2uF to 10uF
In any case, Cp > C2 to avoid a reverse polarity on the regulator when the power is off. If the discharge rate of C2 should be lower than Cp, a protecting diode from output to input of 7805 will protect it.
Note:
To measure Is_max, you can place (as a test) Rs=10 Ohm and measure its voltage (Vs) when the circuit is active.
Is (mA) = Vs / 0.01
Finally, I hope you can find a relay in which its DC and AC sides are better isolated/seperated (surely not like the one you posted earlier).
And adding the R+C (like 500mW 150R, and 10n/630V) at the relay AC terminals will eliminate the spikes that reset your MCU.
Kerim