i recently built this siple zero crossing circuit with input 5V 50Hz but i got a strange delay on the rising edge of the output pulse...im using 1megΩ resistors in series with my signal and an LM358, 1N4002 diodes. this delay can be seen here. any ideas? maybe noise causing this? how i could solve this issue? thanks
A lousy old LM358 and those 60Hz rectifier diodes are pretty darn slow. The very slow slew rate causes the rise and fall of a squarewave to become a ramping triangle. The very high value series resistors feeding the high capacitance of those slow diodes also causes ramping and delay.
A REAL comparator IC will be MUCH faster. Some hysteresis can be used which makes the rise and fall of the waveform much faster.