I am using an ACS71020 3.3 V I2C version hooked up to an ESP32. I have connected the IC as proposed in the datasheet. Rsense used is 1.8 kΩ as proposed in the evaluation board user manual for 230-240 VRMS.

With a load connected I get reasonable results for IRMS when reading register 0x20, but VRMS is much lower than expected, and I guess as a result PRMS is also not correct.

Proposed schematic

enter image description here

Above is my implementation (I2C pull-ups are present).

It is also stated that the maximum voltage for the VINP pin is 0.275 V. I measured Rsense with a multimeter and got something around 0.100 VRMS (which will not be close to 0.275 V in amplitude).

I thought that might be an issue and I tried to recreate the scenario in LtSpice:


And indeed it showed that the the voltage across R5 would be around 0.100 VRMS. I was not sure of the role of R3 and R5, so I tried removing them and got ~0.290 V max amplitude; changing Rsense to 1.7 kΩ would yield ~0.275 V max amplitude exactly.

I removed R3 and R5 from my PCB, but I still got pretty similar results (I will attach the results later, when I get my hands on the test PCB again)

Regarding the code, maybe I am doing something wrong there as well, but as far as I understand the basic flow should be:

  • Read the values from the VRMS and IRMS registers;
  • Transform them from Q number() format to float;
  • Multiply VRMS by 325 (full-scale voltage, or should it 230?) and IRMS by 30 as I have a 30 A AC71020 version.

I expect that the values would oscillate based on at which time of the cycle they are being read by the ESP32, therefore they should by averaged.

Code snippet:

    void acs171020_read_2_15Bytes(byte address) {
      uint16_t Irms;
      uint16_t Vrms;
      byte buff[4];
      Wire.write( 0x20);
      Wire.requestFrom(0x66, 4);
      int nrrr = 0;
      while (Wire.available()) {   // slave may send less than requested
        char c = Wire.read();    // receive a byte as character
        buff[nrrr++] = c;
      Vrms = (buff[1] << 8) + buff[0];
      bitClear(Vrms, 15);
      Irms = (buff[3] << 8) + buff[2];
      bitClear(Irms, 15);
      float testVRM =  ((float)Vrms) * 0.00003051757; //or /32768.0
      float testVRMMM = qToFloat<uint16_t>(Vrms, 15);

      // both give same value
     testVRMMM = testVRMMM *325;

     float testIRM = qToFloat<uint16_t>(Irms, 14); // ((float)Irms) * 0.00006103515;

     float testIRMS =  ((float)Irms) * 0.00006103515; //or /32768.0
     testIRMS = testIRMS * 30;

To sum up : Are two 1 MΩ resistors really needed on the VIN line? Am I missing something crucial in the code part?

UPDATE: OK, in order to improve improve performance a bit and let the IC actualy do its job, I have enabled the customer mode and set the register 0x1C to make an average of 62 samples per minute. Then I read 0x27 once a second. The Q to float value is now ~0.3121337891 so to get 230 the full-scale voltage should then considered to be 736.86351184 V. Where does this number come from, how can I verify it?

  • \$\begingroup\$ A colleague and I were just looking into this same issue an hour before you posted -- what chances! Will post anything we learn. Also, I believe all of your units should be 'V' instead of 'mV'. \$\endgroup\$ Nov 18, 2019 at 19:30
  • \$\begingroup\$ Will look forward to hearing from you. And yes it should be just V(fixed). \$\endgroup\$
    – Miaso
    Nov 20, 2019 at 17:03
  • \$\begingroup\$ Yes, an old question, but the OP actually removed R4 (1 Meg) and not R5 (1.8k). R3 and R4 need to remain in the circuit to provide safe differential measurement of line voltage, although neutral (N) should be near GND potential. \$\endgroup\$
    – PStechPaul
    May 20 at 5:01

1 Answer 1


If you get 150mV amplitude (300mVpp) with 230VRMS and the maximum voltage measured by the part is 275mV amplitude then your full scale voltage is actually 230VRMS * (275mV/150mV) = 421.66V. This seems like normal design to me, providing some margin for safety as well as providing a range of measurement values for inputs above and below the 230V nominal.

Does using 421.66 as the full scale voltage give you a reasonable answer?

  • \$\begingroup\$ Thanks for pointing out how to calculate the full scale voltage, was a bit confused on that. \$\endgroup\$
    – Miaso
    Nov 20, 2019 at 16:33
  • \$\begingroup\$ In case of suggested schematic (with 4x1 M Ohm R and Rsense 1.8k ) when 232 Vrms connected, I get ~0.101 Vrms on the VINP VINN input pins. I read the 0x20 register after ZVC (zero voltage crossing) happens,QtoFloat value is in range ~0.224335 to ~0.2410 , then its multiplied by 421.66. In a second I get 50 samples and average them. And the average is in range from ~95 to ~97 Volts. If i would consider full scale voltage something like 1000 V then the results would be in 230 Vrms range. But i have no explanation why it should be this high number. \$\endgroup\$
    – Miaso
    Nov 20, 2019 at 16:33

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.