Raspberry Pi CPU Temperature Script

Raspberry Pi CPU Temperature Script

Channel:
Subscribers:
12,900
Published on ● Video Link: https://www.youtube.com/watch?v=117l0pOAKqc



Duration: 11:48
435 views
4


█▀█▀█▀█▀█▀█▀█▀█▀█▀█▀█▀█▀█▀█▀█▀█▀█▀█▀█▀█▀█▀█▀█▀█▀█▀█▀█▀█▀█▀█
[Synopsis]
This video is about how you can get the core CPU temperature reading from the Raspberry Pi Raspbian operating system.
▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄
[Procedure]

{Open up the terminal by pressing}
• "Ctrl" + "Alt" + "T"

Type in the commands.

{To create a script file}
• nano Name.sh

In my example
• nano print_tempexample.sh

Type or copy and paste the code into the file
• press "Ctrl" + "X" to exit, and save.

Make the script executable
• chmod +x print_tempexample.sh

To run the .sh file
• ./name of file.sh
OR
• . name of file.sh
To copy the .sh file to the bin directory
• cp filename.extension ~/file directory

In my example,
• cp print_tempexample.sh ~/bin

To delete the file in the root directory
• rm tempexample.sh

To use the Fahrenheit script first install the BC float point app in the terminal.
• sudo apt install bc (This will take a few minutes)
▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄
[Commands]

#Temperature Read#

vcgencmd measure_temp

vcgencmd measure_temp | egrep -o '[0-9]*\.[0-9]*'
▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄
#Temperature Read Script in Degrees C#

#!/bin/bash

printf "-15s%5s\n" "TIMESTAMP" "TEMP(degC)"
printf "%20s\n" "....................."

while true
do
temp=$(vcgencmd measure_temp | egrep -o '[0-9]*\.[0-9]*')
timestamp=$(date +'%s')
printf "%-15s%5s\n" "Stimestamp" "$temp"
sleep 1
done
▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄
#Temperature Read Script In Degrees F#

#!/bin/bash

printf "-15s%5s\n" "TIMESTAMP" "TEMP(F)"
printf "%20s\n" "....................."

while true
do
tempC=$(vcgencmd measure_temp | egrep -o '[0-9]*\.[0-9]*')
tempF=$(echo "scale=2; 1.8 *$tempC + 32" | bc)
timestamp=$(date +'%s')
printf "%-15s%5s\n" "$timestamp" "$tempF"
sleep 1

done
▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄
[Download Links]

◙ Temperature Script in degrees Celcius
https://drive.google.com/open?id=13ED2mLGj_gFS8abtY03MpD8xn6UmPYTP
◙ Temperature Script in degrees Fahrenheit
https://drive.google.com/open?id=1T2ab_E0S4W4fiF-giQ_iSRrz84fQnFdC
▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄
[Sources]

“Raspberry Pi Temperature Monitor.” Linuxhint, 2019, https://linuxhint.com/raspberry_pi_temperature_monitor/ .
Accessed 19 Jan 2020
▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄
[Links]

◙ Raspberry Pi 4 Related Videos
https://he-1000-1975.com/video-directory/#RASP
█▄█▄█▄█▄█▄█▄█▄█▄█▄█▄█▄█▄█▄█▄█▄█▄█▄█▄█▄█▄█▄█▄█▄█▄█▄█▄█▄█▄█▄█







Tags:
Raspbian Temperature Measure
Raspberry Pi Temperature Measure
Raspbian Temperature
Raspberry CPU Temperature