9.3 - Thermocouples (Applies to UD-Series) | LabJack

9.3 - Thermocouples (Applies to UD-Series)

Thermocouples are a very common way to measure temperature. They come in a wide variety of forms and have a large range. Do to their small voltage output and something called a cold junction, they are, however, slightly more challenging to read. Most applications need a temperature range of about -50 to +150C, though, and for these applications you might want to consider using a silicon type sensor, as they are cheaper, more accurate and much easier to use. Examples of these are the EI-1022 and EI-1034 sold by LabJack.

Thermocouples are simply two different metals that meet at a single point. Due to a general property of metals, a small voltage is generated that is proportional to the temperature of this junction. There are many different types of thermocouples, identified by a letter such as J type or K type which determine the metals used which then determines the temperature range and voltage output scaling. In all cases, this voltage is between about -5 and 5 millivolts, a rather small voltage.

It gets more complicated though: since the terminals on your DAQ device (the LabJack) are made of yet another metal, there are two more points where different metals are touching which are generating a voltage proportional to the temperature of this terminal. This is called the cold junction. In order to get an accurate thermocouple reading, you have to adjust for the cold junction. This is called cold junction compensation.

Finally, we should mention that most thermocouples are only accurate to about 1 or 2 degrees C, though calibration can help a little with this.

Now that you have the basics down we can talk about how to read a thermocouple. There are several choices depending on what LabJack you have:

U3: the U3 has a resolution of 12 bit and a range of +/-2.44, the minimum voltage you can read is about 1.2 millivolts (4.88 volts / 4096 steps). Because a thermocouple typically outputs around 40 microvolts per degC, you only get a precision of about 30 degrees! Obviously that isn't going to work so you have to use an amplifier such as the LJTIA or EI1040, both available from LabJack, to amplify that millivolt signal before it gets to the converter.

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 LJTIA or EI1040 amplifier 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 by 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.

Now that we have that covered lets go over using both methods: unamplified and amplified.

This applies only to the UE9 and UE9 Pro because the U3 doesn't have the precision to read the low voltages output by a thermocouple. Please see the last section (7.5) for a full explanation.

1) Right click on SEQUENCES: in the Workspace and select Add Sequence. Give it the name StartUp and click OK.

2) 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_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.

3) Click Apply, then go to Debug - Run this Sequence from the DAQFactory menu to actually set these settings.

4) Create a channel for AIN0 as described back in 3.1 to read the voltage.

5) 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:

6) 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().

7) 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.

When using an amplifier, the steps are pretty much identical to the unamplified version except we need to adjust the input based on the amplification:

1) Right click on SEQUENCES: in the Workspace and select Add Sequence. Give it the name StartUp and click OK.

2) In the sequence editor, check the box labeled Auto-Start, then put the following in the script:

``````
global offset = 0
global gain = 51
``````

If using a UE9, you can add these lines as well:

``````
using("device.labjack.")
include("c:\program files\labjack\drivers\labjackud.h")
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 second to adjust for the gain of the amplifier. The next two optional UE9 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.

3) Click Apply, then go to Debug - Run this Sequence from the DAQFactory menu to actually set these settings.

4) Create a channel for AIN0 as described back in 3.1 to read the voltage.

5) 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 for the UE9 and #30 for the U3. Create another channel called CJC to read A to D channel #133 if using a UE9 or #30 for a U3. Click Apply to save your changes and start reading the inputs.

Now we can convert the thermocouple voltage input into temperature:

6) Click on CONVERSIONS: in the workspace, then Add. Call the conversion Thermocouple and put the following Formula:

``````
TypeK((Value - Offset)/gain, CJC[0]-273.15)
``````

There are different formulas for each thermocouple type, such as TypeJ().

7) 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 samples). Same thing with the gain.

It doesn't really matter what amplifier you use. You can just adjust the offset and gain appropriately.

Sample file: LJGuideSamples\U3_LJTIA_Thermocouple.ctl

Sample file: LJGuideSamples\UE9_LJTIA_Thermocouple.ctl

These 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.

Sample file: LJGuideSamples\U3_LJTIA_Thermocouple_Conversion.ctl

This is identical to the U3_LJTIA_Thermocouple sample, but uses a Conversion to convert from volts to temperature. You can see the Conversion by clicking CONVERSIONS: in the workspace. A Conversion converts the data as it comes in so the channel (FIO4) shows temperature immediately. You never see volts. Conversions can also be applied to multiple channels. That said, for thermocouples, you will probably want a unique conversion for each thermocouple since each input might have a slightly different Offset and Gain. In this case, you'd need to replace "Offset" and "Gain" in the conversion with the actual number for the corresponding input once you have figured these out.