In this article, we will show you different ways to measure core temperature of Raspberry Pi as this will help you keep a check on your device performance.
Measure the Core Temperature of Raspberry Pi
There are multiple methods to measure temperature on Raspberry Pi:
Method 1: Measuring Core Temperature Through Terminal
The “vcgencmd” is a command-line tool that is mostly used to measure the core temperature on Raspberry Pi: Typing the command in the following way will show you the core temperature of Raspberry Pi on the terminal:
If you want to see continuously monitor the temperature after some specific time, you can use the following
This will display a window, where temperature changes can be monitored after every three seconds.
Method 2: Measure Temperature Through GUI
A temperature panel can also be added to the top right corner of the task bar on Raspberry Pi desktop to measure the core temperature of the device. In this way, the value of temperature can easily be viewed.
To add a temperature panel, Right Click on the taskbar and go to “Add/Remove Panel Items”.
Now Click on “Add” button.
A new window will pop out, there you can scroll down and find the “Temperature Monitor”. Click on it and press “Add”.
After adding, you will see a temperature panel on the most top right corner of the taskbar. You can check through the below-given screenshot. This is a perfect way to continuously monitor Raspberry Pi core temperature on your system.
Method 3: Measuring Temperature Through Python Script
Measuring the temperature using Python is another useful way that requires few steps, which are given below:
Step 1: First you need to create a Python file with any name.
A meas_temp.py file will be created in the root directory of Raspberry Pi, where you need to put the following lines.
import time
def measure_temp():
temp = os.popen("vcgencmd measure_temp").readline()
return (temp.replace("temp=",""))
while True:
print(measure_temp())
time.sleep(<time delay>)
After writing the code in the file, use “CTRL + X” and “Y” to save the file.
Once the file is saved, you can run it using the following command:
As code in the Python file was based on some time delay. In our case, we used 1 second time delay in our code that displays the core temperature of Raspberry Pi every 1 second.
Conclusion
To run Raspberry Pi at optimum performance, you must monitor the core temperature of the Raspberry Pi device, because most of the operations performed on the device through the CPU core. The above guide will help you measure the core temperature on Raspberry Pi through terminal, GUI, and Python script. You can choose any method you want as all are pretty easy to follow.