Friday, August 23, 2013

Display RPi's physical parameters in Conky

I've been using Conky in all of the OSes that I use on my Pi from the very start.
Whereas on my Desktops, I always like to display Core and GPU temperatures in Conky, early versions of OSes for the Pi were incapable of displaying any physical parameters.

The one exception, perhaps, was the use of BogoMIPS from /proc/cpuinfo as an approximation for the CPU speed.

Now, however, there's the vcgencmd which provides quite a lot of physical information of the Pi.

The screenshot to the right shows
a very small part of my Conky display in Raspbian which shows the CPU Core temperature, the Core voltage and a more accurate representation of the CPU frequency.

Here's the coding I added to my .conkyrc file to add these parameters to the output:

Core Temp: ${alignr}${exec vcgencmd measure_temp | cut -c6-9}°C 
Core Voltage: ${alignr}${exec vcgencmd measure_volts | cut -c6-10} 
CPU Freq:${alignr}${exec printf "%0.0f" $((`vcgencmd measure_clock arm | cut -c15-24 | awk '{print $1}'`/1000000))} MHz
In reality, the only one of these that actually varies to any significant extent is the core temperature.
The CPU frequency might decrease by 1 MHz now and again but I don't believe I've ever seen the Core voltage change at all.
However, the CPU temperature changes a lot.
At first boot, from cold, this temperature starts at about 32ºC and rises up to as high as 56ºC
This parameter is, therefore, a candidate for color-coding in the Conky output to indicate when the temperature rises above comfortable levels.

No comments:

Post a Comment