Hello i just made a mcu driver dimmer with a tiny13 and to avoid the transformer and MOC optocoupler i designed the power supply with a capacitor and zener.
The problem is about the triac firing pulse,and when
1)The load is connected to A2 the triac responds only to positive gate voltage,if 5V applied the lamp then lights up but it flickers.
2)When load is connected to A1 giving positive 5v or ground to gate the lamp always lights up without flickering but mcu does nothing since gate is biased through clamp diodes.
Without triac mcu works fine reading the potensiometer value and varies the firing pulse length.
I got a mess,i made PCB also and if i knew this at first i would put the MOC and who cares about the cost.