MarkT:
If you build a directly connected triac circuit like this the entire circuit is live and must be insulated appropriately so no part can be touched.
Insulation is of course required but it is not enough in a typical situation. What happens when the circuit has mains power and a desktop pc is plugged in to download code? The common of the ATmega 328 will be grounded through the USB connection.
ZAP. BOOM. POW. when the linear regulator flashes over in a ball of fire. The user will be lucky to escape with only burns on their fingers when the metal housing of the usb cable makes contact with the usb connector. If they happen to be touching the metal of the cable connector, it could be a rather tragic ending