# Arduino Forum

## Topics => Science and Measurement => Topic started by: franck102 on Dec 11, 2018, 02:49 pm

Title: Convert multiple CT readings to pulses
Post by: franck102 on Dec 11, 2018, 02:49 pm
Hi all,

I am trying to improve my home energy monitoring system with a device that would allow me to measure the power consumption of a number of groups of circuits (e.g. heating, lights...).
My power mains is three phase, and circuits in a given group can be spread apart across different phases.
I have an energy monitoring unit that has enough S0 pulse inputs for my needs, what I need is a solution to measure the instantaneous power in each group.

Given the above, and to limit the needed hardware as much as possible, I was thinking of this strategy:

- measure the power factor of each circuit offline, using a handheld wattmeter
- use a single Arduino Mega (16 ADC inputs) to calculate the Irms on up to 16 CTs
- assume a constant Vrms (pretty stable for me)
- calculate Vrms*Irmns*PF for each CT, accumulate by group based on configuration, and emit pulses accordingly on one output pin per group

The idea is that by giving up on real-time voltage + current sampling to compute active power I gain a) the ability to measure across all three phases and b) the bandwidth to handle 16CTs and the pulse outputs in one unit.

Do you think the plan is sound?
Given a single ADC conversion takes 0.11ms, I should be able to sample all 16 CTs about 10 times in each 50Hz period. My guess is that that won't be enough to determine the peak current reliably, so I am wondering if there is some simple, circuitry-based preprocessing I can do on between the CT and the Mega to help capture the peak output of a CT?

Thanks!
Franck

Edit: after a bit more research it looks like I can't escape sampling the CT output multiple times per cycle; so the plan would be to process 4 CT per 50Hz cycle (that's what the emonTX achieves and it processes voltage on top).
Title: Re: Convert multiple CT readings to pulses
Post by: FantomT on Dec 12, 2018, 04:04 am
Given a single ADC conversion takes 0.11ms, I should be able to sample all 16 CTs about 10 times in each 50Hz period. My guess is that that won't be enough to determine the peak current reliably, so I am wondering if there is some simple, circuitry-based preprocessing I can do on between the CT and the Mega to help capture the peak output of a CT?

Thanks!
Franck

Edit: after a bit more research it looks like I can't escape sampling the CT output multiple times per cycle; so the plan would be to process 4 CT per 50Hz cycle (that's what the emonTX achieves and it processes voltage on top).
Your guess is correct, to measure accurately sampling rate has to be 2 kHz /channel. Actually, Mega can do sampling 64 kHz with slightly tweaked ADC settings, loosing 0.5 bit resolution (about 9.5-bits instead of 10). But problem is that even 10-bits is very low to measure current, having 10 mA - 10 A dynamic range already demading 10-bit bipolar, or 11 bits unipolar adc resolution, and 1% accuracy at 10 mA means +7bist more, totaling to 18-bits.
Title: Re: Convert multiple CT readings to pulses
Post by: franck102 on Dec 12, 2018, 07:59 pm
I have done some tests with a Uno, a 1000/1 CT, and a 220ohms burden resistor.
I can get 1000 samples in about 170ms, which allows me to cover all 16CTs  in under 3s. The error is 2-3W max with what my wattmeter reports on a 0.27A AC load, I still need to check larger loads but if that is confirmed the approach works.

BTW reused the EmonLib code, and I notice that they don't use any local variables in the critical loops, they are using class fields instead: is there any performance benefit in doing that?

Franck
Title: Re: Convert multiple CT readings to pulses
Post by: MarkT on Dec 13, 2018, 11:17 pm
Just be sure the CT's are rated for 3-phase use - the inter-phase voltages are 1.7 times a single phase,
so typically stuff designed for single phase may not be automatically rated for 3-phase use. Probably being
paranoid here, especially if clamp-on style CTs, but still...

When you statically measure the various circuits you have a chance to phase-balance the setup (spread
the worst offenders between phases so they don't all end up on one phase and unbalance the system
phase-wise.

Although you mentioned heating and lighting, so I am wondering where the bad power factors might come
from (fluorecent lighting?)
Title: Re: Convert multiple CT readings to pulses
Post by: franck102 on Dec 28, 2018, 06:53 pm
Although you mentioned heating and lighting, so I am wondering where the bad power factors might come
from (fluorecent lighting?)
The fridge (0.3) and the washing machine (0.45 when running slow and not heating) are two examples that I have actually measured with a cheap device. I also have a swimming pool pump, woodworking equipment...

I have finally given up on the approach that being, in favor of a IotaWatt that will do the job much better :)

Thanks for the help,
Franck
Title: Re: Convert multiple CT readings to pulses
Post by: hammy on Dec 31, 2018, 05:49 pm
Depending on your house meter type , you maybe able to get an output from it you can use - mine for example blinks an LED ever 1/100KWH.