Quantcast
Channel: Raspberry Pi Forums
Viewing all articles
Browse latest Browse all 1269

Python • Re: very noisy SoC temperature measurement (RPi5)

$
0
0
After reading all this, I just round the temps to the nearest degree, which I think is good enough for my purposes.

Code:

Time         CPU    Core    Vcore    Temp....Min....Max  Health10:31:43    2800     910   0.9996      48     48     48    OK10:31:53     500     500    0.720      44     44     48    OK10:32:03     500     500    0.720      44     44     48    OK10:32:13     500     500    0.720      44     44     48    OK10:32:23     500     500    0.720      45     44     48    OK10:32:33     500     500    0.720      45     44     48    OK10:32:43    2800     910   0.9996      62     44     62   Fan210:32:54    2800     910   0.9996      66     44     66   Fan210:33:04    2800     910   0.9996      69     44     69   Fan310:33:14    2800     910   0.9996      70     44     70   Fan310:33:24    2800     910   0.9996      70     44     70   Fan310:33:34    2800     910   0.9996      72     44     72   Fan3
I found that doing this in bash was so slow that it triggered the CPU scaling governor and possibly influenced the temps, so I changed to badly written, but very lightweight, C:

Code:

  // TEMPERATURE "12345\n"read(temp, in, 3);lseek(temp, 0, SEEK_SET);cur_temp = (in[0] - 48U) * 10U + in[1] - 48U;if( in[2] > '4' )  ++cur_temp;if( cur_temp < min_temp )  min_temp = cur_temp;if( cur_temp > max_temp )  max_temp = cur_temp;p[6] = chr(cur_temp / 10);p[7] = chr(cur_temp % 10);p[13] = chr(min_temp / 10);p[14] = chr(min_temp % 10);p[20] = chr(max_temp / 10);p[21] = chr(max_temp % 10);
No need to reopen the sysfs file in the loop - seeking back seems to work fine.
Also, for interest, you can get the ARM and CORE freq's with one single call to vcgencmd
"vcgencmd measure_clock arm core".

Statistics: Posted by jahboater — Mon Feb 05, 2024 10:42 am



Viewing all articles
Browse latest Browse all 1269

Trending Articles