Thermistors and Temperature

In MSXI, the BMS system (Plutus) uses a lookup table to efficiently compute the temperature of the battery pack, given a 12-bit ADC reading.

The ADC reading was determined using NTC thermistors (unlike MSX, which used thermocouples), and then put through an equation in order to determine the temperature.

Equations

Steinhart–Hart equation

The Steinhart-Hart equation models the resistance of a semiconductor at various temperatures. You can read up on the equation online, but this is the equation of interest (which was taken from the NTCLE100E3 datasheet).

,

where  is the reference resistance of the thermistor taken at room temperature (25 °C)

Voltage-Divider equation

A voltage-divider is a circuit which turns a large voltage into a smaller one, using two resistors in series and an input voltage. This equation states that the output voltage is directly proportional to the input voltage and the ratio of  and  , where   is the fixed resistor, and   is the power supply voltage.

ADC equation

An ADC reports a ratio between and the supply voltage, using however many bits of resolution.

, where   is the system voltage,   is the voltage measured, and   is the value read back from the ADC.

Derivation

The goal is to determine Temperature (T) as a function of the ADC-reading.

Given the voltage-divider equation [1]:

and the ADC equation [2]:

we solve for as a function of the ADC reading by setting  equal to each other

         (ADC reading * V_cc) / (2 ^ (bits of resolution) - 1) = (R * V_cc) / (R + R_ref)
                  ADC reading / (2 ^ (bits of resolution) - 1) = R / (R + R_ref)    (V_cc cancels)
                                                             R = (ADC reading * (R + R_ref)) / (2 ^ (bits of resolution) - 1)
                                                             R = ((R * ADC reading) + (R_ref * ADC reading)) / (2 ^ (bits of resolution) - 1)
                            R * (2 ^ (bits of resolution) - 1) = (R * ADC reading) + (R_ref * ADC reading)
      (R * (2 ^ (bits of resolution) - 1)) - (R * ADC reading) = (R_ref * ADC reading)
            R * ((2 ^ (bits of resolution) - 1) - ADC reading) = (R_ref * ADC reading)


                                                             R = (R_ref * ADC reading) / ((2 ^ (bits of resolution) - 1) - ADC reading)       [3]

Plug [3] into the Steinhart-Hart equation and then read off the values of the Steinhart-Hart coefficients from the datasheet, and then you have an equation for temperature as a function of the ADC reading.


T(R) = 1 / (a + (b * log(R / R_25)) + (c * (log(R / R_25)^2)) + (d * (log(R / R_25)^3))),


where R = (R_ref * ADC reading) / ((2 ^ (bits of resolution) - 1) - ADC reading)