Skip to content

Automatic fan control based on CPU temperature using PWM signal

License

Notifications You must be signed in to change notification settings

bana513/raspberry_fan_control

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

10 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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

About

Automatic fan control based on CPU temperature using PWM signal

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages