Problem Reading ADE7753 arduino

Thread Starter

Vindhyachal Takniki

Joined Nov 3, 2014
594
1. I had made a code for reading ADE7753. I am using library for ADE7753 also.
Attached is schematic. Both arduino & ADE7753 is 5V powered.

2. Code gets stuck in liobrary code:
while( ! ( ADE7753::getInterruptStatus() & ZX ) ) // wait Zero-Crossing

3. If I surpass this line, then reading is random & do not get correct values.
Library with arduino code is in attached zip file.


<code>

#include "ADE7753.h"
#include <SPI.h>

#define ratioTraf (220/12) //18.3

void setup()
{
Serial.begin(9600);
Serial.write("h");
}

void loop()
{
ADE7753 meter = ADE7753();
meter.analogSetup(GAIN_1,GAIN_1, 0,0,0,0);
meter.resetStatus();

long v1,i1,e1,e2,e3,ae1,ae2,ae3,r1,r2,r3;
float totEnergy = 0;
float kv,ki,ke,ka,kt,f1,basetime;
float voltage, current, energy, aparent, reactive, PF;
String typeLoad = "";
int t1;
int loopCounter = 1;


//Constantes de proporcionalidad.
kv = (ratioTraf)*VOLTDIV*(0.5/0x2851EC); //(0.5/0x2851EC) From Datasheet
ki = CURRDIV*(0.5/0x17D338); //(0.5/0x17D338) From Datasheet
ke = (10/16.0)*VOLTDIV*CURRDIV/4096.0; // 1/(2^12)
basetime = (1.0*NUMCYC)/100.0; // tiempo por el cual se acumula energia
kt=CLKIN/8; //period register, resolution x.y[us]/LSB -per bit-

while(1)
{
Serial.print(meter.getMode());

v1=meter.vrms();
i1=meter.irms();
Serial.print("\nVoltaje RMS [V]: ");
Serial.println(v1);
Serial.println(kv*v1,2);
Serial.println("\nCorriente RMS [A]: ");
Serial.println(i1);
Serial.println(ki*i1,3);
Serial.println();
delay(2000);
}
}

</code>
 

Attachments

Thread Starter

Vindhyachal Takniki

Joined Nov 3, 2014
594
THis library works perfectly. https://github.com/lordofnaz/ardugrid7753/blob/master/ADE7753.cpp

I have to measure voltage, current & active power.

1. Calculations of voltage I have done are, as per page 27 of datasheet 05.V is 1,561,400 in decimal. So I read the VRMS(0x17) & use below formula for get voltage value. Divider is 1M:1K
V = (0.5 / 1561400.0) * Vrms * 1001.0
Is this formula correct?

I have done that there were some shift in values. But after two point calibration now values i read are ok.



2. Similarly for current, page 26 gives, 0.5V is 1,868,467. I am reading IRMS(0x16), burden is 10ohm & CT is 1800:1.
I = (0.5 / 1868467.0) * Irms / 10.0 * 1800.0;
Is this formula correct?

Even after calibration, I am getting some wrong values in it. I am checking hardware if it has some issues. But right now I dont know yet.



3. In the library link above, ADE7753.h, CLKIN is defined 4Mhz at line 186. But I use 3.579545 MHz crsytal as mentioned in datsheet. So should I change this value here only? Or anything else to be changed also? OR I should also chnage crystal to 4Mhz in my board. But datasheet has 3.579545 MHz



4. I need to measure 1Watt to 6KW in the system. So at 220V(suppose), equivalent current for 1W is 0.00455A & for 6Kw it is 27.27A. I keep 30A to add safety limit
Can I measure such low current with IC while I use CT=1800:1 & burden 20ohm.
 

Thread Starter

Vindhyachal Takniki

Joined Nov 3, 2014
594
Below are answer I got from AD forum:

1) The formula should be:V = (0.5 / 1561400.0/sqrt(2)) * Vrms * 1001.0 . The 0.5V max listed in the datasheet is maximum rating. It should be converted to RMS to ensure similarity.

2) similarly I = (0.5 / 1868467.0/sqrt(2)) * Irms / 10.0 * 1800.0;
What is the current level and error after calibration? IRMS is 0.5% accurate upto 100:1 dynamic range i.e. from ~60A to 600mArms

3) In the datasheet, all the parameters/calculations specified are at 3.579545 MHz. Using this will simplify the design. However it does say that the Max clock can be 4MHz. You have to update the calculations accordingly. If you already have a 3.579545Mhz crystal on board, i would recommend using that crystal and changing the code

4)The energy measurements are 0.1% accurate upto 1000:1 range. So with 20 Ohm burden the energy measurements will be accurate from ~30A to 30mA and the Current RMS measurements will be 0.5% accurate from 30A to 300mArms. Beyond 300mA, the accuracy drops significantly and can vary from device to device.
 
Top