-
Notifications
You must be signed in to change notification settings - Fork 1
O. CPU Temperature
One of the most important and critical aspects of an overclocked raspberry pi is the temperature, and even though it will start throttling thus not causing any damages to hardware (melted cpu), it is still something you need to look out for and prevent. Throttling starts at 80°C and implies lower performances and we definitely don't want that.
I did not want to install any additional python packages (gpiozero) or even lm-sensors , I wanted to make something from scratch.
So this is the bash script I came up with: temperature.sh
Script breakdown:
# infinite loop because it will always be true
while true; do
# the cat provides us the value
# then we divide it by 1000
# then extract with 2 decimals
# to which we add a suffix "'C"
echo CPU Temperature: `bc <<< "scale=2; $(cat /sys/class/thermal/thermal_zone0/temp)/1000"`\'C
# waits for 2 seconds, then runs again
sleep 2
done
To use the script:
-
Download it
-
Give it execute permissions
$ chmod 755 temperature.sh
- To run it
$ ./temperature.sh
- It will run forever so you need to "Control + C" to exit
I have a Raspberry Pi 4 with an overclocked CPU (2Ghz).
On it I have Ubuntu Desktop 20.04, and on that I run LAMP to host my web server.
When idle it stays at ~41°C, which is outrageously low and when the backend scripts start running it increases to ~46°C.
I could probably get even better performance if I would have installed a pure CLI based OS - Ubuntu Server but then again that beats the initial purposes of this project, which was to use the Raspberry as a Desktop PC.
**Congrats, you're done!**
We have learned why the CPU temperature is important. We have also learned how to check the temperature.
If you hit a problem or have feedback (which is highly welcomed) please feel free to get in touch, more details in the footer.