I think Olin's correct that power factor should be able to be measured using an 18F. THD is a bit tricky and I think those power analyzers /high end scopes are using FFT. However if we can measure the power factor and the displacement factor, then we can get the distortion factor and thus the THD. So the question is how to effectively measure the displacement factor, which is the phase difference between the fundamental voltage and fundamental current. For those who are a bit interested but confused about the various jargons: 1) power factor =(average power) / ((rms voltage)*(rms current)) 2) THD = total harmonic distortion 3) If the voltage is pure sine wave, then we have the following formula. (power factor) = (distortion factor) * (displacement factor) (displacement factor) =cos (phase angle between fundamental of i and v) (distortion factor) =(rms fundamental current) / (rms current) (distortion factor) = 1/sqrt(1 + (THD)^2)) Normally the phase voltage is pretty okay in USA and most part of the world with only a bit flat top on the peak so one can assume it to be sinusoidal (the THD of the voltage is typically <5%). Or it is better that you check Robert W. Erickson's lecture notes on University of Colorado website or his book "Fundamentals of Power Electronics", 2nd ed. Regards, Xiaofan -----Original Message----- From: olin_piclist@embedinc.com [mailto:olin_piclist@embedinc.com] Sent: Wednesday, July 13, 2005 12:39 AM To: Microcontroller discussion list - Public. Subject: Re: [EE] AC current sensing Martin K wrote: > So calculating the power factor could be done quite easily on an 18F > however THD would require a FFT to calculate the sum of powers at > frequencies above the fundamental. Calculating power factor should be possible on a 18F since its mostly a few multiplies per sample. Calculating total harmonic distortion doesn't require a FFT, although that's one way. You don't need to know the full spectrum to calculate THD, only how much power is in the fundamental and how much everywhere else. There are simpler ways of doing that than a FFT. -- http://www.piclist.com PIC/SX FAQ & list archive View/change your membership options at http://mailman.mit.edu/mailman/listinfo/piclist