# Measuring CPU and GPU Temperatures

**URL:** <https://forum.arduino.cc/t/measuring-cpu-and-gpu-temperatures/248910>\
**Category:** Interfacing w/ Software on the Computer\
**Created:** [July 29, 2014, 9:35pm UTC](https://forum.arduino.cc/t/measuring-cpu-and-gpu-temperatures/248910 "2014-07-29T21:35:24Z")\
**Posts on this page:** 14\
**Page:** 1

<div class="post-metadata">

**Author:** ![system](https://dub1.discourse-cdn.com/arduino/user_avatar/forum.arduino.cc/system/32/1140315_2.png) [@system](https://forum.arduino.cc/u/system)\
**Post date:** [July 29, 2014, 9:35pm UTC](https://forum.arduino.cc/t/measuring-cpu-and-gpu-temperatures/248910/1 "2014-07-29T21:35:24Z")

</div>

Hello guys, i am currently working on PC cpu and free ram monitoring and i found the code for monitoring. And the code is: typeperf "\Memory\Available bytes" "\processor(\_total)% processor time"  
code's output is this; 07/30/2014 00:34:07.610","4949762048.000000","2.309958"

i want to get this output and remove these time stamps then print this free ram and % cpu usage to the LCD screen. Can you help me how can i get this output back from the system(); command. Thank you in advance.

---

<div class="post-metadata">

**Author:** ![gardner](https://dub1.discourse-cdn.com/arduino/user_avatar/forum.arduino.cc/gardner/32/213975_2.png) [@gardner](https://forum.arduino.cc/u/gardner)\
**Post date:** [July 30, 2014, 4:28am UTC](https://forum.arduino.cc/t/measuring-cpu-and-gpu-temperatures/248910/2 "2014-07-30T04:28:03Z")

</div>

Where does the Arduino come into play? There is no system() on Arduino.

---

<div class="post-metadata">

**Author:** ![Robin2](https://dub1.discourse-cdn.com/arduino/user_avatar/forum.arduino.cc/robin2/32/216045_2.png) [@Robin2](https://forum.arduino.cc/u/Robin2)\
**Post date:** [July 30, 2014, 7:32am UTC](https://forum.arduino.cc/t/measuring-cpu-and-gpu-temperatures/248910/3 "2014-07-30T07:32:01Z")

</div>

Are you trying to say that you want to get some data from a PC and send it to an Arduino so that the Arduino can display the data on an LCD display?

If so the [demo here](http://forum.arduino.cc/index.php?topic=225329.msg1810764#msg1810764) shows how to send data from a PC to an Arduino using Python on the PC. You just need to modify the Python code to collect the data you want and modify the Arduino program to use an LCD.

...R

---

<div class="post-metadata">

**Author:** ![system](https://dub1.discourse-cdn.com/arduino/user_avatar/forum.arduino.cc/system/32/1140315_2.png) [@system](https://forum.arduino.cc/u/system)\
**Post date:** [July 30, 2014, 1:54pm UTC](https://forum.arduino.cc/t/measuring-cpu-and-gpu-temperatures/248910/4 "2014-07-30T13:54:57Z")

</div>

> Robin2:  
> Are you trying to say that you want to get some data from a PC and send it to an Arduino so that the Arduino can display the data on an LCD display?
> 
> If so the [demo here](http://forum.arduino.cc/index.php?topic=225329.msg1810764#msg1810764) shows how to send data from a PC to an Arduino using Python on the PC. You just need to modify the Python code to collect the data you want and modify the Arduino program to use an LCD.
> 
> ...R

Yes i want to take free RAM and % cpu usage and print it to the LCD. But i could not get the idea behind Python. My main code is this: typeperf "\Memory\Available bytes" "\processor(\_total)% processor time" it gives me the free ram and % cpu usage in cmd window but how can i get back the data i couldnt get it. Please help me

---

<div class="post-metadata">

**Author:** ![Chagrin](https://avatars.discourse-cdn.com/v4/letter/c/57b2e6/32.png) [@Chagrin](https://forum.arduino.cc/u/Chagrin)\
**Post date:** [July 30, 2014, 2:01pm UTC](https://forum.arduino.cc/t/measuring-cpu-and-gpu-temperatures/248910/5 "2014-07-30T14:01:02Z")

</div>

You can use the programming language of your choice to read the system status and send it to an Arduino. The [InterfacingWithSoftware](http://playground-archive.arduino.cc/Main/InterfacingWithSoftware) page lists examples for just about every language under the sun.

---

<div class="post-metadata">

**Author:** ![system](https://dub1.discourse-cdn.com/arduino/user_avatar/forum.arduino.cc/system/32/1140315_2.png) [@system](https://forum.arduino.cc/u/system)\
**Post date:** [July 30, 2014, 2:10pm UTC](https://forum.arduino.cc/t/measuring-cpu-and-gpu-temperatures/248910/6 "2014-07-30T14:10:03Z")

</div>

Can't you just redirect it to the COM port your Arduino is connected to?

(How very typical of Microsoft to express a number of bytes in a non-integer format!)

---

<div class="post-metadata">

**Author:** ![Robin2](https://dub1.discourse-cdn.com/arduino/user_avatar/forum.arduino.cc/robin2/32/216045_2.png) [@Robin2](https://forum.arduino.cc/u/Robin2)\
**Post date:** [July 30, 2014, 2:40pm UTC](https://forum.arduino.cc/t/measuring-cpu-and-gpu-temperatures/248910/7 "2014-07-30T14:40:51Z")

</div>

I'm pretty sure you can get Python to issue system commands and receive and process the response. Learning how to do that will usefully broaden your experience. There are probably thousands of websites with Python advice.

...R

---

<div class="post-metadata">

**Author:** ![system](https://dub1.discourse-cdn.com/arduino/user_avatar/forum.arduino.cc/system/32/1140315_2.png) [@system](https://forum.arduino.cc/u/system)\
**Post date:** [July 30, 2014, 3:59pm UTC](https://forum.arduino.cc/t/measuring-cpu-and-gpu-temperatures/248910/8 "2014-07-30T15:59:56Z")

</div>

What Arduino are you using? If you're trying to get metrics back from the PC via the USB serial connection, what operating system is running on the PC? If you aren't trying to do that, please explain what you're trying to do.

---

<div class="post-metadata">

**Author:** ![system](https://dub1.discourse-cdn.com/arduino/user_avatar/forum.arduino.cc/system/32/1140315_2.png) [@system](https://forum.arduino.cc/u/system)\
**Post date:** [July 31, 2014, 11:50am UTC](https://forum.arduino.cc/t/measuring-cpu-and-gpu-temperatures/248910/9 "2014-07-31T11:50:33Z")

</div>

> PeterH:  
> What Arduino are you using? If you're trying to get metrics back from the PC via the USB serial connection, what operating system is running on the PC? If you aren't trying to do that, please explain what you're trying to do.

I am using Uno R3, I want to collect CPU Usage, Used RAM, CPU and GPU Temperatures and send it to the LCD connected to the arduino though the serial port. My operating system is Windows. So far i did this;

```arduino
Imports System
Imports System.Management
Imports System.Runtime.InteropServices

Public Class Form1

    Public Enum TempFormat
        Fahrenheit
        Celsius
        Kelvin

        Raw
    End Enum

    Public Declare Function NvCplGetThermalSettings Lib "nvcpl.dll" (ByVal windowsMonitorNumber As UInt32, _
    ByRef coreTemp As UInt32, ByRef ambientTemp As UInt32, ByRef upperLimit As UInt32) As Boolean

    Private Property usedram As Integer

    Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        Timer1.Enabled = Enabled
    End Sub

    Private Sub Timer1_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer1.Tick
        Label1.Text = "CPU kullan?m?: " + ProgressBar1.Value.ToString + "%"
        ProgressBar1.Value = PerformanceCounter1.NextValue.ToString

        Dim dblAns As Double
        dblAns = (My.Computer.Info.TotalPhysicalMemory.ToString / 1024) / 1024
        usedram = Format(dblAns, "###,###,##0") - PerformanceCounter2.NextValue
        Label2.Text = usedram.ToString + " MB"

        usedram = PerformanceCounter3.NextValue
        ProgressBar2.Value = usedram.ToString

    End Sub

End Class

```

I am currently making it just visual on a form. When im finished i will transfer data with serial port. My CPU Usage and Ram usage is working well but just CPU and GPU temperatures are too hard work for me please help about two.

---

<div class="post-metadata">

**Author:** ![system](https://dub1.discourse-cdn.com/arduino/user_avatar/forum.arduino.cc/system/32/1140315_2.png) [@system](https://forum.arduino.cc/u/system)\
**Post date:** [July 31, 2014, 6:29pm UTC](https://forum.arduino.cc/t/measuring-cpu-and-gpu-temperatures/248910/10 "2014-07-31T18:29:37Z")

</div>

I have found some codes that are not correct. They always give me same results. Any idea?

---

<div class="post-metadata">

**Author:** ![system](https://dub1.discourse-cdn.com/arduino/user_avatar/forum.arduino.cc/system/32/1140315_2.png) [@system](https://forum.arduino.cc/u/system)\
**Post date:** [July 31, 2014, 6:45pm UTC](https://forum.arduino.cc/t/measuring-cpu-and-gpu-temperatures/248910/11 "2014-07-31T18:45:37Z")

</div>

> I have found some codes that are not correct. They always give me same results. Any idea?

Don't use those codes.  
Seriously?

**Post your code.**

---

<div class="post-metadata">

**Author:** ![system](https://dub1.discourse-cdn.com/arduino/user_avatar/forum.arduino.cc/system/32/1140315_2.png) [@system](https://forum.arduino.cc/u/system)\
**Post date:** [July 31, 2014, 7:33pm UTC](https://forum.arduino.cc/t/measuring-cpu-and-gpu-temperatures/248910/12 "2014-07-31T19:33:01Z")

</div>

```cpp
Try
            Dim searcher As New ManagementObjectSearcher("root\WMI", "SELECT * FROM MSAcpi_ThermalZoneTemperature")
            For Each queryObj As ManagementObject In searcher.Get()
                Dim temp As Double = CDbl(queryObj("CurrentTemperature"))
                temp = (temp - 2732) / 10.0
                MessageBox.Show(temp.ToString)
            Next
        Catch ex As ManagementException
            MessageBox.Show(ex.Message)
        End Try

```

I have tryed this code but it gives me same results all the time.

---

<div class="post-metadata">

**Author:** ![Robin2](https://dub1.discourse-cdn.com/arduino/user_avatar/forum.arduino.cc/robin2/32/216045_2.png) [@Robin2](https://forum.arduino.cc/u/Robin2)\
**Post date:** [July 31, 2014, 9:25pm UTC](https://forum.arduino.cc/t/measuring-cpu-and-gpu-temperatures/248910/13 "2014-07-31T21:25:45Z")

</div>

That doesn't look like Arduino code and this is the Arduino Forum.

Maybe you should be asking for advice about Windows programming on a different Forum ?

When you have the Windows side of things sorted out you can get help here with getting the data from your PC to an Arduino.

...R

---

<div class="post-metadata">

**Author:** ![system](https://dub1.discourse-cdn.com/arduino/user_avatar/forum.arduino.cc/system/32/1140315_2.png) [@system](https://forum.arduino.cc/u/system)\
**Post date:** [May 6, 2021, 11:29am UTC](https://forum.arduino.cc/t/measuring-cpu-and-gpu-temperatures/248910/14 "2021-05-06T11:29:37Z")

</div>

Closed on May 6, 2021, 11:29am UTC


