The tcDspThermERTJV1G class is used to compute the temperature for an NTC Thermistor. This implementation assumes the a Panasonic ERTJV1G device with a 25 deg-C resistance of 10K and a beta of 3375.
To compute temperature, the A/D count is first converted to voltage, followed by resistance, and finally temperature.
Voltage at the A/D converter ==> Vadc = (2.0) * (ADC Counts) / 4096 Assumes a 2 Volt reference and 12 bit ADC (such as the TLV254x)
Thermistor resistance ===> Rt = (Rf) * (Vin)/(Vadc) Assumes Vin 1.2 Volt (input voltage to thermistor)
T = 1 / ( (1/T0) + (ln(Rt/Rt0) / beta) )
where T is in degrees Kelvin and Rt0, T0 base resistance and temperature (Kelvin)
The temperature is converted to deg-C prior to storage.
This is a simple example of tcDspThermERTJV1G creation and usage:
{ unsigned short myAdcVal0, myAdcVal2; float t0, t2; // Create tcDspTherm objects // (Vref=3v, ADC=12 bits, 100 ohn feedback R, default beta) tcDspThermERTJV1G myFirstSensor(3.0, 12, 100.0); tcDspThermERTJV1G mySecondSensor(3.0, 12, 150.0); // this one with a 150 ohm feedback ... // add latest ADC values to sensors myFirstSensor->SetSensorVal(myAdcVal0); mySecondSensor->SetSensorVal(myAdcVal2); ... // retrieve latest temperatures t0 = myFirstSensor->GetSensorTemp(); t2 = mySecondSensor->GetSensorTemp(); }