Post Go back to editing

ADE7953 Phase Calibration using Registers and Arduino

Category: Hardware
Product Number: ADE7953

Hi, I am trying to do the phase calibration od ADE7953 using arduino and internal registers.

wrote the formula: 

in C

#define CAL_ANGLE_RADIANS(x) (x*PI/180)
AENERGYactual = (int32_t)ade7953.i2c_Read_32(AENERGYA_32);
AENERGYexpected = (int32_t)(((double)VRMS * (double)IRMS * (double)cos(CAL_ANGLE_RADIANS(CALIBRATION_ANGLE_DEGREES)) * CALIBRATION_ACC_TIME) / ((double)WhLSB*(double)3600));
PHCALX = (int16_t)( (( (double)acos( (double)AENERGYactual * (double)cos(CAL_ANGLE_RADIANS(CALIBRATION_ANGLE_DEGREES)) / (double)AENERGYexpected ) - (double)CAL_ANGLE_RADIANS(CALIBRATION_ANGLE_DEGREES) ) / ((double)CAL_ANGLE_RADIANS(360) * (double)INPUT_FREQUENCY) ) * (double)893850);

But I have some issues, the calibration is not correct and need to work also on the 10-bit signed registers to manage the negative calibration values.

Could you provide the calibration code in C/C++?

thanks.

Domenico



-
[edited by: dome1980 at 2:13 PM (GMT -4) on 15 Aug 2023]
  • I am using an stm32 in arduino IDE

    int32_t AENERGYactual = 96000;
    int32_t AENERGYexpected = 97780;
    int32_t PHCALX = (double)((((acos((AENERGYactual * cos(60.00 * PI/180))/AENERGYexpected))*180/PI)-60)*893850)/(360*50);

    if(PHCALX <0){PHCALX = !PHCALX + 1 + 0b1000000000;}  convert to sign mag
    Serial.println((uint32_t)PHCALX, HEX );  // had to cast to uint to get hex value of negative number

    output 201h 

    remember to read 32bit register or sign extend 24 bit registers. 

    Dave

  • Thanks Dave.

    The only problem I see with this approach is that AENERGY relies on Wh/LSB and Wh/LSB relies on W reading that cannot be precise if the Phase Calibration is not performed first (the phase error brings to a wrong value of W), basically I see a vicious circle here.

    So correct me if I am wrong, using the REGISTERS procedures, I am following this ordered approach:

    1. VGAIN calibration
    2. IGAIN calibration
    3. PHASE calibration at PF=0.5 (60°) measuring the angle with the ADE7953 and applying the angle correction of 0.02° * PHCALX  (at 50Hz) to get the precise 60° reading  from ADE7953 (PHCALX in 10-bit signed format)
    4. optional xWGAIN calibration and xVAGAIN calibration to match Vrms*Irms at PF=1 (same value eventually applied to xVARGAIN)
    5. finally calculate the Wh/LSB using the calibrated VGAIN, IGAIN and PHCALx, at PF=1

    Is this procedure correct?

    According to the datasheet https://www.analog.com/media/en/technical-documentation/data-sheets/ADE7953.pdf at page 34:

    The maximum range that can be written to PHCALx[8:0] is 383 (decimal). One LSB of the PHCALx register is equivalentto a time delay or time advance of 1.117 µs (CLKIN/4). With a line frequency of 50 Hz,the resolution is 0.02°/LSB ((360 × 50Hz)/ 895 kHz), which provides a total correction of 7.66° in either direction. With a line frequency of 60 Hz, the resolution is 0.024°/LSB ((360 × 60 Hz)/895 kHz), which provides a total correction of 9.192°in either direction.

    Thank you,

    Domenico

  • Yes phase cal should be be first this is just using ratios so gain calibration is not needed yet. Really depends on the phase shift being corrected and the accuracy you are trying to meet. The lower the meter class 0.2% phase cal errors are more of an issue.

    The phase calibration I used is from the AN-1118 https://www.analog.com/media/en/technical-documentation/application-notes/AN-1118.pdf

    pg 12

    You should not need var and watt gain if the calibration is followed  Igain and Vgain are typically enough. 

    1 phase  if you have a shunt most likely not needed. Also any phase cal will be constant as long as the sensor doesn't change so you can write a fixed value to all parts after you figure the phase correction out.

    2 vgain 

    3 Igain 

    5 is calculated from expected values after calibration.

    Dave