Just use any junker single LED opto.
Put in a series dropping resistor calculated to limit the LED current at the peak line voltage to 20% of Maximum Allowed Forward Current.
Put in a silicon diode in series with the opto LED to block the reverse voltage. This cuts the power dissipation of the dropping resistor in half.(a good thing!).
So you now have a 230V AC source, running to a dropping resistor, running to a diode, running to the opto LED, returning to the 230V source.
Now add another reversed diode in parallel with the the LED. This protects the LED from any destructive reverse voltage.
Monitor the opto's output (the logic levels). The point at which it drops low is going to be the same place on the 230VAC waveform every cycle. Use that as your synchronous point.
I have done this many times for SCR and TRIAC firing control. It is pretty much the standard for this function.
You don't need to worry about the trailing edge of the logic signal. Set up the AVR to count from the falling edge to the next falling edge. That will give you the AC frequency to the accuracy of your counter. If you need the frequency faster than a power line cycle set the aforementioned circuit up in both directions with two opto's. Measure the period between both falling edges. This will get you the frequency in half a line cycle.
Make sure you calculate the power dissipation of the dropping resistor/s. It won't be ignorable.
Keith Cress
kcress -