Two-phase measurement using arduino

No problem. Thanks for the schematics!
This looks a lot better!
However, 2880 Ohm for R1 looks way to low to me. Say 220 volt mains, having its peek at 380 the current would be 380/2880 = 131 mA. That will blow every opto coupler I know. 1 - 10 mA would do fine.