From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

Multifunction DAQ

cancel
Showing results for 
Search instead for 
Did you mean: 

How to write a Labview code to measure temperature using thermocouple

Hi Guys

 

 

I'm a new to LabView and I've been trying to write a code that can be used to acquire temperature measurements and then directly save it in excel file. I'm using K type thermocouple and daq 6009. I don't have a problem with the circuit as I've built it to give voltage (1-Volts). What I need is how can I calibrate the thermocouple (how to insert the calibration values within the code, as I'm not using DAQ assistance) and also how to save the data directly to excel. I've written a primary,please see the attached file. 

 

Regards 

Rajab

0 Kudos
Message 1 of 13
(8,332 Views)
What do you mean by calibration? Are you actually talking about scaling?

Your DAQmx Write is completely wrong. Eliminate that. Use Write to Measurement File or Write to Spreadsheet File in a consumer loop.
0 Kudos
Message 2 of 13
(8,323 Views)

Thanks Dennis,

 

yes I meant scaling. (plotting the voltage against temperature then you get the scaling /or calibration curve. I need to put those values to convert the voltage measurements back to temperature values).

I've modified my code and  attached it,  could you please help me to improve  it!!

 

Thanks

 

0 Kudos
Message 3 of 13
(8,300 Views)

First of all, you need to change your channel type to an Analog Input.  Inputs are for reading, outputs are for writing.  You are reading thermocoupler data, therefore you need the Analog Input.

 

How long are you going to acquire data for?  That waveform could get quite large fairly quick.  I recommend you looking into the Producer/Consumer design pattern.  This way you can acquire your data in one loop and do the writing to file at the same time, saving a lot of memory.

 

The other option would be to use the DAQmx Configure Logging VI.  With that VI, you can tell DAQmx to stream the data straight to a TDMS file.  You will just have to read the data.  No file I/O necessary for you.  Then you can view the data in Excel by using the TDMS Excel Add-In.


GCentral
There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines
"Not that we are sufficient in ourselves to claim anything as coming from us, but our sufficiency is from God" - 2 Corinthians 3:5
Message 4 of 13
(8,298 Views)

A DAQ6009 for thermocouple readings???     😮

 

Have look at the specs of 6009 about the reslution and accuracy

Have a looke at the type K EMF per K ~~ something like 40µV/K if I remember ....

What reading resolution and accuracy do you expect??

 

 

EDIT: out of curiousity .. typical accuracy of a 6009 at 25°C is 1530µV -> go on if you are fine with +-38K 😉


And how do you compensate the reference junction?    (OK it's covered in the accuracy 😉 )

 

Greetings from Germany
Henrik

LV since v3.1

“ground” is a convenient fantasy

'˙˙˙˙uıɐƃɐ lɐıp puɐ °06 ǝuoɥd ɹnoʎ uɹnʇ ǝsɐǝld 'ʎɹɐuıƃɐɯı sı pǝlɐıp ǝʌɐɥ noʎ ɹǝqɯnu ǝɥʇ'


0 Kudos
Message 5 of 13
(8,287 Views)

Hi Henrik 

 

thanks for your concerns, yes I'm a ware about what you've mentioned but there's something called (thermocouple temperature transmitter):smileywink:. Google it if you haven't heard about it :smiley's-happy:  

 

can you help with the code then  Henrik Smiley Sad

 

Regrads 

Rajab 

0 Kudos
Message 6 of 13
(8,275 Views)

Hey, you need help, so it's up to you to provide the information of your setup. 

 

 About the code: read crossrulz post again.

 

Greetings from Germany
Henrik

LV since v3.1

“ground” is a convenient fantasy

'˙˙˙˙uıɐƃɐ lɐıp puɐ °06 ǝuoɥd ɹnoʎ uɹnʇ ǝsɐǝld 'ʎɹɐuıƃɐɯı sı pǝlɐıp ǝʌɐɥ noʎ ɹǝqɯnu ǝɥʇ'


0 Kudos
Message 7 of 13
(8,255 Views)

Thanks crossrulz ,I've changed the channel to an Analog input

 

The data will be acquired for a minute minimum , I've tried to get Producer/Consumer  loops done,  but it's difficult for me (as I'm beginner in labview).

 

is the code I attached last time able to export data to excel??  I'm getting empty undefined file.!!

 

 How to use self calibration function? I'm acquiring volts and need to read it as temperature( I will measure the voltage at 0 and 100 Celsius and few in between to find the scaling curve. Thus,  is there any way to include the scaling values in my code??

 

Regards 

 

Rajab 

0 Kudos
Message 8 of 13
(8,247 Views)

Thanks Henrik

 

how can I connect   Enqueue element function  to my waveform data (since they have diffrent data type, one is waveform DBL, while the other is string.) see the attched file please. 

 

Regards 

 

Rajab

0 Kudos
Message 9 of 13
(8,237 Views)

hey, here's my code with Producer/Consumer design pattern, I still get an error as you can see from the attached file.

any suggestion ??

Download All
0 Kudos
Message 10 of 13
(8,216 Views)