Quantcast
Channel: EngineerZone: Message List
Viewing all articles
Browse latest Browse all 36216

Re: Vrms calibration in ADE7758_SPI with Arduino

$
0
0

Hi Dlath,

 

Yes, it could be the problem from the SPI connection. It may due to loose connection between the Arduino SPI port with the ADE7758 as once the voltage supplied from the transformer is switched off, the serial monitor display constant 16777215 value. For your information, the pins connection and schematic is attached as shown below:

PIC001041.jpg

A doubt, where should I connected my "hanging ground"? If considering the same ground symbol, is it a must to connect to the neutral of the transformer?

Capture.JPG

refered from http://arduino.cc/en/Reference/SPI

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

void ADE7758::setSPI(void){ 

       pinMode(CS,OUTPUT);                                //Chip select by digital output on pin nbs CS

       digitalWrite (CS,HIGH);

                                                                        //Initialize SPI

       SPI.setDataMode(SPI_MODE2);

       SPI.setClockDivider(SPI_CLOCK_DIV32);

       SPI.setBitOrder(MSBFIRST);

       SPI.begin();

       delay(10);

}

 

void ADE7758::closeSPI(void) {

        SPI.end();

        delay(10);

}

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

With this, I would also like to include the READ and WRITE function that I referred the .cpp file from this link:

https://code.google.com/p/ardugrid7753/source/browse/#svn%2Ftrunk

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

/*=== read24 ===*/

unsigned long ADE7758::read24(char reg){

        enableChip();

        unsigned char b2,b1,b0;

        delayMicroseconds(50);

        SPI.transfer(reg);

        delayMicroseconds(50);

        b2=SPI.transfer(0x00);

        delayMicroseconds(50);

        b1=SPI.transfer(0x00);

        delayMicroseconds(50);

        b0=SPI.transfer(0x00);

        delayMicroseconds(50);

        disableChip();

        return (unsigned long)b2<<16 | (unsigned long)b1<<8 | (unsigned long)b0;

}

 

void ADE7758::write24(char reg, unsigned long data){

        enableChip();

        unsigned char data0=0,data1=0,data2=0;

        // For Write -> DB7 = 1  / For Read -> DB7 = 0

        reg |= WRITE;

        //split data

        data0 = (unsigned char)data;

        data1 = (unsigned char)(data>>8);

          data2 = (unsigned char)(data>>16);

       

        //register selection, we have to send a 1 on the 8th bit to perform a write

        delayMicroseconds(50);

        SPI.transfer((unsigned char)reg);   

        delayMicroseconds(50);   

        //data send, MSB first

          SPI.transfer((unsigned char)data2);

          delayMicroseconds(50);

        SPI.transfer((unsigned char)data1);

        delayMicroseconds(50);

        SPI.transfer((unsigned char)data0); 

        delayMicroseconds(50);

        disableChip();

}

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

 

A quick update on my progress

So, i decided to re-run my circuit again yesterday and the result now have variation, (which i dont know why ).

In order to do the xVRMSOS calibration to remove the noise at low freqeuncy, I input 24V and 240V into ADE7758 for Vmin and Vnom respectively. Then i select 333 readings from the output and average them and the xVRMSOS result now is 0x58F (taking the last 3 LSB)

Capture.JPG

 

ko.JPG

After writing 0x58F into the AVRMSOS register, the VRMSOS seem to be more constant at 16200000 (observed from the graph). Then, applying Real Vrms= AVRMS (reading from the register) x (240/LSB), my result now is approximately 248.5V. However, when i try to lower the 240V input voltage, the ADE7758 does not seem to decrease proportional because as the input voltage decreases, the ADE would also sense the decrease and output a lower reading.

 

Thank you.

 

Regards,

jianyee92


Viewing all articles
Browse latest Browse all 36216

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>