قالب وردپرس درنا توس
Home / Tips and Tricks / Temperature monitoring on the Raspberry Pi – CloudSavvy IT

Temperature monitoring on the Raspberry Pi – CloudSavvy IT



Shutterstock / Paolo De Gasperis

Is your Raspberry Pi warm? The Raspberry Pi has a great factory setup when not in use, but if you use it a lot in a heated office, does it get too hot? Find out in a few easy steps.

Monitoring temperature on the Pi

We̵

7;re assuming you’ve already set up your Raspberry Pi, are using Raspbian, and you can access a console prompt – either via SSH or via a desktop-based login.

If you have a brand new Ubuntu installation on your Pi instead, check out vcgencmd for Ubuntu 20.04 aarch64 on RPi 4B by Hamid Elaosta.

Once you are at the terminal prompt, you will first want to check if the vcgencmd utility is available to you. It will likely be present if you use Raspbian. Let’s check:

whereis vcgencmd

where is vcgencmd output

If you have received output that contains more information than a leading vcgencmd:then you are ready to go.

Manually test the temperature on the Pi

Go ahead and run the following command:

vcgencmd measure_temp

You should receive an output similar to the following:

Note that the temperature on your Pi can be higher, say 45 degrees Celsius. Mine (a Raspberry Pi 4) runs in a sleek metal case (the Armor double fan aluminum radiator housing) with a single spinning cooling fan, and it’s pretty cool in here tonight. I have another Raspberry Pi 3 with a plastic shell, a few heatsinks, and no fan, and it’s currently running at 44.4 degrees Celsius.

How much is too much?

Good question. The Raspberry Pi Foundation recommends keeping your Raspberry Pi below 85 degrees Celsius. That’s an upper limit, and you have to keep in mind that there could be some chips on the Raspberry motherboard that are only qualified to go up to 70 degrees Celsius. In general, if you can run at 50 degrees Celsius or less, it looks like you need to be in the green zone.

Even if you had to go above it, you might be able to add a small fan, some coolers, and lower the temperature quickly. The environment / room temperature is also not important. As your environment gets warmer (summer weather etc.), you can expect your Raspberry Pi to rise in temperature as well.

And it’s good to keep in mind that the Raspberry Pi generally throttles (i.e. slows down) when the temperature reaches a certain point. Unless you’re doing something non-standard like overclocking or changing settings.

There is also a lot to be said about which case you choose for your Raspberry Pi 4. Different choices will lead to much better or much worse cooling results. See Raspberry Pi 4 Cases, Temperature and CPU Throttling Under Load by Martin Rowan for a thorough overview of cases.

Scripting temperature and more

The vcgencmd command is quite versatile. You can read more about it on the vcgencmd man page. Let’s make a little script with some of the most useful commands, which we’ll save as ~/temperature.sh

#!/bin/bash 
vcgencmd measure_temp
vcgencmd get_throttled
vcgencmd measure_volts
vcgencmd get_mem arm
vcgencmd get_mem gpu

Measure more with vcgencmd

Here we checked the temperature, throttle status (see the website link above for more info), a volt reading and available memory for the GPU and ARM processor. Keep in mind that your total memory may be greater than what is available for ARM. You can see your total memory using a tool such as htop (sudo apt install htop && htop), or just through free -mh on the command line (first result, top left, is your total memory size).

Shut down

Keeping your Raspberry Pi cool is certainly an important aspect of keeping your Pi running properly. Invest in a case that optimizes the temperature, add one or two fans and, most importantly, regularly check the temperature performance of the system, even under load. Enjoy the wealth of information vcgencmd can provide you and keep an eye on that temperature!


Source link