I'm currently doing my master thesis, and I'm now at a point where I have to control a few AC motors with a microcontroller. From my previous study about the subject, and from previous similar thesis, I've noticed a common practice is to use an optocoupler to separate low voltage from high voltage, and a TRIAC to draw current to the motors.
As far as choosing an optocoupler goes, I've decided to go with one that as zero crossing detection (MOC3041), since I don't need phase control and the small delay doesn't affect the desired function. The datasheet of MOC3041 shows a circuit, but I can't quite understand some aspects of it, namely the values of the resistors.

Here's my take on it, I would appreciate if you correct me if something is wrong:
Thank you in advance, any tips are appreciated!
As far as choosing an optocoupler goes, I've decided to go with one that as zero crossing detection (MOC3041), since I don't need phase control and the small delay doesn't affect the desired function. The datasheet of MOC3041 shows a circuit, but I can't quite understand some aspects of it, namely the values of the resistors.

Here's my take on it, I would appreciate if you correct me if something is wrong:
- Rin is used to pull the necessary current for the LED diode of MOC3041, which is max. 15mA (extracted from datasheet). I'm using an ESP32 microcontroller, so the Vcc will be 3.3V, resulting in a value of Rin = 3.3 / 0.015 = 220 (or higher).
- The 360 ohm one should be obtained in order to pull the necessary current for the TRIAC gate to conduct. The peak gate current of the TRIAC I'm using (BT139) is 2A, and the peak current surge current for the MOC diode is 1A, resulting in a resistance higher than 240V/1A > 240 ohm, so I guess 360 should be ok in my circuit.
- I don't quite understand the use of the 330 ohm resistor. I've read some stuff about it, most of the opinions are that it is useful to have it, but not always necessary.
- The RC snubber would be necessary in my case to remove potential electromagnetic noise. The figure says to use 39 ohm, or 360 ohm for highly inductive loads. How do I determine if the motors that I have fit this profile?
- How do you determine the power rating for the resistors? I've read you can use P=fCV^2 to determine it. In my case, P = 50hz * 0.01uF *240^2 = 0.0288, so I would be fine with regular 1/4 W resistor. Although, I've read some people that used those and they would burn, and it only worked with 1 or 2 W resistors.
Thank you in advance, any tips are appreciated!