Raspberry Pi CPU Fan Automation: A Successful Setup Story

Hey everyone, I wanted to share my recent project with the Raspberry Pi CPU fan automation. After noticing that my Pi 4 4GB was getting quite hot, I decided to tackle the issue head-on. I came across a helpful guide and decided to use two fans—one to blow cold air in and another to blow hot air out. Here’s how I made it work!

First, I wired up the fans using GPIO4, one 5V pin, and one GND pin. I followed the guide to build the circuit and then integrated it into my Home Assistant setup. I added the fans as a switch in the configuration.yaml file:

yaml
sensor:

  • platform: rpi_gpio
    ports:
    4: Raspberry Pi Luefter

To monitor the CPU temperature, I used the command_line platform to create a new sensor:

yaml

  • platform: command_line
    name: CPU Temp
    command: “/bin/cat /sys/class/thermal/thermal_zone0/temp”
    unit_of_measurement: “°C”
    value_template: ‘{{ (value | int / 1000) | int }}’
    icon_template: ‘mdi:thermometer’

Next, I set up automations to control the fans based on the CPU temperature. The fans turn on when the temperature exceeds 55°C and turn off once it drops below 36°C. This setup has been incredibly effective—reducing the temperature from 65°C to 33°C within minutes!

I also wanted to share the fans I used. I started with these affordable ones from Amazon.de:

MakerHawk 2pcs Raspberry Pi DC Bürstenlose Lüfter

However, I’m considering upgrading to these quieter ones in the future:

Noctua NF-A4x10 5V

I hope this detailed walkthrough helps someone else looking to cool down their Raspberry Pi setup. It’s been a great learning experience, and I’m thrilled with the results!

Cheers,
[Your Name]