Arduino based triac dimmer bulb flicker fix on touching Arduino ground
Is that a coil, connected to ATmega's D3 pin?!
Why is there this 0.1 uF capacitor at MOC3021 input?
This coil and the 0.1 uF capacitor make a LC circuit, that delays the moment when the optocoupler conducts, and so it delays the moment when the TRIAC will light the bulb.
Even if it is just a 470 ohm resistor, this resistor delays the charging of 0.1 capacitor, and that delays the triggering of the TRIAC, too. The value of 470 ohm for this resistor could be reduced, too.
Take this 0.1 uF capacitor out of optocoupler's input, and use a resistor with the valua about 220 ohm or 330 ohm for connecting ATMega's D3 pin to MOC3021 input, and everything will be ok.