Skip to content

Latest commit

 

History

History
50 lines (40 loc) · 1.61 KB

README.md

File metadata and controls

50 lines (40 loc) · 1.61 KB

About

Shell script for enabling PWM fan control on FriendlyElec (NanoPi) SBCs.

Only tested on NanoPi NEO3 with Armbian. But should work for most SBC with the 2pin fan connector.

Quick Start

git clone https://github.com/ckwun/nanopi-pwm-fan
cd nanopi-pwm-fan
chmod +x start-pwm-fan install.sh  uninstall.sh

Run

Run the script with default configuration:

./start-pwm-fan

Config

Custom configuration can be made by modifying the pwm-fan.conf file.

Run the script with config file:

./start-pwm-fan pwm-fan.conf
Name Description Default
PWM PWM API path "/sys/class/pwm/pwmchip0"
TEMP Thermal API path "/sys/class/thermal/thermal_zone0/temp"
PERIOD Total period of the PWM signal 8000000
POLARITY Polarity of the PWM signal "normal"
TARGET_TEMPS If current temperature is greater than TARGET_TEMPS[i], duty cycle will be set to DUTY_CYCLES[i] (65000 60000 55000 50000)
DUTY_CYCLES The active time of the PWM signal (8000000 6000000 4000000 2000000)
DEFAULT_DUTY_CYCLE Duty cycle will be set to this value if current temperature is lower than all TARGET_TEMPS 0

For more info, see: kernel.org - Pulse Width Modulation (PWM) interface

Install

Install it as systemd service, and enable it to auto start at boot:

./install.sh

Uninstall

Stop and disable the service, remove all files added by install.sh:

./uninstall.sh