Close Menu
    Facebook X (Twitter) Instagram Pinterest YouTube
    Trending
    • Disable SSH Password Login on Raspberry Pi
    • Elecrow Meteor IPS Touchscreen with RGB LEDs
    • Pi Pico Pinout Display on the Command Line
    • How to Add a Raspberry Pi Pico Reset Button
    • Pi Pico Onboard LED
    • Pi Pico W Pinout and Power Pins
    • CrowPi L Raspberry Pi Laptop and Learning Platform
    • Pi Pico W Launched
    Mastodon YouTube Facebook Instagram Pinterest RSS
    Raspberry Pi SpyRaspberry Pi Spy
    • Home
    • Categories
      • General
      • Hardware
      • Programming
      • Python
      • Software
      • Tutorials & Help
    • BerryClip
      • BerryClip Instructions
      • BerryClip Plus Instructions
      • Videos & Reviews
    • Buy
      • Buy Pi
      • Buy Pi Accessories
      • Buy Books
    • Tools
      • Ultimate Raspberry Pi Alexa Skill
      • Pi Power Estimator App
      • Pi-Lite 14×9 LED Matrix Sprite Editor
      • RPiREF Pin-out Reference App
      • Simple Ohm’s Law Calculator
      • Web Sites & Links
    • Tutorials & Help
        Featured
        November 9, 20200

        Raspberry Pi Temperature Monitoring

        Recent
        February 16, 2024

        Disable SSH Password Login on Raspberry Pi

        December 23, 2022

        How to Add a Raspberry Pi Pico Reset Button

        November 20, 2022

        Pi Pico Onboard LED

      1. Contact Us
      2. Site Map
      Raspberry Pi SpyRaspberry Pi Spy
      You are at:Home»Software»Raspberry Pi OS»Raspberry Pi Temperature Monitoring

      Raspberry Pi Temperature Monitoring

      0
      By Matt on November 9, 2020 Raspberry Pi OS, Tutorials & Help

      As the Raspberry Pi has become more powerful temperature management has become more important. This article aims to provide some easy techniques to monitor the temperature of your Pi.

      The Pi 4 will start to throttle the performance if the temperature exceeds 80 degrees so it is wise to keep an eye on your system temperature.

      Read temperature from command line

      The easiest way to determine the temperature of your Raspberry Pi is by using the following command in a terminal window :

      vcgencmd measure_temp

      This will display the temperature in degrees Celsius:

      temp=31.0'C

      To extract the number you can use:

      vcgencmd measure_temp | egrep -o '[0-9]*\.[0-9]*'

      This feeds the output of vcgenmd to egrep. This then outputs only the characters that are numbers surrounding a full stop (period) character.

      If you want to constantly monitor the temperature you can use the watch command:

      watch -n 2 vcgencmd measure_temp

      This will show the temperature and update the value every 2 seconds.

      Add Temperature Display to Raspberry Pi OS Desktop

      If you are using the Raspberry Pi OS desktop you can add a temperature gauge to the top panel where the clock is displayed. This makes it really easy to keep an eye on the value as you perform different tasks:

      Temperature Monitor Top Panel

      In this example the temperature of my Pi is 35 degrees Celsius.

      To add the temperature to the top panel:

      • Right click on the top panel
      • Select “Add / Remove Panel items”
      • Click “Add”
      • Scroll down the list and select “Temperature Monitor”
      • Click “Add”
      • Use the “Up” button to position the monitor above the “Digital Clock”

      If you want to add some space between the panel items you can:

      • Right click on the top panel
      • Select “Add / Remove Panel items”
      • Click “Add”
      • Scroll down the list and select “Spacer”
      • Click “Add”
      • Use the “Up” or “Down” buttons to position the spacer
      • Use the “Preferences” button to set the size of the spacer

      I used Spacers with a size of 10 to provide a sensible gap between the temperature reading and the surrounding panel items.

      You can change the thresholds and the colours used by:

      • Right click on the Temperature in the top panel
      • Select “Temperature Monitor Settings”
      • Change the settings as required
      • Click “OK” to save

      Here are my settings:

      Raspberry Pi Temperature Monitor Settings

      You can change the values at which the warning colours are triggered.

      Reading temperature in Python

      It’s fairly easy to read the Pi CPU temperature in Python using the Gpiozero library. Simply import the library at the top of your script:

      import gpiozero as gz

      and then read the temperature into a variable:

      cpu_temp = gz.CPUTemperature().temperature

      if you want to round the value to one decimal place you can add the line:

      cpu_temp = round(cpu_temp, 1)

      Once you have the temperature value in the variable you print it to the screen, log to a file or send to a database.

      Reading temperature in Bash

      To read the temperature from within a Bash script you can use:

      temp=$(('cat /sys/class/thermal/thermal_zone0/temp'/1000))
      echo $temp

      You’ll get an integer result with no decimal places but that shouldn’t be an issue for most purposes.

      Share. Facebook Twitter Pinterest LinkedIn Tumblr Email
      Previous ArticleOverclocking the Raspberry Pi 400
      Next Article Raspberry Pi 400 SSD Upgrade

      Related Posts

      Disable SSH Password Login on Raspberry Pi

      How to Add a Raspberry Pi Pico Reset Button

      Pi Pico Onboard LED

      Leave A Reply Cancel Reply

      This site uses Akismet to reduce spam. Learn how your comment data is processed.

      Recent Posts
      February 16, 2024

      Disable SSH Password Login on Raspberry Pi

      March 13, 2023

      Elecrow Meteor IPS Touchscreen with RGB LEDs

      December 26, 2022

      Pi Pico Pinout Display on the Command Line

      December 23, 2022

      How to Add a Raspberry Pi Pico Reset Button

      November 20, 2022

      Pi Pico Onboard LED

      Categories
      • 1-wire
      • 3D Printing
      • Add-ons
      • BBC Micro:bit
      • BerryClip
      • Books
      • Camera Module
      • Cases
      • Events
      • General
      • Hardware
      • I2C
      • Infographics
      • Interfaces
      • Minecraft
      • Model A+
      • Model B+
      • News
      • Pi Models
      • Pi Pico
      • Pi Zero
      • Power
      • Programming
      • Python
      • Raspberry Pi OS
      • Raspbian
      • RetroGaming
      • Robotics
      • Sensors
      • Software
      • SPI
      • Tutorials & Help
      Tags
      Arduino audio battery berryclip Birthday bluetooth cambridge camera CamJam DigiMakers display games GPIO I2C interface Kickstarter Kodi LCD LED Linux media Minecraft Model A motionEyeOS PCB photography photos Pi-Lite Pi Pico power python Raspberry Jam Raspberry Pi Bootcamp raspbian Retrogaming retroPie screen SD card security sensor SPI SSH temperature ultrasonic video
      Raspberry PI Related
      • Adafruit Blog
      • Average Maker
      • Official RaspBerry Pi Site
      • Raspberry Pi Pod
      • RasPi.tv
      • RaspTut
      • Stuff About Code
      Tech Resources
      • MattsBits – Pi Resources
      • Microbit Spy
      • Technology Spy
      Archives

      Entries RSS | Comments RSS

      This site is not associated with the official Raspberrypi.org site or the Raspberry Pi Foundation. Raspberry Pi is a trademark of the Raspberry Pi Foundation.

      Copyright © 2025 - All Rights Reserved - Matt Hawkins

      About

      Unofficial site devoted to the Raspberry Pi credit card sized computer offering tutorials, guides, resources,scripts and downloads. We hope to help everyone get the most out of their Pi by providing clear, simple articles on configuring, programming and operating it.

      Popular Posts
      September 19, 2014

      Top 5 Reasons The Raspberry Pi Sucks

      July 27, 2012

      16×2 LCD Module Control Using Python

      October 20, 2013

      Analogue Sensors On The Raspberry Pi Using An MCP3008

      Latest Posts
      February 16, 2024

      Disable SSH Password Login on Raspberry Pi

      March 13, 2023

      Elecrow Meteor IPS Touchscreen with RGB LEDs

      December 26, 2022

      Pi Pico Pinout Display on the Command Line

      Mastodon YouTube Instagram Facebook Pinterest RSS

      Entries RSS | Comments RSS

      This site is not associated with the official Raspberrypi.org site or the Raspberry Pi Foundation. Raspberry Pi is a trademark of the Raspberry Pi Foundation.

      Copyright © 2025 - All Rights Reserved - Matt Hawkins

      mastodon.social@RPiSpy

      Type above and press Enter to search. Press Esc to cancel.