0% found this document useful (0 votes)
205 views26 pages

Thermistor Temperature Sensor in LabVIEW

This document discusses using a thermistor temperature sensor and LabVIEW to measure temperature. It describes connecting a thermistor and resistor in a voltage divider circuit to a USB-6008 data acquisition device. It then explains how to use the Steinhart-Hart equation to calculate temperature from the thermistor's resistance, which varies with temperature. The document provides LabVIEW code examples and a Python script for measuring temperature continuously and displaying results.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
205 views26 pages

Thermistor Temperature Sensor in LabVIEW

This document discusses using a thermistor temperature sensor and LabVIEW to measure temperature. It describes connecting a thermistor and resistor in a voltage divider circuit to a USB-6008 data acquisition device. It then explains how to use the Steinhart-Hart equation to calculate temperature from the thermistor's resistance, which varies with temperature. The document provides LabVIEW code examples and a Python script for measuring temperature continuously and displaying results.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 26

https://www.halvorsen.

blog

Thermistor Temperature
Sensor in LabVIEW
Hans-Petter Halvorsen
Contents
• We will use LabVIEW to read
Temperature data from a Thermistor
Temperature Sensor
• We will use a USB-6008 DAQ Device
or I/O Module
Hardware
• DAQ Device (e.g., USB-6008)
• Breadboard
• Thermistor 10K (Temperature Sensor)
• Wires (Jumper Wires)
• Resistor 10 kΩ
Software
• LabVIEW
–Graphical Programing Environment
• DAQmx Driver
–Driver used for Communication with
external Hardware such as USB-6008
USB-6008
• USB-6008 is a DAQ Device from NI
• Can be used within LabVIEW
• NI-DAQmx Driver
• It has Analog and Digital
Inputs and Outputs
USB-6008
4 different types of Signals:
• AO – Analog Output
• AI – Analog Input
• DO – Digital Output
• DI – Digital Input
Thermistor
A thermistor is an electronic component that changes
resistance to temperature - so-called Resistance
Temperature Detectors (RTD). It is often used as a
temperature sensor.
Our Thermistor is a so-called NTC (Negative Temperature Coefficient).
In a NTC Thermistor, resistance decreases as the temperature rises.
There is a non-linear relationship between resistance and excitement. To find the
temperature we can use the following equation (Steinhart-Hart equation):
1 ! where 𝐴, 𝐵, 𝐶 are constants given below
[Wikipedia]
= 𝐴 + 𝐵 ln(𝑅) + 𝐶 ln(𝑅)
𝑇 𝐴 = 0.001129148, 𝐵 = 0.000234125 𝑎𝑛𝑑 𝐶 = 8.76741𝐸 − 08
Steinhart-Hart Equation
To find the Temperature we can use Steinhart-Hart Equation:
1
= 𝐴 + 𝐵 ln(𝑅) + 𝐶 ln(𝑅) "
𝑇!
This gives:
1
𝑇. = !
𝐴 + 𝐵 ln 𝑅 + 𝐶 ln 𝑅
𝐴 = 0.001129148
Where the Temperature 𝑇! is in Kelvin
𝐵 = 0.000234125
𝐴, 𝐵 𝑎𝑛𝑑 𝐶 are constants
𝐶 = 0.0000000876741
The Temperature in degrees Celsius will then be:

𝑇3 = 𝑇. − 273.15
Wiring
𝑅 = 10 𝑘Ω
5V

AI0

GND
Thermistor
Wiring
Voltage Divider
The wiring is called a “Voltage divider”:
+5V

10𝑘 Thermistor

Analog In (AI)

𝑅 = 10𝑘Ω

GND
[https://en.wikipedia.org/wiki/Voltage_divider]
General Voltage Divider

𝑅$ Formula:
+

𝑉() 𝑅&
+
𝑉!"# = 𝑉$%
- 𝑅# 𝑉%&' 𝑅' + 𝑅&
-

https://learn.sparkfun.com/tutorials/voltage-dividers/all
Voltage Divider for our System
Voltage Divider Equation: 𝑅* = 10𝑘Ω
+
𝑅D
𝑉BCD = 𝑉EF 5𝑉 𝑉() +
𝑅G + 𝑅D - 𝑅' 𝑉%&'
We want to find 𝑅' : -

"!"# #$ 𝑅' - 10k Thermistor. This varies with


𝑅! = temperature. From Datasheet we
"%& $"!"# know that 𝑅' = 10𝑘Ω @25℃
Steps:
1. We wire the circuit on the Breadboard and connect it to the DAQ device
2. We measure 𝑉%&' using the DAQ device
3. We calculate 𝑅' using the Voltage Divider equation
4. Finally, we use Steinhart-Hart equation for finding the Temperature
Pseudo Code
1. Get 𝑉BCD from the DAQ device

J!"# K$
2. Calculate 𝑅D = J
%& LJ!"#

M
3. Calculate 𝑇. = NOP QF K# O3 QF K# '

4. Calculate 𝑇3 = 𝑇. − 273.15

5. Present 𝑇3 in the User Interface


Pseudo Code
float Vin = 5;
float Ro=10000;
//Voltage Divider
float Rt = (Vout*Ro)/(Vin-Vout);

//Steinhart Constants
float A = 0.001129148;
float B = 0.000234125;
float C = 0.0000000876741;

//Steinhart-Hart Equation
float TempK = 1 / (A + (B * ln(Rt)) + (C * ln(Rt)**3));

//Convert from Kelvin to Celsius


float TempC = TempK - 273.15;
LabVIEW Example
Continuous Reading
Formula Node
MathScript Node
MathScript Code
Vin = 5;
Ro=10000; %10k Resistor
Rt = (Vout*Ro)/(Vin-Vout);

%Steinhart constants
A = 0.001129148;
B = 0.000234125;
C = 0.0000000876741;

% Steinhart-Hart Equation
TempK = 1 / (A + (B * log(Rt)) + (C * log(Rt)^3));

% Convert from Kelvin to Celsius


TempC = TempK - 273.15;
Pure LabVIEW Code
MATLAB Script
LabVIEW Python Integration
LabVIEW Python Integration
thermistor.py import math as mt

# Function for finding Temperature in degrees Celsius


def thermistorTemp(Vout):
# Voltage Divider
Vin = 5;
Ro = 10000 # 10k Resistor

# Steinhart Constants
A = 0.001129148
B = 0.000234125
C = 0.0000000876741

# Calculate Resistance
Rt = (Vout * Ro) / (Vin - Vout)

# Steinhart - Hart Equation


TempK = 1 / (A + (B * mt.log(Rt)) + C * mt.pow(mt.log(Rt),3))

# Convert from Kelvin to Celsius


TempC = TempK - 273.15

return TempC
LabVIEW Python Integration
Hans-Petter Halvorsen
University of South-Eastern Norway
www.usn.no

E-mail: [email protected]
Web: https://www.halvorsen.blog

You might also like