Raspberry Pi

How to Measure Raspberry Pi Temperature Using Terminal

Measuring the Raspberry Pi temperature is crucial, especially when executing high computational tasks on the system. The recommended temperature for Raspberry Pi to be in the green zone is below 50 degrees Celsius. If, in any case, your device temperature rises to this threshold, you should turn off your device to cool it down.

If you don’t have information about measuring the Raspberry Pi temperature, follow this article to find out how you can easily measure the temperature using the Raspberry Pi terminal.

How to Measure Raspberry Pi Temperature Using Terminal

The vcgencmd is a command-line utility that retrieves information from the main core Video GPU. This application operates through Python and is available to be downloaded for your Raspberry Pi using the pip installer. Follow the below-mentioned steps to use vcgencmd commands to measure the Raspberry Pi temperature on the terminal:

Step 1: Install pip on Raspberry Pi

First, you should install pip on Raspberry Pi using the following command in case it’s not installed.

$ sudo apt install python3-pip -y

Step 2: Install the Setup Tools

You should also ensure that your Raspberry Pi should include setup tools needed to run vcgencmd on Raspberry Pi and you can do so by applying the following command:

$ sudo pip3 install setuptools

Step 3: Install Vcgencmd on Raspberry Pi

After successfully installing pip and setup tools, you can run the following command to install vcgencmd on Raspberry Pi.

$ sudo pip3 install vcgencmd

Step 4: Add Video Group to User

You should add your current Raspberry Pi user to the vcgencmd video group so you can use the vcgencmd command with sudo to measure the temperature of your device.

$ sudo usermod -aG video <username>

Measure Raspberry Pi Temperature on Terminal

Now, there are several commands you can use to measure Raspberry Pi temperature like the given below that gives the Raspberry Pi temperature in degree celsius.

$ sudo /usr/bin/vcgencmd measure_temp

In case you want to measure the Raspberry Pi temperature in Fahrenheit, you can apply the following command:

$ sudo /usr/bin/vcgencmd measure_temp | awk -F "[=']" '{print($2 * 1.8)+32}'

You can also apply the following command to check the Raspberry Pi temperature that updates the temperature every 1 second, keeping you updated with the device health.

$ sudo watch -n1 vcgencmd measure_temp

Conclusion

The vcgencmd command-line utility is beneficial for measuring the Raspberry Pi temperature on the terminal. Several commands are discussed in the above guidelines, which provide temperature information about your Raspberry Pi. However, these commands will only work if you ensure that vcgencmd is already installed on your system with the required setup tools. You can then use these above-mentioned commands to measure the Raspberry Pi temperature.

About the author

Awais Khan

I'm an Engineer and an academic researcher by profession. My interest for Raspberry Pi, embedded systems and blogging has brought me here to share my knowledge with others.