Skip to content
A tiny script allowing temperature controlled Raspberry Pi cooling.
Python
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
LICENSE
README.md
pifancontroller.py

README.md

Pi Fan Controller

A simple, temperature-based fan controller for a Raspberry Pi.

Loosely based on the work done by Edoardo Paolo Scalafiotti found here, this simple python script controls a cooling fan using a BJT transistor connected via GPIO. It makes use of two temperature variables (a minimum and a maximum), allowing the user to define a temperature range to oscillate within, avoiding rapid on/off switching when trying to stabilize around a single value.

See imswebra.com for more information on how I personally use this script.

Defaults

  • Fan turns on when the CPU temperature reaches 60°C
  • Fan turns off when the CPU temperature returns to 50°C.
  • The temperature is checked every 10 seconds.
  • The base pin of the transistor used to control the fan should be connected to BCM pin 14.

See the script's inline comments for more information on the user variables.

Installation

Download or clone the script and add python3 /path/to/pifancontroller.py & to your rc.local file to have the script run on boot.

License

This work is licensed under the MIT license.

You can’t perform that action at this time.