I added le pic control label ( the pic isn't directely connected to the gate. it is connected to ctrl_triac .
But unfortunately, I think my design wouldn't work.
I tried to build it, but R1 burned out each time (tried 2 times, second time with 2W resistors :'( ).
I should use a transformer to reduce the AC voltage to an acceptable level,
but I wanted to keep the circuit as simple and robust as possible because the forced triac operation can serve as a safety feature if the microcontroller is blocked or dead
Hello,
The gate is supposed to be driven with respect to the other main terminal, the one closest to the gate in the drawing of the triac. Your drawing seems to show it being driven with respect to the wrong main terminal. That would put a lot of power in R1 or else blow out the triac. You should test the triac to make sure it still turns on properly, and off properly.
The following circuit may work better as long as you have all your resistor values correctly calculated.
Notice now that resistor R1 now connects between the gate (through R2) and the other main terminal when the switch is on. The gate is marked with a "G". To turn on the triac, you energize the gate G with respect to the main terminal on the bottom of that triac shown in the new drawing.
You also have to be careful how you connect the microcontroller to the circuit as shown. When the switch is turned on there may be a conflict because the uC pin that connects to the switch may get overpowered. Maybe a diode in series with the uC pin would help.
Also be aware that not all triacs turn on in both directions with just a positive gate signal. Some require a negative gate signal for the opposite polarity of the two main terminals. This means you should make sure your triac can turn on in both directions with just a positive gate drive.
You also have to make sure you have enough current flowing into the gate to turn it on. The gate current requirement could be different for the two different polarities of the traic main terminals also. It could be higher for one polarity than the other. It has to be high enough for both polarities.
Also, once it turns on, the voltage across the 100uf cap may decrease which means the gate may not get enough current for the power line cycles that follow. You'll have to check that too and modify if needed. A zener may help there to regulate the voltage used to turn the triac on with the switch. That should keep enough energy in the 100uf cap for all cycles.
A 230vac power line has a peak voltage of around 325 volts, you'll want to take some precautions as that is potentially very lethal.