You are on page 1of 7

Project

Build a Temperature Sensor


1

py
co
n
A sensor is a device that measures a physical quantity and converts it into an electrical signal.
Some sensors measure physical properties directly, while other sensors use conversions or
calculations to determine the value. Sensors are usually categorized by the type of property that
tio
they measure. A good sensor is sensitive to the property under investigation, but should have
limited influence on the property being measured. For example, a temperature sensor should be
small in size and made from a material with good response. Inserting a very large or very cold
thermometer into a hot liquid will cool the liquid somewhat as heat is transferred to the
measuring device. Sensors usually need to be calibrated. Sometimes the calibration relationship
ua

is a simple linear one and other times it is more complex.

Temperature sensors are often built from electronic components called thermistors. A thermistor
is a device whose resistance varies with temperature (the name comes from a combination of the
terms thermal and resistor). Typical thermistors are made from ceramic semiconductors or
from platinum wires wrapped around ceramic mandrels or spindles. Thermistors usually have
al

negative temperature coefficients (NTC), meaning the resistance of the thermistor decreases as
the temperature increases. Depending on the material and fabrication process, the typical
operating range for thermistors is 50C to 150C. The small size of most thermistors results in a
Ev

rapid response to temperature changes making them very useful for control systems requiring
quick feedback. They are very rugged and better able to handle mechanical vibration or thermal
shock than other temperature sensors. Thermistors have excellent interchangeability due to their
low cost, precision, and tolerance over a temperature range. Thermistors are used extensively in
many applications, including automobile engines, digital thermostats, rechargeable battery
packs, circadian rhythm devices, and fluid-flow measurements.

PROJECT DESIGN REQUIREMENTS


In this Project, you will build and calibrate a temperature sensor. First, you will construct a
voltage divider circuit using a thermistor. Then you will write a LabVIEW program to convert
the raw voltage reading of the thermistor into Celsius temperature units. Your program should

Engineering Projects with NI LabVIEW and Vernier Vernier Software & Technology P1 - 1
Project 1

simultaneously collect data from a commercial sensor to verify the readings from your
homemade sensor. The temperature values from your homemade sensor and the commercial
sensor, as well as the thermistor voltage readings, should be displayed on the front panel.

MATERIALS
SensorDAQ, LabQuest, or LabQuest Mini Vernier Breadboard Cable
LabVIEW thermistor
computer 15 k resistor
USB cable breadboard
Vernier Surface Temperature Sensor

PROJECT SETUP
Construct a voltage divider circuit
1. Wire the resistor and thermistor to the Breadboard Cable (see Figure 1).

Figure 1 Wiring diagram for temperature sensor


2. Insert the BTA connector on the Breadboard Cable into Channel 1 on the interface.

Connect the commercial sensor to the interface


1. Connect the Surface Temperature Sensor to Channel 2 on the interface.

2. Connect the interface to the computer. If you are using a LabQuest, make sure it is turned on.

PROJECT BACKGROUND INFORMATION


In this Project, you can determine the temperature of a thermistor if the resistance of the
thermistor is known. The resistance-temperature relationship of a thermistor is nonlinear, but can
be approximated using the Steinhart-Hart model. This model gives the absolute temperature of a
thermistor (in Kelvin) as a function of its resistance.

1
T

K 0 K1 ln RT K 2 ln RT 3

P1 - 2 Engineering Projects with NI LabVIEW and Vernier


Build a Temperature Sensor

The resistance of the thermistor (RT) can be measured indirectly by placing it in a voltage divider
circuit with a known resistor (R1) as shown in the diagram below.

Figure 2 Voltage divider circuit


This is a common circuit design used to measure resistance. The output voltage, Vout, is related
to Vin as follows:

RT
V out V in
T
R R 1

where Vin is the voltage supplied by the interface. In this Project this voltage comes from the pin
labeled +5V on the breadboard connector. To start with, use the typical value for your
interface. Typical values depend on the interface used: SensorDAQ=5.08 volts, LabQuest=5.31
volts, and LabQuest Mini=5.29 volts. Vout is the measured voltage from your homemade sensor,
and R1 is the value of the resistor placed in series with the thermistor (RT).

From the equation above, you can algebraically solve for the thermistor resistance.

V out R1
R T
V in V out
This equation can be simplified, because the circuit resistance is known (R1 = 15,000 ).

V out 15000
RT
V in V out
You can configure the Vernier Analog Express VI to read the raw voltage from your homemade
sensor. When the Analog Express VI is placed on the block diagram, a configuration window
appears. The commercial sensor plugged into Channel 2 is automatically identified; however,
since you are building a custom sensor in Channel 1, you will need to manually configure this
channel. Under Configured Channels, select the Manual option and then click the Add Channel
button at the top of the window. You will be choosing the 0 to 5 V option under CHANNEL 1 in
the Activate Channel window. Note: Do not change the values for the K0, K1, and K2
coefficients in the configuration window of the Analog Express VI.

Engineering Projects with NI LabVIEW and Vernier P1 - 3


Project 1

Figure 3 Configuration window for manual setup of a custom sensor


The Analog Express VI can be used in your program to measure the raw voltage of your
homemade sensor after it has been configured and closed. With these measurements you can
solve for the resistance of the thermistor and substitute that value into the Steinhart-Hart
equation to solve for the temperature. Since the Steinhart-Hart equation calculates temperatures
in Kelvin units, you should subtract 273.15 degrees from your final answer to display your
temperature values in degrees Celsius as shown in the equation below. This will allow for an
easier comparison to the commercial sensor. We recommend using the Formula Express VI
(found in the Express Arithmetic & Comparison function palette) to build the equation.

1
T 273.15

K 0 K1 ln RT K 2 ln RT
3

PROJECT TIPS
1. The Steinhart coefficients (K0, K1 and K2) for your thermistor can be found from your
manufacturers published data. For the thermistor we recommend, the coefficients are: K0 =
0.00102119, K1 = 0.000222468, and K2 = 1.33342E-7.

2. A good data collection rate for the Surface Temperature Sensor is 10 samples per second.

3. The Analog Express VI collects data for a fixed amount of time. For an indefinite data
collection length, check the Repeat option in the Analog Express VIs Set Timing
configuration window.

4. We recommend using the Vernier Surface Temperature Sensor for this Project; however, the
Vernier Stainless Steel Temperature Probe will also work. Be aware that its response will be
much slower due to the stainless steel casing on the probe. The steel acts as a heat sink

P1 - 4 Engineering Projects with NI LabVIEW and Vernier


Build a Temperature Sensor

causing the sensor to gain and lose heat more slowly. After a short period of time, however,
the Vernier Stainless Steel Temperature Probe should read approximately the same
temperature as your homemade sensor.

5. Refer to Appendix E for additional information about the Vernier Surface Temperature
Sensor and Breadboard Cable.

PROJECT TROUBLESHOOTING
If the thermistor value does not match the temperature reading of the commercial temperature
sensor in Channel 2,

1. Measure the voltage supplied by the interface (Vin). You can measure the voltage using a
digital multimeter or a Vernier Differential Voltage Probe. Substitute the actual voltage into
your equation and see if that improves the calibration.

2. Make sure the calculations in the program are correct. Run these calculations as a stand-
alone VI with some test values for the Raw Voltage. For the thermistor we recommend, a
Raw Voltage of 3.3 should give a Temperature Out value around 0C; a voltage of 1.7 should
give a temperature around 30C; and a voltage of 0.2 should give a temperature around
100C. Thermistors with different Steinhart coefficients will have different test values.

3. Measure the resistance (R1). You can measure the resistance using a digital multimeter.
Substitute the actual values into your equation and see if it improves your calibration.

4. Check the Steinhart coefficients (K0, K1 and K2) for your thermistor against your
manufacturers published data.

Engineering Projects with NI LabVIEW and Vernier P1 - 5


Project 1

CHALLENGE DESIGN REQUIREMENTS


Note: Do not attempt the Challenge until you have completed the Project Design Requirements.

Write a LabVIEW subVI to give the user the ability to display temperature values in Kelvin or in
degrees Celsius or Fahrenheit. Modify your original Project program to change the units
simultaneously on both your homemade sensor and on the Vernier Surface Temperature Sensor.
The user should be able to switch between units while the program is running.

CHALLENGE BACKGROUND INFORMATION


One way to make a subVI is to convert an existing section of code. Add the equations for unit
conversions to your original Project program. To convert Celsius temperature units to Kelvin,
add 273.15. To convert Celsius degrees to Fahrenheit degrees, use the following equation.

TFahrenheit = 1.8TCelsius + 32
Use the Positioning tool to select the section of the block diagram you want to turn into a subVI
and then choose Create SubVI from the Edit menu. The selected code is automatically turned
into a functional subVI that can be saved and reused.

P1 - 6 Engineering Projects with NI LabVIEW and Vernier


Vernier Lab Safety Instructions Disclaimer
THIS IS AN EVALUATION COPY OF THE VERNIER STUDENT LAB.

This copy does not include:


z Safety information
z Essential instructor background information
z Directions for preparing solutions
z Important tips for successfully doing these labs

The complete Engineering Projects with NI LabVIEW and Vernier manual includes
12 projects as well as essential teacher information. The full lab book is available for purchase
at: http://www.vernier.com/cmat/epv.html

Vernier Software & Technology


13979 S.W. Millikan Way Beaverton, OR 97005-2886
Toll Free (888) 837-6437 (503) 277-2299 FAX (503) 277-2440
info@vernier.com www.vernier.com

You might also like