Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Raspberry Pi 4 | Options to lower CPU idle temperature #3046

Closed
RefineryX opened this issue Aug 9, 2019 · 19 comments
Closed

Raspberry Pi 4 | Options to lower CPU idle temperature #3046

RefineryX opened this issue Aug 9, 2019 · 19 comments

Comments

@RefineryX
Copy link

RefineryX commented Aug 9, 2019

I have installed the latest raspberry pi 4 buster image yesterday from the dietpi website.

I know there has been issues in the past and the raspberry pi foundation released a firmware update to lower the temp - I am not sure if this has been integrated?

However, on idle - I am running 60 degrees (c) - that’s hot! The pi is not doing anything (as checked in htop) It’s in a cool well ventilated environment.

Is this normal?

Not at home at the moment but will complete this later...

Required Information

  • DietPi version |
#!/bin/bash
G_DIETPI_VERSION_CORE=6
G_DIETPI_VERSION_SUB=25
G_DIETPI_VERSION_RC=3
G_GITBRANCH='master'
G_GITOWNER='MichaIng'
  • Distro version | buster
  • Kernel version | Linux Plex 4.19.58-v7l+ #1245 SMP Fri Jul 12 17:31:45 BST 2019 armv7l GNU/Linux
  • SBC device | RPi 4 Model B (armv7l)
  • Power supply used | using Anker PowerPort 60 W 6-Port with an Anker USB C Cable. The only other thing I have plugged in is a Raspberry Pi 3b+
  • SDcard used | Samsung MB-MC32GA/AMZ 32 GB 95 MB/s Memory Evo Plus Micro SD Card
@Trunkzeh
Copy link

Trunkzeh commented Aug 9, 2019

That power supply is not suitable for the RPI4 for starters.

@RefineryX
Copy link
Author

@Trunkzeh - What power supply?

@Trunkzeh
Copy link

Trunkzeh commented Aug 9, 2019

Ahh just noticed its a default template; i read 5v 1A RAVPower as the power supply you are using which is far too low for the RPI4 :)

@MichaIng
Copy link
Owner

MichaIng commented Aug 9, 2019

@SimplyGardner
Thanks for your report.

Jep I read through the long discussions about the RPi4 temperature, that actually made me not yet ordering one for my home production server. The new firmware was a slight enhancement but there are still many similar reports on https://www.raspberrypi.org/forums/. Last result is usually that without any cooling, you must not put it in any housing and at best place it vertically to allow a better passive heat flow. But the very vast majority argue that it simply requires a little fan or something like this: https://www.raspberrypi.org/forums/viewtopic.php?f=28&t=243500&start=325#p1509456

The firmware btw is updated automatically on first boot. If this was more then ~3 weeks ago, then you might still be at the lower version, if no dietpi-software installs or manual APT upgrades have been done. apt update && apt upgrade + reboot will bring you onto current firmware version in case.

But aside from that we can assure that CPU usage is really around zero and some other things:

  • When checking htop, due to the longer 2 seconds update interval, short CPU usage peaks can be missed. htop -d 5 lowers the update interval to 0.5 seconds. Or of course the 1min/5min/15min average numbers give a clearer overview.
  • As well you can run G_OBTAIN_CPU_USAGE to check the overall current (over 2 seconds, I think) CPU usage (all cores in average).
  • Do you have any RPi4 specific HDMI functionality enabled, i.e, 4k? If it's a headless system you might try to enable the headless mode from dietpi-config > Display Options > Display Resolution menu. This disables the whole framebuffer pipe. And v6.26 will bring some more slight enhancements when disabling BT/WiFi/Camera module, which you can try if you don't use either of them?
  • Do you have USB devices attached? I read that those USB3.0 ports can get quite hot when having a non-self powered device attached, which then raises the housing temp significantly.
  • And as you say 60 °C, currently when not changing CPU temperature limit (dietpi-config > Performance Options), it defaults to 65 °C which works very well for RPi Zero/1/2 but means that clocks are started to throttle down at 60°C. You can run cpu to get current clocks, which might be already slightly lower then maximum. With v6.26 we raise this to 75 °C for RPi4 (same as RPi3), so throttling starts at 70°C.

@RefineryX
Copy link
Author

@michalng

Thanks for the reply - i’ll definitely read more into the links you provided this evening when I am home.

I am running the rPi 4 without any case and a heat sync. I’ve not installed any software yet on it so it is just a basic dietpi install. To rule out any corruption - went ahead and did a fresh install again.

It’s running headless without any HDMI plugged in (I plan to run headless).

The only thing I have edited is I plugged in a Western Digital Elements HD (has its own power) into the USB3.0 although this has been idle.

@MichaIng
Copy link
Owner

MichaIng commented Aug 9, 2019

@SimplyGardener
As said, try to select the headless mode from dietpi-config. This will be made more accessible/clearer with v6.26 as well, basically a rework of the display menu and I will post some other minor enhancements later to test.

@RefineryX
Copy link
Author

G_OBTAIN_CPU_USAGE reports between 1.2 to 1.9
Headless was enabled
Installed a mini fan and has brought down the temp to 43 °C on idle.

I have also updated the required information in post 1.

@MichaIng
Copy link
Owner

MichaIng commented Aug 9, 2019

@SimplyGardner
Okay 1.2% to 1.9% close enough to zero, as it should.

Also without case, you could touch the USB port to check if it's hot even in idle. Not sure how well this SBC handles currents for USB devices with external power supply.

Some other things to try:

  • Disable RPi camera related kernel modules, at least this is the only use case for them I know about:
    • Before kernel v4.19 these were not loaded, unless you set start_x=1, which loads the extended device tree, especially required for the RPi camera module. Due to internal changes these are now enabled as well without extended device tree, and they pull a bunch of dependency modules as well. You can compare lsmod before this change and afterwards (+reboot), which should list ~10 modules less then. This will be done with v6.26 update as well, when camera module/extended device tree is disabled.
echo -e 'blacklist bcm2835_codec\nblacklist bcm2835_v4l2' > /etc/modprobe.d/dietpi-disable_rpi_camera.conf
  • Disable Bluetooth via dtoverlay, if you don't use it:
G_CONFIG_INJECT 'dtoverlay=disable-bt' 'dtoverlay=disable-bt' /DietPi/config.txt
dtoverlay disable-bt
  • Disable WiFi via dtoverlay if you use Ethernet only:
G_CONFIG_INJECT 'dtoverlay=disable-wifi' 'dtoverlay=disable-wifi' /DietPi/config.txt
dtoverlay disable-wifi

We disable Bluetooth and WiFi currently only by blacklisting the kernel modules, but the RPi allows to not load them in the first place via dtoverlays, which might further reduce load on hardware level. Would be actually interesting to compare power usage with blacklisted modules only and dtoverlays on the other hand, as I am not sure if there is really a difference and how large it is.

And as we are about to implement some RPi enhancements from v6.26, there is another one, although should not affect CPU usage/temps at all, only reduce RAM usage a bid:

systemctl disable --now haveged
G_AGP haveged
G_AGI rng-tools
G_AGA
  • This changes the entropy daemon. haveged uses slightly more RAM, but works on all devices. rng-tools (rngd) requires some hardware support, which is the case on RPi. So we can switch this. Only downside is that it produces some system log entries every hour, which cannot be disabled currently, however it is default on Raspbian as well so it's best to follow them.

CPU governor is ondemand, right?
You can verify that it is indeed clocked down on idle:
cat /sys/devices/system/cpu/cpu*/cpufreq/scaling_cur_freq
I think it's 600 minimum by default. You can lower minimum clocks to 300 via dietpi-config > Performance Options to have it further clocking down on idle.

@RefineryX
Copy link
Author

@MichaIng

The USB cable to the HDD is not hot or warm. Its normal - room temp.

  • Disabled bluetooth
  • Disabled wifi
  • CPU is is ondemand

Running cat /sys/devices/system/cpu/cpu*/cpufreq/scaling_cur_freq I get:

600000
600000
600000
600000

@MichaIng
Copy link
Owner

MichaIng commented Aug 9, 2019

@SimplyGardner
Okay, 600 Mhz default minimum clock then, like on all other RPi models. As said, you could lower to 300 Mhz which should have no downside. Default ondemand sample rate is 25 milli seconds AFAIK, which means that after max 25 milli seconds CPU usage over limit (50% by default) the clock rate will be increased, fast enough for all usual tasks.

@MichaIng MichaIng changed the title rPi 4: Running very hot Raspberry Pi 4 | Options to lower CPU idle temperature Aug 11, 2019
@MichaIng
Copy link
Owner

MichaIng commented Aug 22, 2019

Okay, our headless mode does not work anymore, since the related config.txt setting has been removed from the firmware: https://www.raspberrypi.org/forums/viewtopic.php?p=1523456#p1523456

So until there is another way, tvservice -o has to be added again to disable HDMI/video completely. I will run some tests, if this disables the framebuffer as well, so it's dimensions can be left unchanged. At least this allows easier restoring of video capabilities (emergency case, SSH failing on boot and such things) by changing the AUTO_SETUP_HEADLESS value only. AUTO_ is then again the wrong prefix... however I hope there will be another way soon to allow disabling things without the need to run any command on boot.

@Trunkzeh
Copy link

I've added the Fan Shim from Pimoroni to my RPI4 - stable temperatures of 42c. Bear in mind the RPI4 SoC doesnt begin to throttle until the 80-85 range; over 85 it will throttle fully.

@RefineryX
Copy link
Author

Running with no fan and it’s running constantly at 60 degrees c.

Just so I understand the issues, is this an issue with the dietpi os of the raspberry 4 hardware?

@Trunkzeh
Copy link

Trunkzeh commented Aug 22, 2019 via email

@MichaIng
Copy link
Owner

@Trunkzeh @SimplyGardner
Jep, hardware "issue", or lets say the expectations might have been different for users used to earlier RPi models without any heat sink/cooler. I mean I have my Pi2 here without any cooling, in closed case beside some HDD and other electronic and it idles at 36 °C (never saw temps > 50 °C even on longer load). How should I expect that I will ever need any though about cooling for on RPi 😄.

Bear in mind the RPI4 SoC doesnt begin to throttle until the 80-85 range; over 85 it will throttle fully.

This is a matter of the temp_limit setting in config.txt, which is 65 °C by default on DietPi. On RPi1-2 this was totally okay, on RPi3 we already raise the default to 75 °C on first boot, on RPi4 with v6.26 as well.

Default on Raspbian is indeed 85 °C, but even if the hardware has no issue with this, if users can't touch certain parts of the SBC without burning their fingers, and plastic cases start to smell and things like that, this is no acceptable situation. So having 75 °C here is good IMO, which means throttling starts at 70 °C, maxxing at 75 °C. Any temperatures beyond that boarder should IMO be cooled down.

@Trunkzeh
Copy link

@MichaIng I briefly took the fan shim off and the RPI4 went up and was idling around 60c. No heatsink or any manner of passive cooling. Set the throttle to 75c within dietpi-config and I havent seen it hit that high during load so this may be a good compromise.

@Trunkzeh
Copy link

For those interested; running the following command below will give you the temperature:

/opt/vc/bin/vcgencmd measure_temp

@MichaIng
Copy link
Owner

@Trunkzeh
Alternative: G_OBTAIN_CPU_TEMP
This basically does cat /sys/class/thermal/thermal_zone0/temp and rounds it to full degree Celsius.

Note that throttling starts about 5 °C below temp limit, so when set to 75 °C it will start throttling at 70 °C. The closer temps reach the limit, the more it throttles down.

@MichaIng
Copy link
Owner

MichaIng commented Oct 9, 2019

Btw with v6.26 we add overclocking presets for RPi4. There is as well one "powersaving" set that simply sets overvoltage to -2 which lowers CPU/GPU voltage from 1.2V to 1.15V which on our tests still runs very stable. Lower voltage = lower power = lower temp.

Aside from that there have been several enhancements done by RPi devs kernel/firmware-wise. I mark this issue hence as closed for now. If there are still ideas/enhancements to better control RPi4 temps, just mention @MichaIng here and I will reopen for investigation.

@MichaIng MichaIng closed this as completed Oct 9, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants