SARPi Project - Slackware ARM on a Raspberry Pi
Raspberry Pi Heatsinks & Fans, Active & Passive Cooling Solutions, Monitoring & Testing.
Just how cool is your Raspberry Pi? That's not asking how 'fashionable and attractive' you think your Raspberry Pi is. It refers to the temperature(s) at which your Raspberry Pi runs and the heat it generates under operation. In some cases (pardon the pun!) it can be quite a lot. If you're looking for ways to cool down a Raspberry Pi then read on.
If your Raspberry Pi is HOT STUFF you've come to the right place! This SARPi mini-project offers information on Raspberry Pi cooling solutions, CPU [thermal] monitoring and testing, heatsinks, metal cases/enclosures, cooling fans, water cooling kits, and what's the best cooling method for your Raspberry Pi. There's a "SARPi Project TEST - The Raspberry Pi 4 Model B Thermal Challenge!" test-case walkthrough, in which we undertake the task of cooling down a RPi4 device for demanding and/or long-term operation(s). The test results and conclusions are quite astonishing!
Raspberry Pi Cooling Solutions
If you have a Raspberry Pi that gets hot, there are quite a few different options, with successful solutions and methods, to address this problem. You may be interested in the following;
Raspberry Pi CPU Thermal Monitoring & Testing
The SARPi Project uses a simple tool [i.e. BASH script] which enables the checking, monitoring, and testing, of the CPU's current clock speed (in MHz) and thermal status (degrees Celsius). This tool was written specifically for various purposes on Slackware ARM but [probably] works on most other Linux distributions running on the Raspberry Pi. The tool can be ran from command-line, or in a desktop terminal, and doesn't require any extra software to be installed or depend on Raspbian's 'vcgencmd' functions, but instead queries the Raspberry Pi's onboard sensors directly. The tool is called 'cpu_status' and the code [for copying and pasting into a BASH script file] can be viewed here: sarpi.penthux.net/files/extra/cpu_status.txt
Re: 'cpu_status.txt' - If you don't know how to create a BASH script file and modify the user rights to make it executable in Linux, ask for help on LQ. Or go back to Raspbian and install/use 'vcgencmd' if that's easier for you.
Raspberry Pi Heatsinks
In many situations the addition of a heatsink to the SoC is all that's required to ensure the Raspberry Pi runs cooler. All shapes and sizes of heatsinks may be suitable, but it's prudent to check what will fit onto your Raspberry Pi before buying one. Another consideration is the heatsink material from which it's made, because it *does* matter and have an effect on cooling efficiency. Copper is quite a dense alloy and a very good material for heatsinks because it gets rid of heat quickly. Aluminium is not nearly as dense as copper but it is cheap and still does the job, just not as effectively. Metals have a thermal resistance rating for their efficiency at dealing with heat [and cold], and some are much better at doing it than others. Heatsinks operate by what's termed as 'passive cooling' because it's just heat being drawn away from the SoC by the heatsink and dissipating into the air. A heatsink can be attached to the SoC with a double-sided thermal pad, or double-sided thermal tape. Thermal glue can also be used for this purpose. Some heatsinks come with this already attached and you then just peel off the protective plastic and affix it to the SoC on the Raspberry Pi. Passive cooling with heatsinks is very successful on the Raspberry Pi Model B, Raspberry Pi Model B+, and Raspberry Pi 2 Model B.
Raspberry Pi Metal Cases & Enclosures
A greater passive cooling capacity can be achieved through installing the Raspberry Pi into a metal case which is designed to act as a heatsink, such as the Flirc Raspberry Pi Case and Flirc Raspberry Pi 4 Case. These cases are generally somewhat more expensive than a heatsink but more convenient, keeping everything neatly together inside. In certain situations you might not be able to fit your Raspberry Pi into a case/enclosure, depending on the size of heatsink you have attached to the SoC and your chosen housing. So, metal cases that have been designed as heatsinks means you will not require any additional cooling, and they do a great job of keeping the SoC cool on all versions of the Raspberry Pi.
Raspberry Pi Fans & Heatsinks
However, if greater cooling capacity is required, a fan [and heatsink] can be attached to the SoC. Fans, such as the Pi Fan, can be attached to the inside, or outside, of a case to blow air onto the SOC with or without a heatsink [e.g. a Noctua NF-A4x10 5V fan which has been mounted ~10mm above the SoC has been reported to keep the RPi4 operating temperature at approx. ~35 degrees Celsius]. Fans can also be attached to the top of the heatsink, directly blowing air onto it and cooling it down. This is what's termed as 'active cooling' because the air is being blown onto the Soc [or heatsink] by the fan which forces the heat to dissipate at a much faster rate. In certain situations this can surpass any passive cooling methods. Active [air] cooling is very cost effective which is why it's used so liberally in life and modern day technology - especially computer systems! Active cooling with a fan and heatsink is very successful on all RPi versions, especially the Raspberry Pi 3 Model B, Raspberry Pi 3 Model B+, and Raspberry Pi 4 Model B. The ultimate air-cooled solution would be to install the ICE Tower CPU Cooler, which guarantees that you won't ever have issues with overheating. [See the Ice Tower Cooler wiki for more detailed information]
Raspberry Pi Water Cooling Kits
At the extreme end of the scale is water cooling. It has to be said that if passive and air cooling is not sufficient, there must be something very wrong with your Raspberry Pi. Or you're overclocking it way beyond established safe boundries. A water cooled Raspberry Pi is possible, but not anywhere near necessary. It's quite expensive to setup, compared to other cooling solutions, and people have done it as a hobby/project or for educational purposes, amongst other reasons. A good example of a water cooling kit for the Raspberry Pi can be seen here: ModMyMods Raspberry Pi Mini Water Cooling Kit (MOD-0171).
From the options above there should be a cooling solution to suit you. So, which one would be best and why? Read on...
Which Is The Best Cooling Method For My Raspberry Pi?
It's not difficult to work out which method of cooling will best suit your Raspberry Pi. You just need an approximate idea of the temperature(s) you're dealing with and how much you need to cool down your Raspberry Pi's SoC. Depending on which version you have will dictate which cooling methods are most efficient and economical. The hotter your device becomes, the greater cooling capacity is required. It goes without saying that a fan and heatsink is by far the best economical cooling method on any version, but successfully cooling down your Raspberry Pi device may be as easy as sticking a small $2.00 heatsink to the SoC and away you go!
Be aware that running any Raspberry Pi while inside a case/enclosure is going to cause it to run at a higher temperature than it would without one. All cases act as insulators to some degree whether they are designed with heatsink capabilites, or not. Additional cooling solutions are prudent and very beneficial in most situations.
From years of experience with working on the Raspberry Pi [all versions except the Zero], dealing with heat issues and other thermal challenges, here's what the SARPi Project recommends to keep your devices running cool(er)...
• NOT water cooling! If you want to go down that route then it's very expensive, but it's your money. The Raspberry Pi doesn't need anywhere near that level of cooling capacity and, even though it is the ultimate cooling solution of all, it's a total overkill on this device. If water cooling on a Raspberry Pi was ever justified there'd be something very, very wrong indeed.
• Raspberry Pi (1): attaching a 14mm (L) x 14mm (W) x 12mm (H) heatsink to the Broadcom BCM2836 SoC is all you should need to do in order to cool it down by approx. 10 degrees Celsius under operation. With such a heatsink installed, our RPiBs and RPiB+s can run anywhere between ~40-52 degrees depending on their workload. Obviously, larger heatsinks will afford more cooling capability but always watch out for the other components on the board [power regulator, etc.] because some of them stick up and may catch on the heatsink that you intend to install. In this situation you can use a 15mm x 15mm x 1.5mm copper heatsink shim [or thicker than 1.5mm, as required] which fits between the Broadcom BCM2835 SoC and heatsink to raise the height, so that the heatsink won't be touching anything it shouldn't. Some heatsinks are designed with a 'raised boss' where it meets the surface of the chip, which is ideal for the Raspberry Pi. If you are overclocking then temperatures will run much higher and you need to factor that into any considerations for adequate cooling. In this event, you might find a fan and heatsink is required. So, perhaps a case that's made to accomodate a fan will be sufficient. Alternatively, you could select a metal case that's designed with heat-reducing qualities. Such as; the Flirc Raspberry Pi Case. The Raspberry Pi Model B+ uses the same SoC and should be treated the same with regards to any cooling considerations.
• Raspberry Pi 2: with the quad-core Cortex-A7, CPU temperatures can soar if you are demanding a lot from it. Demanding a lot would be; compiling binaries from source code using all [4x] cores for many hours, or steaming high quality videos over the Internet on the desktop, or using Kodi. In this scenario you might want to consider attaching a 25mm (L) x 25mm (W) x 20mm (H) heatsink to the Broadcom BCM2836 SoC. This should drop the operating temperature for general use a good 8-10 degrees Celsius. For those who put a greater demand on the system, attaching a fan on top of the heatsink is very easy if you find out the heatsink alone is not sufficient. For example, a 25mm (L) x 25mm (W) x 7mm (H) 5v fan can easily be bought online and some are made specifically for this purpose. You're favourite [local] Pi outlet may even stock them. A fan such as this can be connected to the GPIO header and powered from there. Watch out for other components sticking up and touching the base of the heatsink if/when you're attaching one. Copper heatsink shims are always an option.
• Raspberry Pi 3: the trickiest version of all to ascertain how much cooling is required is the Raspberry Pi 3 Model B. It's much like the Raspberry Pi 4 in terms of, 'operating at higher temperatures than you would normally expect' but it seems to run hotter doing certain things then others. Attaching a 28mm (L) x 28mm (W) x 20mm (H) heatsink to the Broadcom BCM2837 SoC will only lower the operating temperatures by approx. 3-4 degrees Celsius, after the device has been running a while. Adding a fan along with the heatsink will bring that down further to ~12-16 degrees. It's still not great, but it is quite manageable, and the RPi3 has thermal management built-in so there's no need to worry about frying your 1.2GHz quad-core CPU. Depending on how you use your Raspberry Pi 3, a metal case with a heatsink design may suffice. If you are using it for heavy workloads then a fan and heatsink are a must have! Overclocking the RPI3B is not a good idea. Not at all.
• Raspberry Pi 3 Model B+ is similar to the RPi3B. It features the Broadcom BCM2837B0 SoC, a revision of that on the RPi3B, which runs at 1.4GHz. Although the CPU runs faster than it's cousin, it doesn't produce quite as much heat [or as quickly] under operation. However, for general/basic use, attaching a 28mm (L) x 28mm (W) x 20mm (H) heatsink to the Raspberry Pi 3 Model B+ SoC will lower the operating temperature(s) by approx. 8-12 degrees Celsius, which in most cases will be sufficient. An additional 25mm x 7mm fan can easily be attached to the heatsink, if required. Watch out for other components sticking up and touching the base of the heatsink if/when you're attaching one. Again, as with the RPi3B, overclocking this device is not wise. You will certainly have problems if you push the Raspberry Pi 3 Model B+ too hard.
• Raspberry Pi 4: be aware, this device RUNS HOT and onboard thermal management often saves the day to keeps things running [smooth]. If you're a casual user who browses the Internet on the desktop, reads emails, goes on Facebook, etc. then expect the Broadcom BCM2711B0 SoC to operate as expected, but without any additional cooling it will push the thermal limit (83 degrees Celsius) while doing so. At which time thermal throttling will lower the clock speed, and thus - temperature, in order to carry on operating. If you are doing anything other than the most basic of tasks on the Raspberry Pi 4 you should seriously consider an additional cooling solution. Adding a fan and a heatsink to a Raspberry Pi 4 can dramatically reduce the operating temperature(s) to more reasonable levels, and other onboard components will also run cooler as a result. Even with all [4x] cores being used to compile binaries from source code, or streaming video from the Internet, for long periods of time, the SOC will operate at a greatly reduced temperature with a fan and heatsink attached to it. It is strongly advised that you install some additional cooling to your RPi4 device. If/when you are installing a heatsink on the RPi4B the risk of components sticking up and touching the base of the heatsink is not as much of a concern [as it is on other RPi versions] because the SoC stands proud of all the other components on the board around it (NB: except the camera and display ports). You could also fit it into a metal case, which is built specifically for the device and acts as a heatsink by design. If there's any concern(s) with metal 'heatsink-style' cases it would be that, some of them are like radiators; when they heat up, they can keep heating up until the heat source ceases. This can cause problems in certain situations where the metal case itself becomes too hot to handle, like a frying pan! If/when you buy a metal case for your Raspberry Pi 4, make sure that it's well designed and the quality is solid and robust. Like the Flirc Raspberry Pi 4 Case.
So, there's a lot of talking been done so far in this SARPi mini-project but not much [if any?] action! Where would a good mini-project be without an example test-case to go with it? That's where we're heading next.
SARPi Project TEST - The Raspberry Pi 4 Model B Thermal Challenge!
On 26 July 2019 @ 10:00 approx. we got our hands on a Raspberry Pi 4 Model B. Thank you very much ThePiHut.com and Mr Postman!
Obviously, we wanted to get the RPi4 fired up and running as quckly as possible and put this new ARM device through it's paces!
It took a few minutes to download an image of Raspbian and write it to a microSD card and boot the RPi4 with it. It was very easy to get up and running in a very short time. [All credit to Raspbian, and the Raspberry Pi Foundation. They really do facilitate NOOBS with this OS!] Then we started to use the Raspberry Pi with Raspbian installed to check out this new ARM-based device. It wasn't long before we noticed the SoC was starting to get quite hot. Then, as we continued, it got hotter, and hotter. We checked out the status of the CPU by running a simple script ['cpu_update.sh'] that we'd previously used on the RPi2/3, exactly for this purpose. You can see the results in the screenshot below.
Having seen the thermal status of the CPU it was alarming that the operating temperature was at such a high level, when we were only running commands to; check that the RAM is present and correct, check the hardware is what it's supposed to be, install updates with 'apt', etc. All of which was carried out at the command prompt. After checking 'top' and seeing that 0.3% of 1x CPU core was being used by 'top' and 0.2% of another CPU core was being used by 'systemd', we decided to hit the Internet, and ask Google, to try and find out if anybody else had reported the amount of heat generated by the Raspberry Pi 4 Model B. Unfortunately, after spending approx. 1 hour searching, it seemed as if we were one of the first to receive a Raspberry Pi 4 via mail-order. Ergo, there was not much information available online at that time. Unfortunately.
It seemed that those who had received their RPi4 at that time [26-27 June 2019] weren't experiencing any thermal problems but much the opposite. This puzzled us a little and we were actually advised by several 'learned' individuals that we might have a faulty device and should return it (RMA). This hypothesis turned out to be completely misplaced!!!
Even though there were concerns about the thermal issue(s), the Raspberry Pi 4 was put to work porting Slackware ARM onto the device, for much of the rest of the day, while we investigated why it was running at such a high temperature. The RPi4 performed very well indeed! By the end of the day Slackware ARM was booting perfectly on the Raspberry Pi 4. We still hadn't located much information on the thermal issue, or found any other RPi4 users who were having the same problem(s) that we were.
In our continued quest for information, we found an article by [Principal Software Engineer at Raspberry Pi Trading Ltd.] Jamesh who wrote the following in a post on the Raspberry Pi Forum, "The PI4 will run hotter - although its on a smaller process, it has much more powerful ARM cores, plus the HDMI output at 4kp60 adds quite a bit of heat. The ethernet is now on the main SoC also, that is another source of heat that wasn't there before. All in all, more performance requires more power requires more heat output. We are still looking in to clock improvements to reduce heat load, its amazing how much reducing a clock where possible can reduce the overall temperature, it's a matter of finding settings that mean everything still works. So, don't use hdmi_enable_4k=1 unless using 4kp60, that can make quite a difference."
So, it seems that we must wait until the updated 'clock improvements' firmware appears on the Raspberry Pi GitHub repository, before any inherent thermal issue(s) on our Raspberry Pi 4 can be addressed in that respect. The RPi's firmware is closed-source, not open-source. Any repairs, revisions, upgrades (etc.) to the RPi firmware is carried out ONLY by the Raspberry Pi Foundation's software developers and engineers. So, in the meantime, we'll deal with any thermal challenges in our own way.
Makes one wonder, when considering the high operating temperatures and USB-C socket configuration issues so soon after being released, to what degree the Raspberry Pi 4 Model B was tested and evaluated beforehand. Exaga put this question to Jamesh on the Raspberry Pi Forum. Jamesh's response can be seen in this Raspberry Pi Forum post.
The following morning, the Raspberry Pi 4 was powered on with Slackware ARM current installed, which we were testing at the same time as trying to deal with the high temperatures of the device. It was ran without any additonal cooling, so that data could be collected on the system. The screenshot below shows the thermal status of the CPU while idling at the command prompt.
Next we loaded the [Xfce] desktop and just let it sit there for a few minutes. The screenshot below shows the thermal status of the CPU at that time.
A relatively short [approx. 20-25 minute] binary compile from source code was carried out for testing purposes. This was carried out via a terminal on the desktop. During the process thermal throttling kicked-in and lowered the CPU clock speed to compensate many, many times. The screenshot below shows the maximum thermal status of the CPU during this period.
The half-level thermometer icon also popped up on our screen a few times during this test.
Rasberry Pi "Over Temperature Warning" [on-screen icons]
NB: You may see a "thermometer" icon appearing on your screen like the ones displayed above. If/when you see one of these icons, it indicates that the temperature of your SoC is approaching unacceptable levels, and thermal throttling is active. At this point the CPU clock speed will be lowered in order to slow [and cool] the system down. Whenever the half-level thermometer icon is displayed, it indicates that your system SoC is operating at approx. 80-85 degrees Celsius and is a warning indicator. Whenever the full-level thermometer icon is displayed, it indicates that your system SoC is operating at +85 degrees Celsius! When the full-level thermometer icon appears it indicates that you should, "STOP whatever you're doing RIGHT NOW!" If you see either of the thermometer icons appearing often on your screen it's not a good sign and signifies that an additional cooling solution is required.
Due to the results of our testing, we knew from experience and dealing with thermal issues on the RPi3s that an additional cooling solution was required. We measured up the maxumim size of heatsink that would fit easily onto our Raspberry Pi 4 Model B and decided that 28mm (L) x 28mm (W) x 20mm (H) would fit with a little room to spare. A heatsink to those specifications was procured for the princely sum of [approx.] $6.00 and took FIVE DAYS to arrive! [i.e 5 days is 3 days longer than we had anticipated - thanks eBayer A++]
The largest size heatsink that can be installed on a Raspberry Pi 4 Model B is 35mm (L) x 35mm (W). A heatsink of this size was successfully installed on a Raspberry Pi 4 Model B by Jean-Luc Aufranc @ CNXSoft, who quickly found out that using his Raspberry Pi 4 Model B without a cooling solution caused serious performance issues. In some areas his RPi4 device was slower than a Raspberry Pi 3 model B due to severe overheating. Read Jean-Luc's 'Raspberry Pi 4 Benchmarks – Heatsink Edition' review. It's quite an eye-opener.
The heatsink was attached to the Raspberry Pi 4 SoC using a double-sided 14mm x 14mm '3M branded' thermal pad. The heatsink measured 28mm (L) x 28mm (W) x 20mm (H) as advertised. We were good to go with the next phase of addressing this Raspberry Pi 4 Model B thermal issue.
The RPi4 was left to idle at the command prompt for approx. 15 minutes. The screenshot below shows the CPU clock speed and thermal status. Which isn't dramatically less [~5'C lower] than running the device without any additional cooling. We had hoped that this size of heatsink would lower the operating temperature by at least 10 degrees.
A test was ran [compiling a 'gcc make -j4' binary from source code] to see how hot the SoC became while maxing out all [4x] cores for a period of approx 25 minutes. The screenshot below records the highest temperature during this period. As you can see the SoC is ~10 degrees Celsius below the thermal limit of 83 degrees. Considering that we intend to use the RPi4 for, running it with only a heatsink for additional cooling didn't lower the operating temperature of the SoC nearly enough.
It was at this point, we realised that a fan would be required to run with the heatsink. So, a 30mm (L) x 30mm (W) x 7mm (H) [5V] fan, which we already had as a spare, was attached to the top of the heatsink with retaining screws and the fan's power cables were connected [correctly] to the 5V [pin-4] and the ground [pin-6] on the GPIO header pins. Then we left the system to idle at the command prompt for approx. 10-12 minutes and checked the CPU clock speed and thermal status. The results can be seen in the screenshot below.
WOW! Look at the drop in temperature! Now, this is closer to what we're trying to achieve. By attaching a 28mm (L) x 28mm (W) x 20mm (H) heatsink, with a 30mm (L) x 30mm (W) x 7mm (H) [5V] fan on top, it's cooled down the Raspberry Pi 4 SoC to almost half of what it was [i.e. without any additional cooling].
Simply by adding a small fan to our additional cooling setup, we were able to greatly increase the cooling capabilities of our heatsink. The heatsink on it's own only lowered the CPU thermal status by ~5 degrees Celsius. With the addition of a fan, that figure dropped by more than +20 degrees!
So, our fan and heatsink cooler is allowing the SoC to operate at a much lower, and a much more acceptable, temperature. Now we wanted to test to see what the CPU thermal status would be while running 'gcc make -j4' to compile binaries from source code. This will put quite a demanding workload on all of the [4x] CPU cores, and it will tell us if the Raspberry Pi 4 Model B SoC requires greater cooling capacity than what we've already provided. This test period lasted for approx. 25 minutes and the highest temperature achieved during that time can be seen in the screenshot below.
Seeing that the CPU thermal status was well within acceptable parameters, we were very happy with these test results.
So happy, in fact, that we decided to do another test, only this time we ran 'gcc make -j6' to compile binaries from source code. This will put further workload on the [4x] CPU cores and might make a difference to the thermal status. The test ran for approx. 25 minutes and the highest temperature achieved in that time can be seen in the screenshot below. This result shows that 'gcc make -j6' [compared to 'make -j4'] doesn't cause the CPU to generate much more heat at all.
We used the Raspberry Pi 4 for a few days with this additional cooling setup, checking the CPU thermal status every once in a while, and Slackware ARM performed admirably during that time without any problems at all. Which is pretty much what we've come to expect from using the OS. Our Slackware ARM system seemed even quicker with the fan and heatsink installed, and the SoC running at a much lower operating temperature than it would normally run without any additional cooling.
The tool which the SARPi Project uses to monitor a Raspberry Pi's CPU clock speed and thermal status ['cpu_status.txt'] was revised and updated. So, we took this opportunity to test the new version for the final readings in our thermal campaign.
We managed to acquire a slightly smaller 5V fan than the one we are using for thermal testing. This smaller fan measures 25mm (L) x 25mm (W) x 7mm (H) and it will be interesting to see if there is any difference between our previous [30mm] fan and this one in terms of operating temperature(s). The same 28mm (L) x 28mm (W) x 20mm (H) heatsink is being used, with just the fans being swapped over.
A full SARPi4.SlackBuild process was initiated and the CPU clock speed and thermal status was monitored throughout. The highest temperature during this period can be seen in the screenshot below.
On the [Xfce] desktop we had the Firefox browser running with 3 tabs open; 2 playing random youtube.com music videos, and the other playing a streaming test-video @ 720p60. We were installing system updates via slackpkg in a terminal window. We had another terminal window open monitoring the CPU thermal status with the 'cpu_status' tool. All these things at the same time were running and the system was not laggy or glitching at all. The results of the CPU clock speed and thermal status at that time can be viewed in the screenshot below.
The results are slightly higher than the same previous tests but then we are using the VideoCore VI rather enthusiastically. Tasking the GPU (VideoCore VI) will increase the temperature of the Soc because it requires more power in order to work harder/faster and [consequently] generates more heat.
SARPi Project TEST - Raspberry Pi 4 Model B Thermal Challenge Results
In conclusion, the one MAJOR discovery, which stands out more than anything else, from testing and monitoring the thermal status of the Raspberry Pi 4, is the device's GREATLY increased speed and performance while being actively cooled by our fan and heatsink setup! It didn't affect the operating temperatures that much by using a 30mm or a 25mm fan. In terms of time saved, the differences between a Raspberry Pi 4 with and without additional cooling [when running our Sarpi4.SlackBuild process] is approx. 30 minutes. Using our Raspberry Pi 4 [without any additional cooling] as a reference, 30 minutes equates to approx. 20% of the total time it took for the process to run from start to finish. The screenshots below show; maximum temperature reached, and total run time of the build process, on our air-cooled Raspberry Pi 4 Model B.
Our Raspberry Pi 4 [with added fan and heatsink cooling] is approx. 20% faster than it is without any additional cooling. It makes sense to add cooling to your Raspberry Pi for this reason, and many more.
The SARPi Project hopes the information in this mini-project was helpful or useful. If you have any questions, or need assistance please use the Linux Questions Slackware ARM Forum.
Thanks for your interest in our efforts!
SARPi Project Team