This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

PGA305: Calculating Pgain and Tgain

Part Number: PGA305
Other Parts Discussed in Thread: USB2ANY

Tool/software:

Hi Ti,

We are developing Python software to automate the calibration and verification process for pressure sensors utilizing the PGA305 IC. We have chosen Python because we already have developed drivers for the pressure controller, temperature controller, multimeter, reference sensors, etc. We have extended the USB2ANY.dll C++ class provided by TI with additional functions to handle the calibration sequence.

Our question is: How do we calculate Pgain and Tgain in step 4 below, after collecting all ADC points.

Could you please confirm that our understanding so far is correct?

  1. Setting Initial Conditions
    We set the pressure to, for example, 10 bar and the temperature to a certain value x. We then read Padc and Tadc values, converting raw hexadecimal values to integers using the 2's complement method.
    - Example: 0xFECBE6 translates to -78874

  2. DAC Value Adjustment
    We determine which DAC value outputs the expected current (mA) for the given pressure. This is done by setting an arbitrary DAC value, reading the mA, calculating the error, applying the offset, and resetting the DAC value. This process is repeated until the read mA approximates the expected mA.
    - Example: At 10 bar, the expected current is 4.177 mA, which corresponds to a DAC value of 2207

  3. Repeating for Multiple Points
    We repeat the above steps with different pressures and temperatures to gather multiple data points.

  4. Calculating digital Gain
    How do we calculate Pgain and Tgain? What is it limited by?

  5. Calculating Offsets
    We compute Poffset and Toffset by calculating the mean between the lowest and highest ADC values.
    - Example: (Pmax - Pmin) / 2 = Poffset

  6. Applying Gains and Offsets
    We apply Pgain, Poffset, Tgain, and Toffset to all ADC values.
    - Example: (Padc * Pgain) + Poffset

  7. Normalizing ADC Values
    We normalize the Padc and Tadc values by dividing them by 2^22.
    - Example: -78874 / 2^22 = -0.018805027

  8. Normalizing DAC Values
    We normalize the DAC value by dividing it by 2^14.
    - Example: 2207 / 2^14 = 0.13470458984

  9. Polynomial Coefficient Calculation
    This is the formula provided in the datasheet:
    F(P, T) = (h0 + h1 * T + h2 * T^2 + h3 * T^3) + (g0 + g1 * T + g2 * T^2 + g3 * T^3)*P + (n0 + n1 * T + n2 * T^2 + n3 * T^3)*P^2 + (m0 + m1 * T + m2 * T^2 + m3 * T^3)*P^3

    We use NumPy's least squares method to calculate third-order polynomial coefficients (h0...m3) based on the normalized data and the third-order polynomial formula provided in the datasheet. This function is not restricted to 3P3T or 4P4T configurations and can utilize multiple points for more accurate polynomial.
    - Example: F(Padc, Tadc) = DAC

  10. Unnormalizing Coefficients
    We unnormalize the coefficients by multiplying them by 2^22. We then use the 2's complement method to convert the coefficients, as well as Pgain, Tgain, Poffset, and Toffset, into hexadecimal values, which are subsequently uploaded to the EEPROM.

  11. Verification
    Finally, we power off and then power on the sensor to enter compensation mode. We verify the calibration by measuring the mA output with a multimeter.

Your confirmation or any corrections on this procedure would be greatly appreciated.
Thank you


Best Regards,
Mohammad Waqas Imtiaz