I need to detect zero-crossing of 220V 50Hz mains lines. I thought of using ATmega8 comparator by connecting the comparator as shown in the attached figure.
I don't know how to calculate the 1M resistor, it is just a suggestion for the value. I am going to use analog comparator interrupt to detect zero crossing, Is it going to work this way and detect the minus wave as well? If not, any suggestions? I am planning not to use transformers here.