Zero crossing detector

hey guys.... I am doing AC phase control using SCR H bridge rectifier. I need a suggestion for a zero cross detector circuit. I need a precise zero cross detector. For now I am using 4n25 optocoupler but I m not getting the desired output. I have placed attachment of what i need. then the circuit i used and the output i got. Basically i need a better pulse where i can use it for reference to fire the scr negative cycle of the sine wave

You output seems to be inverted from what you want, is this a software problem?
Another popular optocoupler device is the H11AA1

Tats the problem.. d last pic is my hardware result from the circuit of the 2nd pic.. I cant seem to get the value to drop to zero.. I tried using comparator as well but to no avail....

Where are you measuring with the scope probes to get the readings you show? If it's from the optocoupler and the value is being fed to the arduino then can you reverse the logic in software to output the waveform you need?

I am not that sure bout it...