Skip to content

Latest commit

 

History

History
54 lines (38 loc) · 2.12 KB

README.md

File metadata and controls

54 lines (38 loc) · 2.12 KB

Raspberry Pi 3 automatic fan control

Automatic fan control based on CPU temperature using PWM signal.

Fan noise may be annoying but sometimes also might be useful. An automatic fan control is perfect for you if you want a nice passive cooled Raspberry Pi plus an available cooling boost when needed to keep your device at maximum performance or below desired temperature.

alt text

Create circuit

Circuit sketch:

Final circuit:

Pinout

I chose the GPIO pin 18 (pin 12) as it is the closest to power pins. However you can use other GPIO pins as well.
Raspberry Pi 2/3 pinout:

Write Python script

I used Python 3.5 for my code. See the code in fancontrol.py.

Run script on startup

You will need to add startup script as root because of GPIO pins (more sophisticated permissions would be nice if you care more about security, e.g. create a group, allow GPIO pin access to the group, then add your user to the group). Now I want to keep it simple.

bana@banarpi:~ $ sudo su

Edit root´s crontab file:

root@banarpi:/home/bana# crontab -e

Add the following line to your crontab file which will always start to run in background on startup:

...
@reboot python /location/to/file/fancontrol.py /location/to/file/config.json

Config

You can choose 2 different modes:

  1. PWM controlled fan - fan speeds for each temperature level are specified in config file
  2. Binary ON/OFF - turn ON/OFF temperature can be specified

Option 1 can handle variable speeds, however you may hear some PWM noise, which is a deaden with a capacitor, depends also on the fan, how annoying is this phenomenon, so you can choose the other mode if you want to.

More images...

alt text