I have read a lot of articles and forum posts about this topic, but almost everything is quite complicated and all from over 2+ years ago.
So I was wondering, What is the best way tot get the CPU temperature of the Raspberry Pi in C#?
I have the newest version of Windows 10 IoT Core.
Update
I dont want to reduce the CPU temperature. I am using the Sense HAT. The temperature sensor of that thing is located near the CPU so the reading is inaccurate. I have found a python script what makes the reading accurate, but it needs the CPU temperature.
NOTE:
I am using Windows 10 IoT Core!
I DO NOT have this file: /sys/class/thermal/thermal_zone0/temp
Update 2:
If the only way is to write your own driver, please guide me how to do that. I don't know anything about writing drivers or anything so low-level...
As far as i know, there is no IoT SDK or powershell client could access to low-level BCM2836 peripherals.You need to write your own drivers. You can follow the code samples from https://github.com/ms-iot/bsp/tree/master/drivers, it's written under WDK framework so you'll need to get yourself familiar with that in order to get started.
Another option is, measure temperature using DS18B20 thermal sensors. This thermal sensor connects the raspberry pi via I2C. And you need to install Rinsen.OneWire package via nuget in your solution, this library is written in C# and it has built-in support for DS18B20 and DS18S20 sensors.
I'm not 100 percent sure this is the right way to go, but if someone could correct me or point out a better solution, I would be more than happy to learn from it.
You can achieve this using MCP9808 chip.
There is an article by Jeremy Lindsay which walks you through the process of how to make it work using C# on Window 10 IoT Core.
https://jeremylindsayni.wordpress.com/2016/06/09/how-to-measure-temperature-using-c-raspberry-pi-windows-10-iot-core-and-the-adafruit-mcp9808-sensor/
Some excerpts from the article:
How does the MCP9808 work?
This sensor uses the I2C protocol, which is supported by Windows 10 IoT Core on the Pi 3. As there’s already extensive integration of this protocol in the framework, this makes coding significantly easier. The MCP9808 can be initialised using the slave address of 0x18, and the ambient temperature can be read back from two bytes of data after writing 0x05 to the device.
Connecting the MCP9808 to the Raspberry Pi
There are 4 pins on the MCP9808 temperature sensor that we need to use to get a basic temperature reading. I connected mine to the Pi using the pins specified below.
• Supply Voltage – Pin 2
• Ground – Pin 6
• Serial Clock – Pin 5
• Serial Data – Pin 3
Jeremy has also shared the code on GitHub: https://github.com/jeremylindsayni/Magellanic.Sensors.MCP9808
Hope this help!
I think you could try to calculate the current CPU temperature by reading the current consumption and then using this formula to calculate the temperature.
I don't know how current cellphone manufacturers measure the device's temperature today. But this is not much different than how Nokia used to measure temperature based on IBATT (battery current) and VBATT (battery voltage) readings back in the day (when I worked there).
Related
I had knowledge in C# language and web application. I would like to know what is the window command to track the temperature of 4 RX 560 GPU which had installed on my PC.
I had find all of the resources in internet , but couldn't find any relate windows command line to track the temperature. Or if there is any DLL or API to track the temperature?
My purpose is to do a window services which keep track the temperature and push the temperature data to other server over the internet.
Appreciate if anyone can give me guidance.
There is a similar question here on SO (although in that question it is about the CPU temperature): How to get CPU temperature?
The answer of #Jens provides information about Open Hardware Monitor. Although it first seems like an application, there's also an interface available.
More info from the site:
Documentation (what is supported by the interface, on the bottom is a link to a PDF with sample code)
Downloads
Source code on GitHub
I have a Raspberry Pi 3 running Windows 10 IoT Core. My question is; would it be possible, or is there a way to monitor the CPU temperature of the device either via a remote PowerShell connection, locally on the device in the command line console or if all else fails using a C# deployed app on the device?
I confess to being a C# noob, hence it being my third option.
Why?... I'm planning on building a custom case out of Lego for a stack of several devices and want to assess whether I need to purchase a bunch of heat sinks and cooling fans etc.
Many thanks for your time and assistance.
I hope this can guide you to the right track.
In order to access to low-level BCM2836 peripherals that the IoT SDK or PowerShell client does not provide, you'll need to write your own drivers.
You can follow the code samples from https://github.com/ms-iot/bsp/tree/master/drivers, it's written under WDK framework so you'll need to get yourself familiar with that in order to get started.
I guess eventually you'll end up with something like one of those samples under the drivers sample.
When you're done, deploy your driver follow this tutorial https://developer.microsoft.com/en-us/windows/iot/win10/samples/driverlab3
I'm not 100 percent sure this is the right way to go, but if someone could correct me or point out a better solution, I would be more than happy to learn from it.
I want to create a program that monitors my GPU's temperature (AMD ATI HD) and if it goes below say 50C to send me an email.
I know how to send an email - I just have no idea on how to get the temerature :/
Any help would be awesome!
Running Visual Studio - for Windows Forms (or Java works too!)
Andy
I I suggest that you have a look at the OpenHardwareMonitor Project over here
The Open Hardware Monitor is a free open source software that monitors temperature sensors, fan speeds, voltages, load and clock speeds of a computer.
The Open Hardware Monitor supports most hardware monitoring chips found on todays mainboards. The CPU temperature can be monitored by reading the core temperature sensors of Intel and AMD processors. The sensors of ATI and Nvidia video cards as well as SMART hard drive temperature can be displayed. The monitored values can be displayed in the main window, in a customizable desktop gadget, or in the system tray. The Open Hardware Monitor software runs on 32-bit and 64-bit Microsoft Windows XP / Vista / 7 and any x86 based Linux operating systems without installation.
They are open source and you should be able to check out their code and have a look there.
Check out the Overdrive API in the AMD Display Library. They have a C# example but you'll have to add the hook to the temperature library yourself.
AMD Display Library
Specifically: ADL2_Overdrive6_Temperature_Get (ADL_CONTEXT_HANDLE context, int iAdapterIndex, int *lpTemperature)
For NVIDIA users...
I tried Open Hardware Monitor, and it worked, but sometimes it would get in a state when it was causing high CPU usage while pulling the GPU temperature (this problem would go away if I had it pulling only the CPU temperature).
I ended up using this NuGet package to pull the temperature directly from NVAPI.
https://github.com/falahati/NvAPIWrapper
Some sample code looks like...
PhysicalGPU[] gpus = PhysicalGPU.GetPhysicalGPUs();
foreach (PhysicalGPU gpu in gpus)
{
Console.WriteLine(gpu.FullName);
foreach (GPUThermalSensor sensor in gpu.ThermalInformation.ThermalSensors)
{
Console.WriteLine(sensor.CurrentTemperature);
}
}
The Problem:
I'm writing an application that needs to receive electrical input from a machine every time the machine does something.
I have a Limit switch set up to the machine and it currently completes a circuit every time the machine does it's thing
I need it to input into a computer using usb as oppose to just complete a circuit.
I had a dataq 'dl-148u-sp' And i got the c# code to produce a graph using ActiveX controls but all i really need is the digital output from the circuit being completed (which for the life of me i couldn't figure out how to do)..
I ended up frying the device(i think) even the software it came with doesn't recognize it anymore...
I need a new device, and it turns out they discontinued the one i had, and the next one up after shipping is like 90$.
The Question:
Is there a Better/Cheaper/Easier way of doing this? Or can anyone suggest a Good device that's easy to get the output using c# code so i can incorporate it into a program i made?
It's not clear if you are asking for a hardware or software solution here. Are you asking what the best way to facilitate that data transfer from your machine to the PC? If so, this may not be the place to ask, but you might look at a USB to GPIO module.
http://numato.com/8-channel-usb-gpio-module is an example.
I'd recommend an Arduino:
http://www.arduino.cc/playground/Main/InterfacingWithHardware
They dev kits are cheap and there's a ton of open/free libraries that interface the Arduino to C#.
More expensive and complex board is IOFirebug with c# library and many functions. Input voltage range is from 5V to 30V.
I am a pretty green programmer, only having experience with scripting (mostly VBA and Python). One of my professors has asked me to work on an application to operate a Laser Triangulation Scanner, in C#. I know once I get raw voltage data in I can do everything else. But I am a bit overwhelmed by the project as a whole and I can't seem to find any information on how exactly to get analog voltage data from the NI-USB-6008 without the use of Measurement Studio from National Instruments (I don't have $1000 to buy it).
If you've installed NI-DAQmx (if you haven't please do!) there is an ActiveX and .Net DLL you can interop with that provides support for that device. Details here:
http://digital.ni.com/public.nsf/allkb/F0FD13D2DD0C433986256D9C00468D29#NoMS
Example code locations for NI DAQmx here:
http://zone.ni.com/devzone/cda/tut/p/id/5409#toc4
A whole tutorial here (skip to the .Net section):
http://sine.ni.com/nipdfgenerator/nipdfgenerator?pageURL=http://zone.ni.com/devzone/cda/tut/p/id/5409&clientAppName=dz&dotsPerPixel=&dotsPerPoint=
Good luck! NI stuff generally rocks across the board so you don't have to fish out lots of cash - but they'd rather you did.