Using Linear Interpolation

For concise equations, we’ll use the following notations:

Using the (tempR, ADCR) and (tempH, ADCH) points, using a linear interpolation we have the following equation:

VADCVADCRtemptempR=VADCHVADCRtempHtempR

Given a temperature sensor ADC conversion value ADCm, we can infer a coarse value of the temperature tempC as:

[Equation 1]

tempC=tempR+ADCm12121ADCRINT1VR2121tempHtempRADCHINT1VH2121ADCRINT1VR2121

Note 1: in the previous expression, we’ve added the conversion of the ADC register value to be expressed in V

Note 2: this is a coarse value because we assume INT1V=1V for this ADC conversion.

Using the (tempR, INT1VR) and (tempH, INT1VH) points, using a linear interpolation we have the following equation:

INT1VINT1VRtemptempR=INT1VHINT1VRtempHtempR

Then using the coarse temperature value, we can infer a closer to reality INT1V value during the ADC conversion as:

INT1Vm=INT1VR+INT1VHINT1VRtempCtempRtempHtempR

Back to [Equation 1], we replace INT1V=1V by INT1V = INT1Vm, we can then deduce a finer temperature value as:

[Equation 1bis]

tempf=tempR+ADCmINT1Vm2121ADCRINT1VR2121tempHtempRADCHINT1VH2121ADCRINT1VR2121