Triac BT138

Hi,
You need a current limit resistor between the output of the Aduino and the opto-coupler.
optores.jpg
From data, Vf = 1.2V put 30mA through it.

R = V /I = (5 - 1.2) / .03 = 126R so 120R or 180R will do the trick.

The setup you have will let you turn the lamp ON and OFF, but will not allow dimming.

Tom.. :slight_smile:

optores.jpg