SNIA049 November   2022 TMP61 , TMP61-Q1 , TMP63 , TMP63-Q1 , TMP64 , TMP64-Q1

 

  1.   Abstract
  2.   Trademarks
  3. 1Introduction
  4. 2Single-Point Offset Correction
  5. 3Oversampling
  6. 4Software Filtering
  7. 5Noise Reduction With Oversampling and Software Filtering
  8. 6Summary

Single-Point Offset Correction

The TMP6x thermistors are unique in that these thermistors have a fairly consistent error across temperature as compared to traditional negative temperature coefficient (NTC) thermistors, as shown in Figure 2-1. As a result, an offset correction can be performed at any temperature to remove tolerance errors from the TMP6x and other components in the thermistor biasing circuit, such as VCC, VRef, ADC LSB, and RBias errors. The errors remaining after the offset are the parts per million (ppm) errors of each component across temperature. Using low-ppm components in your system helps mitigate the impact of these remaining errors on temperature measurements.

GUID-20221017-SS0I-T9KT-XKKQ-RPLFMN8K2S9J-low.png Figure 2-1 TMP6x Error Before and After Single-Point Offset Correction

To determine the offset for each TMP6x thermistor, a highly-accurate temperature reference is needed, such as the TMP117, an I2C temperature sensor with ±1°C max accuracy from –20°C to 50°C. Use software filtering during the offset calculation to determine a consistent and accurate offset. In the following pseudocode, 5,000 ADC samples of the voltage across the TMP6x are rapidly taken, and a software filter with an alpha of 0.001 is used to eliminate noise from the offset value. The final filtered voltage is converted to a temperature measurement using the 4th order polynomial from the Thermistor Design Tool. Finally, the offset is calculated as the difference between the TMP6x filtered temperature and the reference temperature, and that value is can be stored and applied to all future temperature measurements for that TMP6x thermistor.

int sensorPin = ; // EDIT indicate pin # for analog input to read VTEMP from TMP6
float Vbias = ; // EDIT indicate bias voltage
int ADC_bits = ; // EDIT indicate number of bits of resolution for ADC
int ADC_resolution = powf(2, ADC_bits) - 1; // number of ADC steps
int rawADC; // variable for measured ADC value
float VTEMP; // variable for measured voltage
float VTEMPfiltered; // variable for filtered voltage
float alpha = 0.001; // recommend using strong alpha value to get most robust temperature reading
int samples = 5000; // recommend at least 5,000 samples to give software filter time to stabilize before calculating offset
float offset; // variable to store offset value
float TMP6filtered; // variable to hold the filtered temperature measurement
float referenceTemp; // temperature measurement from high-accuracy temperature reference (ex. TMP117)

/* EDIT 4th order polynomial coefficients from Thermistor Design Tool */
float THRM_A0 = ;
float THRM_A1 = ;
float THRM_A2 = ;
float THRM_A3 = ;
float THRM_A4 = ;

/* in SETUP code */
rawADC = analogRead(sensorPin);
VTEMPfiltered = Vbias / ADC_resolution * rawADC; // initialize the VTEMPfiltered variable to the first measured value to reduce ramp time

/* in MAIN code */
for(int i=0; i<samples; i++){
	rawADC = analogread(sensorPin);
	VTEMP = Vbias / ADC_resolution * rawADC;
	VTEMPfiltered = VTEMPfiltered - (alpha * (VTEMPfiltered - VTEMP)); // continually filter VTEMP over 5,000 samples
}

TMP6filtered = (THRM_A4 * powf(VTEMPfiltered, 4)) + (THRM_A3 * powf(VTEMPfiltered, 3)) + (THRM_A2 * powf(VTEMPfiltered, 2)) + THRM_A1 * VTEMPfiltered + THRM_A0

referenceTemp = ; // EDIT insert code to read reference temp here

offset = TMP6filtered - referenceTemp; // calculate offset as difference between TMP6filtered and referenceTemp