I was interested in monitoring the temperature of the CPU, and there’s an easy command for that:
Go ahead and try it sometime, it will give the following type of output:
Every tutorial I looked up used this command, so the solutions they came up with always had the temperature in Celsius. I use Celsius for monitoring temperatures on my PC, and with my 3D printer, so I’m familiar with it, but as a little challenge I decided to try to adapt a simple temperature monitoring Python script This was complicated by the fact I don’t know Python, but I managed it, with the help of the Internet.
Keval Patel wrote a really nice tutorial all about monitoring the temperature of the Raspberry Pi, and it was his short “temperature monitor” Python script I used as a template. His excellent article can be found at:
https://medium.com/@kevalpatel2106/monitor-the-core-temperature-of-your-raspberry-pi-3ddfdf82989f and I recommend reading it, it explains all the ins and outs.
Without further ado, here is my python script to continuously (once per second) sample and display the temperature of the CPU, with the temperature in Fahrenheit.
import os import time def measure_temp(): temp = os.popen("vcgencmd measure_temp").readline() temp = temp.replace("temp=","") temp = (temp.split(".",1)) return (temp) while True: print int(measure_temp())*9/5+32,"F" time.sleep(1)
Just save it in a file with
("name".py), and run from the command line with
python "name".py (Of course, replace “name” with the actual name, like
And there you have your CPU temperature in Fahrenheit, updated once a second.