# AC power meter dsign with power factor information

Status
Not open for further replies. hi

I want to design a energy meter using 8 bit Pic micro-controller.

I want to know the following

1)How voltage is measured.
2)How current is measured.
3)How Power factor can be measured.

#### KlausST

##### Super Moderator
Staff member Hi,

There are dedicated "energy meter chips". Do you want to use one of them?
--> if yes, then read their datasheet and application notes.

If you want to use the PIC inside ADC:
* there are a lot of examples and hobby solutions in the internet. Read through them.

* in general you need a fixed and stable sample rate to read both voltage and current continously.
* then take the samples of one (or integer multiples) full wave (line frequency)
* calculate the RMS voltage
* calculate the RMS current
* multiply both to get apparent power
* Calculate active power
* calculate: active_power / apparent_power = power_factor

There are other(less reliable) solutions by just using zero cross timings

Klaus

• Points: 2

### thannara123

Points: 2 kindly explain this

"then take the samples of one (or integer multiples) full wave (line frequency)"
What should be the adc sampling frequency?
What about negative cycle (rectifier required?) or generate rms by using diode opamp circuit?

#### KlausST

##### Super Moderator
Staff member Hi,

"then take the samples of one (or integer multiples) full wave (line frequency)"
With 50Hz line frequency one full wave is 20 ms. --> Take samples of 20.0ms, 40.0ms, 60.0ms, 80.0ms... (don´t choose 43 ms for example)

What should be the adc sampling frequency?
Nyquist says you need more than twice the input frequency. Including the statment above it means you need at least 3 times the line frequency, as long as you don´t expect overtones.
You can choose 3, 4, 5, 6, 7, .. time the line frequency)

I recommend to use a sample frequency of (about) 32 x lines frequency. Use an appropriate analog low pass filter to avoide alias frequencies.
With 50Hz line frequency it means 1600 Hz sampling frequency (for each channel) .

What about negative cycle (rectifier required?) or generate rms by using diode opamp circuit?
For sure you need the information of the negative cycle. So your analog input signal needs an offset of 1/2 ADC input range (ideally)
If you are not interested in DC, then no OPAMP is needed. some Rs and Cs do the job.

Klaus

• Points: 2 Why alias filter is required? Are there high frequency harmonics in Main?
I need reference design for filter + ads side.

#### KlausST

##### Super Moderator
Staff member Hi,

Why alias filter is required? Are there high frequency harmonics in Main?

There are harmonics in the mains voltage. But ther are way more harmonics in the current.
Consider all the small power supplies without PFC.
The input current waveform is far away from sine.

I need reference design for filter + ads side.
You should read some "energy metering IC" datasheet, just to see how they do this. You don´t need to do the same, but it´s good information.

A simple LPF is just an R and a C.

Klaus

• Points: 2 Ok.

Sampling the mains at 1600 Hz and then apply RMS formula to get the value?

#### andre_luis

##### Super Moderator
Staff member With 50Hz line frequency one full wave is 20 ms. --> Take samples of 20.0ms, 40.0ms, 60.0ms, 80.0ms

Hi Klauss,

There are some regulatory specifications for measuring mains voltage that define the sampling frequency as being not exactly the multiple of the wave period. The reason for that is due to the risk of happening synchronized noises occurring between samples, and therefore would be not detected, don’t you agree ?

An example of that was illustrated here:

Doing that, at least part of the artifact could be accounted by integrating the average over time.

#### KlausST

##### Super Moderator
Staff member Hi Andre,

yes, sampling a 20ms fullwave with a sample rate of 19ms is undersamling.

While it has it´s benefits, it also has it´s drawback.

I didn´t mention it because it makes things (sampling theory) more complicated.
I did this with an 8 channels (lines frequency) true RMS voltmeter.
Continous sampling (If I remember right then it was 48 samples in 100ms, this makes it usefull for 50Hz as well as 60Hz)
a total sample rate (480Hz x 8 channels = 3840Samples/s) and an output every 100ms for all 8 channels, all within a ATMEGA32.

Klaus

#### c_mitra How accurate you are going to aim? There are short time frequency and phase errors on the line frequency. Also you need a switch to select the mains frequency, 50/60 Hz. You should also ensure that the PIC clock is TXCO giving a good stability. If you just want an (approximate) idea of the power consumed, then you can assume the line voltage is a sine wave and the load current is also a sine wave. Then you will get the power consumed at the fundamental frequency. Measuring phase accurately with a 8 bit accuracy is not easy because of the conversions involved (sine and cosine functions). If you want to include harmonics in the overall calculation, you will need to average over 2-3-4-5 cycles and also sample over 1/2, 1/3, 1/4, 1/5 the line period (20 ms for 50Hz). As KlausST has pointed out, you also need to take care of the Nyquist theorem.

It will be a fun project to do.

• Points: 2

#### DanyR

##### Member level 3  hi,

I have just implemented this circuit for current sensing. For this circuit i am using MCP6022 rail to rail op amp with large rc constant out put filter as described in the document.

Current transformer rating is 1:1000 load and resistor is 130 ohm.Here are some readings

(Watts) (A)

200 0.72 220mv
400 1.57 400mv
600 2.38 580mv
800 3.23 760mv
1000 4.07 940mv
1200 4.89 1.14v

Now i am looking for voltage sensing circuit. Do i need zero cross detect circuit?

- - - Updated - - -

In a current transformer with bridge rectifier , how voltage drop 0f 1.4 v is compensated?

#### Attachments

• Precision Rectifier Circuit for CT Signal Conditioning.pdf
28.4 KB · Views: 45
• starlucky

Points: 2