+ Post New Thread
Results 1 to 12 of 12
  1. #1
    Member level 2
    Points: 818, Level: 6

    Join Date
    Nov 2016
    Posts
    49
    Helped
    0 / 0
    Points
    818
    Level
    6

    What is default slave address for the ACS71020

    Hi,
    i am trying to communicate with ACS71020 using I2C communication Basically I2C need Slave address. I want to know default slave address for the ACS71020KMABTR-090B3-I2C. In datasheet also not mentioned about default slave address.

  2. #2
    Super Moderator
    Points: 263,400, Level: 100
    Awards:
    1st Helpful Member

    Join Date
    Jan 2008
    Location
    Bochum, Germany
    Posts
    46,022
    Helped
    13996 / 13996
    Points
    263,400
    Level
    100

    Re: What is default slave address for the ACS71020

    As described in the datasheet, the I2C slave address is programmed by the voltage level at DIO0 and DIO1 at power on.



    •   AltAdvertisement

        
       

  3. #3
    Member level 2
    Points: 818, Level: 6

    Join Date
    Nov 2016
    Posts
    49
    Helped
    0 / 0
    Points
    818
    Level
    6

    Re: What is default slave address for the ACS71020

    Thanks for your reply.
    But in my application, the DIO0 is used for Voltage zero crossing and DIO1 for Over Current. If I Disable I2C slave address selection circuit means. Then what will be the slave address?.



  4. #4
    Super Moderator
    Points: 80,237, Level: 69
    Achievements:
    7 years registered
    Awards:
    Most Frequent Poster 3rd Helpful Member

    Join Date
    Apr 2014
    Posts
    16,276
    Helped
    3692 / 3692
    Points
    80,237
    Level
    69

    Re: What is default slave address for the ACS71020

    Hi,

    It's quite clear, isn't it?
    DIO0 is used for Voltage zero crossing
    --> Table17 --> value = "0"

    DIO1 for Over Current.
    --> Table18 --> value = "0"

    Now you have "0-0"
    --> table 16, value 0-0 --> address = 96 (decimal)

    Klaus
    Please don´t contact me via PM, because there is no time to respond to them. No friend requests. Thank you.



  5. #5
    Member level 2
    Points: 818, Level: 6

    Join Date
    Nov 2016
    Posts
    49
    Helped
    0 / 0
    Points
    818
    Level
    6

    Re: What is default slave address for the ACS71020

    Hi,
    I am trying to communicate with the ACS71020 with STM32 MCU. I used 0xC0 as a Slave address, but the device not responding.

    HAL_I2C_Mem_Read(&hi2c1,0xC0,0x20,1,&data,1,100);
    Always i am getting '0' only. I made DIO0 & DIO1 pulldown externally. Help me to solve this problem.



    •   AltAdvertisement

        
       

  6. #6
    Super Moderator
    Points: 263,400, Level: 100
    Awards:
    1st Helpful Member

    Join Date
    Jan 2008
    Location
    Bochum, Germany
    Posts
    46,022
    Helped
    13996 / 13996
    Points
    263,400
    Level
    100

    Re: What is default slave address for the ACS71020

    I would do the following:

    - Check with oscilloscope if the device is operated with the expected address and actually doesn't ACK the command.
    - Check if your pull-down resistors actually set the required voltage level of < 0.1 VCC during power on.

    - Consider that there's an EEPROM option to disable the DIO_x address circuit. If it has been set by someone, you'll need to scan the presently set I2C address by a test routine.



  7. #7
    Member level 2
    Points: 818, Level: 6

    Join Date
    Nov 2016
    Posts
    49
    Helped
    0 / 0
    Points
    818
    Level
    6

    Re: What is default slave address for the ACS71020

    Hi,
    Finally, I communicated with the ACS71020 using 0x60 (96 decimal) as a slave address. Random data is coming from the CHIP when I read the address 0x20 to get voltage. But I can't figure it out. In the datasheet mentioned to get the VRMS:-
    "This field is an unsigned 15-bit fixed point
    number with 15 fractional bits. It ranges from 0 to ~1 with a step
    size of 1/215. This number should be multiplied by the overall full
    scale of the voltage path in order to get to volts
    "

    How to get the RMS voltage data from the above procedure.



  8. #8
    Super Moderator
    Points: 263,400, Level: 100
    Awards:
    1st Helpful Member

    Join Date
    Jan 2008
    Location
    Bochum, Germany
    Posts
    46,022
    Helped
    13996 / 13996
    Points
    263,400
    Level
    100

    Re: What is default slave address for the ACS71020

    with a step size of 1/215
    Please quote correctly. It's 1/2^15

    If you get random data, there's possibly a problem with your hard- or software. Can you read other register values consistently?



  9. #9
    Member level 2
    Points: 818, Level: 6

    Join Date
    Nov 2016
    Posts
    49
    Helped
    0 / 0
    Points
    818
    Level
    6

    Re: What is default slave address for the ACS71020

    sorry...It's 1/2^15
    If I read other address like EEPROM data of the ACS71020 means, data is constant and matching. If I try to read only the voltage and current - the data are not constant. Help me to solve this problem....



  10. #10
    Super Moderator
    Points: 80,237, Level: 69
    Achievements:
    7 years registered
    Awards:
    Most Frequent Poster 3rd Helpful Member

    Join Date
    Apr 2014
    Posts
    16,276
    Helped
    3692 / 3692
    Points
    80,237
    Level
    69

    Re: What is default slave address for the ACS71020

    Hi,

    If I try to read only the voltage and current - the data are not constant.
    Let me guess:
    * the analog voltage input is not connected and thus floating
    * or the input is connected and there is either true signal or noise

    Klaus
    Please don´t contact me via PM, because there is no time to respond to them. No friend requests. Thank you.



    •   AltAdvertisement

        
       

  11. #11
    Member level 2
    Points: 818, Level: 6

    Join Date
    Nov 2016
    Posts
    49
    Helped
    0 / 0
    Points
    818
    Level
    6

    Re: What is default slave address for the ACS71020

    Hi,
    I interfaced with the ACS71020 with the Arduino board. But still, I can't' get the actual values.
    This is my Arduino code:-
    Code:
    /* ACS71020 Arduino Programming Code
     * This code will work for Arduino UNO
     * Supply Voltage is 3.3V, ACS71020KMABTR-030B3-I2C
     * SCL Pin = A4 Analog Pin
     * SDA Pin = A5 Analog Pin
     * By using this code it is possible to read AC Voltage, AC Current, Active Power, Reactive Power, Power Factor and Frequency.
     * 
     */
    
    
    #include 
    
    #define kNOERROR 0
    #define kREADERROR 1
    #define kWRITEERROR 2
    
    #define ADDRESS 0x60   // Slave Address = 96 (DIO_0 = DIO_1 = 0 (GND)), When DIO_0 = DIO_1 = 1 (connected to VCC through 10K pull up )Slave Address = 127 
    
    const uint16_t LEDPin = 13;
    const uint32_t WRITE = 0x00;
    const uint32_t READ = 0x80;
    const uint32_t COMMAND_MASK = 0x80;
    const uint32_t ADDRESS_MASK = 0x7F;
    
    double Voltage = 0;
    double VRMS = 0;
    double AmpsRMS = 0;
    double AmpsRMS1 = 0;
    
    unsigned long nextTime;
    bool ledOn = false;
    bool UseI2C = true;
    
    // Setup the demo board.
    void setup()
    {
        pinMode(LEDPin, OUTPUT);
        digitalWrite(LEDPin, LOW);
    
    	// Turn on the pullup so the determination of communication protocol can be made.
       // pinMode(ProtocolSelectPin, INPUT_PULLUP);
    
        if (UseI2C)
        {
            // Initialize I2C
            Wire.begin(); 
            Wire.setClock(100000);
        }
       
        Write(0x2F, 0x4F70656E);   // Unlock device
       // Write(0x1E, 0x00);   // Bypass_enable
        Write(0x25, 0x00);   // Numptsout
        Write(0x1C, 0x32);   // rms_avg, AC Voltage averaging done by writing the 50 decimal value in the rms_avg_1 register (0x1C)
        Write (0x1B, 0x0019C000);
         
        
        // Initialize serial
        Serial.begin(115200);
        // If the Arduino has built in USB, keep the next line
        // in to wait for the Serial to initialize
        while (!Serial);
    
     
        nextTime = millis();
    }
    
    /*
     * Every 500 milliseconds, read the ACS71020 and print out the values
     */
    void loop()
    {
        uint32_t vrms_irms;
        uint32_t vrms;
        uint32_t irms;
        uint32_t pactive;
        uint32_t paparent;
        uint32_t pimag;
        uint32_t pfactor;
        uint32_t numptsout;
        uint32_t vrmsavgonesec_irmsavgonesec;
        uint32_t vrmsavgonesec;
        uint32_t irmsavgonesec;
        uint32_t vrmsavgonemin_irmsavgonemin;
        uint32_t vrmsavgonemin;
        uint32_t irmsavgonemin;
        uint32_t pactavgonesec;
        uint32_t pactavgonemin;
        uint32_t vcodes;
        uint32_t icodes;
        uint32_t pinstant;
        uint32_t flags;
        float AC_Voltage;
        float factor_v;
        float AC_Current;
        float factor_i;
        float Power_Factor;
        float Power_Factor1;
    
            float div1 = 32767.00;
            float div2 = 32767.00;
            float pf,pf1,pact1,pact2,pact3,pact4,Active_Power,Active_Power_avg,Aparent_Power,papa1,pima1,Reactive_Power;
            int Frequency;
            
        // Every 1/2 second, toggle the state of the LED and read the ACS71020
        if (nextTime < millis())
        {
            Read(0x20, vrms_irms);
            Read(0x21, pactive);
            Read(0x22, paparent);
            Read(0x23, pimag);
            Read(0x24, pfactor);
            Read(0x25, numptsout);
            Read(0x26, vrmsavgonesec_irmsavgonesec);
            Read(0x27, vrmsavgonemin_irmsavgonemin);
            Read(0x28, pactavgonesec);
            Read(0x29, pactavgonemin);
            Read(0x2A, vcodes);
            Read(0x2B, icodes);
            Read(0x2C, pinstant);
            Read(0x2D, flags);
    
            vrms = vrms_irms;
              
            irms = (vrms_irms >> 16);
            pimag = pimag & 0x1FFFF;
           
            vrmsavgonesec = vrmsavgonesec_irmsavgonesec;
      
            irmsavgonesec = (vrmsavgonesec_irmsavgonesec >> 16);
     
            vrmsavgonemin = vrmsavgonemin_irmsavgonemin & 0x7FFF;
           
            irmsavgonemin = (vrmsavgonemin_irmsavgonemin >> 16) & 0x7FFF;
           
            pactavgonesec = pactavgonesec & 0x1FFFF;
           
            pactavgonemin = pactavgonemin & 0x1FFFF;
             
            
            factor_v = (vrmsavgonesec / div1);
            AC_Voltage = (factor_v * 240.00 * 1.795);
            Serial.print ("AC_Voltage (Vrms)=     ");
            Serial.println ( AC_Voltage  );
         
    
            float div = 32767.00;
            factor_i = (irms/div2);
            AC_Current = (factor_i*90.00*2);      // 2 is the conversion factor 
            Serial.print ("AC_Current (Arms) =  ");
            Serial.println ( AC_Current   );
           // delay(1000);
            
           if (pfactor<512)
            {
              Power_Factor = (pfactor/512.000);
              Serial.print ("Power_Factor =  ");
              Serial.println ( Power_Factor  );
            }
            else
             {
               pf1 = (2048- pfactor);
               Power_Factor = (pf1/512.000);
               if (Power_Factor >1)
               {
                Power_Factor = 1;
               }
               Serial.print ("Power_Factor =  ");
               Serial.println ( Power_Factor  );
             }
    
    
             if (pactive<32767)
            {
              pact1 = (pactive/32767.00);
              Active_Power = (pact1*6900*1.795);   // 1.795 is the converson factor
             
            }
            else
             {
               pact1 = (131071- pactive);
               pact2 = (pact1/32767.00);
               Active_Power = (pact2*6900*1.795);
               
             }
    
            
            if (pactavgonesec<32767)
            {
              
              pact3 = (pactavgonesec/32767.00);
              Active_Power_avg = (pact3*6900*1.795);
             Serial.print ("Active_Power_avg (Watt) =  ");
             Serial.println ( Active_Power_avg  );
             
            }
            else
             {
              
               pact3 = (131071- pactavgonesec);
               pact4 = (pact3/32767.00);
               Active_Power_avg = (pact4*6900*1.795);
               Serial.print ("Active_Power_avg (Watt)=  ");
               Serial.println ( Active_Power_avg  );
               
             }
    
          if (paparent<32767)
            {
              papa1 = (paparent/32767.00);
              Aparent_Power = (papa1*6900*1.795);
              Serial.print ("Aparent_Power (VA)=  ");
              Serial.println ( Aparent_Power  );
            }
            else
             {
              
               pact1 = (131071- pactive);
               pact2 = (pact1/32767.00);
               Active_Power = (pact2*6900*1.795);
               Serial.print ("Active_Power =  ");
               Serial.println ( Active_Power  );
               
             }
    
          if (pimag<65535)
            {
            
              pima1 = (pimag/65535.00);
              Reactive_Power = (pima1*6900*1.795);
              Serial.print ("Reactive_Power (VAR)=  ");
              Serial.println (Reactive_Power );
              
            }
            else
             {
              
               pact1 = (131071- pactive);
               pact2 = (pact1/32767.00);
               Active_Power = (pact2*6900*1.795);
               Serial.print ("Active_Power =  ");
               Serial.println ( Active_Power  );
               
             }
            
              Frequency = (32000.000/(numptsout*2));
              Serial.print ("Frequency (Hz) =  ");
              Serial.println (Frequency);
            
       
            nextTime = millis() + 500L;
    
            // Blink the LED every half second
            if (ledOn)
            {
                digitalWrite(LEDPin, LOW);
                ledOn = false;
            }
            else
            {
                digitalWrite(LEDPin, HIGH);
                ledOn = true;
            }
        }
    }
    
    /*
     * Read a register
     *
     *    address   - the address to be written
     *    value   	- the value that was read
     *    returns   - the error (0 otherwise)
     */
     
    uint32_t Read(uint8_t address, uint32_t& value)
    {
        uint16_t results = kNOERROR;
    
        if (UseI2C)
        {
            Wire.beginTransmission(ADDRESS);
            Wire.write(address);
            results = Wire.endTransmission();
    
            if (results == kNOERROR)
            {
                byte a,b,c,d;
                Wire.requestFrom(ADDRESS, 4);
    
                a = Wire.read();
                b = Wire.read();
                c = Wire.read();
                d = Wire.read();
    
                value = d;
                value = (value<< 8) | c;
                value = (value<< 8) | b;
                value = (value<< 8) | a;
    
     
                
                
            }
        }
        else
        {
          
        }
    
        return results;
    }
    
    /*
     * Write a register
     *
     *    address   - the address to be written
     *    value   	- the value to be written
     *    returns   - the error (0 otherwise)
     */
    uint16_t Write(uint8_t address, uint32_t value)
    {
        uint16_t results = kNOERROR;
    
        if (UseI2C)
        {
            Wire.beginTransmission(ADDRESS);
    		// Send the address then the value (least significant byte first)
            Wire.write(address);
            Wire.write(value);    
            Wire.write(value >> 8);
            Wire.write(value >> 16);
            Wire.write(value >> 24);
            results = Wire.endTransmission();
        }
        else
        {
          
        }
        if (address < 0x10)
        {
            delay(30);  // If writing to EEPROM delay 30 ms
        }
    
        
        
        return results;  // one curly bracket need to close
    }
    
    
    float ConvertUnsignedFixedPoint(uint32_t inputValue, uint16_t binaryPoint, uint16_t width)
    {
        uint32_t mask;
    
        if (width == 32)
        {
            mask = 0xFFFFFFFF;
        }
        else
        {
            mask = (1UL << width) - 1UL;
        }
    
        return (float)(inputValue & mask) / (float)(1L << binaryPoint);
    }
    
    
    float ConvertSignedFixedPoint(uint32_t inputValue, uint16_t binaryPoint, uint16_t width)
    {
        int32_t signedValue = SignExtendBitfield(inputValue, width);
        return (float)signedValue / (float)(1L << binaryPoint);
    }
    
    
    
     
    int32_t SignExtendBitfield(uint32_t data, uint16_t width)
    {
    	// If the bitfield is the width of the variable, don't bother trying to sign extend (it already is)
        if (width == 32)
        {
            return (int32_t)data;
        }
    
        int32_t x = (int32_t)data;
        int32_t mask = 1L << (width - 1);
    
        x = x & ((1 << width) - 1); // make sure the upper bits are zero
    
        return (int32_t)((x ^ mask) - mask);
    }

    Chip Values:-
    Power_Factor = 0.53
    Active_Power_avg (Watt)= 0.00
    Aparent_Power (VA)= 7.18
    Reactive_Power (VAR)= 3.02
    Frequency (Hz) = 285
    AC_Voltage (Vrms)= 10.75
    AC_Current (Arms) = 4.20
    Power_Factor = 0.50
    Active_Power_avg (Watt)= 0.76
    Aparent_Power (VA)= 24.57
    Reactive_Power (VAR)= 11.15
    Frequency (Hz) = 103

    Actual Values:-
    Frequency (Hz) = 51.117Hz
    AC_Voltage (Vrms)= 152.7VRMS
    AC_Current (Arms) = 0.212A


    We tried to change the conversion factor also, but the linearity of the voltage is not coming.
    Please solve the problem as soon as possible.



  12. #12
    Super Moderator
    Points: 80,237, Level: 69
    Achievements:
    7 years registered
    Awards:
    Most Frequent Poster 3rd Helpful Member

    Join Date
    Apr 2014
    Posts
    16,276
    Helped
    3692 / 3692
    Points
    80,237
    Level
    69

    Re: What is default slave address for the ACS71020

    Hi,

    Please solve the problem as soon as possible.
    Thanks a lot for this ...

    But first you need to give all your informations: (for sure also - as soon as possible )
    * complete schematic of all around the metering IC( power, power supply, load connections microcontroler connections periferial parts...)
    * wiring diagrams
    * scope pictures of input voltage and input current in one screen

    best if you could add
    * photos of your application
    * informations about the connected load (what is it? 1 phase? 3 phase? how connected?

    Klaus
    Please don´t contact me via PM, because there is no time to respond to them. No friend requests. Thank you.



--[[ ]]--