Thermocouples -> manual processing

Hi all,

I want to use Type K and Type J thermocouplers attached to the same module. To do so, i have to set the module to give out Raw-Values which I have to process and calculate by myself. How is this done the right way?

This is how I’ve done it so far:

  1. Raw-Value => Micro-Volts
  2. Compensation-Temperature => Micro-Volts
  3. Sum of both => Temperature

But it seems like I’m doing something wrong or I miss something. At first I set the module to Type K Mode and noted the temperature. When I try to do the conversation by myself, the temperatures are are not the same, the are off by about 4°.

I also tried a second sensor with another module set to internal conversion to check the temperatures side by side. As the temperature rises, the difference between both increases, so they are drifting apart.

I tried several approaches but nothing seems do work satisfying. I have done the Micro-Volt to Temperature conversion with mathimatical functions as well as with interpolation between several points. As well as the Raw to Micro-Volt calculation i tried different methods. Somethings wrong here.

How did you manage this?

Hallo Michael,

you can perform the conversion from µV to temperature using function block MTLookUpTable.

To do this, you need to obtain the thermocouple table. Example:

Gruss

Stephan

Hi Stephan, thank you for your response.

I do the lookup in a similar way and it seems to work like it should. I get the correct Temperature values for a given voltage. So i don’t think that the problem is there. Sorry, it seems like i didn’t mention this.

I rather think that i do something wrong with the Raw to µV conversion.

The module is set to 2µV/Bit. For the conversion I tried
Raw x 2.125
Raw x 2
-65534 + ( Raw + 32768 ) x ( 131068 / 65535 )
-70000 + (Raw + 32768 ) x ( 140000 / 65535 )

None of them looks great

For the conversion of the compensation-temperature to micro-volt i set up another lookup table as well, i tested it seperately and its working as intended.

Hi Mike,

the characteristic curves for Types J and K are non-linear (particularly below 0°C). Therefore, you cannot linearize them using a formula; instead, you should use the FUB.

The selection of 1 µV/bit or 2 µV/bit affects only the resolution of the measurement, not the accuracy.

I know that it’s not linear and my lookup-table is working. When I manually set a Voltage, the correct Temperature is calculated.

But I’m wondering about something else: I looked for several tables for the K Type for comparison. All of them contained the same values, the one you posted has some altered values though. So I’m confused which values are the correct ones, and why there are different tables available. I thought this is standardized :wink:

It would be interesting to know, how the AT-Module handles the internal linearisation and conversion.

Hello Mike,

A couple of quick clarifying questions:

What thermocouple module are you using? Some of the newer X20AT modules have per-channel configuration of the thermocouple type.
What are you using for temperature compensation, and what unit is that value in?

Also, I believe your computation methodology is flawed. Based on my reading, you are doing the following (pseudocode):

Temperature = uV_To_Temp(Raw_To_uV(Raw-Value) + Temp_To_uV(Comp-Temp));

The nonlinearity of the uV-Temp relationship will cause this to fail. If you already have the compensation temperature, then it should be added outside of the conversion from Raw-Value to differential temperature. So it should look like:

Temperature = Raw_To_Temp(Raw-Value) + Comp-Temp;

Does that work better if you don’t convert the Comp-Temp to uVolts?

Best Regards,
Austin

Currently we use AT6402 and AT2402 in our products.

I read the compensation temperature with AsIOAccRead through the channel “CompensationTemperature”. I receive °C.
Sadly, it does not work better with your approach, the temperature drops by 1°, so it increases the difference even more.

Does the module use another temperature than the one I can read out for compensation?
Is my Raw to µV conversion even right?

Does the module use another temperature than the one I can read out for compensation?

There is only one compensation temperature for the X20AT6402/2402 when using the Function Model - Internal Compensation.

Is my Raw to µV conversion even right?

The compensation from Raw-Value to uVolts, standard resolution should be:

uVolts := 2.125 * INT_TO_REAL(Raw-Value);

For high resolution, it should be:

uVolts := 0.2125 * DINT_TO_REAL(Raw-Value);

There is no offset from 0, so there should be no addition or subtraction within the equation.
Analog inputs (resolution = 0.1°C)

Since you indicate that the module reads a K-type thermocouple correctly when configured, I recommend just working backwards from that known information.

  • Configure the module to read a K-type thermocouple.
  • Place the thermocouple in a stable, temperature difference situation (the thermocouple temp should be as stable as possible, and different than the temperature at the cold-junction at the X20 module).
  • Read the output temperature from the module (IO mapping, just Temperature## or Temperature##_H_Res).
  • Read the compensation temperature from the module (using the AsIOAcc library).
  • Determine the expected uVolts by the following equation:
    uVolts := KtypeReverseLookupTable(Temperature## - Comp-Temp).
  • Change the configuration of the module to read uVolts.
  • Check the calculated vs read value in uVolts.

If you have multiple modules + thermocouples, you could do this test in parallel and save the configuration download.

For example, if you place the thermocouple on the heat vent of a laptop that is venting a consistent 40 C air, and the X20 module is in a cool office at 22 C, I would expect the following:

Output temperature = 40 C
Compensation temperature = 22 C
Temperature difference = 18 C
Using a K-type thermocouple chart, at 18 C I would expect to see ~0.718 mV or ~718 uV.
718 uV would read as ~337 Raw-Value (2 uV per bit, standard resolution)

Best Regards
-Austin

Hi Austin here are my results

I read the sensor with the module configured for K-Type => 231
Compensation Temperature => 428 (The Hardware is lying flat on my table currently)
231 - 428 = -197 => ~-750µV should be about -353 in Raw

Configured as µV it reads -446 Raw

Temperatures are scaled by x10 so are my lookup-tables.

Kind regards
Mike

Hey Mike,

Did you happen to also read the Compensation Temperature when you changed the configuration to reading uV?

Assuming the conversion is accurate, the 446 Raw equates to ~948 uV and -24.5 C difference on the K-type thermocouple table. This would represent an ~5 C increase in the cold junction temperature or decrease in thermocouple read temperature (or some combination thereof).

Just checking, this is a K-type thermocouple, correct? The ~948 uV on a J-type thermocouple would represent ~-19 C difference (~0.7 C change over time). Probably is a coincidence, but I figured we’d best check that off the list of possibilities.

Also, just make sure you are using the latest HW upgrade of the X20AT module in use.

Best Regards,
Austin

Hi Austin

Yes, i did.

I was testing my calculation and conversion with a Type K, configured as µV. And a Type J configured as Type J for comparing. And I am using the latest HW Upgrade.

I tinkered around a little, and honestly i can’t remember exactly what i did, but now it looks quite OK for me. There must have been something off in my conversion or calculation. For now I think i leave it as it is and test it on real environments in near time to be sure. I also want to try some new identical sensors to cross-check the tolerances.

Thank you so far, you were very helpful and I hope I can come back to you when i start to struggle again :wink: