Jump to content

As of July 17, 2015, the LabJack forums here at forums.labjack.com are shut down. New registrations, topics, and replies are disabled. All forums are in a read-only state for archive purposes.

Please visit our current forums at labjack.com/forums to view and make new posts. To post on the current forums, use your labjack.com login account. Your old LabJack forums login credentials have been retired. There are no longer separate logins for labjack.com and LabJack forums.


Photo

Reading Internal Temperature Sensor


  • Please log in to reply
5 replies to this topic

#1 pmcintosh

pmcintosh
  • Members
  • 26 posts

Posted 04 January 2012 - 02:51 AM

Hi, I am trying to get temperature readings working with the U6. I am starting with just reading the internal sensor. I have a LJTick-InAmp and will move on to that next. The LJTick-InAmp documentation says I can read a UE9 or U3 with the following: [codebox] //Get the internal temperature reading (channel 133 on the UE9 or channel 30 on the U3). eGet (lngHandle, LJ_ioGET_AIN, internalTempChannel, &cjTempK, 0);[/codebox] Hunting around the LabJack site it looks like the channel for the U6 is 14 (correct?) So I do the following... [codebox] // Get LabJack's Internal Temperature Call(m_peGet(lngHandle, LJ_ioGET_AIN, 14, &ljInternalTemp, 0),__LINE__);[/codebox] But I get I get "25 Stream isn't active" - what step am I missing or is my channel number wrong? Cheers, Paul

#2 LabJack Support

LabJack Support
  • Admin
  • 8677 posts

Posted 04 January 2012 - 09:08 AM

So this is on Windows talking to our UD driver, correct?

Reading the internal temp sensor is just like a normal analog input read. You read channel 14, and instead of voltage you get back degrees K:

http://labjack.com/s...ers-guide/2.6.4

http://labjack.com/s...ers-guide/4.3.3

You can use add/go/get (Section 4.3.3), eGet (like your code), or eAIN (Section 4.3.9).

Errorcode 25 is actually "stream is active". You can't read analog inputs in command/response mode while a stream is active. Also note that you can't read the internal temp sensor in a stream on the U6 (it settles too slow).

#3 pmcintosh

pmcintosh
  • Members
  • 26 posts

Posted 04 January 2012 - 07:03 PM

Hi, Thanks - I am indeed streaming. The text definitely says "25 Stream isn't active" so there may be a typo in your error text in the following config: U6 Firmware Version: 1.350 U6 Bootloader Version: 6.150 U6 Hardware Version: 2.000 UD Driver Version: 3.25 So is there no way to stream and read temperature at the same time? The Vespa has fan forced cooling, so I'd like to log and quantify the relationship between RPM and temperature. Temperature, through a CHT sensor, is not going to change fast, so reading it every 2 seconds should be enough. So do I have to start and stop the stream every time I need to read the CHT? Cheers, Paul

#4 LabJack Support

LabJack Support
  • Admin
  • 8677 posts

Posted 05 January 2012 - 09:15 AM

Do you know where that text is coming from? It is correct in labjackud.h and Section 4.4:

http://labjack.com/s...users-guide/4.4


Looks like a CHT sensor is a thermocouple? You can read that fine in stream mode, especially since you are actually reading the output of the LJTIA. So you have to add the t/c channel to your stream and then average or decimate the extra data.

#5 pmcintosh

pmcintosh
  • Members
  • 26 posts

Posted 05 January 2012 - 06:43 PM

The code 25 is correct it is just the string assoicated with it is wrong. If you open up the C:\Program Files (x86)\LabJack\Drivers\labjackud.dll in a text editor you will see an instance of string "Stream isn't active" but none for "Stream is active" - you just have to update a resource file somewhere.

Yes the CHT is a K Type Thermocouple. Don't I need the LabJack internal temperature for cold junction temperature? Below is what the http://labjack.com/s...IAdatasheet.pdf states...

The UD driver for Windows has a convenient function that takes in thermocouple type, thermocouple voltage, and cold junction temperature, and returns the thermocouple temperature. The following pseudocode demonstrates a measurement:

//Read the amplified and offset thermocouple voltage from an analog input.
eGet (lngHandle, LJ_ioGET_AIN, tcChannel, &valueAIN, 0);

//Get the internal temperature reading (channel 133 on the UE9 or channel 30 on the U3).
eGet (lngHandle, LJ_ioGET_AIN, internalTempChannel, &cjTempK, 0);

//To get the thermocouple voltage we subtract the offset from the AIN voltage
//and divide by the LJTIA gain.
tcVolts = (valueAIN - offsetVoltage)/51;

//Convert TC voltage to temperature.
TCVoltsToTemp (LJ_ttK, tcVolts, cjTempK, &TCTempK);


I have decided the the Scooter Computer will have modes, so I will simply switch to a mode where streaming is not required. That will solve this issue and probably future ones :rolleyes:

Cheers,

Paul

#6 LabJack Support

LabJack Support
  • Admin
  • 8677 posts

Posted 06 January 2012 - 10:04 AM

So perhaps you are getting the bad string from the ErrorToString() function? And thus the mistake is in the compiled DLL. We will check that. To determine the temperature at the remote t/c junction you need to know the temperature of the local t/c junction (cold junction). The U6 internal temp sensor is convenient for that, but an alternative if you needed CJ temperature while streaming would be to shove an LM34CAZ into the proper screw-terminals near the t/c connections.


0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users