Zero Crossing Detector using comparator
Shorting grounds will result in saftey hazards and most likely burnt components if the voltage source is AC mains (120V or 220V). One reason is both neutral and hot can carry current (especially in the event of a fault). An isolation step down transformer should be used in between the mains source and the opamp. For example a 10:1 step down would give a max voltage of 11V and provide isolation for saftey.

Or if you just need to detect the cycle you can use a circuit like this with an opto-coupler