I want to dim a lamp around 70W or more using arduino. I have found two ways for doing that. The first one is to make a circuit that "cuts" the sine wave and produce the dimming effect (link). The other way is to make a circuit that uses a PWM pin to dim a lamp (link). So what is the best solution and why? In my opinion the one with the PWM pin is better because it uses only 2 cables to send signal to the circuit and it is much easier in coding.
Phase control for AC Mains dimming is old but proven technology. This is, of course, PWM control that just happens to be synchronized with the incoming AC Mains waveform.
That said, you can try using a non-synchronized PWM but you need to be aware that you may run into frequency beating problems. That is: if your PWM frequency is not harmonically related to the Ac Mains frequency, you may see the difference in frequency as a low-frequency beat. This will cause the lamp brightness to vary at a periodic rate.
I honestly don't know how well non-synchronized PWM will work. I hope that you try it and let us know how well it works.
In terms of a solution to controlling a lamp with arduino, I would recommend buying a proper module to do this for you rather than constructing your own mains powered circuit, both for safety reasons and for saving you time. But below are a few comments on PWM vs phase control.
One of the benefits of phase controlled switching is to do with EMC (electro-magnetic [noise] compliance) and filtering. Only the leading edge (turn-on) needs to be filtered and it is easy to do this with a inductor. The trailing edge (turn off) does not need to be filtered because this doesn't happen until the current is very small.
When there are trailing edges (turn off) with current still flowing, an inductor filtering on its own will only cause greater voltage spikes which is not good. So for PWM which has current flowing during on-to-off transitions a more complex filter network is required to prevent high voltage spikes and to prevent excessive current slew rates to limit EMC noise.
PWM introduces many times more switching transitions which increases the attenuation requirements of filtering - because noise power is related to the number of transitions. The fact that the PWM frequency is higher and pushes the noise into higher frequencies benefits the filter circuitry, as a filter with a higher cut-off frequency can be constructed with smaller inductance and/or capacitance values. But on the other hand greater attenuation is required due to the increased noise power due to the increase in switching transitions.
The main complications for software control of phase angle control is: #1 synchronising the software to the AC waveform (aka zero-crossing detection); #2 translating a power level in percent into a phase angle. This is going to be load dependant, but assuming a simple resistive load the power is roughly something like 1-cos(2angle[deg]). so angle[deg] = 0.5arccos(1-(power[%]/100)). - don't quote me on it though! You can probably approximate this by using a small lookup table and interpolate values.
There are alternative phase control circuits that use analogue means for working out the switching angle. They could save you needing an additional microcontroller input for zero-crossing detection. you would need to provide an isolated analogue voltage to such circuit which you could do via an opto-isolator using PWM and an RC filter - sorry I haven't provided any examples of this.
The downside of phase angle control is that it causes more harmonic distortion on the power line and has lower power factor - so it introduces more noise onto the mains supply. If you've ever used audio gear near dimmer switches you will know what I mean by more noise.
I am not sure about the circuits you referenced, the phase angle circuit looks like it is missing key features such as filtering components. Also I'm not sure the PCB design has implemented mains voltage safety requirements such as creepage and clearance distances - I would be cautious using this circuit with mains voltages.