Thermistor Temperature Sensor in LabVIEW
Thermistor Temperature Sensor in LabVIEW
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 𝑅' : -
J!"# K$
2. Calculate 𝑅D = J
%& LJ!"#
M
3. Calculate 𝑇. = NOP QF K# O3 QF K# '
4. Calculate 𝑇3 = 𝑇. − 273.15
//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));
%Steinhart constants
A = 0.001129148;
B = 0.000234125;
C = 0.0000000876741;
% Steinhart-Hart Equation
TempK = 1 / (A + (B * log(Rt)) + (C * log(Rt)^3));
# Steinhart Constants
A = 0.001129148
B = 0.000234125
C = 0.0000000876741
# Calculate Resistance
Rt = (Vout * Ro) / (Vin - Vout)
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