Saving calibration settings

A project log for Power Analyzer based on a COTS Power Monitoring IC

The idea of this project is the development of a power analyzer based on the ACS71020 power monitoring IC.

SebastianSebastian 08/05/2021 at 13:030 Comments

After running the calibration wizard, the calibration data must be saved.

For the calibration of the ACS71020, 6 values are required:

  1. crs_sns for setting the coarse gain
  2. sns_fine for the fine trim
  3. qvo_fine to set the offset
  4. pacc_trim for active power
  5. VRMS calibration factor
  6. IRMS calibration factor

The first 4 values are stores in the chips own memory. The IRMS and VRMS calibration factors are set in the code directly. To enable changing these values without reprogramming the teensy, another way of storing these values has to be chosen.

Last week, I was searching the ACS-chip for empty memory locations. A much easier solution is to use the internal EEPROM of the Teensy 4.0, which can store up to 1080 bytes of data. EEPROMs are known to be limited in write-cycles (100 000 cycles in this case), but usually a calibration won't be done that often anyways. Both calibration factors are only 32 bytes each, so there is enough space left.


The internal EEPROM can be accessed with the EEPROM-library easily. Each write stores 1 byte at a given address, so 4 writes have to be done in total. Reading values is analogous. An mcu_read() and a mcu_write() function serve as a wrapper to take care of this task.

Of course, a command from the serial input should be able to set those values as well.

Function changes

The calcVRMS and calcIRMS function both use the calibration factors. The constants are now variables. Everything else remains the same under the assumption, that AC calibration will be done with 230Vrms.