Skip to content

NickelNuts/raspberrypi-GPIOD-fan-control

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 

Repository files navigation

GPIOD-Rpi-fan-control

C++ fan control software using the GPIOD C library

Simple fan control using the c++ bindings of the libgpiod library to toggle control of a cooling fan on and off. Command line arguments are, in order, GPIO pin, timer interval, and temperature setpoint. At the supplied interval, the program tests whether /sys/class/thermal/thermal_zone0/temp is above or below the supplied set point, then toggles the GPIO on if over setpoint or off if under setpoint. Compiled and tested on a Raspberry Pi 4B running Debian Bookworm arm64 architecture. The file t-fan is the binary. The file t-fan.c can be compiled with $ clang++ t-fan.c -o t-fan -lgpiod, and run with ./t-fan 18 60 48.1&, where the argument "18" is an integer representing the RPi GPIO pin, "60" is an integer representing the timer interval, and "48.1" is the floating point temperature threshold. To run at boot, one option is to edit the crontab for root. # crontab -e then add a line, for example: @reboot /path/to/binary/t-fan 18 30 65.0&

About

C++ fan control software using the GPIOD C library

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages