Marechiare ha scritto: >>>> 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. >> True, but you can filter first and then detect the peaks. >> Each peak is then the result of a bunch of input samples, >> and therefore random noise is attenuated. > > Random noise probably would be attenuated indeed, but what if, for > instance, some power SCR/TRIAC-regulated load were present on the > line? Tops of the sine would be heavily suppressed, the filter won't > restore the shape. I put apart the filtering note, waiting for Olin's reply. (I've actually been reading at the PAS code he wrote for me and I can see the IIR filter in there - as I suspected he had already shown such a filter... :) So far, the result is good enough but indeed in real environment there might be spikes - though it has to be said that I'll need rather "slow" readouts (< 2-3 secs) and I'm already averaging the output, and the 3 peaks. Since there will be fans and 1CV pump(s), spikes will indeed be there. >> True RMS requires much more computation. > > Looks like the statement is not true. RMS approach being a "statistic" > approach does not require that many measurements per sine period as > the peak-detect polling does to achieve the same precision. tell me more :) -- Ciao, Dario -- Cyberdyne -- http://www.piclist.com PIC/SX FAQ & list archive View/change your membership options at http://mailman.mit.edu/mailman/listinfo/piclist