Fan controller for Orange Pi
Find a file
2025-07-20 11:42:05 +00:00
.gitignore Initial commit 2025-07-20 11:42:05 +00:00
fancontrol.c Initial commit 2025-07-20 11:42:05 +00:00
fancontrol.service Initial commit 2025-07-20 11:42:05 +00:00
LICENSE Initial commit 2025-07-20 11:42:05 +00:00
Makefile Initial commit 2025-07-20 11:42:05 +00:00
README.md Initial commit 2025-07-20 11:42:05 +00:00

Fan controler for Orange Pi

Control a fan via GPIO on Orange Pi. It may work on other boards with few adjustments

Features:

  • Binary control (no PWM).
  • Start spinning above a given temperature.
  • Stops spinning below a given temperature.
  • Written in C, does not use bash commands to check temperature or set GPIO.

I only tested it on Orange Pi 5 Ultra, with Armbian for Orange Pi 5 Max.

Warning: Never power a fan directly by GPIO! It will fry the pin or the chip. The fan must be powered directly from the power source (5V pins are fine) and controlled through their PWM pins or using a power transistor.

Install

Compile and install WiringOP. We need the wiringPi shared library and the gpio commandline tool.

If your OS does not exactly match your board (that's my case because Armbian does not exist for all flavours of Orange Pi), you may need to fix /etc/orangepi-release as mentioned in this issue.

Compile fancontrol: make

Use the gpio readall command to determine your pin's number. We want the wPi number.

Usage:

fancontrol <pin> <period> <on_thres> <off_thres>
  • pin: fan wPi pin
  • period: number of seconds between each update
  • on_thres: temperature in millicelsius where we start the fan
  • off_thres: temperature in millicelsius where we stop the fan

License

Support me via LiberaPay

GNU AGPL v3, CopyLeft 2025 Pascal Engélibert (why copyleft?)

This program is free software: you can redistribute it and/or modify it under the terms of the GNU Affero General Public License as published by the Free Software Foundation, version 3 of the License.
This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more details.
You should have received a copy of the GNU Affero General Public License along with this program. If not, see https://www.gnu.org/licenses/.