MEVIHUB

Precision Temperature Monitoring with NTC Thermistors and TMS320

Overview

Precision temperature monitoring is essential for maintaining the effectiveness and dependability of numerous systems and devices in the dynamic world of electronics. The combination of NTC (Negative Temperature Coefficient) thermistors and TMS320 microcontrollers is an intriguing area worth exploring, regardless of your background in industrial automation, automotive engineering, or simply as a tech enthusiast looking to delve into the complexities of temperature control.

Introduction:

On a cool morning, imagine yourself drinking a perfect cup of tea. You can’t help but be in awe of the water’s ability to perfectly know when to transition from cold to hot as the steam rises from your cup. It appears as though the liquid is intelligently regulating its temperature. That seemingly magical metamorphosis, however, was made possible by precise temperature control, which was made possible by innovative devices like the NTCALUG01T103FLA NTC thermistor.

Temperature-sensitive NTC thermistors adjust their electrical resistance in response to changes in temperature. They are extraordinary instruments for highly accurate temperature measurement and management. Their name, “Negative Temperature Coefficient,” relates to the fact that they become less resistant as temperature increases, a quality that makes them extremely useful in a variety of applications.

Meet the NTCALUG01T103FLA NTC Thermistor

A Vishay NTC (Negative Temperature Coefficient) thermistor is the NTCALUG01T103FLA. This thermistor has unique properties that make it suited for a variety of temperature measurement and control applications. It was created for temperature sensing applications. Let’s examine its features, operation, and calculation of the beta value in more detail.

Specifications of NTCALUG01T103FLA:

The Working Principle

Here’s a more detailed explanation of the working principle of the NTCALUG01T103FLA thermistor:

In the case of NTC thermistors, the most commonly used mathematical model is the Steinhart-Hart equation, which is an empirical equation that describes the resistance-temperature relationship:

  1. R(T) is the resistance at temperature T.
  2. R25​ is the resistance at a reference temperature, typically 25°C (298.15K).
  3. B is the beta value, a material-specific constant.
  4. T is the absolute temperature in Kelvin.
  5. T25​ is the reference temperature in Kelvin.

Something magical happens when we connect this NTC thermistor to a TMS320 microcontroller. The TMS320 allows us to instantly translate the resistance readings from the thermistor into valid temperature data. Circuit diagrams and code snippets are used in this procedure to connect the physical world of the thermistor with the digital world of data analysis.

Implementing Theory in Practice

Let’s now put theory into action. Using the NTC thermistor and the TMS320 microcontroller, we’ll show you how to determine temperature values. Here, control and precision come together. You can accomplish extremely accurate temperature monitoring and adjustment by comprehending and efficiently using the resistance-temperature relationship.

NTC Thermistor Interfacing Circuit Diagram

NTC Thermistor Pinout

A Table of Precision

We have compiled a table of temperature values ranging from -40°C to +150°C for people who enjoy numbers. This table illustrates how these parameters are connected based on the given equation by including corresponding resistance and voltage readings. It is a picture showing accurate temperature monitoring in action.

Explanation:

Calculate the T1 value for 25 degrees Celsius

  1. To calculate the T1 value for 25 degrees Celsius, you can use the formula to convert temperature from Celsius to Kelvin.
  2. T1​(K)=25°C+273.15

Where:

  1. Temperature (°C): The temperature values range from -40°C to +150°C with a 2°C interval.
  2. Resistance (RT) at 10kΩ, B=3435: This column represents the resistance values calculated using the given equation, with a fixed resistance at 25°C (10000Ω), B coefficient (3435), and the corresponding temperature.
  3. 1/Temperature (1/K): The reciprocal of the temperature in Kelvin (K). The formula used is 1/Temperature in K=1/Temperature in °C+273.151/Temperature in K=1/Temperature in °C+273.15.
  4. 1/Temperature (1/K): The reciprocal of the temperature in Kelvin (K). The formula used is 1/Temperature in K=1/Temperature in °C+273.151/Temperature in K=1/Temperature in °C+273.15.
  5. 1/T1 – 1/Temperature (1/K): The difference between the reciprocal of T1 (298K) and the reciprocal of the temperature in Kelvin. This is a part of the formula to calculate resistance (RT).
  6. -B(1/T1 – 1/Temperature): The negative of the B coefficient (3435) multiplied by the difference in reciprocal temperatures (1/T1 – 1/Temperature).
  7. exp(-B(1/T1 – 1/Temperature)): The exponential term in the formula, which is the exponential of the previously calculated value (-B(1/T1 – 1/Temperature)).
  8. RT2 (Ohms): The resistance (RT) at the given temperature is calculated using the formula: RT​=10000⋅exp(−B(1/T1−1/Temperature)).
  9. Opamp Output Voltage (V): This column represents the output voltage calculated based on the resistance values (RT2) and the 10V supply voltage of the op-amp. The formula used is

Opamp Voltage (V): The op-amp voltage, which is the same as the Opamp Output Voltage, is calculated in this column.

This table provides a comprehensive overview of how resistance, temperature, and voltage are related based on the given equation for temperatures ranging from -40°C to +150°C.

Here are three examples of calculating the resistance (RT), temperature, and op-amp output voltage (opamp outVopamp out​) using the provided equation and the given parameters:

Example 1:

Given:

Example 2:

Given:

Example 3:

Given:

Click to expand

Final Code

/*
 * ADC_Main_v2.c
 *
 *  Created on: XXXX
 *      Author: Admin
 */


#include "DSP28x_Project.h"
#include "math.h"



void InitADC(void);
void InitAdcAIO(void);
void ADC_Inint(void);
void AdcSocConfig(void);
__interrupt void  adc_isr (void);


#define TABLE_SIZE 96
int temperatureTable[96] = {
                            -40, -38, -36, -34, -32, -30, -28, -26, -24, -22, -20, -18, -16, -14, -12, -10,-8, -6, -4, -2, 0, 
							2, 4, 6, 8, 10, 12, 14, 16, 18, 20, 22, 24, 26, 28, 30, 32, 34, 36, 38, 40, 42, 44, 46, 48, 50, 52, 
							54, 56, 58, 60, 62, 64, 66, 68, 70, 72, 74, 76, 78, 80, 82, 84, 86, 88, 90, 92, 94, 96, 98, 100, 102, 
							104, 106, 108, 110, 112, 114, 116, 118, 120, 122, 124, 126, 128, 130, 132, 134, 136, 138, 140, 142, 
							144, 146, 148, 150
};

int TempVolt[96] = {
                       3172, 3156, 3138, 3118, 3097, 3073, 3048, 3020, 2990, 2958, 2923, 2886, 2847, 2805, 2761, 2714, 2665, 2614, 
					   2560, 2505, 2448, 2388, 2328, 2266, 2203, 2138, 2074, 2008, 1943, 1877, 1811, 1746, 1682, 1618, 1555, 1493, 
					   1433, 1373, 1316, 1260, 1205, 1152, 1101, 1052, 1004, 959, 915, 873, 832, 794, 757, 721, 688, 655, 625, 595, 
					   568, 541, 516, 492, 469, 448, 427,  407, 389, 371, 354, 339, 323, 309, 295, 282, 270, 258, 247, 237, 227, 217,
					   208, 199, 191, 183, 176, 169, 162, 156, 149, 144, 138, 133, 128, 123, 118, 114, 109, 105
};

// Input Voltage
unsigned int  uiIpVolt[16] = {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0};
unsigned long ulIpVolt_Sum     = 0;

unsigned int  uiIpVolt_ADC     = 0;
unsigned int  uiIpVolt_ADC_Cnt = 0;

float voltage;
float temp;

Uint16 temperature; // Initialize temperature
void main(void)
{
    InitSysCtrl();
    InitPieCtrl();
    InitPieVectTable();
    InitGpio();

    InitAdc();
    InitAdcAio();
    ADC_Inint();

    EALLOW;
    PieVectTable.ADCINT1 = &adc_isr;
    EDIS;

    PieCtrlRegs.PIEIER1.bit.INTx1 = 1;
    IER |= M_INT1;

    EINT;
    ERTM;


    AdcRegs.ADCSOCFRC1.all = 0x03;
    while(1)
    {
        AdcRegs.ADCSOCFRC1.all = 0x03;
    }

}



void ADC_Inint(void)
{
    EALLOW;
    AdcRegs.ADCCTL1.bit.INTPULSEPOS   = 1;    //ADCINT1 trips after AdcResults latch
    AdcRegs.INTSEL1N2.bit.INT1E       = 1;    //Enabled ADCINT1
    AdcRegs.INTSEL1N2.bit.INT1CONT    = 0;    //Disable ADCINT1 Continuous mode
    AdcRegs.INTSEL1N2.bit.INT1SEL     = 1;   //setup EOC15 to trigger ADCINT1 to fire

    AdcRegs.ADCSOC0CTL.bit.CHSEL      = 0;    //set SOC0 channel select to ADCINA0
    AdcRegs.ADCSOC1CTL.bit.CHSEL      = 1;    //set SOC1 channel select to ADCINA1

    AdcRegs.ADCSOC0CTL.bit.TRIGSEL    = 0;    //set SOC0 start trigger on SW
    AdcRegs.ADCSOC1CTL.bit.TRIGSEL    = 0;    //set SOC1 start trigger on SW

    AdcRegs.ADCINTSOCSEL1.bit.SOC0    = 1;     //ADCINT1 will trigger SOC0
    AdcRegs.ADCINTSOCSEL1.bit.SOC1    = 1;     //ADCINT1 will trigger SOC1


    AdcRegs.ADCSOC0CTL.bit.ACQPS      = 6;   //set SOC0 S/H Window to 7 ADC Clock Cycles, (6 ACQPS plus 1)
    AdcRegs.ADCSOC1CTL.bit.ACQPS      = 6;   //set SOC0 S/H Window to 7 ADC Clock Cycles, (6 ACQPS plus 1)

    EDIS;

}



__interrupt void  adc_isr (void)
{

    // Average the input voltage
    ulIpVolt_Sum                = ulIpVolt_Sum - uiIpVolt[uiIpVolt_ADC_Cnt] + AdcResult.ADCRESULT0;
    uiIpVolt[uiIpVolt_ADC_Cnt]  = AdcResult.ADCRESULT0;
    uiIpVolt_ADC                = ulIpVolt_Sum >> 4;
    uiIpVolt_ADC_Cnt++;
    if(uiIpVolt_ADC_Cnt >= 16)  uiIpVolt_ADC_Cnt = 0;
    unsigned int Ui_P;

    for (Ui_P = 0; Ui_P < TABLE_SIZE - 1; Ui_P++) {
        if (uiIpVolt_ADC > TempVolt[0]) {
            temperature = temperatureTable[0];
            break;
        }
        if ((uiIpVolt_ADC < TempVolt[Ui_P])  && (uiIpVolt_ADC >= TempVolt[Ui_P+1]))
        {
            temperature = temperatureTable[Ui_P];
            break;
        }
    }

    AdcRegs.ADCINTFLGCLR.bit.ADCINT1 = 1;               //Clear ADCINT1 flag reinitialize for next SOC
    PieCtrlRegs.PIEACK.all = PIEACK_GROUP1;             // Acknowledge interrupt to PIE

}

Exit mobile version