Gain and Offset Compensation for Voltage and current Measurement

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Gain and Offset Compensation for Voltage and current Measurement

1,324 Views
krishnakarthik6
Contributor II

Hello,

I am working on 12V Battery Management system project and am using MM9Z1_638 micro controller. I wanted to understand why we need to have the compensations configured for the voltage and temperatures (I know it's a basic question). It would be helpful if you provide an example that explain "what would be the output value if i provide  constant input values for the voltages and current and varying the compensation values

pastedImage_1.png

I got a below table where i am NOT able to interpret much. If possible please explain the below table as well

pastedImage_2.png

Thanks & regards,

Krishna Karthik

0 Kudos
Reply
2 Replies

1,113 Views
Q_man
NXP Employee
NXP Employee

Hi,

the compensation allows to handle device to device variations, influence of external circuitry and temperature effects, whilst still achieving precise results.

The compensation is a mathematical correction of the measured values, in this case a linear correction using a multiplication factor (gain compensation) and by adding a factor (offset compensation). The compensation is channel specific, that why you see different entries in above table.

Lets take the VSENSE2 as example (and explain the principle, not the detailed implementation):

going through the picture from left to right...

  • the input voltage vin is scaled by an internal voltage divider vin * 1/28 (desired sigma delta converter input voltage is 0.0 - 1.0V)
  • the scaled vin  is sampled by a sigma delta converter, which resolution is sdres = Vref / (2^16-1) = 1.25V / 65535 ~ 19uV
  • the compensation is using a gain and a offset value  out = in * gain + offset   (nominal gain = 1.0679, offset = 0)

This results into the following formula:

ACQ_VOLT =  ( vin * 1/28 * (2^16-1) / Vref  ) * gain + offset

with nominal values:

ACQ_VOLT = vin * 1/28 * 65535/1.25V * 1.0679  + 0 V

or a resulting channel resolution:

vsense2res = 28 * 1.25V / 65535 / 1.0679 = 0.5 mV / lsb

Having the flexibility to modify gain and offset values allows to maintain the 0.5mV/lsb resolution with errors in the system.

Example: If the scaling is 2 % to low 1/(0.98* 28) a 2% high gain compensation factor 1.0679 * 1.02 would maintain the 0.5mV/lsb resolution.

As the compensation is done in the digital domain the representation of the compensation code has to be known. The table above provides this information. The nominal gain of 1.0679 is represented with a gain code of 0x200. The resolution of the gain code is LSB = 0.000488.

The gain factor for e.g. 0x210 can be calculated:

gain = 1.0679 + (gaincode - default code) * LSB = 1.0679 + 16 * 0.000488 = 1.075708

Rgds

Wolfgang

1,113 Views
krishnakarthik6
Contributor II

Thanks for detailed explanation Wolfgang

0 Kudos
Reply