Thermocouples are a common type of temperature sensor. See the Temperature Sensors App Note for recommendations selecting a temperature sensor. For more information about thermocouples, see the Thermocouples App Note.
U6 Type K Thermocouple Readings
The U6 internal temperature sensor is calibrated to measure ambient temperature. When measuring thermocouples connected to the AIN on the U6, the thermocouple cold junction is at the U6 screw terminals, which are typically a few degrees warmer than ambient.
Go through Using a Thermocouple with the U6 before continuing.
See the example “thermocouple-u6.ctl” on the DAQFactory for UD page. The following steps reproduce the example configuration:
-
Right click on SEQUENCES in the Workspace and select Add Sequence. Name the new sequence
StartUp. -
In the sequence editor, check the box labeled Auto-Start.
-
Configure the
StartUpsequence as follows:using("device.labjack.") try include("c:\program files (x86)\labjack\drivers\labjackud.h") catch() include("c:\program files\labjack\drivers\labjackud.h") endcatch AddRequest(0, LJ_ioPUT_CONFIG, LJ_chAIN_RESOLUTION, 0, 0,0) AddRequest(0, LJ_ioPUT_AIN_RANGE, 0, LJ_rgBIP1V, 0, 0) GoOne(0) ErrorHandler()-
The U6 supports different AIN resolution index and gain/range settings. The two
AddRequestcalls in the script above sets the resolution index to 0 (default) and the AIN0 gain/range to ± 0.1 V.
-
-
Click Apply in the sequence editor to save your changes, then go to Debug - Run this Sequence from the DAQFactory menu to run the sequence.
-
Click on CHANNELS and add a channel for a thermocouple reading on AIN0.
-
Set Channel Name to
Temperature0. -
Set Device Type to
LabJackUD. -
Set D# to
0. This will take the AIN reading on the first found LabJack device. This can be changed to target a specific LabJack device as outlined in 2 - Installing and Starting. Note that the first parameter toAddRequestandGoOnein theStartUpscript should always match D#. -
Set I/O Type to
A to D(analog input measurement). -
Set Chn # to
0for AIN0. -
Set Timing to
1to take a measurement once per second.
-
-
In CHANNELS, add a channel for the thermocouple CJC.
-
Set Channel Name to
CJC. -
Set Device Type to
LabJackUD. -
Set D# to
0. This will take the AIN reading on the first found LabJack device. This can be changed to target a specific LabJack device as outlined in 2 - Installing and Starting. Note that the first parameter toAddRequestandGoOnein theStartUpscript should always match D#. -
Set I/O Type to
A to D(analog input measurement). -
Set Chn # to
14for AIN14, which reads the internal temperature sensor as a value in Kelvin. -
Set Timing to
1to take a measurement once per second.
-
-
Click Apply in the channel list to save your changes.
-
Click on CONVERSIONS and add a conversion to adjust the CJC value.
-
Click the Add button to add a new conversion.
-
Name the new conversion
AdjustedCJC. -
Change the formula as follows. This converts an input temperature value in Kelvin to Celsius and then applies an offset of 3 °C (to account for the U6 screw terminals being warmer than the ambient reading returned by AIN14):
Value-273.15+3
-
-
Add a conversion for type K thermocouple conversion math.
-
Click the Add button to add a new conversion.
-
Name the new conversion
ThermocoupleK. -
Enter the following formula for Type K thermocouple conversion. This will do a conversion using the input value for the thermocouple voltage and the
CJCchannel for cold junction compensation:
TypeK(Value, CJC[0])
-
-
Click Apply in the conversions list to save your changes.
-
Click on CHANNELS and add the new conversions to your channels.
-
Under the
CJCchannel set Conversion toAdjustedCJC. WhenCJCis read it will now return the newly calculated CJC temperature in °C. -
Under the
Temperature0channel set Conversion toThermocoupleK. WhenTemperature0is read it will now return the converted thermocouple temperature in °C. -
Click Apply to keep your changes.
-
-
Click on Page_0 under PAGES. Add a display to show the thermocouple temperature readings and CJC temperature readings.
-
Right click on the page and select Displays → Variable Value. This will create a new variable value display on the page. You should see it in the Workspace under Page_0. By default it should be labeled
_VariableValue. -
Rename the component
Thermocouple0, set the component CaptionText toThermocouple0 Temperature:, Expression toTemperature0[0], and UnitsText to°C. See 7.4.1 Editing Properties in the DAQFactory User’s Guide. -
Right click on the page and select Displays → Variable Value to create another display for CJC temperature. Rename the component
CJCDisplay, set the component CaptionText toCJC Temperature:, Expression toCJC[0], and UnitsText to°C.
-
-
You should now see Page_0 updating once per second to display thermocouple temperature and CJC temperature.
U3 Type K Thermocouple Readings
The U3 internal temperature sensor is calibrated to measure ambient temperature. This should be a reasonably accurate value for cold junction temperature when using an LJTick-InAmp. An external sensor such as the LM34 could provide greater CJC accuracy.
Go through Using a Thermocouple with the LabJack U3 before continuing.
See the example “thermocouple-ljtia-u3.ctl” on the DAQFactory for UD page. The following steps reproduce the example configuration:
-
Right click on SEQUENCES in the Workspace and select Add Sequence. Name the new sequence
StartUp. -
In the sequence editor, check the box labeled Auto-Start.
-
Configure the
StartUpsequence as follows. This ensures that FIO6 and FIO7 are set to analog:using("device.labjack.") try include("c:\program files (x86)\labjack\drivers\labjackud.h") catch() include("c:\program files\labjack\drivers\labjackud.h") endcatch // Set FIO6 and FIO7 to analog (0b1100000=0d192) ePut(0, LJ_ioPUT_ANALOG_ENABLE_PORT, 0, 192, 16); -
Click on CHANNELS and add a channel for a thermocouple reading on AIN6.
-
Set Channel Name to
Temperature0. -
Set Device Type to
LabJackUD. -
Set D# to
0. This will take the AIN reading on the first found LabJack device. This can be changed to target a specific LabJack device as outlined in 2 - Installing and Starting. Note that the first parameter toePutin theStartUpscript should always match D#. -
Set I/O Type to
A to D(analog input measurement). -
Set Chn # to
6for AIN6 (i.e. FIO6). -
Set Timing to
1to take a measurement once per second.
-
-
In CHANNELS, add a channel for the thermocouple CJC.
-
Set Channel Name to
CJC. -
Set Device Type to
LabJackUD. -
Set D# to
0. This will take the AIN reading on the first found LabJack device. This can be changed to target a specific LabJack device as outlined in 2 - Installing and Starting. Note that the first parameter toePutin theStartUpscript should always match D#. -
Set I/O Type to
A to D(analog input measurement). -
Set Chn # to
30, which reads the internal temperature sensor as a value in Kelvin. -
Set Timing to
1to take a measurement once per second.
-
-
Click Apply in the channel list to save your changes.
-
Click on CONVERSIONS and add a conversion to adjust the CJC value.
-
Click the Add button to add a new conversion.
-
Name the new conversion
AdjustedCJC. -
Change the formula as follows. This converts an input temperature value in Kelvin to Celsius:
Value-273.15
-
-
Add a conversion for type K thermocouple conversion math.
-
Click the Add button to add a new conversion.
-
Name the new conversion
ThermocoupleK. -
Enter the following formula for Type K thermocouple conversion. This will do a conversion using the input value (adjusted for InAmp gain and offset) for the thermocouple voltage and the
CJCchannel for cold junction compensation. This formula assumes an InAmp gain of x51 and offset of 1.25 V:
TypeK((Value - 1.25) / 51, CJC[0])
-
-
Click Apply in the conversions list to save your changes.
-
Click on CHANNELS and add the new conversions to your channels.
-
Under the
CJCchannel set Conversion toAdjustedCJC. WhenCJCis read it will now return the newly calculated CJC temperature in °C. -
Under the
Temperature0channel set Conversion toThermocoupleK. WhenTemperature0is read it will now return the converted thermocouple temperature in °C. -
Click Apply to keep your changes.
-
-
Click on Page_0 under PAGES. Add a display to show the thermocouple temperature readings and CJC temperature readings.
-
Right click on the page and select Displays → Variable Value. This will create a new variable value display on the page. You should see it in the Workspace under Page_0. By default it should be labeled
_VariableValue. -
Rename the component
Thermocouple0, set the component CaptionText toThermocouple0 Temperature:, Expression toTemperature0[0], and UnitsText to°C. See 7.4.1 Editing Properties in the DAQFactory User’s Guide. -
Right click on the page and select Displays → Variable Value to create another display for CJC temperature. Rename the component
CJCDisplay, set the component CaptionText toCJC Temperature:, Expression toCJC[0], and UnitsText to°C.
-
-
You should now see Page_0 updating once per second to display thermocouple temperature and CJC temperature.
Using an LM34 for CJC
CJC readings can be modified to use a dedicated CJC sensor. The following steps can be used to set up an LM34 sensor for CJC.
-
Configure a DAQFactory project for thermocouple measurements as outlined in the sections above.
-
Click on CHANNELS and add a channel called
LM34. Set Chn# to the AIN measuring your LM34. For example, if you have an LM34 on AIN2 you would set Chn# to2. Click Apply to keep your changes. -
Click on CONVERSIONS and a new conversion called
LM34C. Use the following formula to convert LM34 voltage to °C:
(55.56*Value)+ 255.37 - 273.15
Click Apply to keep your changes. -
Click on CHANNELS and change Conversion for the
LM34channel toLM34C. TheLM34channel is now configured to return a temperature in °C. Click Apply to keep your changes. -
Update any thermocouple conversion formulas and CJC displays to use the
LM34channel for CJC. Click Apply to keep your changes.
UE9 Thermocouple Measurements
The UE9 is no longer available for purchase. This section is for existing UE9 users only.
UE9: the UE9 has a resolution of 16 bit so has 65536 steps instead of the 4096 of the U3. This helps some. The UE9 also has some built in gain. Typically you get about 76 microvolts minimum step noise free, and 15 microvolts RMS. This means you get about 1 or 2 degrees C of resolution. This isn't bad and might work. For the exact specs, please review Appendix B of the UE9 Users Guide. If you need better than this, then you will need to get an LJTick-InAmp from LabJack to amplify the thermocouple signal. If you aren't in a rush for your measurements and the temperature is changing slowly, you can also use DAQFactory to oversample, taking multiple measurements and averaging them. This is done by checking the Avg? column of your input channel in the channel
table and entering the number of oversample points in the #Avg column.
UE9 Pro: the UE9 Pro gets you an additional 2 bits of resolution over the UE9 (27 microvolts noise free minimum step, 5 microvolts RMS) which is enough to read a thermocouple directly with a reasonable amount of precision. You can use an amplifier as well if you want higher speed readings.
UE9 Thermocouple Acquisition in DAQFactory
These steps can be used to acquire thermocouple readings with the UE9.
-
Right click on SEQUENCES: in the Workspace and select Add Sequence. Give it the name StartUp and click OK.
-
In the sequence editor, check the box labeled Auto-Start, then put the following in the script:
global offset = 0
using("device.labjack.")
include("c:\program files\labjack\drivers\labjackud.h")
AddRequest(0, LJ_ioPUT_CONFIG, LJ_chAIN_RESOLUTION, 18, 0,0)
AddRequest(0, LJ_ioPUT_AIN_RANGE, 0, LJ_rgUNI5V, 0, 0)
GoOne(0)
The first line is used to adjust for any voltage offset in the signal. The next two lines are the standard lines required to access the LabJack UD from script. The next three lines set the gain and resolution of the UE9. We've chosen the most generic range for AIN0. Your UE9 might be able to use a tighter AIN range and achieve higher precision.
-
Click Apply, then go to Debug - Run this Sequence from the DAQFactory menu to actually set these settings.
-
Create a channel for AIN0 as described back in 3.1 to read the voltage.
-
To accurately read the thermocouple we also need to read the temperature of the cold junction which is essentially the temperature of the LabJack. This is internal A to D channel #133. Create another channel called CJC to read A to D channel #133. Click Apply to save your changes and start reading the inputs.
Now we can convert the thermocouple voltage input into temperature:
-
Click on CONVERSIONS: in the workspace, then Add. Call the conversion Thermocouple and put the following Formula:
TypeK(Value - Offset, CJC[0]-273.15)
There are different formulas for each thermocouple type, such as TypeJ().
-
Go back to the channel table and for the AIN0 channel you created in step 4, select the Thermocouple conversion you just created and click Apply.
That is it. You can now display or plot the input channel. You can adjust the offset variable to adjust for any bias in
the LabJack by changing it in the sequence we created in step 2 and rerunning it, or by creating a screen control to
adjust its value (shown in the sample).
Sample file: LJGuideSamples\UE9_Thermocouple.ctl
The sample doesn't use a conversion, but instead puts the formula in the components themselves. Conversions are typically easier since you typically only want to see the temperature, however, for calibration you often want the raw voltage and so can't use a conversion.