Sunday, 31 July 2016 10:28

Raspberry Pi cooling - CPU Heatsinks do you need them?

Written by 
  • Author Type: Individual
  • Country: uk

Does the Raspberry Pi3 need cooling and are the CPU heatsinks effective? After getting temperature warnings on my RPi3 I decided to see if heatsinks help.

rpi-cpu-temprature-warning2I have several Raspberry Pi's from the original model B to the Raspberry Pi 3 which are all used for various tasks and left on for hours or days at a time but generally don't get too hot. The Raspberry Pi2 does get a little warm but my Raspberry Pi 3 get's too hot at times causing the Yellow then Red squares to appear in the top right corner indicating the processor is getting a tad too hot. For the PIXEL desktop the warnings signified by a Thermometer.

With PC's and Laptops the CPU has a fan to keep things cool as the CPU's get very hot and will be damaged without it. The Raspberry Pi's has low power requirements so the CPU dosn't need cooling to stop damage. If a Raspberry Pi 3 gets to 85oC the processor speed will be halved allowing things to cool down. The down side is it will now take longer for the task you are doing to complete.

So what can be done to keep a Raspberry Pi cool if you are getting CPU Over Temperature errors?

  • Well you could move to somewhere inside the Arctic circle which should do the trick, though not every bodies idea of home.
  • You could point a desk fan at your RPi3 though that could make working on it a bit drafty.
  • You could place it in a container of dry ice and program some flashing coloured LEDs for that party effect.

More practical suggestions would be to use a heatsink or use a heat dissipating case.

Heatsinks

A heatsink is the cheaper of the options and involves sticking a metal grooved block to the Raspberry Pi's CPU. The CPU heats up the heatsink but because it has a bigger surface area it can be cooled quicker by the surrounding air, which in turn cools the CPU and gives you one non sweaty RPI.
Heatsinks are available for as little as £1 and can be made from Aluminium or Copper. A heatsink is more effective the more surface area it has so some perform better than others.

heatsinks-on-raspberrypi

I have tried out two types of Aluminium heatsink with my RPi3. A silver one that came with a case, which just has grooves and a black one with columns of fins. When im converting several thousand PiCamera timelapse stills into a video I often get the Yellow and Red squares appear on the screen as the CPU gets hot. After installing  each heatsink in turn and re-running the test I still get the CPU temperature warnings so they don't seem to be very effective without some additional airflow.

So how effective are Raspberry Pi heatsinks? 

I have done some tests all converting 2364 images into a video to find out how well heatsinks perform. During the test the proccesor is running on average at 98% capacity for at least 25 minutes. 

The ambiant temperature was about 20oc. The CPU temperature was monitored using the following commands:

cpu=$(cat /sys/class/thermal/thermal_zone0/temp)
echo "CPU: $((cpu/1000)) c"

If you get a permissions error then add the command sudo before cat.

Test 1: Raspberry Pi 2 - No Heatsink

Firstly I tested a Raspberry Pi 2 with no heatsink. It was running for over 30 minutes at about 98% CPU usage and got to 65oc. So no cooling required.

Test 2: Raspberry Pi 3  - No Heatsink

Next was the Raspberry Pi 3 with no heatsink. This was running on average at 98% CPU usage for 25 minutes and and got to 86oc causing the yellow temperature error warning at 80oc and the red warning square at 85oc. On average it was at 84oc showing the yellow square. When the Red square appeared at 85oC the processor speed went from 1200Mhz to 600Mhz to help cool the CPU. It stayed at 600Mhz for the rest of the test.

Tests 3 & 4: RPi3 with Heatsink

I then repeated this test with the silver heatsink. This showed no real improvement peaking at 85oc and going into the red. The black heatsink was no better also with a peak temperature of 85oc. As both heatsinks got to 85oc the processor speed was halved in both tests.

How hot can we get?

mr fox raspberrypi cpu heatsinkFor the next test I decided to see how hot the CPU would get if the ambiant temperature was much warmer. As I live in England I would have to wait a long time for the ambiant temperature to get to tropical conditions even with global warming. So I put a Fox in the Microwave. No i'm not being cruel, it is like a cuddly toy which when heated in a microwave, stays hot, to be used like a safe hot water bottle.

Test 5: RPi3 in High Ambiant Temperature

The RPI3's idle CPU temperature was 53oc, I then placed "Mr Fox" across the Pi and waited 5 minutes for the ambiant temperature to increase. The CPU's idle temperature went up 11oc to 64oc. Then I started the video test again. The CPU temperature got to 85oc within a minute eventually peaking at 88oc.

So from these tests the Raspberry Pi 3 doesn't get hot enough on it's own to need cooling but also the heatsinks don't make any difference unless there is some airflow into the case. The only reason you would need cooling is if you need to keep the CPU running at 1200Mhz in which case the temperature needs to be kept below 85oc.

RaspberryPi CPU Fan 5v 0.2A

Test 6: RPi3 with CPU Fan

For a final test the RPI3 had a heatsink installed. I then attached a 5v 0.2 amp fan to the gpio port to get some airflow into the case and run the video test again. The CPU temperature only got to 60oc so the RPi3 stayed at 1200Mhz. In previous test the video took 25 minutes to create. In this test it took 12 minutes.

Conclusion

A Raspberry Pi 3 does not need CPU cooling as it manages the cooling by lowering the CPU speed. In general use it won't get hot enough to cause the CPU speed to be lowered. If you are doing intensive tasks but time is not an issue then again you don't need cooling. If you need the Raspberry Pi3 to keep performing at top speed for an intensive task then you just need some airflow as the CPU will only need to be cooled a few degrees. From most of my tests 2 degrees C is sufficiant and 4 degrees C in very hot enviroments.

 

Heat Dissipating Case

A heat dissipating case is more expensive but if you have a Raspberry Pi that is in constant use perfoming intensive tasks and you are in a warmer environment then this could be a good option. This type of case keeps the CPU cool because part of the metal case is in contact with the RPi's CPU and as with the heatsink the case is warmed up but with a much larger surface area the RPI will be kept cool for whatever tasks you are making it work hard for.

 

Monitoring CPU Temperatures and Speeds

For these test I used a Bash script based on this article by Vivek Gite.

This script displays the CPU & GPU temperature and the processor speed every 10 seconds.

 

#!/bin/bash
CPU=$(/sys/class/thermal/thermal_zone0/temp)
while [ $CPU -gt 30000 ]; do
    CPU=$(/sys/class/termal/thermal_zone0/temp)
    MHZ=$(/sys/devicessystem/cpu/cpu0/cpufreq/cpuinfo_cur_freq)
    echo "$(date)"
    echo "CPU: $((CPU/1000)) c"
    echo "GPU: $(/opt/vc/bin/vcgencmd measure_temp)"
    echo "MHZ: $((MHZ/1000))"
    sleep 10
done

 

To use this script copy the code into a text editor making sure the #!/bin/bash is on the top line.

save the file as CpuTemp.sh

Then open Terminal and navigate to the location you saved the file to.

If this was the desktop then enter

cd ~/Desktop

Then to make the script exceutable enter the command

chmod +x CpuTemp.sh

To run the script enter the command

sudo ./CpuTemp.sh

To exit press Ctrl & c

 

 

Last modified on Sunday, 16 October 2016 12:24
Google
roboberry

RapberryConnect.com SuperUser.  Contactable via the site admin e-mail in the Contact Us link.

Website: www.raspberryconnect.com

Leave a comment

Comments for Guest and account owners. Account owners will need to login to use registered e-mail address.

4 comments

  • Comment Link Graeme Friday, 13 January 2017 20:42 posted by Graeme

    Hi GR Lo, thanks for the info. The script in the article works fine on my Pi2 and Pi3. Though i needed the cat command in terminal I didn't need it in the script. As you say run with sudo ./CpuTemp.sh but if this was an issue on your PI then hopefully this helps anybody else who may have a similar issue.

    Report
  • Comment Link Gr Lo Friday, 13 January 2017 01:58 posted by Gr Lo

    Good article. I corrected some glitches.

    monitor.sh

    #!/bin/bash
    CPU=$(cat /sys/class/thermal/thermal_zone0/temp)
    while [ $CPU -gt 30000 ]; do
    CPU=$(cat /sys/class/thermal/thermal_zone0/temp)
    MHZ=$(cat /sys/devices/system/cpu/cpu0/cpufreq/cpuinfo_cur_freq)
    echo "$(date)"
    echo "CPU: $((CPU/1000)) c"
    echo "GPU: $(/opt/vc/bin/vcgencmd measure_temp)"
    echo "MHZ: $((MHZ/1000))"
    sleep 10
    done


    you have to run this script like this:

    sudo ./monitor.sh

    Report
  • Comment Link Graeme Thursday, 11 August 2016 19:46 posted by Graeme

    Hi, thanks for the typo spot.
    I haven't needed to sudo for the cpu line. Only if you use the Mhz command outside the script. Which is why the CpuTemp script needs sudo.

    cat was missing from my entry above but Im finding that
    cpu=$(cat /sys/class/thermal/thermal_zone0/temp)
    echo "CPU: $((cpu/1000)) c"
    works fine without sudo.
    I have added a note to the article. Thanks

    Report
  • Comment Link The-Alchemist Thursday, 11 August 2016 04:19 posted by The-Alchemist

    A few typos.

    Missing 'c' in class, and I needed sudo.

    cpu=$(sudo cat /sys/class/thermal/thermal_zone0/temp)

    Report

Additional information