opi-fancontrol/README.md
2025-07-20 11:42:05 +00:00

43 lines
2.2 KiB
Markdown

# 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](https://github.com/orangepi-xunlong/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](https://github.com/orangepi-xunlong/wiringOP/issues/95#issuecomment-2049855806).
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](https://liberapay.com/tuxmain/donate)
GNU AGPL v3, CopyLeft 2025 Pascal Engélibert [(why copyleft?)](https://txmn.tk/blog/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/.