Q:

Resistance issue in a triac-optocoupler switch

I have made the following circuit to control my water pump with Arduino(UNO R3). I have tried many resistors (calculated myself) to limit current in the optocoupler and triac, but failed to carry the load for a long time. At one time either resistor get burned or triac gets too hot. Kindly suggest what resistance I should use in the resistors with '?'. Any other suggestions are also welcome.
MOC3021 datasheet
BT136 datasheet

A:

Your circuit's incorrect, try this.

simulate this circuit – Schematic created using CircuitLab
For BT136 to switch on you must make a voltage difference (positive or negative) between the gate and A1 which happens, with this circuit, after mains zero crossing.
The triac triggers in quadrants I and III thereby avoiding quadrant IV triggering.
RG is calculated by considering the triac's Vgt and Igt parameters.
Assume a minimum mains voltage at which you want the triac to switch on, say 20V.
Then RG = (20 - Vgt)/Igt.
This circuit could be improved with the addition of a snubber network across the triac to guard against dv/dt turn on and ensure that the triac commutates correctly (switches off at mains zero crossing). - This is because the load is inductive.
EDIT
If too low a value of mains turn-on voltage is chosen then RG will be too small and the peak allowable gate current (IGM) data sheet specification will be exceeded.
To calculate the minimum value of RG assume the opto triac turns on when the mains voltage is at its peak. MOC3021 is a random phase (non-zero crossing) triac driver.
RG(min) = (Vpk - Vgt)/IGM = ((230V * sqrt(2)) - 1.5V)/2A = 162R (in the UK).
Allow a safety margin, let RG(min) = 200R.
Now it's possible to calculate the minimum mains turn-on voltage using this value of RG.
If Vgt = 1.5V and Igt = 35mA then...
Minimum mains turn-on voltage = (35mA * 200R) + 1.5V = 8.5V

