Zero crossing detection

Hi i am working on a project analyzing the ac power line and i need to detect the zerocrossing point using an 16bit ADC, is there a smarter/better way of doing this than

if(last_sample==<== adc_average&==&== current_ sample> adc_average)

i sample 128 times per period and i'm calculating the adc_average every period, by using the method above i'm still having some jitter when detecting the zero-crossing.

calypso_rae's picture

Re: Zero crossing detection

My Mk2 PV Router sketches detect each zero crossing.  There's a description of how the sketch works in the final section of this article  Diverting surplus PV Power

If measuring the mains voltage via a transformer, the DC point of the secondary circuit will shift continuously so as to minimise the DC content.  This effect is quite noticeable as can be seen from this trace of a power tool of mine which only draws current during one half of each mains cycle when on its half-power setting. 

 

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.