AnsweredAssumed Answered

Vrms calibration in ADE7758_SPI with Arduino

Question asked by jianyee92 on Nov 19, 2013
Latest reply on Feb 14, 2014 by dlath

Cal step.JPG

////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

 

Hi. I am using ADE7758 in my energy monitoring system project. I am able to use SPI to communicate with my Arduino and it is able to display the results. However, I am having some problem calibrating VRMS with the steps given in the ADE7758 datasheet in page 55. By following the steps, I have writen the values into LCYCMODE and MASK like below:

/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

In cpp. file

void ADE7758::setLineCyc(int l)

{    write16 (LINECYC, l);          }

/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

In Arduino Setup

void ADE7758::setMASK(long e)               

{    write24 (MASK, e);             }

/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

    

Then, I followed step  4 by taking N=100,

In cpp file

long ADE7758::Avrms() {

        char i=0;

        long v=0;

        getAVRMS();                                                            //Ignore first reading to avoid garbage

        for(i=0;i<100;++i)    

          {    v+=getAVRMS();     }

        return v/100;

}

 

long ADE7758::getAVRMS(void) {

        long lastupdate = 0;

        ADE7758::getresetInterruptStatus();                          // Clear all interrupts

        lastupdate = millis();

        while( !  ( ADE7758::getInterruptStatus() & ZXA )  )      // wait Zero-Crossing

        {                                                                             // wait for the selected interrupt to occur

                if ( ( millis() - lastupdate ) > 100)

                {       wdt_reset();

                        Serial.println("\n--> getAVRMS Timeout - no AC input");

                        break; 

                }

        }        

        return read24(AVRMS);

}

/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

 

With this code, I am able to produce different values for different input voltage. But the changes are very small.

In order to use the AVRMSOS formula, my readings after using a 10:1 step down transformer:

V_min = 2.5,       V_nom = 24

and the values obtained are as below:

/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

formula for VRMSOS.JPG (formula can be found in pg 55 of datasheet)

 

So, substituting the value into the formula:

Cal.JPG

 

V_in= 5.7V
V_in= 24.5V
V_in= 49V

--> before calibration

VRMS_100: 16767890.0000

--> after calibration

VRMS_100: 1341.5760498046

--> before calibration

VRMS_100: 16705047.0000

--> after calibration

VRMS_100: 1336.5480957031

--> before calibration

VRMS_100: 16693657.0000

--> after calibration

VRMS_100: 1335.6367187500

--> before calibration

VRMS_100: 16766609.0000

--> after calibration

VRMS_100: 1341.4735107421

--> before calibration

VRMS_100: 16762652.0000

--> after calibration

VRMS_100: 1341.1569824218

--> before calibration

VRMS_100: 16506393.0000

--> after calibration

VRMS_100: 1320.6540527343

--> before calibration

VRMS_100: 16771791.0000

--> after calibration

VRMS_100: 1341.8881835937

--> before calibration

VRMS_100: 16767304.0000

--> after calibration

VRMS_100: 1341.5291748046

--> before calibration

VRMS_100: 16777212.0000

--> after calibration

VRMS_100: 1342.3218994140

 

Hence, AVRMSOS = 0x00E (Taking only the last 3 LSB)

The readings obtained are very large. Does this have to do with the VRMSGAIN? I have not written any values into the VRMSGAIN. May I know how can I obtain the correct value of VRMSGAIN?

The connectivity for the circuit is as below:           

ADE7758 VRMS cal pic.JPG

Much of the codes are refered from this link: https://code.google.com/p/ardugrid7753/source/browse/#svn%2Ftrunk

Thank you.

Attachments

Outcomes