Hi, > The RMS calculation is like: > > Vrms = sqrt( v(0)^2 + v(dt)^2 + ... + v(N*dt)^2 )*scale_factor > > Or simply said, it's the square root of the sum of the squares. Isn't it the square root of the mean of the sum of the squares? The above equation would be correct if scale_factor = 1/sqrt(N+1) Often you can get away with only calculating the mean square voltage. This saves you from doing the sqrt() operation. If you want to compare the RMS value of a signal against a window, say Xlow and Xhigh, you can just as well compare the MS signal against Xlow^2 and Xhigh^2. If Xlow and Xhigh are predetermined constants, you can precalculate their squares. Also, you cannot use the A/D samples directly in the above equation, since you had to bias your signal around some DC offset to fit it into the 0-5V span of the A/D. If you bias your signal so that it swings around 2.5V, for instance, you would have to subtract 128 from every sample, before squaring them. If the signal you are measuring has a 0 mean, there is an alternative: If you are using the A/D samples directly in the RMS equation, you are calculating RMS( f(t) + k ) RMS( f(t) + k ) = sqrt( mean( f(t) + k )^2 ) = sqrt( mean( f(t)^2 ) + 2*mean( f(t)*k ) + mean (k^2) ) = sqrt( mean( f(t)^2 ) + 2*k*mean ( f(t) ) + k^2 ) = sqrt( mean( f(t)^2 ) + 2*k*0 + k^2 ) Thus RMS( f(t) ) = sqrt( MS( f(t) + k ) - k^2 ) or MS( f(t) ) = MS( f(t) + k ) - k^2 where k = mean ( f(t) + k ) I think this will be more accurate than subtracting 128 from each sample, since it will compensate for when your DC level is not exactly 2.5V. It works for any DC level. Niki