First, I have no experience with Arduino's, nor do I have one - so pinch(grain) of salt - I just came across this while looking up ideas.
I do not know the speed of the iterations in the sampling loop, but assuming there are more that just a few samples each half cycle offsetIV(I) will move up and down by about (A * S)/1024 where A is the peak A/D count (≈500/2000 at full scale) and S is the number of samples per half wave.
Better would be to update the calculated offset each full wave or even just once each measurement (again depending on # samples each half wave)
mike
First, I have no experience with Arduino's, nor do I have one - so pinch(grain) of salt - I just came across this while looking up ideas.
I do not know the speed of the iterations in the sampling loop, but assuming there are more that just a few samples each half cycle offsetIV(I) will move up and down by about (A * S)/1024 where A is the peak A/D count (≈500/2000 at full scale) and S is the number of samples per half wave.
Better would be to update the calculated offset each full wave or even just once each measurement (again depending on # samples each half wave) mike