>>> ok, my idea was to make this peak-measurement every 20mS, >>> and average it with the previous one. Resimulated the peak >>> method, and it fits in the 1.2% error indeed. >> >> You are still sampling at 1KHz to find the peaks, right? =A0The >> 1.2% error I mentioned comes from the 1KHz samples missing >> the peak by as much as 500uS. > > Yes, my (and your) simulation show that. Detecting peaks is not a good idea in my opinion. Much better advice was: > Trying to detect the peak value and scale that is IMO a bad idea > because a single brief spike could throw the reading way off. > > Taking the average of the magnitude and scaling it would probablly > be a reasonable option. True RMS is also pretty easy to calculate > (square the individual values, average them and take the square root > at the end) -- = http://www.piclist.com PIC/SX FAQ & list archive View/change your membership options at http://mailman.mit.edu/mailman/listinfo/piclist