
Here’s an application note from NXP on how to easily connect main triacs and microcontrollers.
This application note describes the easy connection of NXP LPC microcontrollers and three – quadrant (Hi-Com) triacs to control any resistive or inductive load at mains voltage. A one-for-all control method is presented that uses an innovative, patented, current zero-crossing detection method without need for a shunt resistor in the load current line.

Incredible application note, I did not know these methods to sense the zero crossing via voltage and current.
Yup, nice app note – added to my collection :-)