Raspberry Pi 4 Model B temperature

Hi,

Just configured monitoring sensors on my Raspberry Pi 4 Model B and the temperature fluctuates between 71 - 75 ° c.


This seems a bit on the high side to me?

Am I right to be concerned?

Regards,

4 Likes

Yes,
I have a 4B with a 23 degree ambient it runs at 48 degrees.
I’m using the flirc passive cooling case.
The hotter your cpu runs the lower its life (though its not a linear relationship)
However it should last quite a reasonable amount of time at 75 degrees (I reckon (and this is a guess) at least 4 or 5 years, but HA instances do tend to run 24/7 :man_shrugging: )

Over 70ºC does seem a bit high and I imagine your R Pi will be throttling at times. I see my R Pi 4b running HA Supervised is at 58ºC (in 18ºC ambient).

Nice card by the way. How do you extract the R Pi physical data ?

Hi, I cant take too much credit for it and it took some googling and copy / paste to put it all together.

configuration.yaml

#==================
#=== System Sensors
#==================

  - platform: command_line
    name: RPi CPU Temperature
    command: "cat /sys/class/thermal/thermal_zone0/temp"
    value_template: "{{ value | multiply(0.001) | round(2) }}"

  #===========================================
  #=== Latest Sonoff Tasmota firmware version
  #===========================================
  - platform: command_line
    name: Tasmota Current Version
    command: "curl -s https://github.com/arendst/Sonoff-Tasmota/releases/latest | cut -d'\"' -f2 | rev | cut -d'/' -f1 | rev"
    scan_interval: 86400

  #==============================
  #=== Installed hass.io version
  #==============================
  - platform: version
    name: Installed Version
    source: local


  #================================
  #=== Latest Available HA Version
  #================================
  - platform: version
    name: Latest Available Version
    beta: false
    image: raspberrypi3
    source: hassio


  #=======================
  #=== Raspberry Pi Power
  #=======================
  - platform: rpi_power
    text_state: True


  #=============================================
  #=== Last boot time, Disk, memory & CPU usage
  #=============================================
  - platform: systemmonitor
    resources:
      - type: last_boot
      - type: disk_use_percent
        arg: /
      - type: memory_use_percent
      - type: processor_use

  
  #====================
  #=== CPU Temperature
  #====================
  - platform: command_line
    name: CPU Temp
    command: "cat /sys/class/thermal/thermal_zone0/temp"
    unit_of_measurement: "°C"
    value_template: '{{ value | multiply(0.001) | round(0) }}'


  #===================
  #=== System Up Time
  #===================
  - platform: uptime


  - platform: template
    sensors:

      #==========================
      #=== Home Assistant uptime
      #==========================
      ha_uptime:
        friendly_name: HA Uptime
        value_template: >
          {% if states('sensor.uptime') == '0.0' %} 
            Just restarted...
          {% else %}
            {% macro phrase(value, name) %}
            {%- set value = value | int %}
            {%- set end = 's' if value > 1 else '' %}
            {{- '{} {}{}'.format(value, name, end) if value | int > 0 else '' }}
            {%- endmacro %}
            
            {% set weeks = (states('sensor.uptime') | int / 7) | int %}
            {% set days = (states('sensor.uptime') | int) - (weeks * 7) %}
            {% set hours = (states('sensor.uptime') | float - states('sensor.uptime') | int) * 24 %}
            {% set minutes = (hours - hours | int) * 60 %}

            {{ [ phrase(weeks, 'week'), phrase(days, 'day'), phrase(hours, 'hr'), phrase(minutes, 'min') ] | select('!=','') | list | join(', ') }}
          {% endif %}


      #=========================================
      #=== Raspberry Pi last boot date and time
      #=========================================
      last_boot_date_time:
        friendly_name: Last Boot
        value_template: >
          {% set date = as_timestamp(states('sensor.last_boot')) | timestamp_custom('%d') %}
          {% set date = '{:01}'.format(date | int) %}
          {% if date in ('1', '21', '31') %}
            {% set date = date ~ 'st' %}
          {% elif date in ('2', '22') %}
            {% set date = date ~ 'nd' %}
          {% elif date in ('3', '23') %}
            {% set date = date ~ 'rd' %}
          {% else %}
            {% set date = date ~ 'th' %}
          {% endif %}

          {{ as_timestamp(states('sensor.last_boot')) | timestamp_custom('%H:%M on %a') }} {{ date }} {{ as_timestamp(states('sensor.last_boot')) | timestamp_custom('%b %Y') }}


      #=========================
      #=== Raspberry Pi Up Time
      #=========================
      rpi_uptime:
        friendly_name: RPi Uptime
        entity_id: sensor.time
        value_template: >
          {% set up_time = as_timestamp(now()) - as_timestamp(states('sensor.last_boot')) %}

          {% set minutes = (up_time // 60) | int %}
          {% set hours = (minutes // 60) %}
          {% set days = (hours // 24) %}
          {% set weeks = (days // 7) %}

          {% set minutes = (minutes % 60) %}
          {% set hours =  (hours % 24) %}
          {% set days = (days % 7) %}

          {% macro phrase(value, name) %}
                    {%- set value = value %}
                    {%- set end = 's' if value > 1 else '' %}
                    {{- '{} {}{}'.format(value, name, end) if value | int > 0 else '' }}
          {%- endmacro %}
                    
          {% set text = [ phrase(weeks, 'week'), phrase(days, 'day'), phrase(hours, 'hr'), phrase(minutes, 'min') ] | select('!=','') | list | join(', ') %}
          {% set last_comma = text.rfind(',') %}
          {% if last_comma != -1 %}
            {% set text = text[:last_comma] + ' and' + text[last_comma + 1:] %}
          {% endif %}
          
          {{ text }}

and for the card configuration

custom mini graph card https://github.com/kalkih/mini-graph-card

custom vertical stack card https://github.com/ofekashery/vertical-stack-in-card

type: 'custom:vertical-stack-in-card'
title: SYSTEM MONITORING
cards:
  - type: horizontal-stack
    cards:
      - type: 'custom:mini-graph-card'
        entities:
          - sensor.cpu_temp
        font_size: 75
        line_color: red
        line_width: 8
      - type: 'custom:mini-graph-card'
        entities:
          - sensor.disk_use_percent
        font_size: 75
        line_color: blue
        line_width: 8
  - type: horizontal-stack
    cards:
      - type: 'custom:mini-graph-card'
        entities:
          - sensor.memory_use_percent
        font_size: 75
        line_color: red
        line_width: 8
      - type: 'custom:mini-graph-card'
        entities:
          - sensor.processor_use
        font_size: 75
        line_color: blue
        line_width: 8
  - type: horizontal-stack
    cards:
      - type: glance
        columns: 3
        entities:
          - sensor.ha_uptime
          - sensor.hacs
          - sensor.installed_version
          - sensor.last_boot
          - sensor.last_boot_date_time
          - sensor.latest_available_version
          - sensor.rpi_power_status
          - sensor.rpi_uptime
          - sensor.tasmota_current_version
          - binary_sensor.updater
          - sensor.uptime

For the temperature issue I will try a fan on my case and see if that improves it.
Regards,

6 Likes

Fans can fail and they also consume power, that’s why I always go passive if possible (but I suppose fins can get blocked with dust/gunk over time, but less so than drawing more and more air over them)

Okay,

Fan connector had come loose from header, now see the difference.

I wouldn’t of thought it would of had such an impact.

Christopher Barnatt did a good job of comparing cooling techniques for an RPI 4:

Screenshot from his video:
CoolingComparison

Andreas Spiess reviewed the Flirc case:

1 Like

Very Interesting, may go for a FLIRC case as the fan on mine is rather noisy.

On another note it seems a firmware update is in order.

I presume I would have to shutdown the HA, remove my SD Card and put another one with NOOBS to do the update via terminal?

Thanks for the code. I’ve pinched some of your code for R Pi data and it works nicely. I haven’t managed to get the mini-card-graph going yet but it displays OK in the standard history graph.

All of which shows that my fan shim wasn’t really set up properly as the R Pi was 60ºC +/- 2ºC, a tad warm. It’s now on at 60ºC, off at 50ºC, so I’ll be watching the graph with interest, thanks.

What firmware are you trying to update ? HA ? Raspbian ? Something deeper in the R Pi ? It sounds like you are updating Raspbian if you are using NOOBS, which isn’t really necessary. Assorted sudo apt-get commands should do it.

Hi, It’s the PI 4 Firmware, see attached

Pi4 New Firmware Keeps it Cooler! - How to Install Firmware Raspberry Pi 4

OK, in the interest of experimentation, I just ssh’d into my HA R Pi, and typed the commands in that YouTube video, after checking with the R Pi official site that such actions made sense. Took about 5 minutes, rebooted, and the R Pi and HA are running as normal. Easy, although as with all updates, something could break.

Double check the update worked:

sudo rpi-eeprom-update
BCM2711 detected
BOOTLOADER: up-to-date
CURRENT: Thu 16 Apr 17:11:26 UTC 2020 (1587057086)
 LATEST: Thu 16 Apr 17:11:26 UTC 2020 (1587057086)
 FW DIR: /lib/firmware/raspberrypi/bootloader/critical
VL805: up-to-date
CURRENT: 000137ad
 LATEST: 000137ad

Looks good.

Tried to access mine from win 10 machine, I get
C:\Users\Mark>ssh [email protected]
ssh: connect to host 192.168.0.63 port 22: Connection refused

Found this on the Pi website to enable

3. Enable SSH on a headless Raspberry Pi (add file to SD card on another machine)
For headless setup, SSH can be enabled by placing a file named ssh, without any extension, onto the boot partition of the SD card from another computer. When the Pi boots, it looks for the ssh file. If it is found, SSH is enabled and the file is deleted. The content of the file does not matter; it could contain text, or nothing at all.

If you have loaded Raspbian onto a blank SD card, you will have two partitions. The first one, which is the smaller one, is the boot partition. Place the file into this one.

Can I remove the SD Card and create the ssh file on my windows pc then place it back in my pi and reboot to enable ssh?

For now I do not have a micro HDMI but have ordered one.

Anyway let us know if you find the update has had any improved cooling performance.

Regards,

The instructions you found are for the initial installation and configuration of Raspbian.

You’ll need to connect a monitor, keyboard, and mouse to the RPI. Instructions for installing the ssh service depend on whether you installed Raspbian with or without a GUI.

I found this hilarious :rofl: I’ve made this same mistake so often that I now have changed my “how to install raspbian” notes to include it in bold (twice).
So I’d like to say it’s a mistake you won’t make twice but obviously I probably did it more than twice ! (pays another visit to balena etcher :roll_eyes: )

How did you manage to ssh, was it from windows CL or from ssh add on in HA?

How did you install your image, balenEtcher?

Sorry, who are you talking to ?
You replied to the thread so only the OP would get notified, but that’s you so …

noted, well was intended for Chiny but if anyone else has a suggestion for my predicament?

I’m reasonably confident, well 90% confident, that I have added an empty ssh file to various Raspbians over the years, somewhat after first powering up the image. Raspberry Pi .org say:

When the Pi boots, it looks for the ssh file. If it is found, SSH is enabled and the file is deleted.

Just “boot”, not “first boot”.

Getting a Windows PC to read/write a Linux formatted sd card sounds fun, but I imagine there are a number of utility programs that will do the job.

Ah, just seen your latest post; I ssh’d in from a terminal window on a Mac. I’ve not used the HA ssh utility but would have expected it to be confined to the HA installation, whereas I was working outside HA, in Raspbian. Perhaps of significance, I’m using Home Assistant Supervised, HA on Raspbian.

Back to plan A then, will wait for my micro HDMI cable to arrive then shut down HA and eject my HA SD Card and boot the pi with Raspbian image on a spare SD card, do the update shut down then put my HA SD Card in.

Just a quick catch up to show the results from the Pi eeprom update of April 20.

image

CPU Average temperature decreased approximately 2 - 3 °C.

This may have been in combination with the 0.109 update.