From 04:00 PM CDT – 08:00 PM CDT (09:00 PM UTC – 01:00 AM UTC) Tuesday, April 16, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Acquiring CPU Temperature in LV

Hey folks,

 

Firat off let me say I *did* do a little search before posting this thread up-  including looking at the following two links-

 

http://forums.ni.com/t5/LabVIEW/How-to-get-the-processor-temperature-ussing-LabVIEW/td-p/1080633

 

https://decibel.ni.com/content/docs/DOC-12862

 

The first link is marked solved however I could not get the particular solution to work (and I don't think the original poster/solver is subscribed anymore).

 

And the second link utilizes a ressource that needs to be installed, Core Temp, which is also not legally permitted to be redistributed to target machines without a written lic.   (I have contacted the develoer of core temp, and we can work something out with him, but obviously it's desireable to not require installing a 3rd party piece of software for temp functionality to work...

 

Has anyone else gotten a solution that doesn't require installing other software?

 

Thanks

-Pat

0 Kudos
Message 1 of 10
(9,504 Views)

You can do this by two ways.

 

First is by command line, there are a function to execute command line statements from LabVIEW.

Execute the following line:

wmic temperature

 

Second is by .NET Framwork there are a WMI interface on windows Called System.Management

where you can query many system parameters including the system temperature.

Message 2 of 10
(9,477 Views)

bruno_costa thanks for the info!

 

I ran "wmic temperature > output.txt" cmd running as admin and I got the following result:

 

Accuracy  Availability  Caption         ConfigManagerErrorCode  ConfigManagerUserConfig  CreationClassName       CurrentReading  Description               DeviceID      ErrorCleared  ErrorDescription  InstallDate  IsLinear  LastErrorCode  LowerThresholdCritical  LowerThresholdFatal  LowerThresholdNonCritical  MaxReadable  MinReadable  Name            NominalReading  NormalMax  NormalMin  PNPDeviceID  PowerManagementCapabilities  PowerManagementSupported  Resolution  Status  StatusInfo  SystemCreationClassName  SystemName     Tolerance  UpperThresholdCritical  UpperThresholdFatal  UpperThresholdNonCritical  
32768                   Numeric Sensor                                                   Win32_TemperatureProbe                  CPU Internal Temperature  root\cimv2 0                                                                                                                                                1270         0            Numeric Sensor                                                                                                            1000        OK                  Win32_ComputerSystem     PLYONS-LAPTOP  5                                                                                  

 It seems this result occurrs on my laptop running win7 pro as well as another XP OS I tried it on.

 

I don't have any experience with wmic (but I'll do my google searching to see what I can figure out from this output) - does this result suggest anything to you?

 

I'll also look into the ,net solution you mentioned.

 

Thanks for the response!

-Pat

 

edit:   found this site: http://vbnet.mvps.org/index.html?code/wmi/win32_temperatureprobe.htm but I din't think it tells me how to aquire the temp infor, only how to implement the information given by wmic into a vb app...

 

I'll keep looking...

 

edit2:  I typed in "wmic temperature /?" and got:

 

TEMPERATURE - Data management of a temperature sensor (electronic thermometer).

HINT: BNF for Alias usage.

(<alias> [WMIObject] | <alias> [<path where>] | [<alias>] <path where>) [<verb clause>].

USAGE:

TEMPERATURE ASSOC [<format specifier>]
TEMPERATURE CREATE <assign list>
TEMPERATURE DELETE
TEMPERATURE GET [<property list>] [<get switches>]
TEMPERATURE LIST [<list format>] [<list switches>]


 But I'm still trying to figure out how to figure out what I have to type as a property or switch to gett he temp...

0 Kudos
Message 3 of 10
(9,448 Views)

Seeing as it won't let me edit that post anymore-

 

Here's where I'm currently at:   

 

 

I tried "wmic temperature get CurrentReading /ALL"  and with /VALUE etc... no data is output...  dissapointed 😞

 

-pat

0 Kudos
Message 4 of 10
(9,437 Views)

I'm chalking it up- based on the info I found on this page:

 

http://www.codeproject.com/Questions/474097/RetrievingplusCPUplusTemperatureplususingplusC-23

 

CurrentTemperature does not exist - it is CurrentReading.
 
But I have more bad news for you: that probably won't work either.
See MSDN: Win32_TemperatureProbe class[^]
 
"Most of the information that the Win32_TemperatureProbe WMI class provides comes from SMBIOS. Real-time readings for the CurrentReading property cannot be extracted from SMBIOS tables. For this reason, current implementations of WMI do not populate the CurrentReading property. The CurrentReading property's presence is reserved for future use."

 Makes you wonder how the heck other programs like coretemp or cpuid manage to acquire the info I'm after...

 

 

-pat

0 Kudos
Message 5 of 10
(9,421 Views)

Hi pat,

 

Did you try testing this other example:

Programmatically Find Temperature of a CPU.

 

It depends on the hardware as well..

 

Regards

Message 6 of 10
(9,409 Views)

Thansk for the reply!

 

It appears to work once, but then when I run it again it does not update the temp-  First time I run it it gived me 59.55 degrees, I take a look at my coretemp readings and core temp reports it's dropped to 56, when I run the LV vi it still spits out 59.55 degrees....  I'll have to investigate this a little bit, I don;t know exactly what resources this vi is accessing, but thank very much for the link

 

-Pat

0 Kudos
Message 7 of 10
(9,404 Views)


@PatLyons wrote:

Thansk for the reply!

 

It appears to work once, but then when I run it again it does not update the temp-  First time I run it it gived me 59.55 degrees, I take a look at my coretemp readings and core temp reports it's dropped to 56, when I run the LV vi it still spits out 59.55 degrees....  I'll have to investigate this a little bit, I don;t know exactly what resources this vi is accessing, but thank very much for the link

 

 

-Pat


 

 

Hi Pat,

 

When I ran this VI - counterchecking with the freeware speedfan -  

 

in a nutshell: I get pretty the same result for both programs.

 

 

First I compared the recent result of the VI and speedfan.

 

Then, I marked the box "automatic fan speed" in speedfan to cool my machine down.

 

Afterwards I compared the speedfan values to the VI value and I repeated this test for 3-5 times.

 

 

 

I have to mention about that speedfan returns 5 values (HD0, Temp1,Temp2, Core 0, Core 1).

 

Although  the VI only returns 1 value, this value corresponds quite exactly to "Core 1" from speedfan.

 

1.png 

 

On this Laptop in particular, I run Labview 2012 SP1 with Windows Vista Home Premium.

 

 

 

 

Alex

 

 

 

Message 8 of 10
(9,367 Views)

another picture

2013-05-26_temperature2.png

Message 9 of 10
(9,353 Views)

Thanks for the info,

 

I'm running it on my laptop with n i3 processor and Windows 7 64b OS - it seems to run fine once, giving me the same temp as coretemp gives me, but everytime I run the vi after that, it just gives me the same value over and over, even if I stress the CPU to a significantly higher temp.

 

Building the vi into an exe and deploying it on my target running Win7 pro on an Atom cpu, I get a negative result and an error indicating I have the wrong path (which I assume is the constant "root\WMI:MSAcpi_ThermalZoneTemperature" wired into the Management Class constructor node).

 

 

Right now I'm thinking about trying to use RealTemp with labview, because the other 3rd party apps dont permit redistribution legally.  I may have to contact the developer to ask for the .h file to make some vis that do what I need.

 

Thanks again for the responses!

 

-Pat

0 Kudos
Message 10 of 10
(9,292 Views)