How to Monitor the CPU Temperature of Raspberry PI using Python
- Time:2020-09-09 13:16:32
- Class:Weblog
- Read:37
Raspberry PI does not have any fans – although you can either install cooling chips or CPU fans.

CPU Fan for Raspberry PI 4b
It would be great to monitor the temperature in case it gets too hot. The working temperature is less than 80 degree for raspberry PI. With a CPU fan, I managed to keep the CPU fan of the Raspberry PI cool with less than 30 degree.
Here is a python script that allows you to print the temperature of the CPU for raspberry PI:
1 2 3 4 5 6 7 8 9 10 | import os import time def temperature_of_raspberry_pi(): cpu_temp = os.popen("vcgencmd measure_temp").readline() return cpu_temp.replace("temp=", "") while True: print(temperature_of_raspberry_pi()) time.sleep(1) |
import os import time def temperature_of_raspberry_pi(): cpu_temp = os.popen("vcgencmd measure_temp").readline() return cpu_temp.replace("temp=", "") while True: print(temperature_of_raspberry_pi()) time.sleep(1)

python3-script-monitor-temperature
The python script reports the temperature every second. You can run this in background and add some actions if temperature gets too high e.g. sending a email notification.

temperature-on-raspberry-pi
1 2 | if temperature_of_raspberry_pi > 80: print("CPU Temperature too high!") |
if temperature_of_raspberry_pi > 80: print("CPU Temperature too high!")
Here is a PHP script to measure the temperature on Raspberry PI: Use PHP Script to Monitor Temperature and Uptime for Raspberry PI in the Browser
–EOF (The Ultimate Computing & Technology Blog) —
Recommend:What Is WordPress Live Chat and How Do You Implement It?
5 Beginner’s Tips to Building a WordPress Blog
8 Best Affiliate Marketing Plugins For Your Blog
How Many Squares/Rectangles Does a Rubik Cube Have?
Find the 10001st Prime Number
The Difference Between Sum of Squares and Square of the Sum
Number of Steps to Reduce a Number in Binary Representation to O
Recursive Depth First Search Algorithm to Compute the Diameter o
Find the largest palindrome From the product of two 3-digit numb
What is the largest prime factor of the number 600851475143 ?
- Comment list
-
- Comment add