Post Go back to editing

Reactive Problems

Category: Software
Product Number: ADE9000
Software Version: Aurdino IDE

With Ade9000 we collect data on the card we created ourselves with esp32. But we are having problems with power values.

11:49:20.213 -> ADDR_AWATTHR_HI: 9072645
11:49:20.213 -> Phase A Current: 1.53
11:49:20.213 -> Phase A Voltage: 219.24
11:49:20.260 -> Phase A PF: 0.99
11:49:20.260 -> Phase A Active Powerfun: 331.55
11:49:20.260 -> Phase A Reactive Fun Powerfun: 1.88
11:49:20.260 -> Phase A Visible Powerfun: 331.56
11:49:20.260 -> Phase A Active Power: 332.87
11:49:20.260 -> Phase B Active Power: 332.38
11:49:20.260 -> Phase C Active Power: 332.88
11:49:20.260 -> Phase A Reactive Power: -0.56
11:49:20.260 -> Phase B Reactive Power: -0.88
11:49:20.260 -> Phase C Reactive Power: -0.96
11:49:20.260 -> Phase A Apparent Power: 334.87
11:49:20.260 -> Phase B Apparent Power: 334.38
11:49:20.260 -> C Phase Apparent Power: 334.89

the measurements you see above and in the picture are different. Even if they are close to each other, they reach different values as the power increases.
0.5 lagging power is required for phase calibration, but we cannot provide this in office conditions. Is there a chance to calibrate this manually. We are trying to calibrate watts for PF value. Although we calibrate both Pgain and AWATTOS as in the technical manual, we cannot find a clear value.

We dont calibrate current and voltage because of low difference. 

  • Have you tried the ade9000 calibration xls?

    If you can't provide the pf required for calibration, Try reading the angle register  average a bunch of reading and compare to the equipment you have. 

    Pf -.94 = -19.948 deg 

    Find the delta between your averaged angle measurement and the -19.948 deg this is the angle you need to compensate for. 


  • You should not need pgain if Igain and Vgain are calibrated correctly.

  • Hi dave,

    We try excell too. 

    When we use excel format pf change too much. AFter we do calibration with 0.88 pf, we measure pf 0.18 but normaly it will 0.8. 

    Select Channel Being Calibrated Channel A
    Enter Line Frequency(Hz) 50
    Select Current Sensor Current Transformer
    Select Voltage Sensor Resistor divider
    Enter Nominal RMS Input Voltage(Vrms) 225,18
    Enter Nominal RMS Input Current(Arms) 1,5
    Enter Meter Constant(impulses/kWHr)  
    Enter Energy Accumulation Time(sec)   
    Enter Voltage PGA_GAIN  1
    Enter Current PGA_GAIN 1
    Step 2: Seting up CF pulses  
    Enter CT Turns ratio 1000
    Enter Total CT Burden Resistor(Ohm) 66
    Current Transfer Function(V/A) 0,066
    Enter Top Leg (R1) of Divider Resistor (KOhm) 990
    Enter Bottom Leg (R2)of Divider Resistor (kOhm) 1
    Voltage Transfer Function(V/V) 0,001009082
    Expected CF at Nominal Conditions(Hz) 0
    Program xTHR to Recommended Value( xTHR=0x00100000) 100000
    Nominal Voltage percentage
    of full scale
    Nominal Current percentage
    of full scale
    CFxDEN Register(hex) #SAYI/0!
    Voltage Conversion Constant(uVrms/Code) 13,29629989
    Current Conversion Constant(uArms/Code) 0,203288687
    Power Conversion Constant(mWatt/Code) 0,362788819
    Energy Conversion Constant ( uWxHr/xxTTHR_HI Code) #SAYI/0!
    Step 3:Voltage and Current Gain Calibration  
    Select Calibration technique Calibrate using Register values
    Enter Measured xIRMS register value(hex) 71F3FC
    Enter Measured xVRMS register value(hex) FF92F1
    Expected xIRMS register value(hex) 7096ED
    Expected xVRMS register value(hex) 1026A73
    AIGAIN Register(hex) FFE77E9D
    AVGAIN Register(hex) 16C5C3
    Enter Measured xIRMS register value after calibration(hex)   
    Enter Measured xVRMS register value after calibration(hex)   
    Current Error after Compensation -100,00%
    Voltage Error after Compensation -100,00%
    Step 3.1: RMS offset calibration  
    Enter Offset Calibration Current(Arms)  
    Enter Offset Calibration Voltage(Vrms)  
    Enter Measured xIRMS register value(hex)  
    Enter Measured xVRMS register value(hex)  
    Enter Measured xIFRMS register value(hex)  
    Enter Measured xVFRMS register value(hex)  
    AIRMSOS Register(hex) 0
    AVRMSOS Register(hex) 0
    AIFRMSOS Register(hex) 0
    AVFRMSOS Register(hex) 0
    Step 4: Phase calibration Done at Lagging PF=0.5 such that Active and Reactive Energies are Positive
    Select Calibration technique Calibrate using Register values
    Enter Calibrating Angle between V and I(°)(positive angle for lagging PF) 28,35
    Expected Active Energy Register(xWATTHR_HI hex) at calibrating angle 0
    Expected Reactive Energy(xVARHR_HI hex) at calibrating angle 0
    Enter measured Active Energy register xWATTHR_HI (hex) at calibrating angle 86E6D
    Enter measured Reactive Energy register xVARHR_HI (hex) at calibrating angle FFFEC3AF
    Desired Phase Error Compensation(°) 61,64262863
    APHCAL0 Register(hex) F76DEE7A

    #include <SPI.h>
    #include <ADE9000RegMap.h>
    #include <ADE9000API.h>
    #include <math.h>
    #include "arduinoFFT.h"
    #include "EasyNextionLibrary.h"

    /*Basic initializations*/
    ADE9000Class ade9000;
    #define SPI_SPEED 20000000 //SPI Speed
    #define CS_PIN 5 //8-->Arduino Zero. 16-->ESP8266
    #define ADE9000_RESET_PIN 27 //Reset Pin on HW
    #define PM_1 26 //PM1 Pin: 4-->Arduino Zero. 15-->ESP8266

    #define N 128 // Örneklem sayısı
    #define SAMPLING_FREQ 6400 // Örnekleme frekansı (Hz)

    arduinoFFT FFT = arduinoFFT();
    //EasyNex myNex(Serial);

    double real[N]; // Reel bileşen
    double imag[N]; // Sanal bileşen
    static double Veri[N];
    double Frekans[N];
    double Genlik[N];
    double HGenlik[N];
    double vReal[N]; //Real part of FFT array
    double vImag[N]; //Imaginary part of FFT aray
    static double VeriVC[512];
    static double VeriVA[512];

    //ESP32 Default SPI
    //MOSI: 23
    //MISO: 19
    //SCK: 18
    //SS: 5

    /*Structure decleration */
    struct CurrentRMSRegs curntRMSRegs; //Current RMS
    struct VoltageRMSRegs vltgRMSRegs; //Voltage RMS
    //struct VoltageTHDRegs voltageTHDRegsnValues; //Voltage THD
    struct ResampledWfbData resampledData; // Resampled Data
    struct ActivePowerRegs activePowerRegs;
    struct ReactivePowerRegs reactivePowerRegs;
    struct ApparentPowerRegs apparentPowerRegs;

    struct PowerFactorRegs powerFactorRegs;
    struct VoltageTHDRegs vltgthdRegs; //Value olarak ta alınabiliyor. Regs olarakta
    struct CurrentTHDRegs curntThdRegs;//Value olarak ta alınabiliyor. Regs olarakta
    struct PowerFactorRegs pfactorRegs;//Value olarak ta alınabiliyor. Regs olarakta
    struct ResampledWfbData_harmonic resampledData_harmonic;
    struct PeriodRegs prdRegs;
    struct FundActivePowerRegs fndap;
    struct FundReactivePowerRegs fndqp;
    struct FundApparentPowerRegs fndsp;

    /*Function Decleration*/
    void readRegisterData(void);
    void readResampledData(void);
    void resetADE9000(void);
    double harmonic_samples(double);

    void setup() {
    pinMode(PM_1, OUTPUT); //Set PM1 pin as output
    digitalWrite(PM_1, LOW); //Set PM1 select pin low for PSM0 mode
    pinMode(ADE9000_RESET_PIN, OUTPUT);
    digitalWrite(ADE9000_RESET_PIN, HIGH);
    void resetADE9000();
    ade9000.SPI_Init(SPI_SPEED,CS_PIN); //Initialize SPI
    ade9000.SetupADE9000(); //Initialize ADE9000 registers according to values in ADE9000API.h
    //ade9000.SPI_Write_16(ADDR_RUN,0x1); //Set RUN=1 to turn on DSP. Uncomment if SetupADE9000 function is not used
    //Serial.print("RUN Register: ");
    ade9000.SPI_Write_32(ADDR_AIFRMSOS,0x3DBD997D); */

    void loop() {


    Serial.print("ADDR_AWATTHR_HI: ");
    Serial.print("ADDR_AVARHR_HI: ");
    Serial.print("ADDR_AVRMS: ");
    Serial.print("ADDR_AIRMS: ");
    Serial.print("ADDR_AVFRMS: ");
    Serial.print("ADDR_AFIRMS: ");
    float APFF = (pfactorRegs.PowerFactorReg_A*0.0000000074505805969);
    Serial.print("A PF: ");
    Serial.print("AWATTHR_HI ");
    float AVTHDF = 0;
    float BVTHDF = 0;
    float CVTHDF = 0;

    float AITHDF = 0;
    float BITHDF = 0;
    float CITHDF = 0;

    float AVRMSF = 0;
    float BVRMSF = 0;
    float CVRMSF = 0;

    float AIRMSF = 0;
    float BIRMSF = 0;
    float CIRMSF = 0;
    float NIRMSF = 0;

    float AAPF = 0;
    float BAPF = 0;
    float CAPF = 0;
    float TAP = 0;

    float ASPF=0;
    float BSPF=0;
    float CSPF=0;
    float TSP=0;

    float AQPF = 0;
    float BQPF = 0;
    float CQPF = 0;
    float TQP = 0;

    //float APFF = 0;
    float BPFF = 0;
    float CPFF = 0;

    float LI = 0;
    float LIA = 0;
    float LIB = 0;
    float LIC = 0;
    float AFKayip = 0;
    float BFKayip = 0;
    float CFKayip = 0;
    float TopFKayip =0;

    float AHKayip = 0;
    float BHKayip = 0;
    float CHKayip = 0;
    float TopHKayip =0;

    AVRMSF = (vltgRMSRegs.VoltageRMSReg_A*(0.0000132940876766141)) ;
    BVRMSF = (vltgRMSRegs.VoltageRMSReg_B*(0.0000132940876766141));
    CVRMSF = (vltgRMSRegs.VoltageRMSReg_C*(0.0000132940876766141));

    AIRMSF = (curntRMSRegs.CurrentRMSReg_A*(0.0000002032579885467));
    BIRMSF = (curntRMSRegs.CurrentRMSReg_B*(0.0000002032579885467));
    CIRMSF = (curntRMSRegs.CurrentRMSReg_C*(0.0000002032579885467));
    NIRMSF = (curntRMSRegs.CurrentRMSReg_N*(0.0000002032579885467));

    APFF = (pfactorRegs.PowerFactorReg_A*0.0000000074505805969);
    BPFF = (pfactorRegs.PowerFactorReg_B*0.0000000074505805969);
    CPFF = (pfactorRegs.PowerFactorReg_C*0.0000000074505805969);

    AAPF = ((activePowerRegs.ActivePowerReg_A*0.0003626792564446720));
    BAPF = (activePowerRegs.ActivePowerReg_B*0.0003626792564446720);
    CAPF = (activePowerRegs.ActivePowerReg_C*0.0003626792564446720);
    TAP = ((AAPF + BAPF + CAPF)/1000);
    Serial.print("A Fazı Akım: ");
    Serial.print("A Fazı Gerilim: ");
    Serial.print("B Fazı Akım: ");
    Serial.print("A Fazı Gerilim: ");
    Serial.print("A Fazı PF: ");
    Serial.print("B Fazı PF: ");

    float APFFF = (fndap.FundActivePowerReg_A*0.0003626792564446720);
    Serial.print("A Fazı Aktif Güçfun: ");
    float AQFFF = (fndqp.FundReactivePowerReg_A*0.0003626792564446720);
    Serial.print("A Fazı Reaktif Fun Güçfun: ");
    float ASFFF = (fndsp.FundApparentPowerReg_A*0.0003626792564446720);
    Serial.print("A Fazı Görünür Güçfun: ");

    Serial.print("A Fazı Aktif Güç: ");
    Serial.print("B Fazı Aktif Güç: ");
    Serial.print("C Fazı Aktif Güç: ");
    AQPF = ((reactivePowerRegs.ReactivePowerReg_A*0.0003626792564446720));
    BQPF = (reactivePowerRegs.ReactivePowerReg_B*0.0003626792564446720);
    CQPF = (reactivePowerRegs.ReactivePowerReg_C*0.0003626792564446720);
    TQP = ((AQPF + BQPF + CQPF)/1000);

    Serial.print("A Fazı Reaktif Güç: ");
    Serial.print("B Fazı Reaktif Güç: ");
    Serial.print("C Fazı Reaktif Güç: ");

    TSP = ((ASPF + BSPF + CSPF)/1000);
    Serial.print("A Fazı Görünür Güç: ");
    Serial.print("B Fazı Görünür Güç: ");
    Serial.print("C Fazı Görünür Güç: ");

    AVTHDF = (vltgthdRegs.VoltageTHDReg_A*0.0000007450580596924);
    BVTHDF = (vltgthdRegs.VoltageTHDReg_B*0.0000007450580596924);
    CVTHDF = (vltgthdRegs.VoltageTHDReg_C*0.0000007450580596924);

    AITHDF = (curntThdRegs.CurrentTHDReg_A*0.0000007450580596924);
    BITHDF = (curntThdRegs.CurrentTHDReg_B*0.0000007450580596924);
    CITHDF = (curntThdRegs.CurrentTHDReg_C*0.0000007450580596924);
    float Freq = 0;
    Freq = (prdRegs.FrequencyValue_C);
    String Freqs= String (Freq,2);

    void readRegisterData()
    /*Read and Print RMS & WATT Register using ADE9000 Read Library*/
    ade9000.ReadVoltageRMSRegs(&vltgRMSRegs); //Template to read Power registers from ADE9000 and store data in Arduino MCU


    void resetADE9000(void)
    digitalWrite(ADE9000_RESET_PIN, LOW);
    digitalWrite(ADE9000_RESET_PIN, HIGH);
    Serial.println("Reset Done");