Go Down

Topic: Measuring CPU and GPU Temperatures (Read 7308 times) previous topic - next topic

Bciceksoy

Jul 29, 2014, 11:35 pm Last Edit: Jul 31, 2014, 08:28 pm by Bciceksoy Reason: 1
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.

gardner

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

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 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
Two or three hours spent thinking and reading documentation solves most programming problems.

Bciceksoy


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 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

Chagrin

You can use the programming language of your choice to read the system status and send it to an Arduino. The InterfacingWithSoftware page lists examples for just about every language under the sun.

AWOL

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!)

Robin2

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
Two or three hours spent thinking and reading documentation solves most programming problems.

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.

Bciceksoy


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;

Code: [Select]
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.

Bciceksoy

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

AWOL

Quote
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.

Bciceksoy

Code: [Select]
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.

Robin2

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
Two or three hours spent thinking and reading documentation solves most programming problems.

Go Up