Install packages:
sudo apt install -y git
Clone git repository:
git clone https://github.com/blenherr/pwmfan.git
Change FAN_PIN
to your used pwm pin in this files: calibration.py
and fanctrl.py
nano ~/pwmfan/calibration.py
nano ~/pwmfan/fanctrl.py
Use the calibration.py
program to find the FAN_MIN
value by running in the terminal:
python ~/pwmfan/calibration.py
Create fanctrl.service
file
sudo nano /lib/systemd/system/fanctrl.service
Add following lines and change <your_user_goes_here>
with your own user
[Unit]
Description=Raspberry Pi - PWM Fan Control
After=multi-user.target
[Service]
WorkingDirectory=/home/<your_user_goes_here>/pwmfan
Type=simple
Restart=always
ExecStart=/usr/bin/python /home/<your_user_goes_here>/pwmfan/fanctrl.py
[Install]
WantedBy=multi-user.target
Save and close
Enable service
sudo systemctl enable fanctrl
Start service
sudo systemctl start fanctrl