Gustaf Tham wrote: > I need to measure power the same way the power companies do. Sort of. They try to, but it doesn't always work that way and most of the time they aren't TOO critical. What's a few watt-hours among millions? > They _do_ measure RMS, don't they? "RMS Power" has no meaning. See below. > Also I wonder: If I just measure current, utilizing a toroid and a > load resistor, and let the PIC do the root-mean-squaring over > considerable time - will that give me a fair approximation of power > consumption? An approximation certainly, but fair? No. Must measure voltage too. > I seem to remember that I need the RMS of both the current and the > voltage, and the phase relationship betwixt the two? Getting closer but: No. You need the mean of the instantaneous product of current and voltage, averaged over whatever interval. Probably you don't even want it averaged, just accumulated over an interval. Presumably what you want is watt-hours per however long. If you are talking POWER, or in fact ENERGY, you want only the accumulated product of instantaneous voltage and time. It turns out to be far easier than you were thinking. The RMS voltage or current is the voltage which corresponds to a given energy expenditure for a given load; it is the *equivalent* or *effective* voltage or current. So you don't need a sqrt function after all if you are talking power. > Anyway, I only need to mimic the way the power company's inductive > rotating disk measures power. Hmmm. I'm not sure you really want to do that either, unless you are primarily concerned with mimicing it exactly. You see, it is anything but accurate; doing it with ADCs and a PIC will probably be MORE accurate. For example, it is generally possible to make your meter run backward under certain conditions (or so I am told - haven't tried it!), but I'd better not spell it out, had I? You'd probably be able to find the details on that evil Internet somewhere though, along with all the "build your own terrorist atomic bomb from spare Plutonium" FAQs. > I also just need the hour average, so there's plenty of time. OK, this is easy. Digitise current, digitise voltage, multiply them and accumulate with suitable scaling factor over desired time interval, either at least 10 or 20 times per (highest frequency) waveform period, or randomise the intervals thoroughly. If you want "average power" over a shorter interval, use the "moving window" algorithm from a few weeks back. Cheers, Paul B.