A PWM Dimmer Revisited

This project revisits one of the (inspirational) earlier projects of dyi_bloke: the “AC PWM Dimmer for Arduino”. There were a number of things in the original design that I wanted to understand in detail and a couple of things I thought are worth trying to improve. The things of which I wanted to dig into their details are related to the latency/response times, something on the line of “how far can I go in increasing the PWM frequency until the things won’t go as expected anymore?” The things I thought worth trying to improve: the big, hundreds of volts, capacitor - I’ll let aside the price for it, but that’s such a waste of PCB/box space; the fact that the PWM logic is “polarity inverted” - when the input of the optocoupler is on, the load goes disconnected and viceversa. Additionally, I threw a challenge in front of me. Some year-and-something ago, quite a beginner in electronics (not that I’m hugely more advanced now), I bought a handful of FDP46N30 MOSFETS to use on projects dealing with main power. At the time, I forgot that the main AC 220-240V is RMS voltage, and not the maximum voltage, so I ended with that handful of MOSFETs with a maximum Vds=300V. As a “lest I forget” lesson for myself and to quench the regret of spending $20 for 50 NMOS-es only to decorate the inside of a drawer seldom opened, I challenged myself in using them instead of buying some other more appropriatelly rated MOSFETs - if I’d succeed in doing it (I have), I’ll theoretically be able to switch up to 46Amps - man, that’s like 10kW of power to control with PWM ;) !”