Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

CPU temperature of Raspberry Pi in C#

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

like image 804
Luuk Wuijster Avatar asked Aug 29 '18 00:08

Luuk Wuijster


People also ask

What is the normal temperature of a Raspberry Pi?

Raspberry Pi is between 0°C and 85°C. Specifically, the CPU is qualified from -40°C to 85°C and the LAN is qualified from 0°C to 70°C.

IS 45 C hot for CPU?

But, as a generalization that might help you identify a serious problem, if you have an Intel or AMD processor, you could say that a CPU core temperature of over 45-degrees Celsius while idling and/or a temperature of over 95-degrees Celsius while under full load is probably a cause for concern.

What is a good temp for CPU in C?

The acceptable range is between 150 and 160 degrees Fahrenheit (65 to 70 degrees Celcius) when the PC is running essential apps. This temperature can quickly increase to around 175 degrees Fahrenheit (80 degrees Celsius) when playing games or running intensive software.

Is 70c to hot for CPU?

Is 70 Degrees Hot For A CPU? Up to 70 degrees Celsius (160 degrees Fahrenheit) is fine. Your computer will perform at the best of its ability.


1 Answers

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.

like image 71
Michael Xu Avatar answered Sep 28 '22 11:09

Michael Xu