Classic optocoupler - TRIAC circuit for controlling an AC load with Arduino

There is a classic circuit for controlling a big AC load with Arduino.
This circuit uses a optocoupler DIAC with some TRIAC.

There are many modifications of this circuit.
What is the best value of the resistor that is inseries between optocoupler and the Arduino? (5 volts)
What is the best value for the resistor that is between the optocoupler and the TRIAC?
Do I need it at all?

What is the maximum frequency that this circuit can modulate a load at?
There is a formula at
page 2. I don't know how to apply this formula.

I want to build an Arduino - controlled dimmer switch kind of device. It has to be tied to 60Hz AC frequency or I can just apply PWM on top of the AC to get a desired result.

I want to smoothly adjust a heater to keep it from wearing and tearing from thermal cycling.

Yes you do need the resistor from the Arduino to the Optocoupler otherwise you may fry the Arduino output, the optocoupler or both. 220Ω is a reasonable value but use a resister that will drive the LED in the optocoupler to about 10 to 20ma. I’m not sure about the value of the triac resister so I won’t comment on that.

I would not recommend this simple circuit to PWM an AC Load.
Below are some links to articles and circuits on how to use PWM for dimming lights. These will apply to a heater as well because it’s a resistive load like an incandescent light is. If there is a fan in this unit it’s possible that it may not work properly when PWMed and depending on what type it is it may be quite inductive. Also most of these circuits are changing the AC to DC so you will likely need to power it from the direct AC in. Lastly a heater will draw substantially more current than a light so you’ll need high current devices and heatsinks.

What is the official term for a circuit that uses analog output (from Arduino in our case) to trim off the 60Hz AC wave?

A dimmer switch in which the analog output from Arduino would act as a knob?

I think your referring to emulating a potentionmeter or pot.

If that's the case there are digital potentionmeter chips available that can be controlled via SPI or I2C. Just google "digital potentionmeter".

If you plan on using one of these to replace the pot in your dimmer then you have to check to see if any of the pots terminals are connected to the high voltage. Generally newer dimmers aren't like this but some older and really cheap ones were like this.

I think that I will use a digital potentiometer.

Old/cheap is not as important here. It is all about the kind of load I am trying to modulate.
LED lights, heaters and incandescent lights, motors of various kinds, all require a different kind of "modulation" device.

I want to use a "dimmer switch" on a 120watt heater that is PTC, so it never goes above 120watts and usually consumes a lot less power.

You can either phase control the Triac at 60 hz or zero cycle switch the Triac.
Either way , you need to detect the zero crossing points of the AC waveform and use this data to tell the Arduino when to switch the Triac on.