This may be a slightly different approach. This is how I do dimmers in microcontrollers.

1. Full wave rectify a stepped down ac waveform to get the typical full wave rectified waveform (2 crests per cycle)

2. Use a comparator to interrupt you whenever the crest is close to zero.

3. Once you have this, you could do whatever you want with the signals