# Energy Monitoring (Formulas and methods help)

#### Gryd3

Jun 25, 2014
4,098
I've been intrigued with energy management and logging lately, but everyone seems to have their own method of how to get the actual readings...

I'm hoping to get feedback as well as opinions on this so I can look into it further and understand this process complete.

My current understanding for DC, is simply polling frequently and recording the DC voltage, and DC current. Multiply the two together and you have your answer.
AC on the other hand is a little more complex, and this is where I have a bit of a hole in my understanding.
Polling the AC voltage and Current must be done at a higher frequency than the AC supply, or you could accidentally poll during the peak or zero crossing... giving you incorrect results. That said, if I rectified the output for the voltage and current readings, and averaged it with hardware... (ie, capacitor.) would I still get accurate results?

This starts to get much more complicated when you move from a single phase supply to 3-phase... I'm not sure where to start at all with a 3Phase setup, and tips and information are greatly appreciated.

So.. tl;dr
I'm after formulas and information regarding measuring single and 3phase supplies, as well as pros and cons to taking a larger number high frequency polls, or averaging the readings with analogue electronics.

#### AnalogKid

Jun 10, 2015
2,674
For AC voltage and current monitoring you have two options, not counting the manual way with a zillion readings and a ton of calcultions.

One, if you are sure the waveforms are all going to be sine waves, use a rectifier and filter to get a DC voltage that is related to the sinewave peak value, and divide by the square root of two to get an approsximate RMS value. This is what all small DMMs do for the AC readings.

Two, for more accuracy with any waveform, use a true-RMS-to-DC converter IC.

#### hevans1944

##### Hop - AC8NS
Jun 21, 2012
4,762
For accurate AC power measurements you also have to account for the power factor of reactive loads like motors. That means measuring the phase difference between the current and voltage. IIRC, there are ICs available to do this automagically. If I remember where I saw them, I will post a link. Look at digital power metering circuits used by utilities for billing purposes.

#### Gryd3

Jun 25, 2014
4,098
For accurate AC power measurements you also have to account for the power factor of reactive loads like motors. That means measuring the phase difference between the current and voltage. IIRC, there are ICs available to do this automagically. If I remember where I saw them, I will post a link. Look at digital power metering circuits used by utilities for billing purposes.
From the looks of things, digikey has a selection of metering ICs, power factor correction ICs, and RMS-DC ICs.. I'm still doing some digging.
Thank you for the tips so far.
Ideally, the end result will be something I can build as a prototype to monitor and log the power used by my computer. (In addition to the power used... logging AC line voltage will give me some ammo to get the utility company out here... I'm sick of flickers and brown-outs, and have battery backups on my media equipment.)

#### Harald Kapp

##### Moderator
Moderator
Nov 17, 2011
12,778
RMS-to-DC converters are comparatively slow as they use an integrator to snooth the Dc output. If you can live with the time constant of these chips, you're fine. But: You cannot use the RMS values of current and voltage and multiply them to get at the real power. What you get is apparent power.
For real power measurements you'd have to multiply current*voltage first and then perform the RMS-to-DC conversion.

As you are concerned about brownouts, flicker etc., this method is probably not the best. Have a look at this thread, where a member named @jgauthier discusses building a power monitor. Monitoring voltage and current by two ADCs and a microcontroller will give you the highest flexibility in analyzing your mains power over time.

#### Arouse1973

Dec 18, 2013
5,178
Hi Jerid
Are we talking direct measurements of the mains voltages and currents?

#### Gryd3

Jun 25, 2014
4,098
Hi Jerid
Are we talking direct measurements of the mains voltages and currents?
Yes.
The current plan is to use a shunt for current, but I may opt for a current transformer.
(Would like to stick with a shunt)

#### Arouse1973

Dec 18, 2013
5,178
What sort of current are we talking?

#### Harald Kapp

##### Moderator
Moderator
Nov 17, 2011
12,778
The current plan is to use a shunt for current, but I may opt for a current transformer.
I suggest you use transformers for both current and voltage for two reasons:
1. Safety - potential isolation will greatly reduce the danger of an electric shock (and may even be mandatory, depending on the applicable standards).
2. Technical - you will have to reduce the measurands to a level manageable by the electronics (e.g. microcontroller) anyway.
A tranformer (two for V and I) does both in one step.

#### Gryd3

Jun 25, 2014
4,098
What sort of current are we talking?
Mains voltage for my computer equipment.. currently estimated between 3 and 5 amps, but considering the application, I would be sizing and over compensating components for the maximum load possible on the circuit which would be 15 Amps on my circuits.
(I realize this may sound funny, but if I oversize it, I gain the freedom to use the device in other locations in the home.)
I suggest you use transformers for both current and voltage for two reasons:
1. Safety - potential isolation will greatly reduce the danger of an electric shock (and may even be mandatory, depending on the applicable standards).
2. Technical - you will have to reduce the measurands to a level manageable by the electronics (e.g. microcontroller) anyway.
A tranformer (two for V and I) does both in one step.
Yes Harald, the transformers would indeed make it safer, but I am hoping the use of a shunt can keep the size down. The intention is to put an IC in harms way, and use an opto-coupler to get the data out of the completed device.
(The transformer for voltage can be kept small enough... it's the current transformer that I am concerned with for size)

#### Arouse1973

Dec 18, 2013
5,178
The most accurate way I can think of is to use RMS thermal measurements. Measuring the temperature of a known resistance.

#### Gryd3

Jun 25, 2014
4,098
The most accurate way I can think of is to use RMS thermal measurements. Measuring the temperature of a known resistance.
A little inaccuracy is fine.
I figured using a low enough Ω shunt would allow me to to take current readings.
The voltage could be read with a small transformer, or voltage divider.
Once I have an approach down, I'll be putting safeguards in place to help protect against spikes.

#### AnalogKid

Jun 10, 2015
2,674
For a buck fifty that's disgusting. I notice the datasheet has 0.0 interface guidance. BTW, Analog Devices also is big in power meter ICs.

ak

#### Gryd3

Jun 25, 2014
4,098
For a buck fifty that's disgusting. I notice the datasheet has 0.0 interface guidance. BTW, Analog Devices also is big in power meter ICs.

ak
I must be missing something... Looks like it has more than what I need capabilities wise, and I can connect it to a micro controller via serial to do the formatting and logging of the data.. what am I missing?

#### AnalogKid

Jun 10, 2015
2,674
The isolated interface circuits to high voltage AC and high current AC; you know, the a.n.a.l.o.g stuff.

ak

#### Arouse1973

Dec 18, 2013
5,178
Any energy you use to make the measurment will result in errors. If you can account for all errors then thats fine.

#### Gryd3

Jun 25, 2014
4,098
The isolated interface circuits to high voltage AC and high current AC; you know, the a.n.a.l.o.g stuff.

ak
Datasheet claimed use with current and voltage transformers as well as shunts.
Also provided min/max values so I figured it wouldn't be too hard to draw it up myself as long as the conditions are met.
Any energy you use to make the measurment will result in errors. If you can account for all errors then thats fine.
You're right Adam. If I power the device from a parallel branch before the current shunt, I should be fine. (That's my thought anyway)

I've read the other monitoring thread on here, and have done some digging and the conclusion I have drawn is to use a dedicated IC for this.
This should account for the math, power factor, and line measurements and will greatly simplify the program required on a pic, or AVR.
I'll try to get something drawn up to see if I understand this well enough.

#### Harald Kapp

##### Moderator
Moderator
Nov 17, 2011
12,778
The most accurate way I can think of is to use RMS thermal measurements. Measuring the temperature of a known resistance.
I'm with you, but: That's comparatively slow and you will not be able to detect fast events like flicker, voltage dips etc.

#### Harald Kapp

##### Moderator
Moderator
Nov 17, 2011
12,778
the conclusion I have drawn is to use a dedicated IC for this.
Not a bad decision. Follow the application notes and get something started. There's always time to refine later one you've gotten the gist of it.
Ensure potential isolation and take all necessary safety precautions to avoid electrical shock.

Replies
6
Views
974
Replies
2
Views
965
Replies
2
Views
296
Replies
68
Views
3K
Replies
11
Views
807