Thermistor Interfacing with MSP-EXP430G2 TI Launchpad

Overview of Thermistor

 

A thermistor is a variable resistance element, whose resistance varies with change in temperature. The change in resistance value is a measure of the temperature.

Thermistors are classified as PTC (Positive Temperature Coefficient) or NTC (Negative Temperature Coefficient).

They can be used as current limiters, temperature sensors, overcurrent protectors, etc.

For more information about the thermistor and how to use it, refer to the topic NTC Thermistor in the sensors and modules section.

 

Connection Diagram of NTC Thermistor with MSP-EXP430G2 TI Launchpad

Interfacing Thermistor With MSP-EXP430G2 TI Launchpad
Interfacing Thermistor With MSP-EXP430G2 TI Launchpad

 

Measure Temperature using NTC Thermistor With MSP-EXP430G2 TI Launchpad

Measuring temperature using thermistor.

 

Here, an NTC type thermistor of 10kΩ is used. NTC of 10kΩ means that this thermistor has a resistance of 10kΩ at 25°C.

The voltage across the 10kΩ resistor is given to the ADC of the MSP-EXP430G2 TI Launchpad board.

The thermistor resistance is found out using a simple voltage divider network formula.

Rth + 10k = \frac{3.3 * 10k}{Vout}

 

Rth is the resistance of the thermistor

Vout = 3.3 * \frac{10k}{10k+Rth}

  

Vout is the voltage measured by the ADC

Vout = \frac{3.3 * ADCval}{1023}

 

The temperature can be found out from thermistor resistance using the Steinhart-Hart equation.

Temperature in Kelvin = 1 / (A + B[ln(R)] + C[ln(R)]^3) 

where A = 0.001129148, B = 0.000234125 and C = 8.76741*10^-8

and R is the thermistor resistance.

 

Tread Carefully: MSP-EXP430G2 TI Launchpad board has a RAM of 512 bytes which is easily filled, especially while using different libraries. There are times when you need the Serial buffer to be large enough to contain the data you want and you will have to modify the buffer size for the Serial library. While doing such things, we must ensure that the code does not utilize more than 70% RAM. This could lead to the code working in an erratic manner, working well at times, and failing miserably at others. 

There are times when the RAM usage may exceed 70% and the codes will work absolutely fine, and times when the code will not work even when the RAM usage is 65%. 

In such cases, a bit of trial and error with the buffer size and/or variables may be necessary.

 

Thermistor Temperature Measurement Code for MSP-EXP430G2 TI Launchpad

#include <math.h>
const int thermistor_output = A3;

void setup() {
  Serial.begin(9600);	/* Define baud rate for serial communication */
}

void loop() {
  int thermistor_adc_val;
  double output_voltage, thermistor_resistance, therm_res_ln, temperature; 
  thermistor_adc_val = analogRead(thermistor_output);
  output_voltage = ( (thermistor_adc_val * 3.3) / 1023.0 );
  thermistor_resistance = ( ( 3.3 * ( 10.0 / output_voltage ) ) - 10 ); /* Resistance in kilo ohms */
  thermistor_resistance = thermistor_resistance * 1000 ; /* Resistance in ohms   */
  therm_res_ln = logf(thermistor_resistance);
  /*  Steinhart-Hart Thermistor Equation: */
  /*  Temperature in Kelvin = 1 / (A + B[ln(R)] + C[ln(R)]^3)   */
  /*  where A = 0.001129148, B = 0.000234125 and C = 8.76741*10^-8  */
  temperature = ( 1 / ( 0.001129148 + ( 0.000234125 * therm_res_ln ) + ( 0.0000000876741 * therm_res_ln * therm_res_ln * therm_res_ln ) ) ); /* Temperature in Kelvin */
  temperature = temperature - 273.15; /* Temperature in degree Celsius */
  Serial.print("Temperature in degree Celsius = ");
  Serial.print(temperature);
  Serial.print("\t\t");
  Serial.print("Resistance in ohms = ");
  Serial.print(thermistor_resistance);
  Serial.print("\n\n");
  delay(1000);
}

 

Video of Temperature Measurement using Thermistor and MSP-EXP430G2 TI Launchpad


Components Used

TI Launchpad MSP-EXP430G2
TI Launchpad MSP-EXP430G2
1
Thermistor
Thermistor is a type of resistor whose resistance changes in accordance with change in temperature. It is used to measure the temperature over small range typically -100 °C to 300 °C.
1

Downloads

Thermistor_Interfacing_With_TI_Launchpad_INO Download
Ad