# ATM90E32 Energy registers representation?

Hi everyone, I need a bit of help understanding the way the ATM90E32 represents energy…

So far I got energy value from the uC in the form of CF 1CF = 1kWh/MC and I’ve set MC = 1000

but comparing with a certified tool the error % goes up to 83%…

Is there a calibration method I’m not aware of? someone working with this chip? maybe some information on how to understand why the reading I’m having are so off?

any information is truly appretiated!

How are you obtaining the voltage and current inputs for your ATM90E32?

How did you calculate your meter constant (MC) of 1000? That will depend totally on the relationship between the voltages delivered to the input pins of your ATM90E32 and the real-world voltages and currents.

Take a look at the hard coded values (minus the offsets) in my modified library for this IC: Split-Single-Phase-Energy-Meter/ATM90E32.cpp at master · CircuitSetup/Split-Single-Phase-Energy-Meter · GitHub

The MC shouldn’t be that low.

Mind the 32 bit registers as well.

Thats a thing… I did not calculte the MC as there is no (AFAIK) method or information about how to calculate this parameter I just search and found a library is using this value so start testing with it… before It was 3200 how do you calculate the MC?

voltage inputs are coming from resistors voltage divider exactly as the Application Notes and the current, Im using CT 100A/50mA the ones YHDC sells this are open coil CT…

Any idea on how to get this values correctly?

I just tried your hard coded values, the error compared with a certified tool is ~88% any ideas?

The meter constant should just be 3200, which means there’s 3200 imp/kWh, or 3200 pulses per kWh - there’s really no reason to change this unless you need the pulse output to be different. 3200 imp/kWh is the standard. Because of that PL_Constant registers should be set to:
PLconstH, 0x0861
PLconstL, 0xC468

What do you have the pga_gain (this will only increase the current registers for the 32 unlike the 36 which has gain for voltage), and calibration registers set to? I would be more concerned with those if your readings are so low.

Also, you shouldn’t need to read the lower 16 bit registers (urms, irms) for current and voltage unless you want some extra decimal points.

pga_gain is set to default (x1)

my calibration registers are:

VoltageGainL1 = 49843;
VoltageGainL2 = 49965;
VoltageGainL3 = 50588;
CurrentGainCT1 = 14480;
CurrentGainCT2 = 12099;
CurrentGainCT3 = 12883;

im still confused how this can change the energy reads??

If you are using the circuit diagram ATM90E32AS_3P4W_CT.SchDoc, you will get 240 mV rms at 100 A current. The maximum input voltage is 720 mV, therefore you should set the PGA_GAIN to 2 (according to the Application Note). If you will be measuring not more than 75 A, you can set the PGA_GAIN to 4.

On page 8 of the Application Note, it says: “Application note: how to select CT and CT load resistance.” You can choose a current transformer and its burden (load resistance) to suit the current you want to measure. Ideally, the voltage that appears across the burden resistance will be just less than 720 mV at the maximum current that you want to measure.
If it is much less than this - as it is for you - you can set the amplifier gain to compensate.

Atmel do not know which current transformer you will be using, nor what the value of burden resistance you will have chosen. They cannot tell you what numbers to use in the calibration registers.

You adjust for your choice of components by setting values in the calibration registers. If the number is incorrect, the current that the ATM90E32 indicates will be wrong, and the power and energy will be wrong.

I just changed the gain to 4x as you commented and Im reading correctly the values of current and voltage compared with a certified tool but the energy value is the only one not even close to what it should be

Which energy value? If you have current and voltage, everything else should be calculated by the IC.

Also, PGA_Gain should have no effect on the voltage. If it did, please tell me what you did. haha

HAHA Im so confused I think those registers where actually used in this uC but no effect just my confusion…

i just edited the energy gain in the register GainA to 0x0000 and boom now its recording acordingly but…

I should divide the result (in CF) by 100 and then by MC=3200?..

because the results now show a nearly perfect read but dividing by 10 and then by MC what is wrong??

Wait, which GainA register?

For the math, take a look at the math that is done on the registers in the Arduino library for reading the outputs. Some of them are funny, especially the 32 bit registers. I didn’t do calculations on the lower 16 bit registers of the voltage and current because they only represent 0.001

The GainA register from energy calculations in Aplication Notes pg 24.

take this value down to 0 and now works with an accuracy of 0.01% against a certified meter…

yeah I just erase all math done in the code to just retrieve the register value and show it… then when I have the value (sum) in total for 300 points reading at 1S each time then I divide this value by 10, then by MC and got a accuracy of 0.01%…

done this several times now and its perfect… now is recording for 1H if this works, how can I interpret this?

Error in the DataSheet/ApplicationNotes?,

This is all good but now the only energy is the total…, per phase energy is gone to 0 is there a way to check where the issue could be?